Bug? using ConnectedComponents and LabelRegion(s) with ImageJFunctions.wrapByte(ImagePlus imp)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug? using ConnectedComponents and LabelRegion(s) with ImageJFunctions.wrapByte(ImagePlus imp)

Jay Warrick
Hi All,

I am getting different behavior using the new ConnectedComponents class of imglib2-algorithm depending on whether I get and Img<UnsignedByteType> from a SCIFIO ImageOpener vs. when I get the same image as an Img<UnsignedByteType> by wrapping an ImagePlus. In the SCIFIO case, ConnectedComponents finds the expected single circle while with a wrapped ImagePlus, it doesn't find any regions.

Any thoughts/fixes? Might there be something occurring during the wrapping process to cause an issue? Here is a tiny commented maven project with the example scenario.

https://github.com/jaywarrick/ConnectedComponentsTest

The tiny .tif I'm using is included in the project but is loaded by a string path. Thus, you need to retype the path to the image to match your computer, but that should be it. Sorry... wasn't sure how to avoid that easily.

Thanks for your help,

Jay


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bug? using ConnectedComponents and LabelRegion(s) with ImageJFunctions.wrapByte(ImagePlus imp)

Curtis Rueden
Hi Jay,

Interesting bug. I did some digging. The two Img<UnsignedByteType> instances are identical in terms of dimensionality and pixel values, so that isn't the culprit.

I also tried disabling the labeling computation for SCIFIO to see if it was an issue of tainted state, but the order of computation doesn't seem to make a difference either.

I also stepped a bit with the debugger and certainly the issue is inside of ConnectedComponents.labelAllConnectedComponents. On line 115, the value of numLabels comes back as 2 for the SCIFIO image and 1 for the IJ1 image. Digging deeper becomes tricky due to the multithreadedness of the algorithm, but I fear that's what you'll have to do in order to isolate the difference in behavior.

Regards,
Curtis

On Tue, Jun 30, 2015 at 1:01 AM, Jay Warrick <[hidden email]> wrote:
Hi All,

I am getting different behavior using the new ConnectedComponents class of imglib2-algorithm depending on whether I get and Img<UnsignedByteType> from a SCIFIO ImageOpener vs. when I get the same image as an Img<UnsignedByteType> by wrapping an ImagePlus. In the SCIFIO case, ConnectedComponents finds the expected single circle while with a wrapped ImagePlus, it doesn't find any regions.

Any thoughts/fixes? Might there be something occurring during the wrapping process to cause an issue? Here is a tiny commented maven project with the example scenario.

https://github.com/jaywarrick/ConnectedComponentsTest

The tiny .tif I'm using is included in the project but is loaded by a string path. Thus, you need to retype the path to the image to match your computer, but that should be it. Sorry... wasn't sure how to avoid that easily.

Thanks for your help,

Jay


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bug? using ConnectedComponents and LabelRegion(s) with ImageJFunctions.wrapByte(ImagePlus imp)

Jay Warrick
Curtis - Thanks so much for digging. This focuses my efforts greatly. 

Tobias - If you see this email... I noticed that you are listed as author of the ConnectedComponents class. Any thoughts as I dig in?

Thanks,

Jay

On Jun 30, 2015, at 12:34 PM, Curtis Rueden <[hidden email]> wrote:

Hi Jay,

Interesting bug. I did some digging. The two Img<UnsignedByteType> instances are identical in terms of dimensionality and pixel values, so that isn't the culprit.

I also tried disabling the labeling computation for SCIFIO to see if it was an issue of tainted state, but the order of computation doesn't seem to make a difference either.

I also stepped a bit with the debugger and certainly the issue is inside of ConnectedComponents.labelAllConnectedComponents. On line 115, the value of numLabels comes back as 2 for the SCIFIO image and 1 for the IJ1 image. Digging deeper becomes tricky due to the multithreadedness of the algorithm, but I fear that's what you'll have to do in order to isolate the difference in behavior.

Regards,
Curtis

On Tue, Jun 30, 2015 at 1:01 AM, Jay Warrick <[hidden email]> wrote:
Hi All,

I am getting different behavior using the new ConnectedComponents class of imglib2-algorithm depending on whether I get and Img<UnsignedByteType> from a SCIFIO ImageOpener vs. when I get the same image as an Img<UnsignedByteType> by wrapping an ImagePlus. In the SCIFIO case, ConnectedComponents finds the expected single circle while with a wrapped ImagePlus, it doesn't find any regions.

Any thoughts/fixes? Might there be something occurring during the wrapping process to cause an issue? Here is a tiny commented maven project with the example scenario.

https://github.com/jaywarrick/ConnectedComponentsTest

The tiny .tif I'm using is included in the project but is loaded by a string path. Thus, you need to retype the path to the image to match your computer, but that should be it. Sorry... wasn't sure how to avoid that easily.

Thanks for your help,

Jay


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel



_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel