<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello Michael,<div class=""><br class=""></div><div class="">The current itkTIFFIO does handle some special cases for palette. Namely when all RGB palette entries are equal[1], the image palette is interpreted as grayscale. The other is when all the entires are less that 256, the component is interpreted as unsigned char.</div><div class=""><br class=""></div><div class="">On the bright side you are not getting an RGB of uint16 :) But we are not handling the case where the upper bits of the palette entries are used and not the lower, so you are still getting uint16.</div><div class=""><br class=""></div><div class="">While it is quite possible to modify TIFFIO to load this data as you expect, it likely would be easiest to just shift the palette in the file. As I have used this format before I was surprised with the support from a number of viewers.</div><div class=""><br class=""></div><div class="">HTH,</div><div class="">Brad</div><div class=""><br class=""></div><div class="">[1] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/6871f6f2c9510057ca253727d8487d88724cf2d8/Modules/IO/TIFF/src/itkTIFFImageIO.cxx#L122-L131" class="">https://github.com/InsightSoftwareConsortium/ITK/blob/6871f6f2c9510057ca253727d8487d88724cf2d8/Modules/IO/TIFF/src/itkTIFFImageIO.cxx#L122-L131</a></div><div class="">[2] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/6871f6f2c9510057ca253727d8487d88724cf2d8/Modules/IO/TIFF/src/itkTIFFImageIO.cxx#L392-L402" class="">https://github.com/InsightSoftwareConsortium/ITK/blob/6871f6f2c9510057ca253727d8487d88724cf2d8/Modules/IO/TIFF/src/itkTIFFImageIO.cxx#L392-L402</a></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 22, 2016, at 9:28 AM, Michael Jackson <<a href="mailto:mike.jackson@bluequartz.net" class="">mike.jackson@bluequartz.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-family: FiraSans-Regular;" class="">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:</span><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class=""> itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(getInputFileName(), itk::ImageIOFactory::ReadMode);</span><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">itk::ImageIOBase::IOComponentType componentType = imageIO->GetComponentType();</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">…</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class=""> else if(itk::ImageIOBase::USHORT == componentType)</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class=""> {</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class=""> data = UInt16ArrayType::CreateArray(0, "Temp", false);</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class=""> }</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">…</span><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Here is the header of the tiff file as put out by “tiffdump”</span><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">/Users/XXXXXXXX/Downloads/image_01.tif:</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Directory 0: offset 8 (0x8) next 113277976 (0x6c07c18)</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">ImageWidth (256) LONG (4) 1<12288></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">ImageLength (257) LONG (4) 1<9216></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">BitsPerSample (258) SHORT (3) 1<8></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Compression (259) SHORT (3) 1<1></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Photometric (262) SHORT (3) 1<3></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">StripOffsets (273) LONG (4) 1<31768></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">RowsPerStrip (278) LONG (4) 1<4294967295></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">StripByteCounts (279) LONG (4) 1<113246208></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">XResolution (282) RATIONAL (5) 1<1></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">YResolution (283) RATIONAL (5) 1<1></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">ResolutionUnit (296) SHORT (3) 1<1></span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">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 …></span><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">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?</span><br style="font-family: FiraSans-Regular;" class=""><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Thanks</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">--</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">Michael A. Jackson</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">BlueQuartz Software, LLC</span><br style="font-family: FiraSans-Regular;" class=""><span style="font-family: FiraSans-Regular;" class="">[e]: </span><a href="mailto:mike.jackson@bluequartz.net" style="font-family: FiraSans-Regular;" class="">mike.jackson@bluequartz.net</a></div>_____________________________________<br class="">Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class=""><br class="">Visit other Kitware open-source projects at<br class=""><a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Kitware offers ITK Training Courses, for more information visit:<br class="">http://www.kitware.com/products/protraining.php<br class=""><br class="">Please keep messages on-topic and check the ITK FAQ at:<br class="">http://www.itk.org/Wiki/ITK_FAQ<br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class="">http://public.kitware.com/mailman/listinfo/insight-users<br class=""></div></blockquote></div><br class=""></div></body></html>