[ITK-users] Reading Gray Scale Palette Image

Michael Jackson mike.jackson at bluequartz.net
Fri Jan 22 09:28:58 EST 2016


We have a Tiff image that is GrayScale (8 bit) and Palette (photometric interpretation=3) and the indices into the palette are 16 bit but the values in the palette are 8 bit? When trying to use ITK to figure out what type of array we should be allocating our logic is coming back with 16 bit unsigned shorts because  we have the following code:

  itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(getInputFileName(), itk::ImageIOFactory::ReadMode);

itk::ImageIOBase::IOComponentType componentType = imageIO->GetComponentType();
…
  else if(itk::ImageIOBase::USHORT == componentType)
 {
   data = UInt16ArrayType::CreateArray(0, "Temp", false);
 }
…

Here is the header of the tiff file as put out by “tiffdump”

/Users/XXXXXXXX/Downloads/image_01.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 8 (0x8) next 113277976 (0x6c07c18)
ImageWidth (256) LONG (4) 1<12288>
ImageLength (257) LONG (4) 1<9216>
BitsPerSample (258) SHORT (3) 1<8>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<3>
StripOffsets (273) LONG (4) 1<31768>
RowsPerStrip (278) LONG (4) 1<4294967295>
StripByteCounts (279) LONG (4) 1<113246208>
XResolution (282) RATIONAL (5) 1<1>
YResolution (283) RATIONAL (5) 1<1>
ResolutionUnit (296) SHORT (3) 1<1>
Colormap (320) SHORT (3) 768<0 256 512 768 1024 1280 1536 1792 2048 2304 2560 2816 3072 3328 3584 3840 4096 4352 4608 4864 5120 5376 5632 5888 …>


My question is this: what can we interrogate from the imageIO object to really nail down that this really turns out to be an 8 bit image?

Thanks
--
Michael A. Jackson
BlueQuartz Software, LLC
[e]: mike.jackson at bluequartz.net <mailto:mike.jackson at bluequartz.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160122/7555c42c/attachment.html>


More information about the Insight-users mailing list