knime-ip / knip

KNIME Image Processing Extension
https://www.knime.com/community/image-processing
49 stars 11 forks source link

CCA column preview empty after Image Cropper #494

Open stelfrich opened 6 years ago

stelfrich commented 6 years ago

It seems that if Adjust Dimensionality? is unchecked in an Image Cropper node, the output tables of subsequent Connected Component Analysis nodes do not show a preview of the labeling. Clicking on the cell shows the labeling as expected.

Example workflow: CCAPreviewAfterImageCropper.zip

gab1one commented 6 years ago

Thank you for reporting this, it seems to be a bug with our preview rendering.

imagejan commented 6 years ago

I noticed the same issue with Adjust Dimensionality? being checked and cropping an XYZ image with a defined Z range: after a Global Thresholder and a Connected Component Analysis, the thumbnails are missing in the output table.

gab1one commented 6 years ago

@stelfrich @imagejan This issue is related to the Image Cropper not renormalizing the axis minima. I created a metanode ZeroMin metanode.zip which performs the needed ZeroMin operation. Just add this as a workaround to your workflows where the cropper behavior causes you issues. We might add this as a popper node to KNIP at a later point in time.

imagejan commented 6 years ago

I noticed that this can also problems when trying to use a legacy ij.ImagePlus as an input parameter in an ImageJ2 plugin.

I got:

ERROR ThreadPool                      An exception occurred while executing a runnable.

... when running my TrackMateSpotDetector on a cropped input image. (Strangely, it still worked when I was running the saved workflow, but threw these errors after I had reconfigured the node...)

Adding your ZeroMin metanode helped here, but I see no way of fixing this inside my own plugin, while still taking an ImagePlus input (and I'd like to avoid the need of a ZeroMin node in the final workflow, ideally).

gab1one commented 6 years ago

You could always run Views.zeroMin(..) on your input images? Something like:

RAI myImp = Views.zeroMin(imp);
imagejan commented 6 years ago

@gab1one yes, of course, if I take an ImgPlus or RAI; but as I take an ImagePlus for using it with TrackMate, I wanted to avoid the additional wrapping, because that's what the framework is supposed to do correctly if I define an @Parameter ImagePlus, no?

gab1one commented 6 years ago

In most cases you will actually get an ImgPlus converted to a ImagePlus, at least in KNIME we always use IJ2 / Imglib2 data structures internally. We do not run Views.zeroMin() on our cropped image segments because then you lose the offset information, which you need if you want to recombine the segments at a later time (e.g. using compose image in the GroupBy node).

Maybe we can add an improved conversion strategy in the future, until then I recommend you just request a ImgPlus / RAI as input, wrap it into an ImagePlus yourself after performing Views.zeroMin(..) on it. Then you have maximal control over it. I am sorry that there is currently no easier way for it.