[ImageJ-devel] IOService changed

Curtis Rueden ctrueden at wisc.edu
Fri Jul 19 12:17:32 CDT 2013


Hi Mohamed,

> In you last update, you changed the IOService, and now it is not
> possible to use the ij.io().loadDataset method. the new ij.io().open
> method returns an object that cannot be cast into Dataset. Would you
> show us a little example on how to open a Dataset now?

The method does still exist, but moved to DatasetService:

    ij.dataset().open(String)

It still returns a Dataset (so no casting is necessary), but now throws
only IOException instead of those ImgLib2-specific exceptions.

As Johannes said, the idea is that ij.io().open is now more general purpose
("open something") whereas other individual services are used to open their
specific things. So of course DatasetService can open Datasets. And the
LUTService can open ColorTables (method "loadLUT" probably needs to be
renamed to "open" there), and the TextService can open text files.

I have also updated the tutorials accordingly, in case that helps. Please
let us know of any problems with it!

Regards,
Curtis

On Fri, Jul 19, 2013 at 10:54 AM, Johannes Schindelin
<schindelin at wisc.edu>wrote:

> Hi Mohamed,
>
> On Fri, 19 Jul 2013, Mohamed Tleis wrote:
>
> > In you last update, you changed the IOService, and now it is not
> > possible to use the ij.io().loadDataset method. the new ij.io().open
> > method returns an object that cannot be cast into Dataset. Would you
> > show us a little example on how to open a Dataset now?
>
> Please note that the I/O part of ImageJ2 in particular is still in heavy
> development mode. You need to expect it to change a lot.
>
> Now, to the IOService in particular: if you expect it to load only Dataset
> instances, you use the wrong service. Remember, ImageJ2 also wants to open
> macros and scripts, and result tables, and basically a *lot* on top of
> images. That is why the open() method now returns an object.
>
> If you *know* that you want to open an image (and you need to open it
> yourself rather than being nice and asking the user to open the image or
> create it or obtain in any way they want rather than the way you want them
> to) use the ImgOpener class of SCIFIO:
>
> http://jenkins.imagej.net/view/SCIFIO/job/SCIFIO-javadoc/javadoc/io/scif/img/ImgOpener.html
>
> However, I strongly suggest that you try to make your plugin as flexible
> as possible by stating that you want a Dataset as a @Parameter instead of
> forcing the user to store the image as a file and then read it back.
>
> Ciao,
> Johannes
>
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20130719/340f42a0/attachment.html>


More information about the ImageJ-devel mailing list