Skip to content

FIX: name each AREG IOS-CBCT patient folder as its files do and hand back the oriented CBCT beside the meshes - #88

Merged
Jules-GP merged 1 commit into
DCBIA-OrthoLab:mainfrom
Jules-GP:fix/areg-ioscbct-patient-folder
Oct 27, 2026
Merged

Jules-GP merged 1 commit into
DCBIA-OrthoLab:mainfrom
Jules-GP:fix/areg-ioscbct-patient-folder

Conversation

@Jules-GP

Copy link
Copy Markdown
Collaborator

Why

A cohort run showed two problems with the AREG IOS-CBCT results.

  1. The patient folders used the matching key as their name. The key keeps only the digits of a file name, so the arches of case_042_T1_U.stl landed in a folder called 42. Nothing on disk ties 42 back to case_042.
  2. In Fully-Automated mode, the meshes were in a frame the reader could not open. ASO orients the CBCT first, and every arch is registered onto that oriented scan. That scan stayed in the job's work directory and was deleted with it. Opened over the original CBCT, the registered meshes were off by the whole rotation ASO applied. The landmark residuals were good (0.7 to 3.7 mm on every arch), so the registration itself was right: only its target was missing from the results.

Change

Folder names

  • New pipeline.patient_name(): it keeps the name up to the end of its first word that holds a digit, skipping a timepoint word.
    • case_042_T1_L.stl gives case_042
    • P_0001_T2.nii.gz gives P_0001
    • a name with no digit is kept whole
  • discover() still pairs on patient_key, and the landmark files are still matched on it. Each pair now also carries its name, taken from the patient's first intraoral mesh (the files the folder holds).
  • The output folder and the patients / unpaired keys of AREG_report.json use the name.
  • Two keys that would share a name are kept apart: the second gets its key appended, so one patient can never overwrite another's arches.

The oriented CBCT

  • When the CBCT came from ASO (Fully-Automated mode), each patient's folder now also receives:
    • the oriented scan, <scan>_Or.nii.gz;
    • ASO's <scan>_Or_transform.tfm (original scan to oriented one), for a reader who wants the meshes on the original scan instead.
  • The report names both files (oriented_cbct, cbct_transform).
  • A patient whose arches all failed gets no copy, and a missing file is a warning, not a failure.
  • Semi-Automated and Registration register onto the caller's own scan, so nothing is copied back in those modes.

Compatibility

The report's patient keys change from the digit key ("1") to the name ("P001"). Nothing in the server or the Slicer client reads those keys.

Tests

  • New tests for patient_name, for two keys that would share a name, and for Fully-Automated handing back the oriented CBCT and its transform, while Semi-Automated does not.
  • The existing tests now expect the named folders and report keys.
  • AREG_IOSCBCT: 217 passed.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 13:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Jules-GP
Jules-GP merged commit e077b5f into DCBIA-OrthoLab:main Oct 27, 2026
44 checks passed
@Jules-GP
Jules-GP deleted the fix/areg-ioscbct-patient-folder branch October 27, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants