[ImageJ-devel] IOService changed

Curtis Rueden ctrueden at wisc.edu
Mon Jul 22 12:52:07 CDT 2013


Hi Mohamed,

> I was wondering if I can search the ij2 source for all methods that
> returns "Dataset" variable for example. If so, that would make things
> easier whenever I face a similar problem, currently I can only search
> for Class names.

I do not know if this is possible using an IDE. (You can search for all
Dataset references but that would be too many hits, here.)

However, Unix command line tools are your friend. I highly advise learning
them, as they will give your productivity a big boost. The git command line
tool also has a lot of nice things built in; especially on Windows that may
work well for you.

Here's how I found a list of places in the code that return a Dataset:

    git grep 'public Dataset '

Note the space after "Dataset" to ensure it doesn't match e.g.
DatasetService.

This returns 43 hits, which is a lot to wade through. But in your case, you
probably knew you wanted a *Service* with a method that returns a Dataset,
so you can chain them:

    git grep 'public Dataset ' | grep Service.java

Now we're down to 9 hits, which is promising. If we also limit ourselves to
the name of the method we want (in this case, "open"):

    git grep 'public Dataset ' | grep Service.java | grep open

We are down to a single hit! Success!

Of course, this does not search for any methods that return sub-types of
Dataset; that gets more complicated and IDE support for that would be most
welcome. Perhaps there is a plugin for it, but it is not something I
personally have needed much in the past.

Regards,
Curtis


On Sat, Jul 20, 2013 at 11:53 AM, Mohamed Tleis
<mohammedtleis at hotmail.com>wrote:

>
>
> Thank you Johannes and Curtis,
>
>  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.
>
> That is good news.
> Off-topic question: I was wondering if I can search the ij2 source for all
> methods that returns "Dataset" variable for example. If so, that would make
> things easier whenever I face a similar problem, currently I can only
> search for Class names.
>
>
>  I have also updated the tutorials accordingly, in case that helps. Please
> let us know of any problems with it!
>
>   Thanks again, these are wonderful tutorials, and I hope you would have
> time to release some more in the future.
>
>   Regards,
> Curtis
>
>
>
>> 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
>>
>>    I will try the ImgOpener later, but for now I will just use the
> dataset().open from the dataset() service as I am already testing with
> Dataset.
>
>    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.
>>
>>    In this regard I am loading the image directly for two benefits,
> first when I am testing my code I don't have to choose manually the image
> each time. Second, to load and process a set of images automatically.
>
>    Ciao,
>> Johannes
>>
>> _______________________________________________
>> ImageJ-devel mailing list
>> ImageJ-devel at imagej.net
>> http://imagej.net/mailman/listinfo/imagej-devel
>>
>
>   Thank you again, keep the good work going on :)
>
> Best Regards,
> Mohamed Tleis
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20130722/1efd8ae9/attachment.html>


More information about the ImageJ-devel mailing list