MATLAB: Are images displayed differently by IMMOVIE and IMSHOW

Image Processing Toolbox

I have a set of uint16 image data that I am trying to use to create a movie. When I use IMMOVIE without the colormap (similar to the use of IMSHOW), I receive an error message:
X= uint16(round(65535*rand(256,256,1,10)));
mov = immovie(X);
??? Error using ==> image
Indexed CData must be size [MxN], TrueColor CData must be size [MxNx3].
Error in ==> D:\Applications\MATLABR12P1\toolbox\images\images\imshow.m
On line 103 ==> hh = image(xdata, ydata, cdata, 'BusyAction', 'cancel', ...
If I do specify a colormap:
immovie(X,gray(256))
the images that are captured do not look like the images displayed when I use IMSHOW to view the data. I cannot use 65536 colors in the colormap, because MATLAB seems to hang. I believe that, since IMSHOW does display the image correctly, IMMOVIE should do the same without the need to specify a colormap.

Best Answer

The ability to use uint16 images with IMMOVIE is not availabe in MATLAB.
MATLAB's movie structure has only two color models --- indexed and RGB. MATLAB's Handle Graphics has colormap length limitations. IMMOVIE works within these limitations.
Due to these limitations in MATLAB which constrain the amount of colors that IMMOVIE can use, it will not display 65536 different shades of gray.
However, you can use colormaps with length 256, which is the same range as uint8 data. You will need to convert your uint16 data to uint8, with IM2UINT8, and specify a grayscale colormap with 256 colors.
The workaround using IM2UINT8 to convert the 16-bit data to 8-bit data is given below:
Xnew = im2uint8(X);
immovie(X,gray(256)).