Skip to content

Conversation

@36000
Copy link
Collaborator

@36000 36000 commented Jan 28, 2026

  1. Better ROI seeding on WMGMI
  2. Minor bug fixes
  3. Allow "mixed" bundle definitions - some ROIs from subject space, some from template space for the same bundle.
  4. Much needed efficiency gains in bundle recognition by making more extensive use of the resampled tractogram in endpoint/startpoint filtering and length filtering

Copilot AI review requested due to automatic review settings January 28, 2026 01:35
@36000 36000 changed the title Reward bundles [WIP] Changes for reward bundles Jan 28, 2026
@36000 36000 added this to the pyAFQ 3.0 milestone Jan 28, 2026
Copy link
Contributor

Copilot AI left a comment

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 appears to add support for “reward bundles” by introducing new template assets and enabling more flexible ROI handling (including mixed-space ROI definitions and ROI dilation behavior used in recognition/tracking workflows).

Changes:

  • Add MassP template fetching/loading utilities and update bibliography references.
  • Extend BundleDict ROI handling to support mixed-space ROI specifications and update ROI transformation call sites to pass images (not affines).
  • Enhance RoiImage generation with optional ROI dilation and WM-only masking.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
docs/source/references.bib Adds two new literature references.
AFQ/tasks/utils.py Adjusts base filename generation to avoid unconditional trailing-char stripping.
AFQ/tasks/mapping.py Updates transform_rois call to pass the DWI image (aligning with new API).
AFQ/tasks/decorators.py Removes forced logger level configuration.
AFQ/recognition/utils.py Introduces shared tolerance_mm_to_vox utility.
AFQ/recognition/preprocess.py Refactors to delegate tolerance conversion to AFQ.recognition.utils.
AFQ/recognition/criteria.py Updates ROI transformation call to pass the image instead of the affine.
AFQ/nn/synthseg.py Updates label groupings used to derive PVE outputs.
AFQ/definitions/image.py Adds ROI dilation + WM-only masking options for ROI-derived images.
AFQ/data/fetch.py Adds MassP template fetcher/reader utilities.
AFQ/api/group.py Removes logger level forcing; docstring example was modified.
AFQ/api/bundle_dict.py Adds mixed-space ROI support and updates transformation helper signature to use an image object.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1127 to +1138
if isinstance(roi_or_sl, dict):
space = roi_or_sl.get("space", None)
roi_or_sl = roi_or_sl.get("roi", None)
if roi_or_sl is None or space is None:
raise ValueError(
(
f"Unclear ROI definition for {roi_or_sl}. "
"See 'Defining Custom Bundle Dictionaries' "
"in the documentation for details."
)
)
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

This introduces a new ROI definition format (dicts containing roi + space) and new error-paths for invalid definitions. There are existing BundleDict tests (e.g., AFQ/tests/test_bundle_dict.py), but none appear to cover this new format. Please add tests for: (1) valid space="template"|"subject" ROI dicts, (2) invalid/missing keys raising the intended ValueError, and (3) mixed-space bundles.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

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.

1 participant