Login  Register

Re: AND function

Posted by Gabriel Landini on Jul 18, 2005; 4:09pm
URL: http://imagej.273.s1.nabble.com/AND-function-tp3705233p3705236.html

On Monday 18 July 2005 15:03, Florian Ulrich wrote:

> > At 01:28 PM 7/14/05 +0200, Florian Ulrich wrote:
> > >>first channel value 110
> >>second channel value 55
> >>AND operation gives 55...
> >
> >         110 AND 55 is 38, not 55.
> >
> > Rex Couture
>
> yep, but that's what I got.

You must be producing a 32 bit result or using 32 bit images.
These bit-wise logical operations should be used with the same image type (8
or 16 bit images (and not using a 32bit as result).

newImage("Test", "8-bit Black", 256, 256, 1);
run("Add...", "value=110");
run("Duplicate...", "title=Test-copy");
run("Subtract...", "value=55");
imageCalculator("AND create", "Test-copy","Test");

The result should be 38 as Rex pointed out.

You then can convert the result to 32bit if necessary.

Cheers,

G.