-
Notifications
You must be signed in to change notification settings - Fork 54
ENH: Numerical stability of EPI brain-masks using probabilistic prior #485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Numerical stability of EPI brain-masks using probabilistic prior #485
Conversation
|
Best reviewed: commit by commit
Optimal code review plan (2 warnings)
|
7ef66a2 to
e569fca
Compare
Codecov Report
@@ Coverage Diff @@
## master #485 +/- ##
==========================================
- Coverage 64.17% 59.38% -4.79%
==========================================
Files 43 42 -1
Lines 5290 5326 +36
Branches 770 774 +4
==========================================
- Hits 3395 3163 -232
- Misses 1750 2036 +286
+ Partials 145 127 -18
Continue to review full report at Codecov.
|
e569fca to
7cf097f
Compare
|
Waiting on #488 so that I can run some validation tests on TACC. |
effigies
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the argument. Two small comments.
mgxd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oesteban anything else you wanted to address here?
|
I haven't tested this yet on TACC on a larger scale but it should be ready to go. One little detail I might have overseen from @effigies comment is that the |
|
yup - would you have time to get that in today? I'm planning on cutting a new rc today |
|
okay, doing it right now |
5358c98 to
b038cb8
Compare
|
I'm finding it impossible to test this separately before merging. Should we just go ahead or keep waiting until I can do this (or someone else)? |
|
Do we have an fMRIPrep branch pinned against this to at least get one CI run we can look at artifacts? |
d4c8e26 to
4f38379
Compare
4db6a60 to
cbe4022
Compare
make sure that the new masks are uploaded to the artifacts
Co-Authored-By: Chris Markiewicz <[email protected]>
Taking advantage of the new auto-update. This commit also removes the requirements.txt file that was used exclusively by the Docker image distribution: pyntcloud now is in Pypi and we can safely pin templateflow to >=0.6.0 since the autoupdate was implemented.
cbe4022 to
66c37d4
Compare
d0bdb2b to
2af5e71
Compare
5c166e2 to
294a867
Compare
|
I think we can go ahead with this one - we probably will need to revise the brain mask down the line, but that's more of a TemplateFlow's problem. WDYT? |
|
@effigies @mgxd any issues with merging this one? Bottom line is: unless we want to spend more time in generating a really probabilistic brainmask of MNI152NLin2009cAsym, this will not improve (we can move things around a little playing with the threshold, that doesn't give a lot of search space). I think this is sufficient as is to address the problem, and setting the threshold at .85 or a bit higher seems to yield results very very close to those of the original binary mask. If at some point we embark in generating probabilistic masks, I would basically extract the brain mask for many OpenNeuro datasets with OASIS (default sMRIPrep), keep using sMRIPrep to calculate the normalization to MNI152NLin2009cAsym, and finally average the resulting masks after projection back to MNI152NLin2009cAsym. This probabilistic mask would be interesting for two reasons:
(point 2 would be of an extremely low priority and I don't even have any expectation that it will be ever done). |
| ---------- | ||
| brainmask_thresh: :obj:`float` | ||
| Lower threshold for the probabilistic brainmask to obtain | ||
| the final binary mask (default: 0.5). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting the threshold at .85 or a bit higher seems to yield results very very close to those of the original binary mask
shouldn't this be .85 by default then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem
|
On ds210, the mask is calculated on a pre-masked brain, and really doesn't match the boundary. It's hard to tell whether it would fit better if the underlying brain were unmasked. |
Maybe not the best issue tittle I have chosen: nipreps/fmriprep#2162 Because of that difficulty, I have opened the reportlet before (older than the ME-EPI PR that started to show masked brains) and after this PR and checked visually the contour. Except for minimal deviations, with 0.85 the contour is almost always matched. |
to easily test new code on those (e.g., nipreps/niworkflows#485 in this particular commit)
to easily test new code on those (e.g., nipreps/niworkflows#485 in this particular commit)
First release in the 1.3.x series. This release includes enhancements and bug-fixes towards the release of the first LTS version of fMRIPrep. PyBIDS has been revised to use more recent versions, a series of ANTs' interfaces have been deemed ready to upstream into Nipype, and several improvements regarding multi-echo EPI are included. With thanks to Basile Pinsard for contributions. * FIX: Patch ``ApplyTransforms`` spec to permit identity in a chain (#554) * FIX: Add dots to extensions in PyBIDS' config file (#548) * FIX: Segmentation plots aligned with cardinal axes (#544) * FIX: Skip T1w file existence check if ``anat_derivatives`` are provided (#545) * FIX: Avoid diverting CIFTI dtype from original BOLD (#532) * ENH: Add ``smooth`` input to ``RegridToZooms`` (#549) * ENH: Enable ``DerivativesDataSink`` to take multiple source files to derive entities (#547) * ENH: Allow ``bold_reference_wf`` to accept multiple EPIs/SBRefs (#408) * ENH: Numerical stability of EPI brain-masks using probabilistic prior (#485) * ENH: Add a pure-Python interface to resample to specific resolutions (#511) * MAINT: Finalize upstreaming of ANTs' interfaces to Nipype (#550) * MAINT: Update to Python +3.6 (#541)
1.3.0rc3 First release in the 1.3.x series. This release includes enhancements and bug-fixes towards the release of the first LTS version of fMRIPrep. PyBIDS has been revised to use more recent versions, a series of ANTs' interfaces have been deemed ready to upstream into Nipype, and several improvements regarding multi-echo EPI are included. With thanks to Basile Pinsard for contributions. * FIX: Patch ``ApplyTransforms`` spec to permit identity in a chain (nipreps#554) * FIX: Add dots to extensions in PyBIDS' config file (nipreps#548) * FIX: Segmentation plots aligned with cardinal axes (nipreps#544) * FIX: Skip T1w file existence check if ``anat_derivatives`` are provided (nipreps#545) * FIX: Avoid diverting CIFTI dtype from original BOLD (nipreps#532) * ENH: Add ``smooth`` input to ``RegridToZooms`` (nipreps#549) * ENH: Enable ``DerivativesDataSink`` to take multiple source files to derive entities (nipreps#547) * ENH: Allow ``bold_reference_wf`` to accept multiple EPIs/SBRefs (nipreps#408) * ENH: Numerical stability of EPI brain-masks using probabilistic prior (nipreps#485) * ENH: Add a pure-Python interface to resample to specific resolutions (nipreps#511) * MAINT: Finalize upstreaming of ANTs' interfaces to Nipype (nipreps#550) * MAINT: Update to Python +3.6 (nipreps#541)
1.3.0 First release in the 1.3.x series. This release includes enhancements and bug-fixes towards the release of the first LTS (*long-term support*) version of *fMRIPrep*. *PyBIDS* has been revised to use more recent versions, a series of ANTs' interfaces have been deemed ready to upstream into *Nipype*, and several improvements regarding multi-echo EPI are included. With thanks to Basile Pinsard for contributions. * FIX: Patch ``ApplyTransforms`` spec to permit identity in a chain (nipreps#554) * FIX: Add dots to extensions in PyBIDS' config file (nipreps#548) * FIX: Segmentation plots aligned with cardinal axes (nipreps#544) * FIX: Skip T1w file existence check if ``anat_derivatives`` are provided (nipreps#545) * FIX: Avoid diverting CIFTI dtype from original BOLD (nipreps#532) * ENH: Add ``smooth`` input to ``RegridToZooms`` (nipreps#549) * ENH: Enable ``DerivativesDataSink`` to take multiple source files to derive entities (nipreps#547) * ENH: Allow ``bold_reference_wf`` to accept multiple EPIs/SBRefs (nipreps#408) * ENH: Numerical stability of EPI brain-masks using probabilistic prior (nipreps#485) * ENH: Add a pure-Python interface to resample to specific resolutions (nipreps#511) * MAINT: Upstream all bug-fixes in the 1.2.9 release * MAINT: Finalize upstreaming of ANTs' interfaces to Nipype (nipreps#550) * MAINT: Update to Python +3.6 (nipreps#541)

Replaces the template's binary mask with a probabilistic map.
The workflow for EPI brain-extraction utilizes an atlas-based approach in its initialization. Before this PR, the template's mask is binary. The intention is to minimize numerical instability of edge voxels due to the resampling of the binary mask (i.e., when moving the atlas' brain mask on to the subject space). With this PR, the binarization occurs later and the risk of having a voxel whose value varies between runs (due to the minimal but existing variability introduced by the ants registration process) is much lower.
See #476