cmp.stages.segmentation.segmentation module

Definition of config and stage classes for segmentation.

class cmp.stages.segmentation.segmentation.SegmentationConfig[source]

Bases: traits.has_traits.HasTraits

Class used to store configuration parameters of a SegmentationStage object.

seg_tool

Choice of segmentation tool that can be “Freesurfer”

Type

traits.Enum([“Freesurfer”, “Custom segmentation”])

make_isotropic

Resample to isotropic resolution (Default: False)

Type

traits.Bool

isotropic_vox_size

Isotropic resolution to be resampled (Default: 1.2, desc=’’)

Type

traits.Float

isotropic_interpolation

Interpolation type used for resampling that can be: ‘cubic’, ‘weighted’, ‘nearest’, ‘sinc’, or ‘interpolate’, (Default: ‘cubic’)

Type

traits.Enum

brain_mask_extraction_tool

Choice of brain extraction tool: “Freesurfer”, “BET”, or “ANTs” (Default: Freesurfer)

Type

traits.Enum

ants_templatefile

Anatomical template used by ANTS brain extraction

Type

traits.File

ants_probmaskfile

Brain probability mask used by ANTS brain extraction

Type

traits.File

ants_regmaskfile

Mask (defined in the template space) used during registration in ANTs brain extraction. To limit the metric computation to a specific region.

Type

traits.File

use_fsl_brain_mask

Use FSL BET for brain extraction (Default: False)

Type

traits.Bool

use_existing_freesurfer_data

(Default: False)

Type

traits.Bool

freesurfer_subjects_dir

Freesurfer subjects directory path usually /output_dir/freesurfer

Type

traits.Str

freesurfer_subject_id

Freesurfer subject (being processed) ID in the form sub-XX(_ses-YY)

Type

traits.Str

freesurfer_args

Extra Freesurfer recon-all arguments

Type

traits.Str

custom_brainmask

Instance of CustomBrainMaskBIDSFile that describes the custom BIDS formatted brain mask

Type

traits.Instance(CustomBrainMaskBIDSFile)

custom_wm_mask

Instance of CustomWMMaskBIDSFile that describes the custom BIDS formatted white-matter mask

Type

traits.Instance(CustomWMMaskBIDSFile)

custom_gm_mask

Instance of CustomGMMaskBIDSFile that describes the custom BIDS formatted gray-matter mask

Type

traits.Instance(CustomGMMaskBIDSFile)

custom_csf_mask

Instance of CustomCSFMaskBIDSFile that describes the custom BIDS formatted CSF mask

Type

traits.Instance(CustomCSFMaskBIDSFile)

custom_aparcaseg

Instance of CustomAparcAsegBIDSFile that describes the custom BIDS formatted Freesurfer aparc-aseg file

Type

traits.Instance(CustomAparcAsegBIDSFile)

number_of_threads

Number of threads leveraged by OpenMP and used in the stage by Freesurfer and ANTs (Default: 1)

Type

traits.Int

class cmp.stages.segmentation.segmentation.SegmentationStage(subject, session, bids_dir, output_dir)[source]

Bases: cmp.stages.common.Stage

Class that represents the segmentation stage of a AnatomicalPipeline.

create_workflow()[source]

Create the workflow of the SegmentationStage

create_workflow(flow, inputnode, outputnode)[source]

Create the stage workflow.

Parameters
  • flow (nipype.pipeline.engine.Workflow) – The nipype.pipeline.engine.Workflow instance of the anatomical pipeline

  • inputnode (nipype.interfaces.utility.IdentityInterface) – Identity interface describing the inputs of the segmentation stage

  • outputnode (nipype.interfaces.utility.IdentityInterface) – Identity interface describing the outputs of the segmentation stage

create_workflow_custom(flow, inputnode, outputnode)[source]

Create the stage workflow when custom inputs are specified.

Parameters
  • flow (nipype.pipeline.engine.Workflow) – The nipype.pipeline.engine.Workflow instance of the anatomical pipeline

  • inputnode (nipype.interfaces.utility.IdentityInterface) – Identity interface describing the inputs of the segmentation stage

  • outputnode (nipype.interfaces.utility.IdentityInterface) – Identity interface describing the outputs of the segmentation stage

define_inspect_outputs(debug=False)[source]

Update the inspect_outputs class attribute.

It contains a dictionary of stage outputs with corresponding commands for visual inspection.

Parameters

debug (bool) – If True, show printed output