How to superimpose/overlay a grayscale 3D image onto a color 3D image?
4 views (last 30 days)
Show older comments
I have used 'vol3d' from the following link by Oliver Woodford;
on the ultrasound data collected and was able to get the 3D image either in gray scale or color as required.
But I have another co-registered 3D data and would like to superimpose this 3D image in color over 3D ultrasound data which I require to be in gray scale.
I understand that this is quite straight forward for 2D images but technique for converting image to rgb cannot be used for 3D image since rgb conversion of 2D image gives 3 x m x n which is 3D in itself.
The resultant 3D image should be a co-registered image from both the modalities.
Or another way to look at this question is to have two superimposed 3D images with two different colormaps.
Please give your suggestions or guidance and thanks in advance.
1 Comment
Walter Roberson
on 21 Jan 2014
Have I understood correctly that you have two 3D volume datasets (voxels), and you want to display them both in the same volume but with different coloring?
If so, then at any one voxel, how should the output be chosen? Suppose V1 is the value from the first (render-in-greyscale) volume, and V2 is the value from the second (render-in-rgb) volume, then what would you like the output to be at that location? For example is there a threshold for V2 above which color_map(V2) should be the output and V1 ignored, or should V2 be the alpha value applied to color_map(V2)?
V2 * color_map(V2) + (1-V2) * grey_map(V1)
Answers (2)
Bruno Pop-Stefanov
on 21 Jan 2014
Edited: Bruno Pop-Stefanov
on 21 Jan 2014
I don't think it is any different for 3D images. If a color 3D image has dimensions (m x n x p x 3), then you could convert a grayscale 3D image with dimensions (m x n x p) to color with the following:
% Generate a random grayscale 3D image
gray3Dimage = rand([m n p]);
% Create its color equivalent
gray3Dimage_rgb(:,:,:,1) = gray3Dimage; % red channel
gray3Dimage_rgb(:,:,:,2) = gray3Dimage; % green channel
gray3Dimage_rgb(:,:,:,3) = gray3Dimage; % blue channel
You could replace the three lines above with:
gray3Dimage_rgb = repmat(gray3Dimage,[1,1,1,3]);
Then overlay with a coefficient alpha:
% Superimpose with other color 3D image
alpha = 0.5;
super(:,:,:,1) = alpha*gray3Dimage_rgb(:,:,:,1) + (1-alpha)*other3Dimage_rgb(:,:,:,1); % red channel
super(:,:,:,2) = alpha*gray3Dimage_rgb(:,:,:,2) + (1-alpha)*other3Dimage_rgb(:,:,:,2); % green channel
super(:,:,:,3) = alpha*gray3Dimage_rgb(:,:,:,3) + (1-alpha)*other3Dimage_rgb(:,:,:,3); % blue channel
or simply
super = alpha*gray3Dimage_rgb + (1-alpha)*other3Dimage_rgb;
muna majeed
on 4 Feb 2015
please can any one help me how to read pixel from 3d image is there special instruction in matlab
0 Comments
See Also
Categories
Find more on Red in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!