Re: Problem with setMinAndMax
Posted by
Michael Doube on
Feb 12, 2008; 2:20pm
URL: http://imagej.273.s1.nabble.com/Problem-with-seMinAndMax-tp3697203p3697205.html
I have figured it out - setMinAndMax expects 16-bit signed values (
−32768 to 32767) while my images are 16-bit unsigned (0 to 65535). So
subtracting 32768 from min and max values fixes the problem.
Mike
Michael Doube wrote:
> Hi all
>
> I've been struggling with a little macro that will automatically
> window some 16-bit CT images of dry bone in air. I want air to be
> black and bone to be shades of grey with nice dynamic range.
>
> If I manually set Window and Level, macro recorder tells me the code is:
>
> setMinAndMax(31468, 32959);
>
> and my image looks how I want it
>
> However, if I run this code from a macro window, my image goes black
> as the window level is way too low (the ramp goes off the right of the
> W&L graph).
>
> Any ideas what might be going on?
>
> Cheers
>
> Mike
>
> ij 1.39r Java 1.6.0_04 WinXP SP2
>
--
Michael Doube BPhil BVSc PhD MRCVS
Research Associate
Department of Bioengineering
Imperial College London
South Kensington Campus
London SW7 2AZ
United Kingdom