Matlab: Warning Dimensions of AlphaData must match CData
===

The following code produces the error:

> Warning: Dimensions of AlphaData must be 1x1, or must match CData. 

The problem is that CData is a color image and thus has 3 dimensions, and alphadata is a matrix of transparancy data abd thus has 2 dimensions.


    red = cat(3, ones(512), zeros(512), zeros(512));
    mask = [];
    bounds = data(currow,1:6);
    if slice >= bounds(5) && slice <= bounds(6)
        mask = zeros(size(segmask,1),size(segmask,2));
        mask(bounds(1)-4:bounds(2)+4,bounds(4)+4:bounds(4)+5) = 1;
        mask(bounds(2)+4:bounds(2)+5,bounds(3)-4:bounds(4)+4) = 1;
    end
    imshow(low(:,:,slice),[WL-WW/2 WL+WW/2])
    hold on
    h = imshow(red);
    set(h, 'AlphaData', 0.3*mask);
    hold off


Here is the info on AlphaData and CData from the Matlab Documentation


----------


> AlphaData m-by-n matrix of double or uint8
> 
> Transparency data. A matrix of non-NaN values specifying the
> transparency of each face or vertex of the object. The AlphaData can
> be of class double or uint8.
> 
> MATLAB software determines the transparency in one of the following
> ways:
> 
> Using the elements of AlphaData as transparency values
> (AlphaDataMapping set to none)
> 
> Using the elements of AlphaData as indices into the current alphamap
> (AlphaDataMapping set to direct)
> 
> Scaling the elements of AlphaData to range between the minimum and
> maximum values of the axes ALim property (AlphaDataMapping set to
> scaled, the default)


----------


> CData 
> matrix | m-by-n-by-3 array
> 
> The image data. A matrix or 3-D array of values specifying the color
> of each rectangular area defining the image. image(C) assigns the
> values of C to CData. MATLAB determines the coloring of the image in
> one of three ways:
> 
> Using the elements of CData as indices into the current colormap (the
> default) (CDataMapping set to direct)
> 
> Scaling the elements of CData to range between the values
> min(get(gca,'CLim')) and max(get(gca,'CLim')) (CDataMapping set to
> scaled)
> 
> Interpreting the elements of CData directly as RGB values (true color
> specification)
> 
> 
> Note that the behavior of NaNs in image CData is not defined. See the
> image AlphaData property for information on using transparency with
> images.


----------
How Can AlphaData and CData possibly h

