Skip to content

ENH: Expose TIFF baseline tags in TIFFImageIO metadata dictionary - #6915

Draft
blowekamp wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
blowekamp:tiff-readtags-baseline-metadata
Draft

blowekamp wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
blowekamp:tiff-readtags-baseline-metadata

Conversation

@blowekamp

Copy link
Copy Markdown
Member

Merge TIFF baseline tags (BitsPerSample, Compression, dimensions, tiling geometry, resolution, etc.) and RowsPerStrip/SampleFormat into ReadTIFFTags's generic fetch loop, so they appear in the ImageIO metadata dictionary alongside custom tags instead of only custom tags being exposed.

Details
  • Adds TIFF_RATIONAL/SRATIONAL support to the generic tag switch (libtiff marshals these as float).
  • Uses TIFFGetFieldDefaulted so spec-mandated defaults (e.g. BitsPerSample) are captured even when absent from the file.
  • Replaces manual _TIFFfree/bool bookkeeping with a std::unique_ptr custom deleter so the self-allocated buffer is freed via RAII on every exit path.
Test results

ctest -R "TIFF" --output-on-failure — 113/113 passed.

@github-actions github-actions Bot added type:Enhancement Improvement of existing methods or implementation area:IO Issues affecting the IO module labels Sep 28, 2026

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

Comment thread Modules/IO/TIFF/src/itkTIFFImageIO.cxx
Merge baseline tags (BitsPerSample, Compression, dimensions, tiling,
resolution, etc.) and RowsPerStrip/SampleFormat into ReadTIFFTags's
generic fetch loop, rather than only custom tags. Add TIFF_RATIONAL/
SRATIONAL support, and use TIFFGetFieldDefaulted so spec-mandated
defaults are captured. Replace manual _TIFFfree bookkeeping with a
unique_ptr so the self-allocated buffer is freed via RAII.
@blowekamp
blowekamp force-pushed the tiff-readtags-baseline-metadata branch from 74dd5f6 to f58f93b Compare September 29, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:IO Issues affecting the IO module type:Enhancement Improvement of existing methods or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants