Posted by
Joachim Wesner on
Mar 20, 2009; 11:25am
URL: http://imagej.273.s1.nabble.com/Missing-Classes-for-CallJavaDemo-tp3693236p3693239.html
> Hi Joachim,
>
> you are right, PlugInFilter.CONVERT_TO_FLOAT does not care about the
> calibration. The flag is meant for filtering operations such as
> convolution, smoothing etc.
> When doing such an operation directly on 8-bit or 16-bit data one
> would not convert them to calibrated values before doing the
> conversion and convert them back to 8 or 16 bits after the operation,
> so it is the same behavior.
>
> If you need calibrated values, I'd suggest not using CONVERT_TO_FLOAT
> but rather ip.getPixelValue(x,y), which returns the calibrated value.
> There will be a significant difference on RGB images, however: With
> CONVERT_TO_FLOAT, the run(ip) method is called 3 times with the color
> channels (for filtering of all the colors); with ip.getPixelValue you
> get a (weighted) average of the color channels (weighted depends on
> Edit>Options> Conversion).
>
> ---
>
> A FloatProcessor cannot have a calibration.
>
> Hope this helps,
>
> Michael
Hi Michael,
I see your point, but maybe one would like to retain not the **extra**
calibration but really the "effektive" values in the "smoothing" output
or whatever, because otherwise also when not trying to convert back to 8 or
16 bits,
the final scaled values maybe "wrong". So my question.
In my special case, if a Floatprocessor cannot have another extra crazy
calibration attached to it, I already removed CONVERT_TO_FLOAT and the
code I had shown can be even much simpler and handles all cases (float,
nonfloat w/o calibration, nonfloat w calibration) correctly, simply:
if (!(ip instanceof FloatProcessor))
ip = ip.convertToFloat();
else
ip = ip.duplicate();
Cheers
Joachim
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________