From: Brandon Giles on
Hi Everyone,
I'm working with an unsupported image data structure. I can view the image that its supposed to produce with the function imagesc. When I try to use imshow or imtool I just get a black image.

When looking at CData values of the black image, the values of the 512x512 matrix range from [0,5e-10]. When I use contrast adjust tool for the black image displayed using imtool, and set the max value to 5e-10 I can view the image, so I believe that imagesc automatically scales the image data to [0,1] instead of [0.5e-10]. Is there a way to call imtool with this scaling ability?

Also, I'm trying to save the image using imwrite, but it appears I save the unscaled CData when I do this. Is there a way to permanently change the CData from the unscaled to the scaled version so I can just view the image without having to rescale it?

Thanks so much for your help!
Brandon
From: ImageAnalyst on
Display your image like this
imshow(imageArray, []);

Then scale your data via the usual way to the range of 0-255 and cast
it to uint8. I wouldn't mess with CData. Then call imwrite to save
to a usual format.
From: Brandon Giles on
How do you scale data in "the usual way"? And can you explain what you mean by cast to uint8?
Thanks!
From: Image Analyst on
"Brandon Giles" <bg95722(a)aim.com> wrote in message <hvtrp2$sff$1(a)fred.mathworks.com>...
> How do you scale data in "the usual way"? And can you explain what you mean by cast to uint8?
> Thanks!
-------------------------------------------------------------------------
You know, the usual way -- like if you were to intuitively do it. Scale it to between 0 and 1 and then scale it and offset it to what you need.
From an earlier post of mine:

Why don't you just normalize in the usual manner: divide by the actual
max value and multiply by the desired max value, like
imageArray = imageArray * desiredMaxValue / max(max(imageArray));

If you want to pin down two points, the max and min, do something like
this:
actualMax = max(max(imageArray));
actualMin = min(min(imageArray));
slope = (desiredMax - desiredMin) / (actualMax - actualMin);
imageArray = slope * (imageArray - actualMin) + desiredMin;
From: Brandon Giles on
Thanks for the help!