MATLAB Answers

8 bit depth TIF files coloured or not?

1 ビュー (過去 30 日間)
F Sp
F Sp 2020 年 6 月 9 日
コメント済み: F Sp 2020 年 8 月 10 日
Hello, I have TIF files that appear coloured in Windows and FIJI (Image J) but in MatLab show as grayscale. I found that the file has only 8 bit depth so 1 channel and therefore should correspondingly be gray. However why does it not appear like that in Windows etc.? A JPG file created from the very same TIF file works perfectly fine as it is a normal RGB.
I have been looking for answers for a long while now without finding anything helpful. I would really appreciate any help!
The information I get from imfinfo:
FileSize: 16823378
Format: 'tif'
FormatVersion: []
Width: 4096
Height: 4096
BitDepth: 8
ColorType: 'indexed'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 8
Compression: 'Uncompressed'
PhotometricInterpretation: 'RGB Palette'
StripOffsets: [1×256 double]
SamplesPerPixel: 1
RowsPerStrip: 16
StripByteCounts: [1×256 double]
XResolution: []
YResolution: []
ResolutionUnit: 'Centimeter'
Colormap: [256×3 double]
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 255
MinSampleValue: 0
Thresholding: 1
Offset: 16777224
ImageDescription: '[Parameter-Settings]←↵Width→=→4096←↵Length→=→4096←↵Bits per Sample→=→8←↵Used Bits per Sample→=→8←↵Samples per Pixel→=→1←↵ScanMode→=→xy←↵AOBS (0)→=→100.000000←↵AOBS (1)→=→100.000000←↵AOBS (2)→=→0.000000←↵AOBS (3)→=→0.000000←↵AOBS (4)→=→0.000000←↵AOBS (5)→=→0.000000←↵AOBS (6)→=→0.000000←↵AOBS (7)→=→0.000000←↵AOBS (0)→=→0.000000←↵AOBS (1)→=→0.000000←↵AOBS (2)→=→0.000000←↵AOBS (3)→=→0.000000←↵AOBS (4)→=→0.000000←↵AOBS (5)→=→0.000000←↵AOBS (6)→=→0.000000←↵AOBS (7)→=→0.000000←↵AOTF (0)→=→0.000000←↵AOTF (1)→=→0.000000←↵AOTF (0)→=→0.000000←↵AOTF (1)→=→0.000000←↵AOTF (458)→=→0.000000←↵AOTF (476)→=→0.000000←↵AOTF (488)→=→0.000000←↵AOTF (514)→=→0.000000←↵AOTF (543)→=→100.000000←↵AOTF (633)→=→0.000000←↵AOTF (458)→=→0.000000←↵AOTF (476)→=→0.000000←↵AOTF (488)→=→0.000000←↵AOTF (514)→=→0.000000←↵AOTF (543)→=→0.000000←↵AOTF (633)→=→0.000000←↵PMT 1→=→Inactive←↵PMT 2→=→Active←↵PMT 2 (Offs.)→=→0.800000←↵PMT 2 (HV)→=→941.383353←↵PMT 3→=→Inactive←↵PMT 4→=→Inactive←↵PMT NDD3→=→Inactive←↵PMT NDD4→=→Inactive←↵Beam Expander→=→Beam Exp 6←↵External Detection FW→=→Mirror ←↵Polarization FW→=→Empty 1 ←↵Hardware Type No.→=→2.000000←↵inverse flag topo→=→0←↵Scan Field Rotation→=→-0.038943←↵Rotation Direction→=→1←↵X Scan Actuator→=→Active←↵X Scan Actuator (Gain)→=→1.000000←↵X Scan Actuator (Offs.)→=→0.000000←↵Y Scan Actuator→=→Active←↵Y Scan Actuator (Gain)→=→1.000000←↵Y Scan Actuator (Offs.)→=→0.000000←↵Z Scan Actuator→=→Inactive←↵Z Scan Actuator (POS)→=→0.000000←↵Scan Speed→=→400.000000←↵Phase→=→21.451823←↵Y-Phase→=→0.122100←↵SP Mirror 1 (left)→=→498.000000←↵SP Mirror 1 (right)→=→533.000000←↵SP Mirror 1 (stain)→=→←↵SP Mirror 2 (left)→=→553.000000←↵SP Mirror 2 (right)→=→637.000000←↵SP Mirror 2 (stain)→=→TRITC←↵SP Mirror 3 (left)→=→702.000000←↵SP Mirror 3 (right)→=→761.000000←↵SP Mirror 3 (stain)→=→←↵SP Mirror 4 (left)→=→761.875000←↵SP Mirror 4 (right)→=→820.625000←↵SP Mirror 4 (stain)→=→←↵Objective→=→HCX PL FLUOTAR 63.0x1.30 IMM←↵Order number (Obj.)→=→506186←↵Numerical aperture (Obj.)→=→1.300000←↵RoiScan→=→0←↵IsSequential→=→unknown type←↵ChaserUVShutter→=→0←↵ChaserVisibleShutter→=→0←↵MPShutter→=→0←↵UVShutter→=→0←↵VisibleShutter→=→1←↵ScanMode→=→xyz←↵Pinhole [m]→=→0.000126←↵Pinhole [airy]→=→1.021414←↵Size-Width→[µm]→=→238.095238←↵Size-Height→[µm]→=→238.095238←↵Size-Depth→=→0.000000←↵StepSize→[µm]→=→0.007670←↵Voxel-Width→[µm]→=→0.058129←↵Voxel-Height→[µm]→=→0.058129←↵Voxel-Depth→=→0.000000←↵Zoom→=→1.000000←↵Scan-Direction→=→1←↵Y-Scan-Direction→=→1←↵SequentialMode→=→0←↵Frame-Accumulation→=→1←↵Frame-Average→=→2←↵Line-Average→=→16←↵Resolution→=→8←↵Channels→=→1←↵Format-Width→=→4096←↵Format-Height→=→4096←↵Sections→=→1←↵Series Name→=→Mar 16.lei←↵'
Software: 'TCSNTV'
DateTime: '2020:03:16 15:07:37'
Artist: 'TCS User'
HostComputer: 'No. of Processors: 8, Type: 586, Level: 6, Revision 7685'
UnknownTags: [1×1 struct]

  0 件のコメント



Nitin Kapgate
Nitin Kapgate 2020 年 8 月 6 日
Hi F Sp,
From the details you have provided with the help of imfinfo function, it appears that the “ColorType” is “Indexed” for your image file. Hence the image you are referring to is indeed an Indexed Color Image. The color information is indexed in a colormap, which is also stored in the TIF file.
The code below will help you in understanding the Indexed Color Images.
% MATLAB has an inbuilt, indexed Color image named as "corn.tif"
% read the color indexed TIF image with "imread"
im1 = imread('corn.tif');
imshow(im1); % The 8 bit image is shown in Grayscale as “imread” is unaware of presence of any Color Map present in the image. It treats the image as any other 8-bit Grayscale image
imfinfo('corn.tif').ColorType; % There are multiple images with the name 'corn.tif', the first one of them is indexed
% Now that we know that the image is Indexed Color Image, we need to convert it into a normal 24 bit RGB Color image
% Get the Pixel Data and Color map from the image
[X,cmap] = imread('corn.tif');
% Use "ind2rgb" function to convert an 8 bit indexed Color image to RGB 24 bit image
rgbIm = ind2rgb(X,cmap);
imshow(rgbIm); % Now the RGB image is shown as color image
For more details about “ind2rgb” function, refer to this documentation

  1 件のコメント

F Sp
F Sp 2020 年 8 月 10 日
Thank you, that explained my question!


その他の回答 (0 件)


Community Treasure Hunt

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

Start Hunting!

Translated by