|
Hi Jan!
I have a similar problem to Marco, and it seems you know quite a bit about alphamap... =)
I have used vol3d.m (http://www.mathworks.com/matlabcentral/fileexchange/4927) to render a 3d volume from a stack of 2d PET
images. The image I used was thus of size (128,128,50) where 50 is the number of slices.
Anyway, I get a nice rotatable image, but I want to alter the transparancy of individual pixels of the volume. I want to set
all pixels outside the body contour to invisible. Those pixels have index:
index = find(image(:) > 190); %image min = 0, max = 255.
I want the transparency of each pixel to be inversley proportional to the pixelvalue itself, i.e. white pixels become
transparent and black opaque. I do like this:
a = 1-image(:)/max(image(:)); % ranges from 0 to 1.
a(index) = 0;
colormap(gray)
alphamap(a);
This should make the light pixels transparant, no? It doesn't work. Do you have any idea what I'm doing wrong, and how I can
fix it? Thanks a lot!
/Ida
"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <gd1pn0$gbl$1@fred.mathworks.com>...
> Hi Marco!
>
> > is it possible to load an transparent image and to show in a gui which contains an axis element?
> >
> > [data, map]=imread('Transparent.gif');
> > logo=ind2rgb(data,map);
> > image(logo);
>
> If you just want to see the image with the transparent color set to the figure's background color, do exactly that! Replace the color corresponding with the transparant color in [Map].
>
> PATCH objects can have transparent faces, so drawing a PATCH with corresponding CDATA allows even to use an ALPHAMAP, so different degrees of transparence. This is the solution if you want to see a background picture or any other objects shining through your image.
>
> Good luck, Jan
|