Reputation: 81
I get the following errors when trying to run imshow with some tiff files:
??? Error using ==> imageDisplayValidateParams>validateCData at 114
Unsupported dimension
Error in ==> imageDisplayValidateParams at 31
common_args.CData = validateCData(common_args.CData,image_type);
Error in ==> imageDisplayParseInputs at 79
common_args = imageDisplayValidateParams(common_args);
Error in ==> imshow at 199
[common_args,specific_args] = ...
Error in ==> CellArea at 6
imshow('A1 x20.tiff')
I initially stored the image data in a matlab variable using imread
and when that didn't work with imshow
I used it to just get the image directly with the filename; the error messages are the same.
The problem images I'm trying to analyze are 1032x778 tiff files. I made a sample tif image using Paint and the function has no problems with it. Does anybody know what is causing these errors and how to get the image to display? Thanks
Here is the infinfo output for one of the images, as requested
Filename: 'A1 x20.tiff'
FileModDate: '14-Oct-2013 15:49:26'
FileSize: 3211714
Format: 'tif'
FormatVersion: []
Width: 1032
Height: 778
BitDepth: 32
ColorType: 'truecolor'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: [8 8 8 8]
Compression: 'Uncompressed'
PhotometricInterpretation: 'RGB'
StripOffsets: 8
SamplesPerPixel: 4
RowsPerStrip: 4.2950e+009
StripByteCounts: 3211584
XResolution: []
YResolution: []
ResolutionUnit: 'None'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: [255 255 255 255]
MinSampleValue: 0
Thresholding: 1
Offset: 3211592
doing x = imread('A1 x20.tiff') and then whos x gives
Name x
Size 778x1032x4
Bytes 3211584
Class uint8
Attributes
Upvotes: 3
Views: 2449
Reputation: 114806
For some reason your tiff file has four channels (nothing to do with multiple frames): size(x,3)==4
. I guess the fourth is an alpha-channel.
imshow
can display either gray scale images, indexed images (with size(x,3)==1
) or true-color images (with size(x,3)==3
). Your image had 4 channels and thus imshow
failed.
Asking inshow
to work only on the first three channels made the trick:
>> imshow( x(:,:,1:3) );
Upvotes: 6