[BUG]: Mask "inherit" will be warped twice if working in native space. #284
No reviewers
Labels
No labels
CRITICAL
Stale
WIP
bug
concept
coordinate
dataset
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
maintenance
maps
marker
mask
on hold
parcellation
preprocess
question
ready
storage
template-space
triage
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
juaml/junifer!284
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/inherit-mask-single-warp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is there an existing issue for this?
Current Behavior
I'm running a pipeline in which we use warp data to native space. The second preprocessing step is doing confound removal, while using a GM mask. The markers have
mask="inherit", so the same GM mask is used. What I see in the log is that the mask is warped twice, so in the end, it does not fit the subject's images and many voxels are not considered as part of the GM.Expected Behavior
I expect the "inherited" mask not to be warped twice, since it's already warped in the preprocessing step.
Steps To Reproduce
inheritforfetch_icbm152_brain_gm_maskin the marker. Check the output, it should be the same.Environment
Relevant log output
Anything else?
Log at 17:00:40 shows the first warping
Log at 17:02:14 shows the second warping.
Error is here:
github.com/juaml/junifer@01055e80cc/junifer/data/masks.py (L337-L338)We are basically warping if the target data is in "native" space. We should be warping ONLY if the mask is not in the target data's space.
We also need to set the space here:
github.com/juaml/junifer@01055e80cc/junifer/preprocess/confounds/fmriprep_confound_remover.py (L577)Codecov Report
Attention:
1 linesin your changes are missing coverage. Please review.Additional details and impacted files
100.00% <ø> (ø)89.46% <90.00%> (+0.01%)Flags with carried forward coverage won't be shown. Click here to find out more.
98.78% <100.00%> (ø)83.33% <88.88%> (+0.59%)@ -323,3 +328,4 @@f"Masks are in different spaces: {unique_spaces}, ""unable to merge."),klass=RuntimeError,I do not follow here the logic. Why we do not consider "inherit" in "filtered spaces"? Indeed inherit should be replaced by the space of the "inherited" mask, no?
@ -323,3 +328,4 @@f"Masks are in different spaces: {unique_spaces}, ""unable to merge."),klass=RuntimeError,We need to check actual space and not "inherit" coz we get the unique ones by making a set out of the spaces and inherit doesn't make sense there. That's a fair point that the space of the inherited mask should be replaced, will take a look.
@ -323,3 +328,4 @@f"Masks are in different spaces: {unique_spaces}, ""unable to merge."),klass=RuntimeError,So I've updated the logic to check for correct target space and do away with "inherit".