Source modelling and reconstruction
Build forward models and reconstruct source activity from sensor-space recordings.
almkanal.almkanal_steps.headmodel_utils.ForwardModel
Bases: AlmKanalStep
Build an MEG forward model for source reconstruction.
The forward model combines the sensor geometry, MEG-to-MRI coregistration, source space, and boundary-element model (BEM).
Individual FreeSurfer reconstructions are expected under
subjects_dir / 'freesurfer' / subject_id. When template anatomy is
used, fsaverage is scaled to the participant and stored as
<subject_id>_from_template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject_id
|
str
|
Subject identifier. |
required |
subjects_dir
|
str | Path
|
AlmKanal working directory. FreeSurfer subjects are stored under
|
required |
pick_dict
|
dict | None
|
Channel selection passed to :func: |
required |
source
|
(surface, volume)
|
Type of source space used for the forward model. Default is
|
'surface'
|
redo_hdm
|
bool
|
If True, recompute the MEG-to-MRI coregistration and, when using
template anatomy, rescale |
required |
spacing
|
str
|
Source-space spacing used for surface source spaces based on an
individual MRI, for example |
required |
source_ico
|
int
|
Icosahedral subdivision level of the |
required |
bem_conductivity
|
float | Sequence[float]
|
Conductivity value or values passed to :func: |
required |
volume_pos
|
float
|
Grid spacing in millimetres for volume source spaces. The same
spacing is used when preparing the corresponding |
required |
min_dist_src
|
float
|
Minimum distance in millimetres between sources and the inner skull used when computing the forward solution. Default is 5.0. |
required |
use_template_mri
|
bool
|
If True, use a participant-specific scaling of |
required |
meg
|
bool
|
Include MEG channels in the forward solution. Default is True. |
required |
eeg
|
bool
|
Include EEG channels in the forward solution. EEG forward models require a three-layer BEM conductivity specification. Default is False. |
required |
Notes
The BEM surface resolution is fixed internally and is independent of
source_ico. source_ico controls the number of cortical source
locations, not the resolution of the BEM geometry.
An fsaverage source space corresponding to the requested surface or
volume resolution is prepared so that later source estimates can be
morphed to a common source space.
Returns:
| Type | Description |
|---|---|
Forward
|
|
almkanal.almkanal_steps.src_recon_utils.SourceReconstruction
Bases: AlmKanalStep
Perform source reconstruction using a preceding ForwardModel.
The source space, FreeSurfer subject, and FreeSurfer subjects directory are taken from the preceding ForwardModel to ensure that source reconstruction uses the same anatomical model and source geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
Beamformer | None
|
Spatial filter to apply. If None, use the filters produced by the preceding SpatialFilter step. |
required |
return_parc
|
bool
|
Whether to parcellate the reconstructed source estimates. Default is False. |
required |
label_mode
|
str
|
Extraction mode used for surface parcellation. Volume
parcellation uses |
required |
atlas
|
(glasser, dk, destrieux)
|
Atlas used when |
'glasser'
|
morph2fsaverage
|
bool
|
Whether to morph source estimates to the common |
required |
Returns:
| Type | Description |
|---|---|
dict | SourceEstimate | dict | VolSourceEstimate
|
Source time courses or parcellated data. |