♻️ refactoring anatomical_resampled bold masking#2215
Conversation
…space masking block
a8b3bdf to
9cca410
Compare
b378709 to
fbc6abf
Compare
| else: | ||
| automask = pe.Node(interface=afni.Automask(), name=f"automask_bold_{pipe_num}") | ||
| automask.inputs.dilate = 1 | ||
| automask.inputs.outputtype = "NIFTI_GZ" | ||
|
|
||
| node, out = strat_pool.get_data("desc-preproc_bold") | ||
| wf.connect(node, out, automask, "in_file") | ||
| wf.connect(automask, "out_file", gen_motion_stats, "inputspec.mask") |
There was a problem hiding this comment.
In this case, do we want to put automask.out_file in the resource pool as "space-bold_desc-brain_mask" or do we not care to keep it beyond this one connection?
There was a problem hiding this comment.
I am not sure about this one.
As far as I can tell, its not needed in the abcd-options pipeline as the bold is masked in template space.
I guess it won't hurt to push that into the resource pool anyway. I can check with @sgiavasis in the next meeting.
There was a problem hiding this comment.
I would lean towards no, but, actually-
Does HCP-ABCD do anything with the BOLD in native space? If so, how do they handle it?
If not - the answer is probably that they just do all of this in template space.
I recommend reviewing their pipeline choices first.
There was a problem hiding this comment.
What I'm getting at - it may be that we just need to make that jump to more flexible "native vs. template space" toggles for basically any single nodeblock that can interchangeably be done in any space.
The answer is probably "calculate motion stats in template space after masking in template space."
As always, my mandatory mention: the new engine could do this 😅
| }, | ||
| "template_space_func_masking": { | ||
| "run": bool1_1, | ||
| "using": [In({"Anatomical_Resampled"})], |
There was a problem hiding this comment.
Why even have using if there's only one option?
There was a problem hiding this comment.
This is an attempt to keep it open if we have another method in future, that we may add here.
But, I am open to just make it for "Anatomical_Resampled".
| template_space_func_masking: | ||
| run: Off | ||
| # Anatomical_Resampled: Resample anatomical brain mask in standard space to get BOLD brain mask in standard space. Adapted from DCAN Lab's BOLD mask method from the ABCD pipeline. ("Create fMRI resolution standard space files for T1w image, wmparc, and brain mask […] don't use FLIRT to do spline interpolation with -applyisoxfm for the 2mm and 1mm cases because it doesn't know the peculiarities of the MNI template FOVs") | ||
| using: [Anatomical_Resampled] | ||
|
|
||
| apply_func_mask_in_template_space: Off |
There was a problem hiding this comment.
I (think I) get "run" is generating the mask and "apply_func_mask_in_template_space" is applying the generated mask, but I think we could be clearer if we add some comments in the default and blank configs and/or naming the keys something like "generate" and "apply"
There was a problem hiding this comment.
I see what you menan. I think we could remove the switch apply_func_mask_in_template_space: Off, so that run will both generate and apply the mask. Its less confusing that way?
There was a problem hiding this comment.
If we don't want / care to allow for generating-but-not-applying, then yeah, I think just one switch makes sense. Otherwise, I just think
- it's not clear that
rungenerates but doesn't apply, and apply_func_mask_in_template_spaceis unnecessarily long.
But those are just my opinions. I think with some comments saying what the options do, these keys can work fine.
birajstha
left a comment
There was a problem hiding this comment.
Copilot changes
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2215 +/- ##
==========================================
- Coverage 28.2% 0 -28.2%
==========================================
Files 230 0 -230
Lines 25890 0 -25890
Branches 4069 0 -4069
==========================================
- Hits 7294 0 -7294
+ Misses 17969 0 -17969
+ Partials 627 0 -627 🚀 New features to boost your workflow:
|
Fixes
Fixes #2209 by @birajstha
Related to #2047 @sgiavasis
Description
This PR refactors the
bold_mask_anatomical_resamplednodeblock used in functional masking, aligning its functionality more closely with its original intent of producing template-space BOLD masks only, and removes its generalization for creating native-space masks, which was causing cropped mask outputs.Technical details
Anatomical_Resampled, including:Anatomical_Resampledfrom thefunc_maskingoptions in pipeline configs to avoid misuse.template_space_bold_maskingsection, whereAnatomical_Resampledis now the only available method tobetter reflect its usage in the ABCD pipeline.abcd_optionspreconfig to continue usingAnatomical_Resampledfor template-space masking only.Tests
Run CPAC with
abcd-optionspreconfig.Screenshots
After the fix

Checklist
Update index.md).developbranch of the repository.Developer Certificate of Origin
Developer Certificate of Origin