CellProfiler / knime-bridge

ZMQ connection between CellProfiler and Knime
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Normalization of pixel values between 0 and 1 #4

Open dietzc opened 9 years ago

dietzc commented 9 years ago

CellProfiler, for now, only accepts images with pixel values between 0 and 1. We should normalize the images in the knime-bridge, rather than in KNIME itself. Therefore we can directly do it on the underlying data-array, which is faster. Additionally, users don't need to worry about a suitable format for CellProfiler, as the bridge takes care about.

LeeKamentsky commented 9 years ago

The problem is that Knime hasn't filled in the ImgPlus.set/getValid bits field:

https://github.com/CellProfiler/knime-bridge/blob/master/src/main/java/org/cellprofiler/knimebridge/message/RunReq.java#L68

If you did this for integer images, the bridge would normalize properly. Floating-point images should probably not be normalized.

I should probably pass this through the bridge because applications like ImageJ and Ilastik need to have the image un-normalized: converted to 8-bit or 16-bit ranges for analysis.

dietzc commented 9 years ago

So how can I decide on KNIME side which images I should normalize between 0...1 and which I shouldn't? Can I get this information from the pipeline?

LeeKamentsky commented 9 years ago

Is there some way you can call ImgPlus.setValidBits()? It should be easy for 8-bit (if you have a byte image, setValidBits(8), but for 16, some of them are really 12 (0-4095) which you can tell by reading the TIFF. If you do that, it's my job to normalize (or the job of the bridge).