neuralset.extractors.neuro.FmriExtractor¶
- pydantic model neuralset.extractors.neuro.FmriExtractor[source][source]¶
fMRI feature extraction with optional projection, signal cleaning, and caching to a NumPy memmap.
Input: a volumetric image of shape [x, y, z, time] or a surface image of shape [n_vertices, time].
Preprocessing pipeline (each step is optional):
Spatial smoothing (
fwhm): If active, smooths the image with an isotropic Gaussian kernel.Spatial projection (
projection): If active, projects the data to an array [n_features, time]. There are three projection types: SurfaceProjector (-> [n_vertices, time]), MaskProjector (-> [n_voxels, time]), and AtlasProjector (-> [n_parcels, time]).Signal cleaning (
cleaning): If active, cleans the data usingnilearn.signal.clean.Temporal resampling (
frequency): If active, resamples the data to the target frequency, using np.interp.
- Parameters:
offset (float) – Seconds to shift TRs forward to align delayed BOLD response.
projection (BaseFmriProjector | None) –
Spatial projection config — one of:
SurfaceProjector(mesh="fsaverage5")MaskProjector(mask="mni152_gm", resolution=2)AtlasProjector(atlas="schaefer_2018", atlas_kwargs={"n_rois": 400})None— keep raw volumetric / surface data
cleaning (FmriCleaner | None) – Signal cleaning config, passed to
nilearn.signal.clean.Noneskips all cleaning.frequency (
"native"| float) – Target sampling frequency.padding (int |
"auto"| None) – Pad 1-D+T data to a uniform voxel count across subjects.query (Query | None) – Per-event predicate selecting which fMRI variant(s) to load, evaluated directly on
Fmrievent objects. This is a deliberate subset of the pandasQueryEventsdialect: it supportsspace,preproc, andstudystring conditions with==,!=,in, andnot incombined withand/or/not. Referenced names are validated at construction, so typos fail fast — including in short-circuited branches. For richer filters, use aQueryEventstransform upstream.from_space – Deprecated compatibility aliases for older configs. Prefer
query; legacy selector fields remain in cache UIDs so old configs can keep using their existing cache namespace while they migrate.from_space="auto"additionally re-enables the deprecated projection-aware space selection (SurfaceProjector prefers fsaverage, GlasserProjector prefers fsLR, others prefer MNI); it has noqueryequivalent and will be removed in a future release.from_preproc – Deprecated compatibility aliases for older configs. Prefer
query; legacy selector fields remain in cache UIDs so old configs can keep using their existing cache namespace while they migrate.from_space="auto"additionally re-enables the deprecated projection-aware space selection (SurfaceProjector prefers fsaverage, GlasserProjector prefers fsLR, others prefer MNI); it has noqueryequivalent and will be removed in a future release.fwhm (float | None) – Full width at half maximum (in mm) for isotropic spatial smoothing via
nilearn.image.smooth_img. Applied after masking and before projection.Noneskips smoothing.
- Fields:
- field cleaning: FmriCleaner | None = FmriCleaner(standardize='zscore_sample', detrend=True, high_pass=None, low_pass=None, filter=None, ensure_finite=True)[source]¶
- prepare(obj: DataFrame | Sequence[Event] | Sequence[Segment]) None[source][source]¶
Pre-compute and cache extractor data for a collection of events.
This method triggers
_get_dataon every matching event so that expensive computation (e.g. model inference) is done once and cached. It then calls the extractor on a single event to populate the output shape, which is needed whenallow_missing=True.Call
preparebefore using the extractor in a dataloader.