BrainData¶
BrainData(data = None, *, Y = None, X = None, mask = None, masker = None, h5_compression = 'gzip', verbose = False, resample = True, interpolation = 'auto')Represent neuroimaging data as vectors instead of three-dimensional matrices.
This representation makes it easier to perform data manipulation and analyses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | Neuroimaging data. Can be: - None (empty BrainData) - BrainData object - List of BrainData objects or file paths - File path (str/Path) to .nii/.nii.gz/.h5/.hdf5 - nibabel Nifti1Image object - URL to download data from - numpy array (1D (n_voxels,) for a single image or 2D (n_images, n_voxels) for a stack). The mask argument is required and must define the same number of in-mask voxels. | None | |
mask | Brain mask. Can be None (uses MNI template), a nibabel Nifti1Image, a file path (str/Path) to a mask file, or a template name string like '2mm-MNI152-2009c' (version: ‘fsl’ for default/, ‘a’ for nilearn/, ‘c’ for fmriprep/). | None | |
masker | nilearn masker object (e.g. ROI or searchlight extractor). Default will load data as voxels. | None | |
Y | Optional per-image target/label values, stored as a polars DataFrame (.Y). Default None. If data is a BrainData with a .Y, that value is inherited when this is None. | None | |
X | Optional per-image design/feature values, stored as a polars DataFrame (.X). Default None. If data is a BrainData with an .X, that value is inherited when this is None. | None | |
h5_compression | str, default=‘gzip’ | Compression filter used when writing HDF5 (.h5/.hdf5) output. | ‘gzip’ |
verbose | bool, default=False | Emit informational messages during loading and other operations. | False |
resample | bool, default=True | Whether to automatically resample data to mask space. If True, data is resampled to match mask spatial characteristics. If False, data must already be in mask space. Default True preserves backward compatibility with v0.5.1. | True |
interpolation | str, default=‘auto’ | Interpolation method for resampling. Options: ‘auto’ (detect based on data type; uses ‘nearest’ for discrete data like atlases/masks and ‘continuous’ for stat maps), ‘nearest’ (nearest-neighbor, preserves discrete values), ‘linear’ (linear interpolation), ‘continuous’ (higher-order spline, use for stat maps). | ‘auto’ |
Attributes:
| Name | Type | Description |
|---|---|---|
X | Design matrix / per-image covariates as a polars DataFrame. | |
Y | Per-image targets as a polars DataFrame. | |
data | ||
design_matrix | ||
dtype | Get data type of BrainData.data. | |
is_empty | bool | Check if BrainData.data is empty. |
masker | ||
shape | Get images by voxels shape. | |
size | Total number of elements in BrainData.data (numpy convention). | |
verbose |
Methods:
| Name | Description |
|---|---|
align | Align BrainData instance to target object using functional alignment. |
append | Append data to BrainData instance. |
apply_mask | Mask BrainData instance using nilearn functionality. |
astype | Cast BrainData.data as type. |
bootstrap | Bootstrap statistics using efficient online algorithms. |
cluster_report | Generate a cluster report with anatomical labels. |
compute_contrasts | Compute contrasts from fitted GLM results. |
copy | Create a copy of a BrainData instance (data deep-copied). |
create_empty | Create a copy of BrainData with empty data array. |
decompose | Decompose BrainData object. |
detrend | Remove linear trend from each voxel. |
distance | Calculate distance between images within a BrainData() instance. |
extract_roi | Extract activity from mask or ROI atlas using NiftiLabelsMasker. |
filter | Apply a Butterworth filter to data (wraps nilearn.signal.clean). |
find_spikes | Identify spikes from Time Series Data. |
fit | Fit a model to brain imaging data. |
iplot | Interactive WebGL brain viewer powered by niivue. |
mean | Get mean of each voxel or image. |
median | Get median of each voxel or image. |
multivariate_similarity | Predict a BrainData spatial distribution from a linear combination. |
plot | Plot BrainData instance using nilearn visualization or matplotlib. |
plot_flatmap | Plot brain data on cortical flatmap. |
plot_surf | Render this BrainData on fsaverage surfaces as a tight 2×2 montage. |
predict | Predict voxel timeseries (encoding) or decode labels (MVPA). |
r_to_z | Apply Fisher’s r-to-z transformation to each data element. |
regions | Extract brain connected regions into separate regions. |
report | Generate a nilearn HTML report for a fitted GLM. |
resample_to | Resample BrainData to match target image or resolution. |
scale | Scale data via mean scaling. |
similarity | Calculate similarity to a single BrainData or nibabel image. |
smooth | Apply spatial smoothing using nilearn smooth_img(). |
standardize | Standardize BrainData() instance. |
std | Get standard deviation of each voxel or image. |
sum | Get sum of each voxel or image. |
temporal_resample | Resample BrainData timeseries to a new target frequency or number of samples. |
threshold | Threshold BrainData instance with optional cluster filtering. |
to_nifti | Convert BrainData Instance into Nifti Object. |
transform_pairwise | Transform data into pairwise comparisons. |
ttest | One-sample voxelwise t-test across images (axis 0). |
ttest2 | Two-sample voxelwise t-test between two BrainData stacks. |
upload_neurovault | Upload BrainData images and metadata to NeuroVault. |
write | Write out BrainData object to Nifti or HDF5 File. |
z_to_r | Convert z score back into r value for each element of data object. |
Methods¶
align¶
align(target, method = 'procrustes', axis = 0, *, spatial_scale: str = 'whole_brain', roi_mask: str = None, radius_mm: float = 10.0)Align BrainData instance to target object using functional alignment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target | (BrainData) object to align to. | required | |
method | (str) alignment method to use [‘probabilistic_srm’,‘deterministic_srm’,‘procrustes’] | ‘procrustes’ | |
axis | (int) axis to align on | 0 | |
spatial_scale | str | 'whole_brain' (default), 'roi', or 'searchlight'. 'roi' is supported (per-parcel transforms + reassembly, requires roi_mask). 'searchlight' is not yet implemented (overlapping spheres have no canonical per-voxel transform). | ‘whole_brain’ |
roi_mask | Atlas image used when spatial_scale='roi'. | None | |
radius_mm | float | Reserved for spatial_scale='searchlight'. | 10.0 |
Returns:
| Name | Type | Description |
|---|---|---|
out | (dict) a dictionary containing transformed object, transformation matrix, and the shared response matrix |
Examples:
>>> out = data.align(target, method='procrustes')
>>> out = data.align(target, method='probabilistic_srm')append¶
append(data, ignore_attrs = False, **kwargs)Append data to BrainData instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | BrainData instance to append. | required | |
ignore_attrs | (bool) If True, skip concatenation of X and Y attributes. Useful when appending images where .X or .Y have different column counts. Default False. | False | |
kwargs | Currently ignored. X/Y are concatenated with polars’ pl.concat(..., how="vertical_relaxed"), which takes no caller-supplied options. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | New appended BrainData instance. |
apply_mask¶
apply_mask(mask, resample_mask_to_brain = False)Mask BrainData instance using nilearn functionality.
Note target data will be resampled into the same space as the mask. If you would like the mask resampled into the BrainData space, then set resample_mask_to_brain=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask | (BrainData or nifti object) mask to apply to BrainData object. | required | |
resample_mask_to_brain | (bool) Will resample mask to brain space before applying mask (default=False). | False |
Returns:
| Name | Type | Description |
|---|---|---|
masked | (BrainData) masked BrainData object |
astype¶
astype(dtype)Cast BrainData.data as type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtype | datatype to convert | required |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | BrainData instance with new datatype |
bootstrap¶
bootstrap(stat, *, n_samples = 5000, save_boots = False, percentiles = (2.5, 97.5), X_test = None, device = 'cpu', max_gpu_memory_gb = None, tail = 2, n_jobs = -1, random_state = None, progress_bar: bool = False)Bootstrap statistics using efficient online algorithms.
Uses memory-efficient bootstrap infrastructure with CPU parallelization or GPU acceleration. Supports simple aggregation statistics and fitted model statistics (Ridge).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stat | (str) Statistic to bootstrap. Options: Simple stats (‘mean’, ‘median’, ‘std’, ‘sum’, ‘min’, ‘max’) or Model stats (‘weights’ requires fitted Ridge model, ‘predict’ requires fitted Ridge model + X_test). | required | |
n_samples | (int) Number of bootstrap iterations. Default: 5000 | 5000 | |
save_boots | (bool) If True, store all bootstrap samples. Default: False | False | |
percentiles | (tuple) Percentiles for confidence intervals. Default: (2.5, 97.5) | (2.5, 97.5) | |
X_test | (np.ndarray, optional) Test features for ‘predict’ bootstrap. | None | |
device | (str) Compute device for Ridge bootstrap: ‘cpu’ (default), ‘gpu’ (PyTorch on CUDA/MPS if available), or ‘auto’ (GPU if present, else CPU). Ignored for simple stats. Default: ‘cpu’ | ‘cpu’ | |
max_gpu_memory_gb | (float, optional) Explicit GPU memory budget in GB when device is ‘gpu’ or ‘auto’. None (default) measures the device. | None | |
n_jobs | (int) Number of CPU cores for parallelization. -1 means all CPUs. | -1 | |
random_state | (int, optional) Random seed for reproducibility | None | |
progress_bar | bool | (bool) If True, show a progress bar. Default: False | False |
Returns:
| Type | Description |
|---|---|
BrainData or dict: - For simple stats: Returns BrainData with bootstrap mean - For model stats: Returns dict with keys: ‘mean’, ‘std’, ‘Z’, ‘p’, ‘ci_lower’, ‘ci_upper’ (all BrainData objects) - If save_boots=True: Returns dict with ‘samples’ key containing all samples |
Examples:
>>> boot = brain.bootstrap(stat='mean', n_samples=1000)
>>> brain.fit(X=dm, model='ridge', alpha=1.0)
>>> boot = brain.bootstrap(stat='weights', n_samples=1000)cluster_report¶
cluster_report(*, stat_threshold: float | None = 3.0, cluster_threshold: int = 10, two_sided: bool = True, min_distance: float = 8.0, atlas: str | Sequence[str] | None = None, prob_threshold: float = 5.0) -> ClusterReportGenerate a cluster report with anatomical labels.
Identifies surviving clusters in the stat map (after voxel + extent thresholding), reports peak coordinates and sub-peaks, and labels each peak/cluster against one or more atlases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stat_threshold | float | None | Voxel-level threshold (e.g. z- or t-cutoff). None treats self as already thresholded. | 3.0 |
cluster_threshold | int | Minimum cluster size in voxels. | 10 |
two_sided | bool | Report negative clusters separately. | True |
min_distance | float | Minimum mm between sub-peaks within a cluster. | 8.0 |
atlas | str | Sequence [ str ] | None | Atlas name or list of names (see list_atlases). Defaults to ("harvard_oxford", "aal", "schaefer_200"). | None |
prob_threshold | float | Drop probabilistic-atlas regions below this %. | 5.0 |
Returns:
| Type | Description |
|---|---|
ClusterReport | ClusterReport with peaks, |
ClusterReport | clusters (polars DataFrames), and stat_img (BrainData). |
compute_contrasts¶
compute_contrasts(contrasts, statistic = 't')Compute contrasts from fitted GLM results.
This method computes contrasts as linear combinations of the GLM beta coefficients. Must be called after .fit(model=‘glm’, X=design_matrix) has been run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contrasts | Can be: - str: A string specifying the contrast using column names e.g., “conditionA - conditionB” or “2*conditionA - conditionB - conditionC” - dict: Dictionary with contrast names as keys and contrast strings/vectors as values e.g., {“main_effect”: “conditionA - conditionB”, “interaction”: [1, -1, -1, 1]} - array: Numeric contrast vector matching the number of regressors e.g., [1, -1, 0, 0] for a 4-regressor model | required | |
statistic | str | Which statistic to return per contrast. One of "t" (default, t-statistic map), "z" (z-score), "p" (p-value), "beta" / "effect_size" (effect-size β map — use this when feeding a second-level group analysis), or "all" (a bundle dict {"beta", "t", "z", "p", "se"} of maps for one contrast). Default: "t". | ‘t’ |
Returns:
| Type | Description |
|---|---|
BrainData or dict: A single contrast with a scalar statistic returns a BrainData map; with statistic="all" it returns a flat dict keyed by "beta"/"t"/"z"/"p"/"se". A dict of contrasts returns a dict keyed by contrast name (nested under the five keys when statistic="all"). |
Examples:
>>> brain.fit(model='glm', X=design_matrix)
>>> contrast1 = brain.compute_contrasts([0, 1, -1])
>>> contrast2 = brain.compute_contrasts("conditionA - conditionB")
>>> results = brain.compute_contrasts({
... "A_vs_B": "conditionA - conditionB",
... "avg_effect": [0, 0.5, 0.5],
... })Note
String contrasts support coefficients: “2A - B" or "0.5A + 0.5*B”
Column names must match design matrix columns exactly (case-sensitive)
Contrast weights should sum to zero for proper inference in most cases
copy¶
copy()Create a copy of a BrainData instance (data deep-copied).
The data array and most attributes are deep-copied, so mutating the
copy’s data leaves the original untouched. Fitted state is shared, not
copied: model_, X_, every glm_*/ridge_* result, and mask/
masker are held by reference (this avoids pickling unpicklable Backend
objects — see __deepcopy__). Mutating those on the copy mutates the
original; refit the copy if you need independent fit results.
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | A copy with independent data but shared fitted state. |
create_empty¶
create_empty()Create a copy of BrainData with empty data array.
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | A copy of this object with an empty data array. |
decompose¶
decompose(*, method = 'pca', axis = 'voxels', n_components = None, **kwargs)Decompose BrainData object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | (str) Algorithm to perform decomposition types=[‘pca’,‘ica’,‘nnmf’,‘fa’,‘dictionary’,‘kernelpca’] | ‘pca’ | |
axis | dimension to decompose [‘voxels’,‘images’] | ‘voxels’ | |
n_components | (int) number of components. If None then retain as many as possible. | None | |
**kwargs | forwarded to the underlying sklearn decomposition estimator. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
output | a dictionary of decomposition parameters |
detrend¶
detrend(method = 'linear')Remove linear trend from each voxel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | (‘linear’,‘constant’, optional) type of detrending | ‘linear’ |
Returns:
| Name | Type | Description |
|---|---|---|
out | (BrainData) detrended BrainData instance |
distance¶
distance(metric = 'euclidean', *, spatial_scale: str = 'whole_brain', roi_mask: str = None, radius_mm: float = 10.0, **kwargs: float)Calculate distance between images within a BrainData() instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric | (str) type of distance metric (can use any scipy.spatial.distance metric supported by cdist) | ‘euclidean’ | |
**kwargs | Additional metric options forwarded to scipy.spatial.distance.cdist (e.g. p for minkowski). | {} | |
spatial_scale | str | One of 'whole_brain' (default), 'roi', or 'searchlight'. 'whole_brain' returns a single pairwise distance Adjacency between images. 'roi' requires roi_mask and returns a stacked Adjacency with one RDM per parcel and spatial_scale provenance attached for back-projection via Adjacency.to_brain(). 'searchlight' requires radius_mm (and is not yet implemented in this slice). | ‘whole_brain’ |
roi_mask | Atlas image (BrainData / Nifti1Image / path) for spatial_scale='roi'. | None | |
radius_mm | float | Searchlight radius in mm. Default 10.0. | 10.0 |
Returns:
| Name | Type | Description |
|---|---|---|
Adjacency | Single pairwise distance matrix for 'whole_brain'; stacked Adjacency (one matrix per parcel/searchlight) with spatial_scale set for 'roi' / 'searchlight'. |
extract_roi¶
extract_roi(mask, method = 'mean', n_components = None)Extract activity from mask or ROI atlas using NiftiLabelsMasker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask | BrainData, nibabel image, or file path. Can be: - Binary mask (extracts from single ROI) - Labeled atlas (extracts from multiple ROIs) | required | |
method | Extraction method (‘mean’, ‘median’, ‘pca’). Default: ‘mean’ | ‘mean’ | |
n_components | If method=‘pca’, number of components to return | None |
Returns:
| Type | Description |
|---|---|
| For binary mask: scalar or 1D array. | |
| For labeled atlas: 1D or 2D array, or PCA components. |
Examples:
>>> roi_values = brain.extract_roi(binary_mask)
>>> atlas_values = brain.extract_roi(atlas_mask)
>>> components = brain.extract_roi(mask, method='pca', n_components=5)filter¶
filter(*, sampling_freq = None, high_pass = None, low_pass = None, **kwargs)Apply a Butterworth filter to data (wraps nilearn.signal.clean).
Note
Unlike nilearn’s default, does not detrend or standardize. Pass detrend=True or standardize=True via kwargs to enable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sampling_freq | Sampling freq in hertz (i.e. 1 / TR) | None | |
high_pass | High pass cutoff frequency | None | |
low_pass | Low pass cutoff frequency | None | |
**kwargs | Additional arguments passed to nilearn.signal.clean | {} |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | Filtered BrainData instance |
find_spikes¶
find_spikes(global_spike_cutoff = 3, diff_spike_cutoff = 3, *, TR: float | None = None, sampling_freq: float | None = None)Identify spikes from Time Series Data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
global_spike_cutoff | int or None | cutoff to identify spikes in global signal in standard deviations, or None to skip. | 3 |
diff_spike_cutoff | int or None | cutoff to identify spikes in average frame difference in standard deviations, or None to skip. | 3 |
TR | float | None | Repetition time in seconds. Sets the returned DesignMatrix’s sampling_freq for downstream .append(...) / .convolve(). Pass exactly one of TR or sampling_freq. | None |
sampling_freq | float | None | Sampling frequency in Hz (= 1/TR). See TR. | None |
Returns:
| Type | Description |
|---|---|
| DesignMatrix with one indicator column per detected spike TR, with | |
| all spike columns pre-marked as confounds. A TR flagged by both | |
detectors yields a single column (named global_spike*); the | |
| colliding detections are bitwise identical, so only the retained | |
| name differs. |
fit¶
fit(model = 'glm', *, X = None, cv = None, device = 'cpu', local_alpha = True, fit_intercept = False, inplace = True, scale = 'auto', standardize = 'auto', progress_bar = False, **kwargs)Fit a model to brain imaging data.
Creates and fits a model from string specification. The brain data (self.data) is always used as the target variable. Model and results are stored for later use with predict().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model | str | Model type: ‘ridge’, ‘glm’, or future model names | ‘glm’ |
X | array - like or DataFrame | Design matrix or feature matrix | None |
cv | int or sklearn CV splitter | Cross-validation specification (Ridge only). int → KFold(cv); pass a splitter object (e.g. KFold(5, shuffle=True), GroupKFold(8)) for non-contiguous folds. Generators (splitter.split(X)) are rejected. | None |
device | str, default=‘cpu’ | Ridge only. Compute device for the ridge solve/CV: 'cpu' (NumPy), 'gpu' (PyTorch on CUDA/MPS when available), or 'auto' (GPU if present, else CPU). Ignored when model='glm'. | ‘cpu’ |
local_alpha | bool, default=True | Ridge only. If True, select α independently per voxel via solve_ridge_cv. If False, pick a single α shared across all voxels. | True |
fit_intercept | bool, default=False | Ridge only. Forwarded to the Ridge model — center X and y on the training fold mean per fold and recover the intercept after. | False |
inplace | bool, default=True | If True, mutate self and return self. If False, return a Fit dataclass with the results. self.data and the result attributes (ridge_* / glm_* / cv_results_) are left unchanged, but self.model_ and self.X_ (plus self.design_matrix for GLM) ARE updated on self so predict() / compute_contrasts() still work. | True |
scale | bool or ‘auto’, default=‘auto’ | Apply percent-signal-change scaling before fitting via nilearn’s per-voxel mean_scaling. 'auto' → False for both models (PSC is opt-in). Redundant with standardize='zscore' (warns). Applied before standardize. | ‘auto’ |
standardize | str or None or ‘auto’, default=‘auto’ | Standardize each voxel across observations after scaling. 'center', 'zscore', or None. 'auto' → 'zscore' for ridge, None for glm. | ‘auto’ |
progress_bar | bool | Display a progress bar during fitting. Default: False. | False |
**kwargs | dict | Additional arguments passed to model constructor | {} |
Returns:
| Type | Description |
|---|---|
BrainData or Fit: If inplace=True, returns self (fitted BrainData). If inplace=False, returns Fit dataclass with results. |
Note
After model="glm", the following per-regressor BrainData attributes are populated — one map per design-matrix column:
glm_betas: effect-size (β) maps.glm_t: marginal t-statistic for each regressor.glm_p: marginal p-value.glm_se: standard error of β.glm_r2: voxel-wise R².
glm_t[i] is a valid t-map for the trivial one-hot contrast on regressor i only. For contrasts across regressors ("A - B", [1, -1, 0, ...]) use compute_contrasts — you cannot correctly combine these per-regressor maps by hand because t-statistic arithmetic requires the off-diagonal elements of the parameter covariance matrix, which are not stored. Pass statistic="all" to get β/t/z/p/se for one contrast in a single call.
Examples:
>>> brain_data.fit(model='ridge', alpha=1.0, cv=5, X=features)
>>> fit = brain_data.fit(model='ridge', alpha=1.0, X=features, inplace=False)iplot¶
iplot(*, view: str = 'ortho', threshold: float | str | None = None, lower: float | str | None = None, upper: float | str | None = None, autoscale: bool | tuple[float, float] = True, cmap: str = 'warm', bg_img: str | bool | None = None, atlas: str | Atlas | None = None, opacity: float = 1.0, outline: float = 0.0, colorbar: bool = True, controls: bool = True, **kwargs: bool)Interactive WebGL brain viewer powered by niivue.
Renders inline in a live kernel (Jupyter, marimo) with
live windowing (right-drag to set the threshold/contrast), slice
scrolling, native 4D frame scrubbing, true 3D rendering, a stat-map
colorbar, and optional nltools-atlas overlays. Static-built docs (plain
Markdown) are not interactive; use plot there.
Returns a NiivueViewer widget. By default (controls=True) it
renders an in-widget threshold slider above the viewer; the window is
reactive through the cal_min / cal_max traits. Pass
controls=False to hide the slider (right-drag windowing still
works).
Thresholding is a divergent magnitude window: cal_min is the
display floor (sub-floor voxels render transparent), cal_max the
saturation point, with the positive limb using cmap and the
negative limb its mirrored partner. Precedence: lower/upper
win; otherwise threshold sets the floor; any unset edge comes
from autoscale. The window is always computed in Python and
passed to niivue explicitly, so the slider handles show exactly the
window being rendered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | str | "ortho" (default), "axial", "coronal", "sagittal", or "render" (3D volume render). "surface" is no longer supported — use "render" or plot_flatmap / plot_surf. | ‘ortho’ |
threshold | float | str | None | Convenience symmetric magnitude floor (→ cal_min). Accepts a percentile string ("95%") resolved over the finite nonzero magnitudes, consistent with threshold. | None |
lower | float | str | None | Window floor (→ cal_min). Overrides threshold. Accepts a percentile string. | None |
upper | float | str | None | Window ceiling (→ cal_max). Overrides threshold. Accepts a percentile string. | None |
autoscale | bool | tuple [ float , float ] | Robust default window for the edges not set above. True (default): ceiling at the 98th percentile of the finite nonzero magnitudes — a couple of outlier voxels no longer wash out the whole map — with an epsilon floor (everything nonzero visible; threshold up from there). (lo_pct, hi_pct): floor/ceiling at those magnitude percentiles. False: the raw data extremes (the old behavior, made explicit). | True |
cmap | str | niivue colormap for the positive limb (default "warm"). Common matplotlib names are auto-mapped with a warning. | ‘warm’ |
bg_img | str | bool | None | None/True auto-loads the matching MNI template when the data is in standard space (else none); False disables the background; a path string uses that image. | None |
atlas | str | Atlas | None | Atlas overlay — a registry name (e.g. "aal"), a loaded Atlas, or None. Deterministic atlases only; probabilistic atlases raise. | None |
opacity | float | Stat-map (and filled-atlas) opacity in 0..1. | 1.0 |
outline | float | > 0 draws atlas region boundaries of that width (stat map stays visible); 0 draws filled regions. | 0.0 |
colorbar | bool | Show the stat-map colorbar (default True). An explicit is_colorbar kwarg overrides this. | True |
controls | bool | Render an in-widget threshold slider above the viewer (default True). False hides it; the viewer still supports niivue’s right-drag windowing. No extra dependency either way — the slider is native to the widget frontend. | True |
**kwargs | Forwarded verbatim to new Niivue(opts) (e.g. height, ConfigOptions like is_colorbar). | {} |
Returns:
| Type | Description |
|---|---|
A NiivueViewer widget (an anywidget.AnyWidget). Its threshold | |
window is reactive via the cal_min / cal_max traits. |
mean¶
mean(axis = 0, *, spatial_scale: str = 'whole_brain', roi_mask: str = None)Get mean of each voxel or image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis | 0 = across images (default, returns BrainData), 1 = within images (returns array). Ignored when spatial_scale='roi'. | 0 | |
spatial_scale | str | 'whole_brain' (default) preserves existing behavior. 'roi' requires roi_mask and returns a BrainData of the same shape with each voxel painted with its parcel’s mean per image (parcellation smoothing). | ‘whole_brain’ |
roi_mask | Atlas image for spatial_scale='roi'. | None |
Returns:
| Type | Description |
|---|---|
| float/np.array/BrainData: Mean values. |
median¶
median(axis = 0, *, spatial_scale: str = 'whole_brain', roi_mask: str = None)Get median of each voxel or image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis | 0 = across images (default, returns BrainData), 1 = within images (returns array). Ignored when spatial_scale='roi'. | 0 | |
spatial_scale | str | 'whole_brain' (default) or 'roi' (paints each voxel with its parcel’s median per image). | ‘whole_brain’ |
roi_mask | Atlas image for spatial_scale='roi'. | None |
Returns:
| Type | Description |
|---|---|
| float/np.array/BrainData: Median values. |
multivariate_similarity¶
multivariate_similarity(images, method = 'ols', tail = 2)Predict a BrainData spatial distribution from a linear combination.
The predictors may be other BrainData instances or nibabel images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
images | BrainData instance of weight map | required | |
method | str | Regression method. Default: ‘ols’. | ‘ols’ |
tail | 2 | ‘two’ (two-tailed, default) or 1 |
Returns:
| Name | Type | Description |
|---|---|---|
out | dictionary of regression statistics in BrainData instances {‘beta’,‘t’,‘p’,‘df’,‘residual’} |
plot¶
plot(*, method = 'glass', upper = None, lower = None, threshold = None, view = 'z', cut_coords = None, cmap = None, bg_img = None, ax = None, figsize = (8, 6), title = None, colorbar = True, save = None, stat = 'mean', limit = 3, **kwargs)Plot BrainData instance using nilearn visualization or matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | str | Visualization type: ‘glass’, ‘slices’, ‘timeseries’, ‘histogram’ | ‘glass’ |
upper | str / float | Upper threshold. | None |
lower | str / float | Lower threshold. | None |
threshold | float | Convenience parameter for thresholding. | None |
view | str | For method="slices", any non-empty combination of "x", "y", "z" (e.g. "xyz", "xz", "y"). Default: "z". | ‘z’ |
cut_coords | list or dict | Cut coordinates for multi-slice views. Takes precedence over view-based defaults. Either a list matching len(view) or a dict keyed by axis letter. | None |
cmap | str | Colormap name. | None |
bg_img | str/nibabel image | Background image. | None |
ax | Axes | Matplotlib axis. | None |
figsize | tuple | default figure size if no axis (8, 6) | (8, 6) |
title | str | Plot title. | None |
colorbar | bool | Whether to show colorbar. Default: True. | True |
save | str | Path to save figure(s). | None |
stat | str | Statistic for timeseries plots. Default: ‘mean’. | ‘mean’ |
limit | int | Maximum number of images to render when this BrainData contains multiple maps and method is "glass" or "slices". Default: 3. Warns when more images exist than limit. | 3 |
**kwargs | Additional arguments passed to nilearn plot functions. | {} |
Returns:
| Type | Description |
|---|---|
| matplotlib.figure.Figure or list[matplotlib.figure.Figure]: A | |
| single figure for single-image data; a list of figures for | |
multi-image data with method in {"glass", "slices"} | |
| (one per image for glass; one per image-and-view pair for | |
| slices). |
plot_flatmap¶
plot_flatmap(*, threshold = None, cmap = 'RdBu_r', vmax = None, vmin = None, template = 'fsaverage5', with_curvature = True, curvature_contrast = 0.5, curvature_brightness = 0.5, transparency = 'auto', colorbar = True, colorbar_orientation = 'horizontal', figsize = (12, 6), title = None, radius_mm = 3.0, interpolation = 'linear', axes = None, save = None)Plot brain data on cortical flatmap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold | float | Values below this absolute threshold are masked. | None |
cmap | str | Matplotlib colormap. Default: ‘RdBu_r’. | ‘RdBu_r’ |
vmax | float | Maximum value for colormap. | None |
vmin | float | Minimum value for colormap. | None |
template | str | Freesurfer surface resolution. Default: ‘fsaverage5’. | ‘fsaverage5’ |
with_curvature | bool | Show sulcal/gyral pattern. Default: True. | True |
curvature_contrast | float | Contrast of curvature overlay. Default: 0.5. | 0.5 |
curvature_brightness | float | Mean brightness of curvature overlay. Default: 0.5. | 0.5 |
transparency | BrainData, Nifti1Image, str, or “auto” | Binary mask used to render vertices outside the mask as transparent. "auto" (default) uses the instance’s .mask; pass None to disable masking. | ‘auto’ |
colorbar | bool | Show colorbar. Default: True. | True |
colorbar_orientation | str | ‘horizontal’ or ‘vertical’. Default: ‘horizontal’. | ‘horizontal’ |
figsize | tuple | Figure size as (width, height). Default: (12, 6). | (12, 6) |
title | str | Figure title. | None |
radius_mm | float | Sampling radius in mm. Default: 3.0. | 3.0 |
interpolation | str | Interpolation method. Default: ‘linear’. | ‘linear’ |
axes | Axes | Existing axes to plot on. | None |
save | str | File path to save figure. | None |
Returns:
| Type | Description |
|---|---|
| matplotlib.figure.Figure |
plot_surf¶
plot_surf(*, hemi = 'both', view = 'montage', surface = 'pial', template = 'fsaverage5', threshold = None, cmap = 'RdBu_r', vmin = None, vmax = None, transparency = 'auto', bg_on_data = False, colorbar = True, colorbar_orientation = 'horizontal', figsize = (10, 8), title = None, radius_mm = 3.0, interpolation = 'linear', zoom = 1.2, axes = None, save = None)Render this BrainData on fsaverage surfaces as a tight 2×2 montage.
Facade over plot_surf. See that function’s
docstring for the full argument reference. Notable defaults:
surface="pial", zoom=1.2, transparency="auto" (uses
this instance’s .mask).
Returns:
| Type | Description |
|---|---|
| matplotlib.figure.Figure |
predict¶
predict(*, y: np.ndarray | str | None = None, X: np.ndarray | None = None, spatial_scale: str = 'whole_brain', model: str = 'svm', cv: int | str = 5, standardize: bool = True, reduce: str | None = None, n_components: int | None = None, scoring: str = 'auto', groups: np.ndarray | str | None = None, roi_mask: np.ndarray | str | None = None, radius_mm: float = 10.0, inplace: bool = False, n_jobs: int = 1, random_state: int | None = None, progress_bar: bool = False)Predict voxel timeseries (encoding) or decode labels (MVPA).
Dispatched by which of X or y is provided:
Timeseries prediction (
Xprovided): use a fitted ridge / GLM encoding model onselfto predict voxel responses. Returns a freshBrainDatawhose.dataholds the predicted timeseries (composes directly with.plot(),.standardize()etc.).inplacehas no effect in this mode.MVPA decoding (
yprovided, or resolvable from.Y): train a classifier or regressor with cross-validation. Returns aPredictdataclass. Spatial fields (weight_map,fold_weight_maps,final_weight_map,accuracy_map) areBrainDataobjects soresult.weight_map.plot()works directly. Drop down to numpy viaresult.weight_map.data.
Labels travel with the data: when y is omitted and this object
carries a single-column .Y frame, that column is decoded
(y='name' picks a column of a multi-column .Y; groups
accepts a .Y column name the same way). An object with both a
fitted encoding model and a stored .Y refuses the no-argument
call as ambiguous — pass y= or X= explicitly.
Field shapes by spatial_scale=:
whole_brain:
predictions(n_samples,) OOF predictions,scores(n_folds,),mean_scorefloat,std_scorefloat,weight_mapBrainData (coef_from one fit on the full(X, y)— the publishable map),fold_weight_mapsBrainData (n_folds, n_voxels) for stability analysis,estimatorthe fitted all-data sklearn estimator (use for.predict()on new data).roi:
scores(n_folds, n_rois),mean_score(n_rois,),std_score(n_rois,),roi_labels(n_rois,) atlas IDs in matching order,accuracy_map/weight_map/fold_weight_mapsBrainData (per-parcel coefs reassembled to voxel space; voxels outside the atlas = NaN),estimatordict keyed by atlas label.searchlight:
accuracy_mapBrainData.
With inplace=True, fields are attached to self with a
predict_ prefix (e.g. self.predict_weight_map,
self.predict_accuracy_map), mirroring bd.fit()'s
glm_* / ridge_* naming.
Why weight_map is the all-data refit, not the CV mean:
the mean of K per-fold coef_ vectors doesn’t correspond to
any actual fitted estimator (each fold saw a different subset).
The all-data refit is a single legitimate model with all the
information used. CV gives the honest score; the refit gives
the publishable map. The CV-mean is one line away if you want
it: result.fold_weight_maps.data.mean(axis=0).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ( array - like , str ) | Labels (classification) or continuous targets (regression), shape (n_samples,), or the name of a .Y column. Triggers MVPA mode; omitted, it falls back to a single-column .Y. | None |
X | array - like | Features for timeseries prediction, shape (n_samples, n_features). Triggers encoding mode. | None |
spatial_scale | str | MVPA dispatch — 'whole_brain', 'searchlight', or 'roi'. | ‘whole_brain’ |
model | str or sklearn estimator | Algorithm. String shortcuts: - Classification: 'svm' (LinearSVC), 'logistic', 'lda', 'ridge_classifier'. - Regression: 'ridge', 'lasso', 'svr'.Or pass any sklearn estimator / Pipeline (e.g., make_pipeline(StandardScaler(), SelectKBest(k=500), LinearSVC())). When model is a sklearn Pipeline, standardize is auto-defaulted to False (with a warning) so we don’t wrap another StandardScaler around your pipeline. Pass standardize=True explicitly to override. | ‘svm’ |
cv | int, str, or sklearn CV splitter | int → shuffled KFold (regression) or StratifiedKFold (classification), honoring groups via the Group variants; 'loo' (leave-one-out); 'logo' (leave-one-group-out — pass the grouping variable via groups, e.g. runs for leave-one-run-out); or any sklearn splitter. | 5 |
standardize | bool | Z-score features per fold before fitting. Default True. Auto-flipped to False when model is a sklearn Pipeline (see model above). | True |
reduce | str | Per-fold dimensionality reduction. Currently only 'pca' supported. Default None. Weight maps are back-projected through PCA to voxel space. | None |
n_components | int | PCA components when reduce='pca'. | None |
scoring | str | Sklearn scoring string. Default 'auto' → 'accuracy' if classifier, 'r2' if regressor. | ‘auto’ |
groups | ( array - like , str ) | Group labels for CV splitters that need them (e.g., leave-one-run-out), or the name of a .Y column holding them. | None |
roi_mask | Nifti1Image or path - like | Atlas image for spatial_scale='roi'. | None |
radius_mm | float | Searchlight radius in mm. Default 10.0. | 10.0 |
inplace | bool | If True, populate result fields as predict_* attributes on self and return self. Default False returns a fresh Predict. | False |
n_jobs | int | Parallel jobs for searchlight / ROI. Default 1; searchlight on a real brain at higher n_jobs can be memory-heavy. | 1 |
random_state | int | Seed for the shuffled fold splitter when cv is an int (MVPA mode). Default None (unseeded shuffle each call). Ignored when cv is a splitter object — set its own random_state instead. | None |
progress_bar | bool | Show progress bar for searchlight / ROI. | False |
Returns:
| Type | Description |
|---|---|
| Predict | BrainData: Predict dataclass when inplace=False; self (mutated, with predict_* attrs) when inplace=True. |
Examples:
>>> result = brain.predict(y=labels, spatial_scale='whole_brain', cv=5)
>>> result.weight_map.plot() # publishable map (all-data fit)
>>> result.mean_score # honest CV-derived accuracy
>>> new_pred = result.estimator.predict(new_X) # apply to new data>>> result = brain.predict(y=labels, spatial_scale='searchlight',
... radius_mm=8.0, n_jobs=4)
>>> result.accuracy_map.plot()>>> result = brain.predict(y=labels, spatial_scale='roi', roi_mask=atlas)
>>> top = result.roi_labels[result.mean_score.argsort()[::-1][:10]]
>>> result.accuracy_map.plot() # brain-space view of the same mapCustom sklearn pipeline as model — standardize auto-defaults to False because we detect the Pipeline:
from sklearn.feature_selection import SelectKBest
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import LinearSVC
pipe = make_pipeline(StandardScaler(), SelectKBest(k=500),
LinearSVC())
result = brain.predict(y=labels, model=pipe)r_to_z¶
r_to_z()Apply Fisher’s r-to-z transformation to each data element.
regions¶
regions(*, min_region_size = 1350, method = 'local_regions', smoothing_fwhm = 6, is_mask = False)Extract brain connected regions into separate regions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_region_size | int | Minimum volume in mm3 for a region to be kept. | 1350 |
method | str | Type of extraction method [‘connected_components’, ‘local_regions’]. | ‘local_regions’ |
smoothing_fwhm | scalar | Smooth an image to extract more sparser regions. | 6 |
is_mask | bool | Whether to treat as boolean mask. | False |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | BrainData instance with extracted ROIs as data. |
report¶
report(contrasts = None, **kwargs)Generate a nilearn HTML report for a fitted GLM.
Must be called after fit(model='glm', ...). Renders the design
matrix, requested contrast maps, and model parameters as a
self-contained HTML report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contrasts | str, list, or dict | Contrast(s) to render, same forms as compute_contrasts. | None |
**kwargs | Forwarded to nilearn’s generate_report (e.g. title, threshold, alpha). | {} |
Returns:
| Name | Type | Description |
|---|---|---|
HTMLReport | nilearn report; call .save_as_html(path) or display it in a notebook. |
Examples:
>>> brain.fit(model='glm', X=design_matrix)
>>> brain.report(contrasts='conditionA - conditionB').save_as_html('report.html')resample_to¶
resample_to(*, img = None, resolution = None, interpolation = None)Resample BrainData to match target image or resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img | Target image for resampling (nibabel Nifti1Image, str/Path, or None). | None | |
resolution | Target voxel size in mm (float/int for isotropic, or None). | None | |
interpolation | Interpolation method (‘nearest’, ‘linear’, ‘continuous’, or None). | None |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | New BrainData instance with resampled data |
scale¶
scale(scale_val = 100.0, axis = None)Scale data via mean scaling.
Two scaling modes are available:
Grand-mean scaling (axis=None, default): Divides all values by the global mean across all voxels and timepoints.
Voxel-wise scaling (axis=0): Divides each voxel’s time-series by its own temporal mean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scale_val | (int/float) Target value for the mean after scaling. Default 100. | 100.0 | |
axis | (int or None) None for grand-mean scaling (default), 0 for voxel-wise scaling. | None |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | New BrainData instance with scaled data. |
similarity¶
similarity(image, metric = 'correlation')Calculate similarity to a single BrainData or nibabel image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image | (BrainData, nifti) image to evaluate similarity | required | |
metric | (str) Type of similarity [‘correlation’,‘pearson’,‘rank_correlation’,‘spearman’,‘dot_product’,‘cosine’] | ‘correlation’ |
Returns:
| Type | Description |
|---|---|
| float or np.ndarray: Similarity value(s). |
smooth¶
smooth(fwhm)Apply spatial smoothing using nilearn smooth_img().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fwhm | (float) full width half maximum of gaussian spatial filter | required |
Returns:
| Type | Description |
|---|---|
| BrainData instance (copy with smoothed data) |
standardize¶
standardize(*, axis = 0, method = 'center', suppress_warnings = False)Standardize BrainData() instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis | int | 0 standardizes each voxel across observations (default). 1 standardizes each observation across voxels. | 0 |
method | str | ‘center’ subtracts the mean (default). ‘zscore’ subtracts the mean and divides by standard deviation. | ‘center’ |
suppress_warnings | bool | If True, suppress sklearn numerical warnings that occur when voxels have near-zero variance. Default: False. | False |
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | Standardized BrainData instance. |
std¶
std(axis = 0, *, spatial_scale: str = 'whole_brain', roi_mask: str = None)Get standard deviation of each voxel or image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis | 0 = across images (default, returns BrainData), 1 = within images (returns array). Ignored when spatial_scale='roi'. | 0 | |
spatial_scale | str | 'whole_brain' (default) or 'roi' (paints each voxel with its parcel’s std per image). | ‘whole_brain’ |
roi_mask | Atlas image for spatial_scale='roi'. | None |
Returns:
| Type | Description |
|---|---|
| float/np.array/BrainData: Standard deviation values. |
sum¶
sum(axis = 0)Get sum of each voxel or image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis | 0 = across images (default, returns BrainData), 1 = within images (returns array) | 0 |
Returns:
| Type | Description |
|---|---|
| float/np.array/BrainData: Sum values. |
temporal_resample¶
temporal_resample(*, sampling_freq = None, target = None, target_type = 'hz')Resample BrainData timeseries to a new target frequency or number of samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sampling_freq | (float) sampling frequency of data in hertz | None | |
target | (float) upsampling target | None | |
target_type | (str) type of target can be [samples,seconds,hz] | ‘hz’ |
Returns:
| Type | Description |
|---|---|
| upsampled BrainData instance |
threshold¶
threshold(*, upper = None, lower = None, binarize = False, coerce_nan = True, cluster_threshold = 0)Threshold BrainData instance with optional cluster filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
upper | (float or str) Upper cutoff for thresholding. | None | |
lower | (float or str) Lower cutoff for thresholding. | None | |
binarize | bool | return binarized image. Default False. | False |
coerce_nan | bool | coerce nan values to 0s. Default True. | True |
cluster_threshold | int | Minimum cluster size in voxels. Default 0. | 0 |
Returns:
| Type | Description |
|---|---|
| Thresholded BrainData object. |
to_nifti¶
to_nifti()Convert BrainData Instance into Nifti Object.
Returns:
| Type | Description |
|---|---|
| nibabel.Nifti1Image: Brain data as a NIfTI image. |
transform_pairwise¶
transform_pairwise()Transform data into pairwise comparisons.
Returns:
| Name | Type | Description |
|---|---|---|
BrainData | BrainData instance transformed into pairwise comparisons |
ttest¶
ttest(*, popmean = 0.0, permutation = False, n_permute = 5000, tail = 2, return_null = False, n_jobs = -1, random_state = None)One-sample voxelwise t-test across images (axis 0).
Tests whether the per-voxel mean across images differs from
popmean. Operates on a stack of images (e.g. subject-level
contrast maps) with shape (n_samples, n_voxels).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
popmean | Population mean to test against. Default 0.0. | 0.0 | |
permutation | If True, use sign-flip permutation test via one_sample_permutation_test. | False | |
n_permute | Number of permutations (used only when permutation=True). Default 5000. | 5000 | |
tail | 2 | ‘two’ (two-tailed, default) or 1 | |
return_null | If True, also return the null distribution. Default False. | False | |
n_jobs | Number of parallel jobs. Default -1 (all cores). | -1 | |
random_state | Random seed for reproducibility. | None |
Returns:
| Type | Description |
|---|---|
| dict with four BrainData keys: - "mean": voxelwise mean across images (effect size). - "t": parametric one-sample t-statistic. - "z": signed z-score, sign(t) * norm.isf(p/2) — matches nilearn’s output_type='z_score'. - "p": parametric p-value, or empirical p when permutation=True. | |
| The effect size is always returned alongside the inferential maps | |
| so group-level code never has to recompute the mean. |
Examples:
>>> # Stack of subject-level contrast maps
>>> result = contrast_maps.ttest()
>>> sig = result["p"].data < 0.05
>>> effect = result["mean"] # for reporting magnitude
>>> z_map = result["z"] # for nilearn-style thresholding>>> # Permutation-based p-values; still reports t/z/mean
>>> result = contrast_maps.ttest(permutation=True, n_permute=5000)ttest2¶
ttest2(other, equal_var = True, tail = 2)Two-sample voxelwise t-test between two BrainData stacks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | BrainData to compare against. Must have the same number of voxels. | required | |
equal_var | If True (default), standard two-sample t-test. If False, Welch’s t-test. | True | |
tail | 2 | ‘two’ (two-tailed, default) or 1 |
Returns:
| Name | Type | Description |
|---|---|---|
dict | {"t": BrainData, "p": BrainData}. |
upload_neurovault¶
upload_neurovault(*, access_token = None, collection_name = None, collection_id = None, img_type = None, img_modality = None, **kwargs)Upload BrainData images and metadata to NeuroVault.
Adds any columns in self.X to image metadata. The index is used as
the image name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access_token | (str, Required) Neurovault api access token | None | |
collection_name | (str, Optional) name of new collection to create | None | |
collection_id | (int, Optional) neurovault collection_id if adding images to existing collection | None | |
img_type | (str, Required) Neurovault map_type | None | |
img_modality | (str, Required) Neurovault image modality | None |
Returns:
| Name | Type | Description |
|---|---|---|
collection | (pd.DataFrame) neurovault collection information |
write¶
write(file_name)Write out BrainData object to Nifti or HDF5 File.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name | str or Path | Output file path (.nii/.nii.gz for NIfTI, .h5/.hdf5 for HDF5). | required |
z_to_r¶
z_to_r()Convert z score back into r value for each element of data object.