Hi,
convertToByte() will _return_ a ByteProcessor; it will not manipulate
directly the values of your original image (in your case myIP will remain
untouched, so to speak).
To view the image in a meaningful greyscale you can also try the method
setMinandMax(double min, double max).
Cheers,
William
On 1/10/07, Tony Shepherd <
[hidden email]> wrote:
>
> I have a FloatProcessor object that I have filled with values in the range
> -1.5 to 1.5 approx. The point is these values are in a small range and
> includes negative values.
>
> I want to view the image in a meaningful greyscale so I use the
> convertToByte method. However, when I view the image it looks like a
> binary
> image. I know that the initial values were well spread out over the
> (small)
> dynamic range so why is this spread not retained by the conversion? Also,
> when I hover the mouse pointer over the displayed image, the status bar
> reports pixel values in the original range (including negative values).
> What
> am I doing wrong ? (code example below)
>
>
> FloatProcessor myIP = ( ... FloatProcessor populated with small signed
> doubles using the 'putPixelValue(x,y,val)' method .....)
>
> myIP.convertToByte(true);
>
> ImagePlus myImp = new ImagePlus("my image rescaled to 0-255",myIP);
>
> myImp.show();
>