Reading multiple image Tiff file
25 次查看(过去 30 天)
显示 更早的评论
When I try to read a tiff image with imread I receive the warming:
" Only the first slice will be read from this image with depth 418 "
Which I understand. According to the documentation of imread, I schould then be able to acces the other slices by typig for example:
Image = imread(filename, 2).
However when I do that I get the message:
" Invalid TIFF image index 2 "
How can I read my entire tiff image (CT_Scan with 418 slices)?
imfinfo on this file returns the following information:
struct with fields:
FileModDate: '24-Aug-2020 07:57:58'
FileSize: 438358619
Format: 'tif'
FormatVersion: []
Width: 512
Height: 512
BitDepth: 32
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 32
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: []
SamplesPerPixel: 1
RowsPerStrip: 4.2950e+09
StripByteCounts: []
XResolution: 15.4683
YResolution: 15.4683
ResolutionUnit: 'Centimeter'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: 128
TileLength: 128
TileOffsets: [1×6688 double]
TileByteCounts: [1×6688 double]
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 4.2950e+09
MinSampleValue: 0
Thresholding: 1
Offset: 438304776
ImageDescription: 'MeVisLab'
Software: 'MFL MeVis File Format Library, TIFF Module'
SampleFormat: 'IEEE floating point'
SMinSampleValue: 0
SMaxSampleValue: 552
ImageDepth: 418
TileDepth: 1
3 个评论
Noshin Nawar
2022-5-17
Hi Ingrid,
I'm having this same issue. What do you mean when you say you used the function Tiff? Are you using that instead of imfinfo? When I try:
tiffile = (Tiff(filename,2));
I get out:
Expected MODE to be one of these types:
char, string
Instead its type was double.
How did you end up making the multi-element struct for each TIF slice? Thanks!
Image Analyst
2022-5-17
The second argument to Tiff should be a letter. You probably want 'r' instead of 2.
Input Arguments
filename — Name of file
character vector | string scalar
mode — File access type
'r' (default) | 'w' | 'w8' | 'a' | 'r+'
回答(1 个)
Image Analyst
2020-8-24
Looks like it's not a multi-page TIFF, but a single page tiff with a 3-D volumetric image in it that has 418 slices. You can get the second slice (what you thought was a page) by indexing:
slice2 = image3D(:, :, 2);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!