Image Calculator Problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Image Calculator Problem

T.Strutz
Dear ImageJ Experts,

I would like to communicate a problem with the Image calculator which I
have noticed recently.

I am using the subtract method of the ImageCalculator (plus Measure
Tool) for the comparison of images (if min=max=0 of the 32-bit
difference, then the images are identical).

If, however, the images have a different type, as, for example, 8-bit +
colour palette (first image) and RGB Color (second image), then this
comparison does not work. Probably the subtraction is somehow performed
between the indexes of the first image and the RGB values of the second
disregarding the palette, which does not make sense.

I would like to suggest
either to output a warning message that the images have a different type
or to convert the palette image automatically to the RGB color format.

Kind regards,

T.Strutz

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Image Calculator Problem

Gabriel Landini
On Tuesday 10 Jul 2012 10:02:17 T. Strutz wrote:
> I am using the subtract method of the ImageCalculator (plus Measure
> Tool) for the comparison of images (if min=max=0 of the 32-bit
> difference, then the images are identical).

But they aren't... 0 is not 0.0. They are not represented equally. To
complicate things further, some time ago I learned that there is also such
thing as -0.0
 
> If, however, the images have a different type, as, for example, 8-bit +
> colour palette (first image) and RGB Color (second image), then this
> comparison does not work. Probably the subtraction is somehow performed
> between the indexes of the first image and the RGB values of the second
> disregarding the palette, which does not make sense.

Hm... can't reproduce here.
If I apply a LUT to a 8bit image and subtract this from a white RGB image I
get the subtraction by the values in the LUT, not the indexes.
This shows the result is an RGB image where the white has the LUT values
subtracted from the white.

newImage("ramp", "8-bit Ramp", 127, 127, 1);
newImage("white", "RGB White", 127, 127, 1);
selectWindow("ramp");
run("Fire");
imageCalculator("Subtract create", "white","ramp");
selectWindow("Result of white");

If you want to subtract the indexes, use the greyscale LUT.

And also colour values are subtracted if it is an 8bit colour palette:

selectWindow("ramp");
run("RGB Color");
run("8-bit Color", "number=256");
imageCalculator("Subtract create", "white","ramp");
selectWindow("Result of white");

I think this is the expected behaviour (it is subtracted what you see).

> I would like to suggest
> either to output a warning message that the images have a different type
> or to convert the palette image automatically to the RGB color format.

Converting automatically images without the user knowing is, I think, not a
good idea.

I am using IJ 1.47a5.

Cheers
G.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html