From: Cemil on
I am displaying a color MR spectroscopy map image over a gray scale MRI image with transparency. To achieve this, I convert both images to RGB, using gray and color maps, and then merge them with required transparency. I want to adjust background image contrast giving specified window/level values. How can I achieve that? Any help is appreciated. Thanks.

Cemil
From: Walter Roberson on
Cemil wrote:
> I am displaying a color MR spectroscopy map image over a gray scale MRI
> image with transparency. To achieve this, I convert both images to RGB,
> using gray and color maps, and then merge them with required
> transparency. I want to adjust background image contrast giving
> specified window/level values. How can I achieve that?

Typically contrast is adjusted by adjusting the axes CLim property (perhaps
via the caxis() command) -- this is what imtool does for it's "window/level"
function for example.

However, because axes CLim properties apply to everything on the axes, you
would not be able to adjust two images on the same axes independently. That
does, though, leaves open the possibility of using two different axes in the
same location.

Beyond that, you can do the equivalent of changing the CLim property for an
image by adjusting the spread of values. For example, imagesc works by doing
the equivalent of

immin = min(TheImage);
immax = max(TheImage);
NewImage = (TheImage - immin) ./ (immax - immin);
From: Cemil on
Walter Roberson <roberson(a)hushmail.com> wrote in message <hum5cs$30i$1(a)canopus.cc.umanitoba.ca>...
> Cemil wrote:
> > I am displaying a color MR spectroscopy map image over a gray scale MRI
> > image with transparency. To achieve this, I convert both images to RGB,
> > using gray and color maps, and then merge them with required
> > transparency. I want to adjust background image contrast giving
> > specified window/level values. How can I achieve that?
>
> Typically contrast is adjusted by adjusting the axes CLim property (perhaps
> via the caxis() command) -- this is what imtool does for it's "window/level"
> function for example.
>
> However, because axes CLim properties apply to everything on the axes, you
> would not be able to adjust two images on the same axes independently. That
> does, though, leaves open the possibility of using two different axes in the
> same location.
>
> Beyond that, you can do the equivalent of changing the CLim property for an
> image by adjusting the spread of values. For example, imagesc works by doing
> the equivalent of
>
> immin = min(TheImage);
> immax = max(TheImage);
> NewImage = (TheImage - immin) ./ (immax - immin);

Thanks Walter for your reply. When I use two axes in the same location and display overlayed image after background image, the background image becomes invisible. I want to see background image pixel on any pixel where overlay image pixel is zero and a combination of background and overlayed image pixel elsewhere. Also I would like to adjust contrast level of both images as I mentioned before. Thank you.

Cemil
From: Walter Roberson on
Cemil wrote:
> When I use two axes in the same location
> and display overlayed image after background image, the background image
> becomes invisible. I want to see background image pixel on any pixel
> where overlay image pixel is zero and a combination of background and
> overlayed image pixel elsewhere.

The image data type supports an AlphaData property; set it to
BlendFraction .* (OverlayImage ~= 0)


> Also I would like to adjust contrast
> level of both images as I mentioned before. Thank you.

Both together, or each individually? If both together and the two images have
the same data range, then you can use a single axes and adjust the axes CLim
or use imtool's window/level tool.