Skip to content
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

add a notebook for comparison between CBMR and CBMA on neurosynth dataset #833

Closed
wants to merge 192 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
153584d
add cbmr.py file
yifan0330 Jun 16, 2022
59a3742
create a design matrix function for cbmr
yifan0330 Jun 18, 2022
3371a98
add test file for cbmr
yifan0330 Jun 18, 2022
8d2a151
modify pre-process and training function in cbmr
yifan0330 Jul 15, 2022
d014234
modify the dataset.anotations in cbmr
yifan0330 Jul 15, 2022
f741eeb
add documentation in utils functions
yifan0330 Jul 15, 2022
e326758
update model structure
yifan0330 Jul 16, 2022
85a6d11
update optimizer function
yifan0330 Jul 16, 2022
fe80124
[skip ci][wip] update loss function
yifan0330 Jul 17, 2022
3edaa74
update _fit function in CBMR
yifan0330 Jul 22, 2022
cadffa6
[wip][skip ci] allow other data types as pre-process inputs
yifan0330 Jul 27, 2022
c632d29
use a sparse array instead of numpy
yifan0330 Jul 28, 2022
a22048d
[skip ci][wip] allow for multiple-group cbmr
yifan0330 Jul 29, 2022
ab450fa
[skip ci][wip] fix conflict to merge
yifan0330 Jul 31, 2022
0f2a93a
solve conflicts
yifan0330 Jul 31, 2022
b3ee6f1
[skip CI][wip] modify settings in pre_process
yifan0330 Aug 1, 2022
0262c66
[skip ci][wip] implemented group-wise CBMR and fix problems
yifan0330 Aug 3, 2022
7fd47bc
[skip ci][wip] add results as inputs to MetaResults
yifan0330 Aug 5, 2022
b2b84a4
Merge branch 'main' of https://github.com/neurostuff/NiMARE into enha…
yifan0330 Aug 6, 2022
48d4b57
[skip ci][wip] modify standardization of group moderators
yifan0330 Aug 6, 2022
5e6107f
[skip ci][wip] implement NB regression
yifan0330 Aug 7, 2022
c686558
[skip ci][wip]remove vox2idx function and simplify the code
yifan0330 Aug 25, 2022
171d5a6
[skip ci][wip]develp CNB model
yifan0330 Aug 26, 2022
b786a3d
adjustment to Firth penalty
Sep 19, 2022
f7cc042
Merge branch 'main' of https://github.com/neurostuff/NiMARE into enha…
Sep 19, 2022
1a822d6
Merge branch 'main' of https://github.com/neurostuff/NiMARE into enha…
Sep 24, 2022
e051015
[skip CI][wip] implement index2voxel function
Sep 24, 2022
c38aa31
[skip CI][wip] add implementation for SE of regression coefficient
Sep 24, 2022
27a8c8e
[skip CI][WIP] implementing CBMRInference
Sep 29, 2022
c0da20d
[skip CI][wip] implement spatial homogeneity test
Sep 30, 2022
8be35d8
[skip ci][wip] implement CBMRInference group-wise comparison
Oct 7, 2022
8e73380
formalize GLH contrast variable
Oct 28, 2022
e6c1b92
[skip ci][wip] implemented Cov in GLH for all three models
Oct 30, 2022
988c5b4
[skip CI][wip] add a demonstration for CBMREstimator & CBMRInference
Nov 6, 2022
a746b9a
Merge branch 'main' of https://github.com/neurostuff/NiMARE into enha…
Nov 20, 2022
f4cd61e
[skip CI][wip] modify example files for demonstrating CBMR
Nov 20, 2022
024797d
add documentation to functions.
Dec 2, 2022
7c1b8ad
solve some issues suggested by flake8
Dec 9, 2022
9882c51
[skip CI][WIP] fix a bug in log-likelihood function of CNB model
Dec 21, 2022
b0a5e2d
Merge branch 'enhance_cbmr' of github.com:yifan0330/NiMARE into yifan…
jdkent Dec 21, 2022
5824abb
Merge pull request #3 from jdkent/yifan/enhance_cbmr
yifan0330 Dec 21, 2022
f70e6ac
[skip CI][WIP] Update code according to comments
Jan 10, 2023
d103ceb
[skip CI][WIP] solve conflicts in code
Jan 10, 2023
7de6b78
restructure code
jdkent Jan 10, 2023
1253adb
[skip CI][WIP] replace variable name and remove study_level_moderators
Jan 11, 2023
e00a621
[skip CI][WIP] changed variables names to be more intuitive.
Jan 12, 2023
bd88e32
reorganize model classes to be partially initialized
jdkent Jan 12, 2023
f64ad48
[skip CI][WIP] set some params as attribute of CBMREstimator Class.
Jan 12, 2023
c5dfec6
restruct inference code to models
Jan 13, 2023
7a65550
add some code for overdispersion model class.
Jan 13, 2023
6b51276
change model to use optimizer
jdkent Jan 13, 2023
320a712
change model names
jdkent Jan 13, 2023
ea0ad27
refactor the optimizer functions into the model class
Jan 15, 2023
b55433d
create a fit method for models
jdkent Jan 16, 2023
b525887
resolve conflicts
jdkent Jan 16, 2023
a62f26c
add summary to model fit
Jan 16, 2023
2ec109f
function name suggestions
jdkent Jan 17, 2023
2f9ad20
make square_root an attribute
jdkent Jan 17, 2023
6e3f425
allow categorical variables in CBMR
Jan 19, 2023
dac6287
fix a bug
Jan 19, 2023
e1c801f
new changes on inference class
Jan 20, 2023
404ff61
solve conflict
Jan 22, 2023
e580951
restruct code in CBMRInference
Jan 24, 2023
5b19e4d
add documentation foor create_contrast function
Jan 26, 2023
ea73c72
add new steps: remove duplicate rows in contrast matrix
Jan 26, 2023
9c2e7aa
modify documentation and comments
Jan 26, 2023
02bc3fa
change function name to snake case
Jan 27, 2023
050d470
restruct code and remove repetition
Jan 28, 2023
a761b07
reconstruct code, remove repeated code
Jan 29, 2023
06629b8
correct testing cases of z_to_p function
Feb 1, 2023
17bd65e
add regular expression code to CBMRInference
Feb 1, 2023
3eb6432
[skip CI][WIP] update example file based on reconstructed code
Feb 11, 2023
e842394
[skip CI][WIP] Tried standardized categorical covariates
Feb 11, 2023
a07d359
Raise deprecation warnings with Python 3.6 and 3.7 (#754)
JulioAPeraza Jan 11, 2023
c87b134
[MAINT] Fix various errors due to major version changes in dependenci…
jdkent Jan 12, 2023
12ff95b
Remove "dataset" `return_type` option from kernel transformers (#752)
JulioAPeraza Jan 13, 2023
252ab43
[skip ci] Update CHANGELOG
jdkent Jan 13, 2023
cb3b1ac
Support nibabel 5.0.0 (#762)
JulioAPeraza Jan 31, 2023
d8918f6
Do not zero out one-tailed z-statistics for p-values > 0.5 (#693)
JulioAPeraza Feb 1, 2023
7a70ed3
Link to NeuroStars software support category instead of neuro questio…
tsalo Feb 6, 2023
6a986b2
Revert "Do not zero out one-tailed z-statistics for p-values > 0.5" (…
JulioAPeraza Feb 6, 2023
ea43cec
create a design matrix function for cbmr
yifan0330 Jun 18, 2022
dac143f
[skip CI][WIP] solve conflicts
Feb 11, 2023
2f14d55
update model structure
yifan0330 Jul 16, 2022
9d02762
use a sparse array instead of numpy
yifan0330 Jul 28, 2022
514166f
[skip CI][WIP] solve conflict
Feb 11, 2023
8e237a1
solve conflicts.
Feb 11, 2023
5b4df2c
[skip ci][wip] modify standardization of group moderators
yifan0330 Aug 6, 2022
a4f67c0
[skip CI][wip] implement index2voxel function
Sep 24, 2022
b6d912b
[skip CI][wip] add implementation for SE of regression coefficient
Sep 24, 2022
01aab8b
[skip CI][wip] add a demonstration for CBMREstimator & CBMRInference
Nov 6, 2022
5f732ab
[skip CI][WIP] fix a bug in log-likelihood function of CNB model
Dec 21, 2022
f745b63
[skip CI][WIP] Update code according to comments
Jan 10, 2023
2f10a96
refactor the optimizer functions into the model class
Jan 15, 2023
59432d9
create a fit method for models
jdkent Jan 16, 2023
02c9c69
allow categorical variables in CBMR
Jan 19, 2023
116c8c2
restruct code in CBMRInference
Jan 24, 2023
1913f60
[skip CI][WIP] update example file based on reconstructed code
Feb 11, 2023
18bafd3
solve conflict
Feb 11, 2023
aa773d5
[skip CI][WIP] solve conflicts
Feb 12, 2023
8000f1c
solve conflicts
Feb 12, 2023
6390ce0
[skip CI][WIP] work on example file
Feb 17, 2023
b20dd74
[skip CI][WIP] complete example file for cbmr.
Feb 20, 2023
d82d485
[skip CI][WIP] implement an option to specify the reference subtype f…
Feb 25, 2023
c73bdbb
[skip CI][WIP] rewrite cbmr example in py file.
Feb 27, 2023
c0049e0
[skip CI][WIP] modify corrector class to be consistent with cbmr outputs
Mar 12, 2023
650cda4
[skip CI][WIP] add FDR/FWE correction methods to test
Mar 14, 2023
9904123
add testing cases with more coverage for CBMREstimator
Mar 19, 2023
f517b9f
[skip CI] [WIP] added new changes
Mar 20, 2023
e9f2cae
run black and isort
jdkent Mar 20, 2023
8efc82a
wip: working through refactor
jdkent Mar 24, 2023
15df47c
more refactor
jdkent Mar 24, 2023
2f68a02
merge with main
jdkent Mar 24, 2023
45004c7
remove debug info
jdkent Mar 24, 2023
88ecc31
fix errors
jdkent Mar 24, 2023
d90b73e
test firth penalty
jdkent Mar 26, 2023
5fd2402
black formating
jdkent Mar 26, 2023
addd0ba
more formatting
jdkent Mar 26, 2023
618a2ee
remove peaks2maps
jdkent Mar 26, 2023
d3d813f
remove redundant def
jdkent Mar 26, 2023
7d477d2
change documentation line
jdkent Mar 26, 2023
1fc008d
move patsy into function
jdkent Mar 26, 2023
448f376
add necessary installs
jdkent Mar 26, 2023
13b90f9
update example notebook with api
jdkent Mar 26, 2023
5ac3b0c
increase spacing and tolerance
jdkent Mar 26, 2023
2aa0906
fix estimator name
jdkent Mar 26, 2023
1645c40
sync utils with main
jdkent Mar 26, 2023
0b453f6
update to main on z_to_p test
jdkent Mar 26, 2023
f605cd1
remove conperm workflow
jdkent Mar 26, 2023
5446f44
remove whitespace
jdkent Mar 26, 2023
45f2ee6
fix some errors
jdkent Mar 26, 2023
30e34e2
make explicit where to document
jdkent Mar 26, 2023
f26282e
make StandardizeField a transformer
jdkent Mar 26, 2023
ba12a80
add functorch for python 3.6
jdkent Mar 27, 2023
38fb4e5
try to use older version of functorch
jdkent Mar 27, 2023
2307161
loosen restriction
jdkent Mar 27, 2023
d386573
fix bugs in cbmr example file
Apr 1, 2023
52f830b
[skip CI][WIP] fix bugs in testing function for cbmr_update
Apr 1, 2023
2b56139
add documentation for models.py
Apr 2, 2023
69f1b87
add documentation for cbmr.py
Apr 2, 2023
18ae03f
add documentation for utils.py
Apr 3, 2023
02db35c
add description for CBMREstimator
Apr 3, 2023
42e12cd
change lr to a smaller value
Apr 3, 2023
2643ecb
edit description function and add reference.
Apr 3, 2023
109897f
check if result.__description is a string.
Apr 3, 2023
1dd2299
resolve merge conflict
Apr 6, 2023
0f46781
set random seed
Apr 6, 2023
f4d4b49
simplify the log-likelihood function of NB model
Apr 7, 2023
383dc22
simplify the log-likelihood function of NB model
Apr 7, 2023
1171c30
implement wald test for CBMRInference
Apr 9, 2023
7529a6f
edit testing function for cbmr
Apr 9, 2023
0696e05
edit testing function for correctors
Apr 9, 2023
1f47e5f
fix linting error
Apr 10, 2023
5651c07
fix linting error
Apr 10, 2023
7be1632
fix linting error
Apr 10, 2023
395dae2
fixed linting error
Apr 10, 2023
c938ec3
fix linting error
Apr 10, 2023
931d2c1
fix linting error
Apr 10, 2023
73fe525
fix linting error
Apr 10, 2023
3745624
fix linting error
Apr 10, 2023
da7577b
fix linting error
Apr 10, 2023
6e79adc
fix linting error
Apr 10, 2023
2b8827a
remove unused test datasets
Apr 27, 2023
da2fbe2
fix linter error
Apr 27, 2023
c288695
add cbmr to docs/api.rst
Apr 27, 2023
cabdfce
edit example file for cbmr
Apr 27, 2023
e7bc4c1
remove the standardize_field function as it's replicated in the Stand…
Apr 29, 2023
ab751a5
use pass instead of return in the abstract methods
Apr 29, 2023
a95e116
added a test for StandardizeField class.
Apr 29, 2023
4705c47
edit example file of cbmr methods.
Apr 29, 2023
d48cd41
fix linter error.
Apr 29, 2023
677e6a5
fix a linter error.
Apr 29, 2023
d3487f5
fix a linter error
Apr 29, 2023
6a7b4c9
fix merge
jdkent May 3, 2023
93cff60
fix names of notebooks
jdkent May 3, 2023
4bbe51e
remove functorch (it was absorbed into torch)
jdkent May 3, 2023
8e34a5c
[skip ci] merge
jdkent May 3, 2023
b36ef7d
fix math mode and links in cbmr example.
May 18, 2023
5ab8a2b
fix math mode
May 18, 2023
c442bda
add a test with none moderator variable for CBMRInference
yifan0330 Jul 20, 2023
20e8908
add a separate test for moderators=None
yifan0330 Jul 20, 2023
e026add
merge from upstream, solve conflict
yifan0330 Aug 26, 2023
3730e4b
Replace functorch.hessian by torch.func.hessian to remove pytorch war…
yifan0330 Aug 26, 2023
0dbe8e9
Merge branch 'fix_cbmr' of https://github.com/yifan0330/NiMARE into f…
yifan0330 Aug 26, 2023
668311e
solve lint error
yifan0330 Aug 26, 2023
9e34484
fix a bug with L-BFGS algorithm and speed up the execution time
yifan0330 Sep 2, 2023
b3fb1e2
Merge branch 'main' of https://github.com/neurostuff/NiMARE into fix_…
yifan0330 Sep 2, 2023
c68866e
fix lint code error
yifan0330 Sep 2, 2023
2531c19
fix a lint error
yifan0330 Sep 2, 2023
ff5bdc3
add a notebook for comparing cbmr and cbma
yifan0330 Sep 9, 2023
2f4a33f
fix documentation error in notebook
yifan0330 Sep 10, 2023
1df7789
try not to run this notebook due to memory consideration
yifan0330 Sep 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 226 additions & 0 deletions examples/02_meta-analyses/12_compare_cbmr_and_cbma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
"""

.. _metas_cbmr_vs_cbma:

================================================================
Compare coordinate-based meta-regression and meta-analysis methods
================================================================

A comparison between coordinate-based meta-regression (CBMR) and
coordinate-based meta-analysis (CBMA) in NiMARE

CBMR is a generative framework to approximate smooth activation intensity function and investigate
the effect of study-level moderators (e.g., year of pubilication, sample size, subtype of stimuli).
It allows flexible statistical inference for either spatial homogeneity tests or group comparison
tests. Additionally, it's a computationally efficient approach with good statistical
interpretability to model the locations of activation foci.

This tutorial is intended to provide an intuitive comparison of CBMA and MKDA results on
neurosynth dataset.

For more detailed introduction to CBMR implementation in NiMARE, see the `CBMR tutoral
<https://nimare.readthedocs.io/en/latest/auto_examples/02_meta-analyses/11_plot_cbmr.html>`_ and
`documatation <https://nimare.readthedocs.io/en/latest/generated/nimare.meta.cbmr.html>`_.

"""
import os

from nimare.extract import download_abstracts, fetch_neurosynth
from nimare.io import convert_neurosynth_to_dataset
from nimare.meta import models
from nilearn.plotting import plot_stat_map

###############################################################################
# Download the Neurosynth Dataset
# -----------------------------------------------------------------------------
# Neurosynth is a large-scale functional magnetic resonance imaing (fMRI) database.
# There are currently 507891 activations reported in 14371 studies in the Neurosynth
# database, with interactive, downloadable meta-analyses of 1334 terms. There is also
# a `platform <https://neurosynth.org/>`_ designed for automated synthesis of fMRI data.

out_dir = os.path.abspath("../example_data/")
os.makedirs(out_dir, exist_ok=True)

files = fetch_neurosynth(
data_dir=out_dir,
version="7",
overwrite=False,
source="abstract",
vocab="terms",
)
# Note that the files are saved to a new folder within "out_dir" named "neurosynth".
neurosynth_db = files[0]

neurosynth_dset = convert_neurosynth_to_dataset(
coordinates_file=neurosynth_db["coordinates"],
metadata_file=neurosynth_db["metadata"],
annotations_files=neurosynth_db["features"],
)
neurosynth_dset.save(os.path.join(out_dir, "neurosynth_dataset.pkl.gz"))

neurosynth_dset = download_abstracts(neurosynth_dset, "[email protected]")
neurosynth_dset.save(os.path.join(out_dir, "neurosynth_dataset_with_abstracts.pkl.gz"))

###############################################################################
# For term-based meta-analyses, we split the whole Neurosynth dataset into two subsets,
# one including all studies in the Neurosynth database whose abstracts include the term
# at least once, the other including all the remaining studies. Here, we will conduct
# meta-analyses based on the term "pain", and explore the spatial convergence between
# pain studies and other fMRI studies.

# extract study_id for pain dataset and non-pain dataset
all_study_id = neurosynth_dset.annotations["id"]
pain_study_id = neurosynth_dset.get_studies_by_label(labels=["terms_abstract_tfidf__pain"])
non_pain_study_id = list(set(list(all_study_id)) - set(pain_study_id)) # 13855 studies
# add an additional column for group
neurosynth_dset.annotations.loc[all_study_id.isin(pain_study_id), "group"] = "pain"
neurosynth_dset.annotations.loc[all_study_id.isin(non_pain_study_id), "group"] = "non_pain"

###############################################################################
# Estimation of group-specific spatial intensity functions
# -----------------------------------------------------------------------------
# Now we are going to run CBMR framework on the Neurosynth Dataset and estimate
# spatial intensity functions for both pain studies and non-pain fMRI studies.

from nimare.meta.cbmr import CBMREstimator
cbmr = CBMREstimator(
group_categories="group",
moderators=None,
spline_spacing=10, # a reasonable choice is 10 or 5, 100 is for speed
model=models.PoissonEstimator,
penalty=False,
lr=1e-1,
tol=1e-2, # a reasonable choice is 1e-2, 1e3 is for speed
device="cpu", # "cuda" if you have GPU
)
results = cbmr.fit(dataset=neurosynth_dset)

###############################################################################
# Now that we have fitted the model, we can plot the spatial intensity maps.

plot_stat_map(
results.get_map("spatialIntensity_group-Pain"),
cut_coords=[0, 0, -8],
draw_cross=False,
cmap="RdBu_r",
title="Pain studies",
threshold=3e-4,
vmax=1e-3,
)
plot_stat_map(
results.get_map("spatialIntensity_group-Non_pain"),
cut_coords=[0, 0, -8],
draw_cross=False,
cmap="RdBu_r",
title="Non-pain fMRI studies",
threshold=3e-4,
vmax=1e-3,
)

###############################################################################
# These two figures correspond to group-specific spatial intensity map of pain group
# and non-pain group. Areas with stronger spatial intensity are highlighted.

###############################################################################
# Group-wise tests for spatial homogeneity
# -----------------------------------------------------------------------------
# For group-wise spatial homogeneity test, we generate contrast matrix *t_con_groups*
# by specifying the group names in *create_contrast* function, and generate group-wise
# p-value and z-score maps for spatial homogeneity tests.
from nimare.meta.cbmr import CBMRInference

inference = CBMRInference(device="cpu")
inference.fit(result=results)
t_con_groups = inference.create_contrast(
["Pain", "Non_pain"], source="groups"
)
contrast_result = inference.transform(t_con_groups=t_con_groups)

###############################################################################

# generate z-score maps for group-wise spatial homogeneity test.
plot_stat_map(
contrast_result.get_map("z_group-Pain"),
cut_coords=[0, 0, -8],
draw_cross=False,
cmap="RdBu_r",
title="Z-score map for spatial homogeneity test on pain studies",
threshold=20,
vmax=30,
)

plot_stat_map(
contrast_result.get_map("z_group-Non_pain"),
cut_coords=[0, 0, -8],
draw_cross=False,
cmap="RdBu_r",
title="Z-score map for spatial homogeneity test on non-pain fMRI studies",
threshold=20,
vmax=30,
)

###############################################################################
# Group comparison test between pain studies and non-pain fMRI studies
# -----------------------------------------------------------------------------
# CBMR framework also allows flexible statistical inference for group comparison
# between any two or more groups. For example, it's straightforward to generate
# contrast matrix *t_con_groups* by specifying *contrast_name* as "group1-group2".

inference = CBMRInference(device="cpu")
inference.fit(result=results)
t_con_groups = inference.create_contrast(
["Pain-Non_pain"], source="groups"
)
contrast_result = inference.transform(t_con_groups=t_con_groups)

###############################################################################

# generate z-statistics maps for each group
plot_stat_map(
contrast_result.get_map("z_group-Pain-Non_pain"),
cut_coords=[0, 0, 0],
draw_cross=False,
cmap="RdBu_r",
title="Spatial convergence between pain studies and Non-pain fMRI studies",
threshold=6,
vmax=20,
)

###############################################################################
# This figure (displayed as z-statistics map) shows CBMR group comparison test
# of spatial intensity between pain studies and non-pain studies in Neurosynth.
# The null hypothesis assumes spatial intensity estimations of two groups are equal
# at voxel level, $H_0: \mu_{1j}=\mu_{2j}, j=1,\cdots,N$, where $N$ is number of
# voxels within brain mask, $j$ is the index of voxel. Areas with significant p-vaules
# (siginificant difference in spatial intensity estimation between two groups) are
# highlighted. We found that estimated activation level are significantly different
# in ... between pain group and non-pain group.

###############################################################################
# Run MKDA on Neurosynth dataset
# -----------------------------------------------------------------------------
# For the purpose of justifying the validity of CBMR framework, we compare the estimated
# spatial covergence of activation regions between pain studies and non-pain fMRI studies
# with MKDA.

from nimare.meta.cbma.mkda import MKDAChi2

pain_dset = neurosynth_dset.slice(ids=pain_study_id)
non_pain_dset = neurosynth_dset.slice(ids=pain_study_id)

meta = MKDAChi2()
results = meta.fit(pain_dset, non_pain_dset)

plot_stat_map(
results.get_map("z_desc-consistency"),
cut_coords=[0, 0, -8],
draw_cross=False,
cmap="RdBu_r",
title="MKDA Chi-square analysis between pain studies and non-pain studies",
threshold=5,
)

###############################################################################
# This figure (displayed as z-statistics map) shows MKDA spatial covergence of
# activation between pain studies and non-pain fMRI studies. We found the results are
# very consistent with CBMR approach, with higher specificity but lower sensitivity.
8 changes: 4 additions & 4 deletions nimare/meta/cbmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def __init__(
spline_spacing=10,
model=models.PoissonEstimator,
penalty=False,
n_iter=1000,
lr=1e-2,
n_iter=2000,
lr=1,
lr_decay=0.999,
tol=1e-2,
tol=1e-9,
device="cpu",
**kwargs,
):
Expand Down Expand Up @@ -359,7 +359,7 @@ def _preprocess_input(self, dataset):
n_group_study = len(group_study_id)
group_foci_per_study = np.array(
[(group_coordinates["study_id"] == i).sum() for i in group_study_id]
)
) # try groupby
group_foci_per_study = group_foci_per_study.reshape((n_group_study, 1))

foci_per_voxel[group] = group_foci_per_voxel
Expand Down
Loading
Loading