Login  Register

Re: Convert image : 32-bit to 16-bit, keeping the whole intensity range?

Posted by Michael Schmid on Jan 22, 2014; 9:28am
URL: http://imagej.273.s1.nabble.com/Convert-image-32-bit-to-16-bit-keeping-the-whole-intensity-range-tp5006223p5006225.html

Hi Christophe,

There are two possibilities for a fixed scale when converting float to 16-bit:

(a) with Edit>Options>Scale When Converting off:
Float data will be rounded to the nearest integer. So your float data should be somewhere between 0 and 62235 (the maximum 16-bit value).

(b) with Edit>Options>Scale When Converting on:
You can use setMinAndMax(min, max) to set the minimum and maximum of the float data. These will become 0 and 65535 in the 16-bit data.

In any case, you should set the Edit>Options>Scale in your macro (use the Plugins>Macros>Record to get the macro command for it).

Michael
________________________________________________________________
On Jan 22, 2014, at 10:01, Christophe Leterrier wrote:

> Hi,
>
> I am trying to do flatfield-correction on microscope images, i.e. using
> reference images from uniform slides to compensate for the uneven
> illumination pattern.
>
> So I have two images : an input image, and a flatfield image, both 16-bits.
> Ideally I'd like to normalize the input image by the flatfield image,
> keeping the mean intensity of the result image equal to that of the input
> image.
>
> What I do: I have made a 32-bit normalization image that is equal to:
> normalization image = (mean Intensity of flatfield image) / (flatfield
> image)
>
> and then multiply the input image by this normalization image to obtain a
> 32-bit corrected image:
> corrected image (32-bit) = (input image) * (normalization image)
>
> The mean intensity of this 32-bit corrected image is equal to this of the
> 16-bit input image. However, I am unable to convert this corrected image
> into a 16-bit final image, keeping the intensity constant. When converting
> the 32-bit corrected image using Images>Type>16-bit, there is a rescaling
> by min and max occuring, and the resulting image does not have the same
> mean intensity. This is specially bad for stacks, where the min/max
> rescaling uses the values of the displayed slices, regardless of the values
> in the other slices, this ending up with saturated images in
> higher-intensities slices in the stack.
>
> TL;DR version: How can I convert a 32-bit image into a 16-bit images,
> keeping the measured pixel values equal (full intensity range, no
> rescaling)? Or is there another way to do the flatfield correction without
> using 32-bit images as intermediaries?
>
> Thanks for your help,
>
> --
> Christophe Leterrier
> Researcher
> Axonal Domains Architecture Team
> CRN2M CNRS UMR 7286
> Aix Marseille University, France
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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