Skip to content

Use ACPC-space atlases to create MIF files - #400

Merged
tsalo merged 8 commits into
mainfrom
split-interface
Aug 18, 2026
Merged

tsalo merged 8 commits into
mainfrom
split-interface

Conversation

@tsalo

@tsalo tsalo commented Aug 16, 2026 •

Copy link
Copy Markdown
Member

Closes #303. Closes #399.

Changes proposed:

  • Split the WarpConnectivityAtlases interface into new init_warp_atlases_wf.
  • Delete WarpConnectivityAtlases, _resample_atlas, label_convert, ExtractAtlasFiles.
  • Add AtlasLUTs, which is the pure-Python LUT half of the old label_convert.

 - Deleted WarpConnectivityAtlases, _resample_atlas, label_convert, ExtractAtlasFiles (−242 lines net of the addition).
  - Added AtlasLUTs — the pure-Python LUT half of the old label_convert, unit-tested.
  - Drive-bys found while working there: SplitAtlasConfigs._run_interface was missing return runtime, and IFLOGGER was
  bound to 'nipype.interfaces', which isn't a valid nipype logger name and so evaluated to None. The second one surfaced
  because the new test exercised the warning path — every other module in interfaces/ uses 'nipype.interface'.

  qsirecon/workflows/recon/anatomical.py — four MapNodes as designed: conform_atlases → warp_atlases
  (ants.ApplyTransforms) and make_atlas_luts → convert_labels (nipype.interfaces.mrtrix3.LabelConvert, whose cmdline is
  byte-identical to the old subprocess call). Transforms now come from the template_to_acpc_xfm source node, matching
  odf_rois. The dead space/identity branch and the unconnected commands output are gone, and the two compute nodes now
  submit to the scheduler instead of running in the main process.

  Per your call, this stays behavior-preserving on #399: convert_labels.in_file is still the template-space atlas, with
  an XXX comment pointing at the issue. The fix is now a one-line connection change.
@tsalo tsalo added the refactor label Aug 16, 2026
@codecov-commenter

codecov-commenter commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.31%. Comparing base (38e5900) to head (7749611).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #400      +/-   ##
==========================================
- Coverage   50.47%   50.31%   -0.16%     
==========================================
  Files          55       55              
  Lines        8139     8107      -32     
  Branches      944      943       -1     
==========================================
- Hits         4108     4079      -29     
+ Misses       3792     3789       -3     
  Partials      239      239              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Pull request overview

This PR refactors atlas preparation in the reconstruction anatomical workflow by removing the monolithic WarpConnectivityAtlases interface and replacing it with smaller, clearer workflow nodes, while extracting LUT generation into a pure-Python AtlasLUTs interface.

Changes:

  • Replaces WarpConnectivityAtlases with explicit ConformAtlas → ants.ApplyTransforms → mrtrix3.LabelConvert nodes, and recombines outputs back into atlas_configs.
  • Adds AtlasLUTs interface to generate MRtrix label lookup tables from atlas TSVs.
  • Adds unit tests for AtlasLUTs and updates documentation references away from WarpConnectivityAtlases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
qsirecon/workflows/recon/scalar_mapping.py Updates docstring to reference the new atlas-preparation nodes in the anatomical workflow.
qsirecon/workflows/recon/anatomical.py Refactors atlas preparation into separate MapNodes (conform, warp, LUT creation, label conversion) and recombines datasinked outputs into configs.
qsirecon/tests/test_interfaces.py Adds unit tests covering AtlasLUTs outputs and 0-index handling.
qsirecon/interfaces/utils.py Removes the old atlas-warping/labelconvert utilities and introduces the AtlasLUTs interface.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread qsirecon/interfaces/utils.py
Comment thread qsirecon/workflows/recon/anatomical.py Outdated
Comment thread qsirecon/workflows/recon/anatomical.py Outdated
@tsalo

tsalo commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

I'm going to move the relevant nodes into a new workflow and write unit tests to verify #399 before fixing that.

@tsalo tsalo changed the title Split the WarpConnectivityAtlases interface Use ACPC-space atlases to create MIF files Aug 18, 2026
@tsalo tsalo added bug Something isn't working and removed refactor labels Aug 18, 2026
@tsalo
tsalo merged commit 1ce9de4 into main Aug 18, 2026
29 checks passed
@tsalo
tsalo deleted the split-interface branch August 18, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connectivity .mif parcellations are in template space, not DWI space Split WarpConnectivityAtlases into separate nodes

3 participants