Applying modified LUT to 16-bit image in macro

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

Applying modified LUT to 16-bit image in macro

lesuaz
Hi all,

I use the latest version of Fiji to open a 16-bit grayscale image, change the minimum/maximum displayed values under Image -> Adjust -> Brightness/Contrast and then hit "Apply", which gives me a 16-bit image with a modified LUT. However, when I try to do the same thing in a macro...

setMinAndMax(0, 20000);
run("Apply LUT");

... I get an error message saying that:

"Apply LUT" requires an image of type: 8-bit grayscale, 8-bit color, RGB color.

I don't understand why I can perform the 16-bit image conversion manually, but not in a macro. Does anyone know a solution to this problem?

Thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: Applying modified LUT to 16-bit image in macro

MatthewThompson
If you convert the image to 8-bit first, the issue will be resolved.

Use:

run("8-bit"); //Equivalent to Image > Type > 8-bit
setMinAndMax(0, 20000);
run("Apply LUT");

That doesn't exactly answer the question of why it works manually and not in a macro, but it's a workaround that seems to do the trick

lesuaz wrote
Hi all,

I use the latest version of Fiji to open a 16-bit grayscale image, change the minimum/maximum displayed values under Image -> Adjust -> Brightness/Contrast and then hit "Apply", which gives me a 16-bit image with a modified LUT. However, when I try to do the same thing in a macro...

setMinAndMax(0, 20000);
run("Apply LUT");

... I get an error message saying that:

"Apply LUT" requires an image of type: 8-bit grayscale, 8-bit color, RGB color.

I don't understand why I can perform the 16-bit image conversion manually, but not in a macro. Does anyone know a solution to this problem?

Thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: Applying modified LUT to 16-bit image in macro

Gabriel Landini
On Thursday 24 Sep 2015 14:54:14 MatthewThompson wrote:
> If you convert the image to 8-bit first, the issue will be resolved.
>
> Use:
>
> run("8-bit"); //Equivalent to Image > Type > 8-bit
> setMinAndMax(0, 20000);
> run("Apply LUT");

I think your suggestion would not work.
You need to first set the min and max in the 16 bit image, so the range for
the greyscale which displays the 16bit image is set, only then convert to 8
bit.
In the code above, by the time you set min and max to the range of 0 to 20000,
the image (which is 8bit after the first macro line), has only 256 levels.

Cheers

Gabriel

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

Re: Applying modified LUT to 16-bit image in macro

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by lesuaz
> Hi all,
>
> I use the latest version of Fiji to open a 16-bit grayscale image, change the minimum/maximum displayed values under Image -> Adjust -> Brightness/Contrast and then hit "Apply", which gives me a 16-bit image with a modified LUT. However, when I try to do the same thing in a macro...
>
> setMinAndMax(0, 20000);
> run("Apply LUT");
>
> ... I get an error message saying that:
>
> "Apply LUT" requires an image of type: 8-bit grayscale, 8-bit color, RGB color.
>
> I don't understand why I can perform the 16-bit image conversion manually, but not in a macro. Does anyone know a solution to this problem?

Use the Help>Upgrade ImageJ command to upgrade to the latest ImageJ daily build (1.50c15), which fixes this bug.

-wayne

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