nimare.meta.cbma.ale.ALESubtraction

class ALESubtraction(kernel_transformer=<class 'nimare.meta.kernel.ALEKernel'>, n_iters=5000, voxel_thresh=0.001, low_memory='auto', vfwe_only=True, restrict_to_inference_mask=False, memory=Memory(location=None), memory_level=0, n_cores=1, **kwargs)[source]

Bases: PairwiseCBMAEstimator

ALE subtraction analysis.

Changed in version 0.9.0:

  • New parameters: vfwe_only and voxel_thresh for montecarlo family wise error correction.

Changed in version 0.2.1:

  • New parameters: memory and memory_level for memory caching.

Changed in version 0.0.12:

  • Use memmapped array for null distribution and remove memory_limit parameter.

  • Support parallelization and add progress bar.

  • Add ALE-difference (stat) and -log10(p) (logp) maps to results.

  • Use a 4D sparse array for modeled activation maps.

Changed in version 0.0.8:

  • [FIX] Assume non-symmetric null distribution.

Changed in version 0.0.7:

  • [FIX] Assume a zero-centered and symmetric null distribution.

Parameters:
  • kernel_transformer (KernelTransformer, optional) – Kernel with which to convolve coordinates from dataset. Default is ALEKernel.

  • n_iters (int, default=5000) – Default is 5000.

  • voxel_thresh (float, default=0.001) – Uncorrected voxel-level p-value threshold used for cluster-defining threshold when cluster nulls are computed.

  • low_memory ({False, True, "auto"}, default="auto") – Best-effort strategy for reducing resident memory used by study-wise MA maps during permutations. When ALESubtraction generates MA maps from coordinates, low-memory mode builds each group’s CSR MA maps chunk by chunk and stores the chunks as disk-backed memmaps before permutation-based resampling. If “auto”, only activate this behavior when the projected combined MA-map footprint exceeds roughly half of the currently available system memory. Precomputed MA maps are used as provided and do not participate in this chunked path.

  • vfwe_only (bool, default=True) – If True, only compute voxel-level null information. If False, also compute and retain cluster size and mass null distributions from the permutation maps.

  • restrict_to_inference_mask (bool, default=False) – If True and directional inference maps are supplied to fit, restrict permutation inference to the union of nonzero inference-map voxels. Observed group and contrast summary-statistic maps are still reported across the full estimator mask.

  • memory (instance of joblib.Memory, str, or pathlib.Path) – Used to cache the output of a function. By default, no caching is done. If a str is given, it is the path to the caching directory.

  • memory_level (int, default=0) – Rough estimator of the amount of memory used by caching. Higher value means more memory for caching. Zero means no caching.

  • n_cores (int, default=1) –

    Number of processes to use for meta-analysis. If -1, use all available cores. Default is 1.

    Added in version 0.0.12.

  • **kwargs – Keyword arguments. Arguments for the kernel_transformer can be assigned here, with the prefix kernel__ in the variable name. Another optional argument is mask.

Variables:
  • masker (NiftiMasker or similar) – Masker object.

  • inputs (dict) – Inputs to the Estimator. For ALESubtraction, this includes edited coordinate DataFrames for both groups, stored under coordinates1 and coordinates2.

Notes

This method was originally developed in Laird et al.[1] and refined in Eickhoff et al.[2].

The ALE subtraction algorithm is also implemented as part of the GingerALE app provided by the BrainMap organization (https://www.brainmap.org/ale/).

The voxel-wise null distributions used by this Estimator are very large, so they are not retained as Estimator attributes. However, summary distributions (e.g., per-iteration maximum statistics for voxel-level FWE correction) are retained.

Warning

This implementation contains one key difference from the original version.

In the original version, group 1 > group 2 difference values are only evaluated for voxels significant in the group 1 meta-analysis, and group 2 > group 1 difference values are only evaluated for voxels significant in the group 2 meta-analysis.

In NiMARE’s implementation, the analysis is run in a two-sided manner for all voxels in the mask.

References

Methods

correct_fwe_montecarlo(result[, ...])

Perform FWE correction using the max-value permutation method.

fit(dataset1, dataset2[, drop_invalid, ...])

Fit Estimator to two collections.

get_params([deep])

Get parameters for this estimator.

load(filename[, compressed])

Load a pickled class instance from file.

save(filename[, compress])

Pickle the class instance to the provided file.

set_params(**params)

Set the parameters of this estimator.

correct_fwe_montecarlo(result, voxel_thresh=0.001, n_iters=None, n_cores=1, vfwe_only=False, target='pairwise')[source]

Perform FWE correction using the max-value permutation method.

fit(dataset1, dataset2, drop_invalid=True, ma_maps1=None, ma_maps2=None, inference_map1=None, inference_map2=None)[source]

Fit Estimator to two collections.

Parameters:
  • dataset1/dataset2 (Studyset or Dataset) – Collection objects to analyze.

  • ma_maps1/ma_maps2 (scipy sparse matrix or sparse array, optional) – Precomputed study-wise MA maps aligned to dataset1 and dataset2, respectively. When provided, the estimator will reuse these maps instead of recomputing them from coordinates. These are typically 2D study-by-masked-voxel sparse matrices.

  • inference_map1/inference_map2 (array_like or Niimg-like, optional) – Optional directional inference maps aligned to the common masked voxel space. Positive pairwise effects are only evaluated where inference_map1 > 0, and negative pairwise effects are only evaluated where inference_map2 > 0.

Returns:

  • MetaResult – Results of Estimator fitting.

  • .. warning:: – Support for Dataset inputs is deprecated and will be removed in a future release. Prefer Studyset.

  • The fit method is a light wrapper that runs input validation and

  • preprocessing before fitting the actual model. Estimators’ individual

  • ”fitting” methods are implemented as _fit, although users should

  • call fit.

get_params(deep=True)[source]

Get parameters for this estimator.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.

  • compressed (bool, default=True) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.

Returns:

obj – Loaded class object.

Return type:

class object

save(filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.

  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.

set_params(**params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Return type:

self