Skip to content

ENH: Reimplement GDCMSeriesFileNames on gdcm::IPPSorter/Scanner (drop deprecated SerieHelper)#6469

Open
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:gdcmseriesfilenames-ippsorter
Open

ENH: Reimplement GDCMSeriesFileNames on gdcm::IPPSorter/Scanner (drop deprecated SerieHelper)#6469
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:gdcmseriesfilenames-ippsorter

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Reimplement itk::GDCMSeriesFileNames on the supported modern GDCM API (gdcm::Directory + gdcm::Scanner + gdcm::IPPSorter), dropping the deprecated gdcm::SerieHelper. Part of #6467.

Why

gdcm::SerieHelper is documented by GDCM as deprecated backward-compat code — "DO NOT USE this class, it is only a temporary solution for ITK migration from GDCM 1.x to GDCM 2.x … Instead see ImageHelper or IPPSorter." This PR moves GDCMSeriesFileNames to the supported API.

What changed
  • Backend: gdcm::Directory (enumerate, honoring Recursive) → gdcm::Scanner (group by SeriesInstanceUID + detail tags; the series identifier replicates SerieHelper::CreateUniqueSeriesIdentifier) → gdcm::IPPSorter (geometric ImagePositionPatient-on-normal ordering). Lazy parse with a TimeStamp cache, so repeated GetSeriesUIDs/GetFileNames/GetInputFileNames calls no longer re-scan.
  • Characterization tests (first commit, added while still on SerieHelper so they pin the pre-existing contract): single-series enumeration/grouping, geometric ordering reconstructs a valid uniformly-spaced volume, GetInputFileNames returns the first series, Recursive descent. Green on both backends.
Intentional behavior changes
Testing

All 89 ITKIOGDCM tests pass locally (series-reader, direction-cosine, compliance suites). pre-commit run --all-files clean. The vendored gdcm::SerieHelper is untouched (still used by GDCM's own code); a follow-up may remove it once upstream GDCM drops it.

@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:IO Issues affecting the IO module labels Jun 17, 2026
@hjmjohnson hjmjohnson marked this pull request as ready for review June 18, 2026 02:57
@greptile-apps

This comment was marked as resolved.

Comment thread Modules/IO/GDCM/src/itkGDCMSeriesFileNames.cxx Outdated
Comment thread Modules/IO/GDCM/src/itkGDCMSeriesFileNames.cxx Outdated
Comment thread Modules/IO/GDCM/test/itkGDCMSeriesFileNamesContractGTest.cxx Outdated
…twareConsortium#6467)

Pin the observable contract of itk::GDCMSeriesFileNames before migrating
its backend off the deprecated gdcm::SerieHelper onto gdcm::Scanner +
gdcm::IPPSorter: single-series enumeration / grouping, geometric ordering
that reconstructs a valid uniformly-spaced volume, GetInputFileNames
returning the first series, and the Recursive flag controlling descent
(which must be set before SetInputDirectory triggers the scan).

These tests are backend-agnostic and must remain green across the swap.
Replace the deprecated gdcm::SerieHelper backend ("DO NOT USE ... temporary
solution for ITK migration from GDCM 1.x to 2.x") with the supported modern
API: gdcm::Directory for enumeration, gdcm::Scanner for series grouping, and
gdcm::IPPSorter for geometric (ImagePositionPatient on the slice normal)
ordering.

Behavior preserved on the in-tree suite (all 89 ITKIOGDCM tests pass,
including the series-reader and direction-cosine tests) and pinned by the
GDCMSeriesFileNames characterization tests added in the previous commit:
single-series enumeration / grouping, geometric ordering, GetInputFileNames
returning the first series, Recursive descent.

Intentional behavior changes:
- IPPSorter is strict: duplicate-IPP and gantry-tilt acquisitions FAIL to
  sort; the input order is then left unchanged rather than fabricated.
  Whether these need first-class support (and whether SerieHelper's permissive
  strategy was correct) is tracked for discussion in InsightSoftwareConsortium#6468.
- AddSeriesRestriction now refines the series identifier (the documented and
  example intent, e.g. "0008|0021"), instead of delegating to SerieHelper's
  largely-inert file restriction list.

Part of InsightSoftwareConsortium#6467.
@hjmjohnson hjmjohnson force-pushed the gdcmseriesfilenames-ippsorter branch from 19dc745 to 0e85890 Compare June 18, 2026 12:24
@github-actions github-actions Bot added the area:Documentation Issues affecting the Documentation module label Jun 18, 2026
@hjmjohnson hjmjohnson requested a review from malaterre June 18, 2026 12:28
@hjmjohnson

Copy link
Copy Markdown
Member Author

@malaterre I have been looking at removing the "SerieHelper" dependency that is only kept around for ITK (according to the GDCM comments for SerieHelper). Your insights into the implications of the proposed change would be helpful.

@dzenanz dzenanz requested a review from issakomi June 18, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Documentation Issues affecting the Documentation module area:IO Issues affecting the IO module type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant