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
Use sparse array in ALE, ALESubtraction, SCALE, KDA, and MKDADensity #725
Conversation
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 noticed a couple of commented-out lines that will to be removed before this is merged. I had a few comments/suggestions as well. Thanks for this!
nimare/meta/cbma/ale.py
Outdated
masker = self.dataset.masker if not self.masker else self.masker | ||
mask = masker.mask_img | ||
mask_data = mask.get_fdata().astype(bool) | ||
n_mask_voxels = np.count_nonzero(mask_data) |
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'm not sure how well this generalizes to other masker types, but I've opened an issue requesting a new attribute for masker objects with this info: nilearn/nilearn#3296
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.
Having that attribute will be helpful. I think it may save us memory and computation time.
nimare/meta/utils.py
Outdated
def compute_ale_ma(shape, ijk, kernel): | ||
def compute_ale_ma(mask, ijks, exp_idx, sample_sizes, kernels, use_dict): |
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'd like to compare this to https://github.com/tsalo/NiMARE/blob/49191a0a4b10a2ac522828c9e558f279d5c6d6ea/nimare/meta/utils.py#L400-L438 before we merge.
Co-authored-by: Taylor Salo <tsalo006@fiu.edu>
Co-authored-by: Taylor Salo <tsalo006@fiu.edu>
Codecov Report
@@ Coverage Diff @@
## main #725 +/- ##
==========================================
+ Coverage 85.34% 85.83% +0.48%
==========================================
Files 41 41
Lines 4539 4646 +107
==========================================
+ Hits 3874 3988 +114
+ Misses 665 658 -7
Continue to review full report at Codecov.
|
Co-authored-by: Taylor Salo <tsalo006@fiu.edu>
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.
Looking great! I have a couple places where docstrings should likely be updated, and I'm testing locally to if some of the functions are ever called with np.array
since the switch to sparse arrays.
these lines no longer need to be in the code: NiMARE/nimare/tests/test_meta_ale.py Lines 48 to 53 in ac57801
since we have removed memory limit |
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 think the core changes are ready. There are just a few docstring changes that I think need to be made, as well as a small improvement to one of the CBMA tests (i.e., covering the new masker type check).
Co-authored-by: Taylor Salo <tsalo006@fiu.edu>
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.
Everything looks good to me, thanks!
Closes #692.
Changes proposed in this pull request:
compute_ale_ma
and return a 4D sparse array.ALEKernel._transform
andKernelTransformer.transform
.ma_maps
4D sparse array inALE
andCBMAEstimator
. This will involve adding support for sparse array inALE._compute_summarystat_est
,ALE._determine_histogram_bins
, andALE._compute_null_approximate
.