Re: bug in Image5D

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: bug in Image5D

ctrueden
Hi Jean,

> I develop plugins for ImageJ, and i have a problem using image5D
> (v1.2.5): when i call the methods getSlice() or getCurrentSlice() from
> the java API, the return number does not always corresponds to the
> actually displayed slice.

Thanks for the bug report. I created an example illustrating the problem
and committed to a new class for testing:
    https://github.com/imagej/image5d/blob/master/src/main/java/Main.java

Your mail reminded me that we hadn't been hosting the Image5D source code
on GitHub. So we are now doing that:
    https://github.com/imagej/image5d

I created an issue to track this problem at:
    https://github.com/imagej/image5d/issues/1

I started trying to fix it on a branch...
    https://github.com/imagej/image5d/tree/position-sync

...but the issue is too nasty, and I do not have time to fully figure it
out. The latest code on that branch does report correct Z, C and T values
whenever the position changes, either via the sliders or via the mouse
wheel. Unfortunately, it also breaks the proper redrawing of the actual
image in the case of the Z slider. The reason is related to a dichotomy in
what "setSlice" and "getCurrentSlice" mean to ImageJ vs. Image5D: in the
case of ImageJ, it means 1D index in [1, stackSize] whereas for Image5D it
means Z index in [1, nSlices]. I added some hacky code to work around the
discrepancy, but it would need further investigation to fully sort out.

In the meantime, now that the code is hosted on GitHub, it should be dirt
easy for anyone interested to fork the code, work on the bugfix, and submit
a pull request for it. For an overview of how to do that, see:
    https://help.github.com/articles/using-pull-requests/

I would strongly encourage anyone using Image5D for serious work to
reconsider, and instead use ImageJ's built-in hyperstack support. I know
some users prefer Image5D's fancier UI to ImageJ's stripped down one, but
the Image5D code is seriously out of date with ImageJ core, and has lots of
bugs to prove it—this one is only the tip of the iceberg.

If you really need to continue using Image5D specifically, you might be
best served by rewriting/simplifying portions of the code to leverage
ImageJ's built-in support for 5D image stacks. None of that code existed
when Image5D was written so there is a lot of logic to work around ImageJ's
"3D-ness" but it is simply not necessary anymore. I would be happy to help
out to an extent, review code, and merge upstream into the official
release, if anyone is willing to put in the time to rework the Image5D code.

Regards,
Curtis


On Thu, Aug 9, 2012 at 7:48 AM, Jean Ollion <[hidden email]> wrote:

> Hello,
> I develop plugins for ImageJ, and i have a problem using image5D
> (v1.2.5): when i call the methods getSlice() or getCurrentSlice() from
> the java API, the return number does not always corresponds to the
> actually displayed slice.
> It depends how i change the slice (mouse wheel, click on the scroll
> pane... ) and from which end i start.
> I need the slice number to display ROI in 3D using listeners, and
> maybe i registered the wrong listeners. I used the code provided on
> the fiji website. here is my code:
> public static void addScrollListener(ImagePlus img, AdjustmentListener
> al, MouseWheelListener ml) {
>         //from Fiji code
>         // TODO Find author...
>         for (Component c : img.getWindow().getComponents()) {
>             if (c instanceof Scrollbar)
> ((Scrollbar)c).addAdjustmentListener(al);
>             else if (c instanceof Container) {
>                 for (Component c2 : ((Container)c).getComponents()) {
>                     if (c2 instanceof Scrollbar)
> ((Scrollbar)c2).addAdjustmentListener(al);
>                 }
>             }
>         }
>         img.getWindow().addMouseWheelListener(ml);
>     }
> I don't have this problem with regular imagePlus.
> Could you check this please?
> Thank you
> Jean Ollion
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html