REF: generalised anat references 2.0 - #477
Draft
eilidhmacnicol wants to merge 11 commits into
Draft
Conversation
mgxd
reviewed
May 7, 2025
mgxd
left a comment
Collaborator
There was a problem hiding this comment.
had a chance to jot down some thoughts - i like the overall direction, but we can take this moment to clean up the logic (which admittedly is a bit of a mess if derived from nibabies 😅 )
| 'data': subject_data[modality], | ||
| 'n': len(subject_data[modality]), | ||
| 'precomputed': f'{modality}_preproc' in precomputed, | ||
| 'role': 'reference' if modality.capitalize() == reference_anat else 'aux', |
Collaborator
There was a problem hiding this comment.
can this just be a bool, since if not we will treat as auxillary
Suggested change
| 'role': 'reference' if modality.capitalize() == reference_anat else 'aux', | |
| 'is_ref': modality.capitalize() == reference_anat, |
| anat_inputs = { | ||
| modality: { | ||
| 'data': subject_data[modality], | ||
| 'n': len(subject_data[modality]), |
Collaborator
There was a problem hiding this comment.
wdyt about
Suggested change
| 'n': len(subject_data[modality]), | |
| 'count': len(subject_data[modality]), |
| 'role': 'reference' if modality.capitalize() == reference_anat else 'aux', | ||
| } | ||
| for modality in ['t1w', 't2w', 'flair'] | ||
| if modality in subject_data.keys() |
Collaborator
There was a problem hiding this comment.
since i believe all keys are in subject_data, this will check if the list is not empty
Suggested change
| if modality in subject_data.keys() | |
| if subject_data.get(modality) |
| msm_sulc=False, | ||
| t1w=[str(bids_root / 'sub-01' / 'anat' / 'sub-01_T1w.nii.gz')], | ||
| t2w=[str(bids_root / 'sub-01' / 'anat' / 'sub-01_T2w.nii.gz')], | ||
| anat=collect_anat(collect_data(bids_root, '01')[0], {}, 'T1w'), |
Collaborator
There was a problem hiding this comment.
this is pretty noisy and has a lot going on for one line
Comment on lines
+137
to
+142
| anat_inputs[reference_anat.lower()].update( | ||
| { | ||
| f'have_{preproc}': f'{reference_anat.lower()}_{preproc}' in precomputed | ||
| for preproc in ['mask', 'tpms', 'dseg'] | ||
| } | ||
| ) |
Collaborator
There was a problem hiding this comment.
looking at this, i wonder if this precomputed parsing would be better suited for a separate function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After pushing #475 , @mgxd suggested to move the logic to its own workflow.
As a result, we have a new function,
collect_anatwhich will assign a modality as either 'reference' or 'aux'. At the moment, 'reference' is hard-coded to be T1w but this provides an opportunity for command line overrides or alternative pipelines for nirodents/nibabies