adding an RGB volume to a grayscale MRI volume
1 view (last 30 days)
Show older comments
I have a grayscale MRI volume of dimension 160x216x176.
I also have a volume corresponding to its labels, which is in RGB, so its 160x216x176x3.
I want to use imshow to show each mri volume slice superimposed to its labels, with the mri volume appearing in gray and the labels appearing in a custom colormap that I created.
I use this to produce the RGB slices:
labelRGB_slice=label2rgb(handles.label(:,:,handles.current_slice_z), my_colormap, [0 0 0]);
handles.labelRGB(:,:,handles.current_slice_z, : , : , :) = labelRGB_slice;
this is the imshow that I plan to use to update axes:
imshow((handles.imdata_show(:,:, handles.current_slice_z) +...
handles.labelRGB(:,:,handles.current_slice_z, : , : )),...
'DisplayRange', [])
it's obviously faulty cause the matrix dimensions don't agree, but I don't know how to fix the grayscale slice to make it addable to the rgb slice.
What should I use here? repmat? ind2rgb?
I tried using ind2rgb with a 'gray' colormap, like this:
imshow((ind2rgb(handles.imdata_show(:,:, handles.current_slice_z), gray) +...
squeeze(handles.labelRGB(:,:,handles.current_slice_z, : , : ))),...
'DisplayRange', [])
and got this botched image, losing all gray contrast (rgb labels haven't been placed yet):
0 Comments
Answers (0)
See Also
Categories
Find more on Basic Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!