Skip to content

Discussion: GDCMSeriesFileNames ordering edge cases (duplicate IPP, gantry tilt) and whether SerieHelper's permissive strategy is correct #6468

Closed

Description

@hjmjohnson

Context

#6467 migrates itk::GDCMSeriesFileNames off the deprecated gdcm::SerieHelper onto gdcm::Scanner + gdcm::IPPSorter. The two backends differ in how tolerant they are of awkward series, so this issue is to decide the intended behavior before we lock it in.

gdcm::IPPSorter (by design, per its own header docs) is strict:

  • Fails on duplicate ImagePositionPatient — Sort() returns false (there is an opt-in SetDropDuplicatePositions, but dropping changes the returned slice count).
  • Gantry tilt is treated as an error (documented \bug).
  • Assumes sortable image SOP classes (e.g. CT/MR/PET); other datasets are out of scope.

gdcm::SerieHelper::OrderFileList was more permissive: IPP-projected-on-normal first, with an ImageNumber / file-name fallback chain, and it did not hard-fail on the cases above.

In the migration PR (#6467)

The initial backend swap lets duplicate-IPP, oblique-edge, and gantry-tilt cases fail (IPPSorter's native behavior), with a code note pointing here. This issue tracks whether that is acceptable long-term.

Questions for discussion

  1. Do these cases need first-class support in ITK? Which real-world acquisitions actually produce them?

    • Gantry-tilt CT (older head CT) is the classic real case.
    • Duplicate IPP usually indicates bad data (repeated/duplicated slices) — should ITK order it or reject it?
    • Oblique / non-axis-aligned series are common and should sort fine via IPP-on-normal; confirm IPPSorter handles them (it should — it projects on the orientation normal).
  2. Was SerieHelper's strategy correct? Its fallback chain silently produced an ordering even for degenerate input, which can mask bad data. Is "fail loudly" (IPPSorter) actually the better contract?

  3. If we do need the permissive path, the plan (see Modernize itk::GDCMSeriesFileNames onto gdcm::IPPSorter/Scanner (drop deprecated gdcm::SerieHelper) #6467 follow-on commits) is to port the SerieHelper ordering logic into ITK as a documented, opt-in fallback (e.g. gated behind an IO option for gantry tilt), rather than keep depending on a class GDCM says "DO NOT USE." A motivating benefit: ITK owning this lets upstream GDCM finally remove the SerieHelper stopgap (and the various Applications/ workarounds built around its IPPSort-failure cases), completing the "temporary solution for ITK migration from GDCM 1.x to 2.x" that has lived for ~15 years.

Related

Activity

  1. dzenanz commented on Jun 30, 2026

    @dzenanz
    Member

    Gantry-tilt CTs should continue to be supported. I encountered this with pediatric patients - technicians were trying hard to avoid the eyes while scanning.

  2. hjmjohnson commented on Jul 17, 2026

    @hjmjohnson
    MemberAuthor

    The concrete deliverable this discussion gated has landed on main: 50dfb136658 reimplemented GDCMSeriesFileNames on gdcm::Scanner + gdcm::IPPSorter, and 7cb3bbec23d added the opt-in permissive fallback (FailOnAmbiguousOrdering, throwing by default). The gating migration issue #6467 is closed.

    One request from the thread remains open: @dzenanz asked that gantry-tilt CTs continue to be supported, and today they are only handled via the legacy fallback, which is off by default and which the code comment itself calls untrustworthy. That is a maintainer judgment call about intended behavior rather than missing migration work, so I've split it into its own tracking issue: #6656.

    Closing this discussion in favor of #6656.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions