0
votes

After processing an input I finally have a matrix of N x M x L representing a volume. The values on that matrix are only 0 or 1. When I try to display a "slice" from this volume using image like this:

image(volume(:,:,80))

the displayed figure is all blue. Now if I use imagesc, the image is displayed ok (in blue and red tones). I think this is related to colormap but can't really figure out how to display the images with the image command. My final goal is to display 3 or 4 slices in one 3d plot, somthing similar to what is shown here: http://www.mathworks.com/help/matlab/visualize/techniques-for-visualizing-scalar-volume-data.html#f5-4457

1

1 Answers

1
votes

You are right, your problem is related to colormap. Try

image(volume(:,:,80))
colorbar

You will see that your current colormap ranges from 0 to 64. If you use this command instead:

image(volume(:,:,80),'CDataMapping','scaled')
colorbar

you should get the image you want, and your colormap is now scaled to the range of your data (of course, you don't need to show the colorbar to get the right scaling, I just added it to make things more clear).