knime-ip / knip

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

Image Calculator: improper output type conversion #471

Closed stelfrich closed 7 years ago

stelfrich commented 7 years ago

When output type of the Image Calculator node is set to UnsignedByteType, results are not the same when the output type is set to e.g. FloatType and the conversion to UnsignedByteType is done subsequently via clipping.

See also http://forum.imagej.net/t/macro-help-for-simple-automated-image-arithmetic/5184/6

imagejan commented 7 years ago

As also noted on the forum thread, it is the responsibility of the caller to ensure that the result fits into the given type. (The Image Calculator cannot know what kind of calculation you'll do, and therefore cannot simply assume DoubleType or some such, as this wouldn't always be desirable. It's hard to follow the principle of least surprise here...)

It could be documented a bit better, though.

stelfrich commented 7 years ago

It could be documented a bit better, though.

Indeed! Especially since we have the situation of an Image Calculator menu item in ImageJ/Fiji with close ties to the ImageJ1 "world" and an Image Calculator node using ImgLib2 under the hood. So I guess this should be clearly stated in the documentation of the Image Calculator node.

imagejan commented 7 years ago

Well, we also have an ImageJ2 ImageCalculator that presumably acts the same as KNIP's ImageCalculator regarding the types. :-D (and then Ops!)

stelfrich commented 7 years ago

Well, we also have an ImageJ2 ImageCalculator that presumably acts the same as KNIP's ImageCalculator regarding the types. :-D

As if the situation wasn't confusing enough already. :sob:

stelfrich commented 7 years ago

It could be documented a bit better, though.

See #472.