meegpype.workflows.anat.bem moduleπ
BEM surface workflows.
All workflows write their surfaces to subjects_dir/subject_id/bem (brain.surf,
inner_skull.surf, outer_skull.surf and outer_skin.surf), the location MNE
reads them from. Since this folder is shared between methods, the surfaces of the
current workflow are reinstalled on every run, even when nodes are cached: the content
of the bem folder always matches the workflow that ran last.
- meegpype.workflows.anat.bem.generate_basic_bem_workflow(subject_id=None, subjects_dir=None, name='basic_bem_workflow')π
Build the basic BEM workflow, using the watershed algorithm.
All BEM surfaces (brain, inner skull, outer skull and outer skin) are computed with
mne.bem.make_watershed_bem()and installed insubjects_dir/subject_id/bem.- Workflow Graph
(Source code, png, svg, pdf)
- Parameters:
subject_id (str, optional) β FreeSurfer subject ID. Can also be connected to
inputnode.subject_id.subjects_dir (str, optional) β FreeSurfer subjects directory. Can also be connected to
inputnode.subjects_dir.name (str) β Name of the workflow.
Notes
The
outputnodeprovidessubject_id,subjects_dirand the paths of the installed surfaces:brain_surf,inner_skull_surf,outer_skull_surfandouter_skin_surf.
- meegpype.workflows.anat.bem.generate_bem_workflow(subject_id=None, subjects_dir=None, name='freesurfer_bem_surfaces', method='basic')π
Build a BEM workflow.
- Parameters:
subject_id (str, optional) β FreeSurfer subject ID. Can also be connected to
inputnode.subject_id.subjects_dir (str, optional) β FreeSurfer subjects directory. Can also be connected to
inputnode.subjects_dir.name (str) β Name of the workflow.
method (
"basic"|"refined") β The method used to compute the BEM surfaces, seegenerate_basic_bem_workflow()andgenerate_refined_bem_workflow().
- meegpype.workflows.anat.bem.generate_refined_bem_workflow(subject_id=None, subjects_dir=None, name='refined_bem_workflow')π
Build the refined BEM workflow, using the FreeSurfer brain mask.
The brain and inner skull surfaces are computed from the FreeSurfer
brainmask.mgz. In the forward pipeline, it holds the ANTs brain extraction computed by sMRIPrep (FreeSurferβs own skull stripping is skipped), which includes the CSF surrounding the brain:the mask is binarized;
a surface is extracted with marching cubes (
mri_mc), smoothed and decimated to 5120 triangles;the brain surface is obtained by expanding it by 1 mm, and the inner skull surface by expanding the brain surface by a further 2 mm.
The outer skull and outer skin surfaces are computed with
mne.bem.make_watershed_bem(). All surfaces are installed insubjects_dir/subject_id/bem.- Workflow Graph
(Source code, png, svg, pdf)
- Parameters:
subject_id (str, optional) β FreeSurfer subject ID. Can also be connected to
inputnode.subject_id.subjects_dir (str, optional) β FreeSurfer subjects directory. Can also be connected to
inputnode.subjects_dir.name (str) β Name of the workflow.
Notes
The
outputnodeprovidessubject_id,subjects_dirand the paths of the installed surfaces:brain_surf,inner_skull_surf,outer_skull_surfandouter_skin_surf.
- meegpype.workflows.anat.bem.install_bem_surfaces(subjects_dir, subject, brain, inner_skull, outer_skull, outer_skin)π
Install the BEM surfaces in subjects_dir/subject/bem.
Existing files are only replaced when their content differs, so that unchanged surfaces keep their timestamps (and nipype caches).