Reading multiple image Tiff file

17 views (last 30 days)
Ingrid van Peufflik
Ingrid van Peufflik on 24 Aug 2020
Commented: Image Analyst on 17 May 2022
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 Comments
Noshin Nawar
Noshin Nawar on 17 May 2022
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
Image Analyst on 17 May 2022
@Noshin Nawar I think you're getting TIFF confused with read
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+'

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 24 Aug 2020
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);

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!