-
Notifications
You must be signed in to change notification settings - Fork 58
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] Do not apply IBMA methods to voxels with zeros or NaNs #544
Conversation
It's not a map, it's a float.
Codecov Report
@@ Coverage Diff @@
## main #544 +/- ##
==========================================
+ Coverage 85.36% 85.43% +0.06%
==========================================
Files 39 39
Lines 4169 4189 +20
==========================================
+ Hits 3559 3579 +20
Misses 610 610
Continue to review full report at Codecov.
|
I don't have enough insight to the potential side effects, but let me provide this input: SPM & FSL (& I assume AFNI) work with a succession of masking requests and rules that, ultimately, produces an analysis mask. (For example, in SPM, you can specify an absolute or relative % threshold that every subject's data must satisfy to be included; you can provide an explict analysis mask; and any zero-variance voxels are removed from the analysis; it is the intersection of all these rules that produces the fina analysis mask). It seems to me this is simply an issue about at what stage the anlaysis mask is finalised. If you find the present implimentation creating funny surprises for the user, maybe the analysis mask creation should be moved to an earlier stage. |
Thanks @nicholst. I think these changes should operate similarly to the SPM approach then. I don't anticipate any issues, since the final mask should really be equivalent to the current implementation, with the small difference that voxels with zeros will be removed before going to PyMARE instead of after, but if there do end up being issues I can focus on consolidating the masking earlier in the process. |
if n_bad_voxels: | ||
LGR.warning( | ||
f"Masking out {n_bad_voxels} additional voxels. " | ||
"The updated masker is available in the Estimator.masker attribute." |
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.
This was a mistake. The masker is not updated directly.
Related to #542 and #274. The issue at hand is that PyMARE raises warnings when provided with arrays that are all zeros, while NiMARE's aggressive masking replaces any voxels with a zero in one or more studies with zeros across all studies. Our current goal is to eliminate that warning by only feeding PyMARE voxels with valid data.
Changes proposed in this pull request:
boolean_unmask
function to unmask result arrays from only including good voxels to including all voxels. Any bad voxels will have NaNs._fit
method.MetaEstimator._preprocess_input
, ends up being pretty far away from the masking, in the individual IBMA Estimator's_fit
. Additionally, we'd be modifyingEstimator.inputs_
within_fit
, which might be a little unclear to users.tau2
fromWeightLeastSquares
results. It is a float, not a map. This was an existing bug, but we never noticed because (1) we have no solution for Add shape check to MetaResult initialization #305 and (2) no one has cared enough abouttau2
to try to get the map for it from theMetaResult
, I guess.