<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Greetings,</div><div><br></div><div>I have recently refactored ITK's TIFFImageIO to remove a significant amount of dead code, and improve performance up to 3-5X. A number of bug related to reading BigTIFF files have been addressed. Additionally, Tiff tags are now place into the Meta-DataDictionary to allow access to additional TIFF fields such as OME-XML tags ( Originally contributed by Richard Beare <a href="http://www.insight-journal.org/browse/publication/728">http://www.insight-journal.org/browse/publication/728</a> ).</div><div><br></div><div>Significant performance improvements were made to both scalar images and palette images. Handling of certain orientations are now "better" handled, while not changing how the default TOPLEFT orientation is loaded or written. There were a number of cases which appear unreachable and illogical such as support from Zeiss two-componet types, and support for some type of SGI tiled tiff as a 3D image. These were removed.</div><div><br></div><div>If you are an active user of TIFF images with ITK, please checkout the latest ITK master and test the refactored TIFFImageIO.</div><div><br></div><div>Thanks,</div><div>Brad</div><div><br></div><div>p.s. Here is the git log for the recent changes.</div><div><br></div><div>$<span style="font-family: Menlo; font-size: 11px;">git log --no-merges 6791b4a3613aade07e3f11f765f1316faf03b113..</span></div><div><br></div><div><div>commit 46f4125df47aeff9c42c9f2b3699c06e67ffaca9</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Fri Oct 31 14:25:13 2014 -0400</div><div><br></div><div>    ENH: adding TIFFImageIO test for RGB palette images</div><div>    </div><div>    Change-Id: I320acc8beac8225616451d11b291b1d7e12a17d0</div><div><br></div><div>commit 9adc54c7f53b4da84a41f500d561ae494cb85158</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Fri Oct 24 13:42:02 2014 -0400</div><div><br></div><div>    BUG: Adding missing parentheses around boolean expression</div><div>    </div><div>    Change-Id: I669d160ff3ba830f3c33ac87de434db41472eb79</div><div><br></div><div>commit 40afd95161727be3274f8094ce19fe45e2c3aa50</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Wed Oct 22 15:05:39 2014 -0400</div><div><br></div><div>    PERF: Refactor color table lookup</div><div>    </div><div>    Change to use a index lookup for the color and gray scale</div><div>    palettes. The remove excessive exception checking done on a per pixel</div><div>    basis with the GetColor method. Additionally the InitializeColor</div><div>    method was change do initialize the color palette variables.</div><div>    </div><div>    An exception no longer occurs when an index exceeds the number of</div><div>    entries in a palette. Instead a module operator is used to prevent</div><div>    out of bounds memory access.</div><div>    </div><div>    Change-Id: Ia62c65cd8b1be0d66c488540709a8fb961190cc9</div><div><br></div><div>commit d98cbeb7206f6007f7d0c25fd4a4becad8973053</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Fri Oct 3 09:01:28 2014 -0400</div><div><br></div><div>    ENH: Refactor per pixel conversion function to per scan-line method</div><div>    </div><div>    This patch changes the implementation of conversion from the TIFF</div><div>    scanline buffer from a function call on each pixel to a function call</div><div>    per scanline. The enable efficient copying of similar scanline and</div><div>    better reuse of variables for palette look ups.</div><div>    </div><div>    This can increase the performance of reading grayscale images by up to</div><div>    3X for cached files.</div><div>    </div><div>    Change-Id: I24bb744fda35629f1c1ed7154e26e5708e912059</div><div><br></div><div>commit 8e488f40e8cb7defa046700798b77e3944ac33c9</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Tue Sep 30 08:56:58 2014 -0400</div><div><br></div><div>    ENH: RGBA read images should stay unchanged.</div><div>    </div><div>    The image that are read with the TIFFReadRGBAImage should not have</div><div>    their pixel types converted. This libtiff method always read images</div><div>    into an ABGR uint8 format. When the tiff file is read by this method</div><div>    it should report that uint8 and RGBA is the component an pixel type</div><div>    for the image. This allows the standard ITK buffer conversion to be</div><div>    performed.</div><div>    </div><div>    This change remove extra cases and template instantiations.</div><div>    </div><div>    Additionally the RGBAImageToBuffer method was flipping the image along</div><div>    the y-axis, this has been more explicitly done with the call to</div><div>    TIFFReadRGBAImageOriented.</div><div>    </div><div>    Change-Id: I022b12921d406edb09730f905213b0db811f1bd4</div><div><br></div><div>commit e5834d5b00e4e3fab3255d88e7d8fd917ee722e9</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Fri Sep 26 14:04:09 2014 -0400</div><div><br></div><div>    ENH: Remove support for TIFF tile as 3D and dead code</div><div>    </div><div>    This TIFF file format is a file which contains a list of directories,</div><div>    if there are no directories in the file it's not a valid tiff. Code</div><div>    which supported 3D tiles was conditioned on a file with no directories</div><div>    and no data. Additional code was removed related to a private SGI tag</div><div>    TIFFTAG_TILEDEPTH, ImageJ specific tag also pre-conditioned on this</div><div>    invalid case.</div><div>    </div><div>    Change-Id: Id4ef171c5dbe0c797be206e0059c7488719ef6e6</div><div><br></div><div>commit 3ac19a9ffd94e02254900dd0e5e2661c329e3183</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Mon Oct 6 10:01:50 2014 -0400</div><div><br></div><div>    BUG: Address Coverity warning about null pointer dereferences</div><div>    </div><div>    The patch addressed the following Coverity warnings:</div><div>    </div><div>    ** CID 1243373:  Explicit null dereferenced  (FORWARD_NULL)</div><div>    itkTIFFImageIO.cxx:</div><div>    1192 in itk::TIFFImageIO::ReadTIFFTags()()</div><div>    </div><div>    ** CID 1243372:  Dereference null return value  (NULL_RETURNS)</div><div>    itkTIFFImageIO.cxx:</div><div>    1096 in itk::TIFFImageIO::ReadTIFFTags()()</div><div>    </div><div>    ** CID 1243371:  Dereference before null check  (REVERSE_INULL)</div><div>    itkTIFFImageIO.cxx:</div><div>    1100 in itk::TIFFImageIO::ReadTIFFTags()()</div><div>    Last login: Fri Oct  3 19:47:29 on ttys004</div><div>    </div><div>    Change-Id: I02c8435628c860ff03889b9b57e9dd1543bf82da</div><div><br></div><div>commit 52ce992f3a57ef9f187f9c4b4ebd7ce20db365bd</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Fri Sep 26 11:04:38 2014 -0400</div><div><br></div><div>    ENH: Reduce code duplicate in TIFFImageIO::ReadCurrentPage</div><div>    </div><div>    Refactoring of the pixelOffset to include the number of components</div><div>    remove the need for a separate block for RGB multi-component files.</div><div><br></div><div>commit 97b33787ec17b76a61fdb43b5f1e1ea708bbac2c</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Wed Sep 24 15:00:54 2014 -0400</div><div><br></div><div>    ENH: add arbitrary TIFF TAGs to meta-data dictionary</div><div>    </div><div>    A more general approach to adding custom tiff tags to the meta-data</div><div>    dictionary has been used based on the implementation of libtiff's</div><div>    PrintDirectory method and the libtiff "Defining New TIFF Tags"</div><div>    documentation.</div><div>    </div><div>    Additionally a new test image was added generated in Photoshop, which</div><div>    has a novel pixel layout, and also contains additional tag types such</div><div>    as byte, and size specified ascii.</div><div>    </div><div>    Change-Id: Idb2e669e540cfbe27a932444011f4b9896ca403d</div><div><br></div><div>commit 795c71abb8b5c3a09d461ec7b34eefbfdcb460e9</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Mon Sep 22 15:08:36 2014 -0400</div><div><br></div><div>    BUG: Use array delete operator for array new allocations</div><div>    </div><div>    Change-Id: Ic9bc3c3792083a1a1b3fd842486a7436a4086150</div><div><br></div><div>commit 83e8b6e699b3d9e2da8533dd1ea36dc0692bc9eb</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Tue Sep 23 11:14:15 2014 -0400</div><div><br></div><div>    STYLE: Fix minor kwstyle defects in test and test results</div><div>    </div><div>    Change-Id: I4b2641d31acb5c764de4041bb7d21c08b3c99846</div><div><br></div><div>commit 869f3275120646829b27d5cd75c23800d9df01cd</div><div>Author: Richard Beare <<a href="mailto:Richard.Beare@ieee.org">Richard.Beare@ieee.org</a>></div><div>Date:   Tue Sep 23 11:11:34 2014 -0400</div><div><br></div><div>    ENH: Include TIFF tags in the MetaDataDictionary</div><div>    </div><div>    Add contribution from the Insight Journal:</div><div>    <a href="http://hdl.handle.net/10380/3170">http://hdl.handle.net/10380/3170</a></div><div>    </div><div>    Change-Id: I20b02394d92c421bad75c5d0af496a6e80089ac0</div><div><br></div><div>commit c7a76c9acb319862647a651a2060dd3fb16560d7</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Mon Sep 22 14:46:44 2014 -0400</div><div><br></div><div>    BUG: Remove dead separated plannar code, add test</div><div>    </div><div>    The PLANARCONFIG_SEPARATE block in TIFFImageIO::ReadGenericImage, was</div><div>    preceded by a unreachable due to a conditional and exception</div><div>    check. Support for this configuration remains in the TIFFReadRGBAImage</div><div>    method. A test for the configuration has been added.</div><div>    </div><div>    A new input image is added from the from the libTiff test images:</div><div>    </div><div>    PlanarConfiguration = 2 (separated samples)</div><div>    -------------------------------------------</div><div>    oxford.tif      601x81 8-bit RGB (lzw) screendump off oxford</div><div>    </div><div>    Change-Id: Ibb874f80809b70b1aee7a2c9ff1fc8544ed56c04</div><div><br></div><div>commit 1b57d75964496dd2cc9e050a4a4425f1163d4b22</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Mon Sep 22 13:32:23 2014 -0400</div><div><br></div><div>    BUG: Fix right oriented tiff images</div><div>    </div><div>    The TIFFImageIO::ReadGenericImage method correctly handled top-left</div><div>    oriented images, and bottom-right image, however images oriented with</div><div>    right were non-correctly handled. These cases are now handled</div><div>    correctly by the TIFFRGBAImage generic path.</div><div>    </div><div>    New test images of the cthead1 image were added which have been</div><div>    flipped the to the different orientation, and the matching orientation</div><div>    tag specified so that they should all be read as equivalent</div><div>    images. These have been added as a test case.</div><div>    </div><div>    Change-Id: I058382d6d2e18341ab87edd165490be2187c1d15</div><div><br></div><div>commit 6263f4389026f1bd770054e86c428b56629d705b</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Thu Sep 18 16:20:41 2014 -0400</div><div><br></div><div>    ENH: Refactor duplicated code to read a page</div><div>    </div><div>    Created a method to read a single page or sub-image in a tiff</div><div>    file. Simular code was both in the ReadVolume method for 3-d and the</div><div>    Read method for 2-d. The code block from ReadVolume was used because</div><div>    it contained more typed cases. There for this patch does improve the</div><div>    2d reading capabilities for tiffio, so that they are consistent with</div><div>    the 3d.</div><div>    </div><div>    Change-Id: I0fbfb19f04435a703bb3fa09ea4e79179592e443</div><div><br></div><div>commit 233571f1e626917bce872e450907bc8e8521e371</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Thu Sep 18 14:59:58 2014 -0400</div><div><br></div><div>    ENH: Refactor method to convert RGBA image to output buffer</div><div>    </div><div>    BUG: Address overflow issue when computing page offset with</div><div>    TIFFReadRGBAImage method.</div><div>    </div><div>    Extract repeated code to convert from ReadRGBAImage to output image</div><div>    type.</div><div>    </div><div>    Change-Id: Ia90b5e104f22c77493b8a4cd5bf640fd793b8b4b</div><div><br></div><div>commit 1cd59825fa65f1123726a32f67c1a443015b40ec</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Thu Sep 18 11:30:41 2014 -0400</div><div><br></div><div>    BUG: Remove Zeiss 2-channel support code in TIFFImageIO ( and LSMImageIO )</div><div>    </div><div>    There are no tests for this branch of code. It only works in 3D under</div><div>    certain cases. There are apparent bugs in the code such as not setting</div><div>    all of the input image, and logically dead branches. Some downloaded</div><div>    test images for similar described format do not load. This may effect</div><div>    files with the extensions tif, tiff, or lsm.</div><div>    </div><div>    Removal of this code will enable expansion of the current code to more</div><div>    generically support multi-sample per pixel images.</div><div>    </div><div>    For more robust reading of this type of image the SCIFIO remote</div><div>    module should be used.</div><div>    </div><div>    Change-Id: Idb98d69538db3bc8520881ea4a5e22476238c41e</div><div><br></div><div>commit 690cfdc89343fcc8c7d3cc266d652cfb14de9d41</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Tue Sep 16 15:31:52 2014 -0400</div><div><br></div><div>    ENH: Refactor GenericReadImage into template function</div><div>    </div><div>    Reduce code duplication by using template method.</div><div>    </div><div>    Change-Id: I79411ad6595258d54cbfa5a4152cc55994acd8e0</div><div><br></div><div>commit 5f73f24bfb668fa9f33804218c0db05cf5cadb3f</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Tue Sep 16 12:09:59 2014 -0400</div><div><br></div><div>    ENH: Refactor ReadTwoSamplePerPixelImage into template function</div><div>    </div><div>    Reduce code duplication by using template method.</div><div>    </div><div>    Change-Id: I45f417486e60a4d3e67ff31fa967dac069b3ce3e</div><div><br></div><div>commit 0b573136d636613217df9683ea846db8039f9312</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Tue Sep 16 11:12:45 2014 -0400</div><div><br></div><div>    ENH: Extract TiffReaderInternal to separate file</div><div>    </div><div>    Refactored private class to be in separate private header.</div><div>    </div><div>    Change-Id: Icb4008c1605a3a0b62c563350cf2e3bbe948ec6d</div><div><br></div><div>commit 6791b4a3613aade07e3f11f765f1316faf03b113</div><div>Author: Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>></div><div>Date:   Mon Sep 15 16:46:26 2014 -0400</div><div><br></div><div>    BUG: Fix overflows computing size of read tiff image</div><div>    </div><div>    When multiplying the height and width of an tiff image (32-bits),</div><div>    at least one element should be converted to size_t to help prevent</div><div>    numeric overflow.</div><div>    </div><div>    This change enables reading of larger RGB and large 2D image, that</div><div>    were previously truncated when reading. This does not address</div><div>    potential buffer overflow or resource limits which could occur.</div><div>    </div><div>    Change-Id: I192370606677c8dc1a903c67c2a0701026256d5a</div><div><br></div><div>commit b6fabfeb2a5b8d339b2d459edd3e3c50232b55ff</div><div>Author: Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>></div><div>Date:   Mon Aug 25 00:35:48 2014 -0400</div><div><br></div><div>    COMP: Do not use _stat64 with MinGW-32.</div><div>    </div><div>    Unlike MinGW-w64, MinGW-32 aka MinGW, does not define as much of the API</div><div>    including _stat64.  Do not use use _stat64 in TIFFImageIO when building with</div><div>    MinGW-32.</div><div>    </div><div>    Change-Id: I8f13a4500cdadf4f4adae7b5cf8893fe8b8cad55</div></div><div><br></div><div><br></div><div><br></div></body></html>