Tissue class segmentation

Segmentation

class sbl.sabre.interfaces.SegmentTissueClasses(command=None, **inputs)

Segment a masked 3T T1 image (containing intracranial volume only) using sb-T1seg_3T, assigning each voxel to one of the following values/tissue classes:

3: gray matter (GM)
4: white matter (WM)
5: cerebrospinal fluid (CSF)
0: background

Input attributes:

Parameters:
  • input_image – Input masked T1 image as an existing file name
  • window_size – Window size for histogram smoothing as an integer (default=10)
  • class_values – Values to assign to background, CSF, gray matter, and white matter voxels as a list of items which are a value of type ‘int’ (default=[0, 5, 4, 3])
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image; default=_seg)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> segment = SegmentTissueClasses()
>>> segment.input_T1_image = '{session}_T1_TIV.nii.gz'
>>> segment.cmdline
'T1seg_3T {session}_T1_TIV {session}_T1_TIV_seg -bgfw 0 5 4 3'
>>> segment.run() 
class sbl.sabre.interfaces.SegmentLesionZone(command=None, **inputs)

Segment sulcal cerebrospinal fluid (sCSF) and gray matter.

Input attributes:

Parameters:
  • input_segmentation – Input segmented T1 image as an existing file name
  • input_csf – Input CSF mask as an existing file name
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • threshold_csf – CSF threshold as an integer
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> segment = SegmentLesionZone()
>>> segment.input_segmentation = 'mni_icbm152_T1_tiv.nii.gz'
>>> segment.cmdline
'SCSFGM mni_icbm152_T1_tiv mni_icbm152_T1_tiv_seg -bgfw 0 5 4 3'
>>> segment.run() 
class sbl.sabre.interfaces.SegmentLesions(command=None, **inputs)

Segment a masked 3T T2 or PD image (containing intracranial volume only) using sb-Lsegment, assigning each voxel to one of the following values/tissue classes:

1: lesion
0: background

Input attributes:

Parameters:
  • input_image – Input masked T2 or PD image as an existing file name
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • hyperintensity_cutoff – Cut-off for hyperintensity as a float (default=0.25)
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image; default=_lesions)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> segment = SegmentLesions()
>>> segment.input_image = '{session}_T1_TIV.nii.gz'
>>> segment.cmdline
'Lsegment m{session}_T1_TIV {session}_T1_TIV_lesions'
>>> segment.run() 

Post-processing

class sbl.sabre.interfaces.MaskClasses(command=None, **inputs)

Set image voxels corresponding to select classes from a segmentation to zero using sb-mask_img.

Input attributes:

Parameters:
  • input_image – Input image as an existing file name
  • input_segmentation – Input segmentation as an existing file name
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • mask_classes – Values to mask (drop) as a list of items which are a value of type ‘int’
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image; default=_masked)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> mask = MaskClasses()
>>> mask.input_image = '{session}_T1.nii.gz'
>>> mask.input_segmentation = '{session}_T1_seg.nii.gz'
>>> mask.mask_classes = [0, 5]
>>> mask.cmdline
'mask_img {session}_T1.nii.gz {session}_T1_seg.nii.gz -o {session}_T1_masked.nii.gz -m 0 5'
>>> mask.run() 
class sbl.sabre.interfaces.DilateClass(command=None, **inputs)

Perform 2D dilation on voxels in the input segmentation that have a value equal to voxel_class using a cross (1) or ball (2) structuring element with radius equal to dilation_radius. Values in the input image unaffected by the dilation operation remain unchanged.

Input attributes:

Parameters:
  • input_segmentation – Input segmentation as an existing file name
  • voxel_class – Voxel class to dilate as an integer
  • dilate_radius – Dilation radius as an integer
  • structuring_element – Structuring element as 1 <= an integer <= 2
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image; default=_dilated)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

input_spec

alias of DilateClassInputSpec

Hole-filling

class sbl.sabre.interfaces.FillHolesInSegmentation(command=None, **inputs)

Fill holes in a segmentation using sb-fill_csf_seg_holes.

Input attributes:

Parameters:
  • input_segmentation – Input segmented image as an existing file name
  • mask_image – Input TIV mask as an existing file name
  • segment_value – Value of region to fill holes in as an integer
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • output_suffix – Output suffix (if output_image not provided) as a string (optional; mutually exclusive with output_image)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> fill = FillHolesInSegmentation()
>>> fill.input_segmentation = 'mni_icbm152_T1.nii.gz'
>>> fill.cmdline
'fill_csf_seg_holes mni_icbm152_T1_seg.nii.gz mni_icbm152_T1_mask.nii.gz 5 mni_icbm152_T1_seg_filled.nii.gz'
>>> fill.run() 

Relabeling

class sbl.sabre.interfaces.RelabelBlackHoles(command=None, **inputs)

Relabel black holes in a segmentation using sb-relabel_black_holes.

CSF and VCSF must be uniquely labeled on the T1 segmentation. Any non-zero value in the lesion segmentation that corresponds to a CSF voxel on the T1 segmentation will be relabelled as a black hole.

Input attributes:

Parameters:
  • input_segmentation – Input segmentation as an existing file name
  • input_lesions – Input lesion segmentation as an existing file name
  • csf_value – Value corresponding to cerebrospinal fluid (CSF) in segmentation as an integer
  • bh_value – Value corresponding to black holes (BH) in segmentation as an integer
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image; default=_bh)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> relabel = RelabelBlackHoles()
>>> relabel.input_segmentation = '{session}_T1_seg_vcsf.nii.gz'
>>> relabel.input_lesions = '{session}_T1_lesions.nii.gz'
>>> relabel.csf_value = 5
>>> relabel.bh_value = 2
>>> relabel.cmdline
'relabel_black_holes -t1seg {session}_T1_seg_vcsf.nii.gz -lseg {session}_T1_lesions.nii.gz -csf 5 -bh 2 -out {session}_T1_seg_vcsf_bh.nii.gz'
>>> relabel.run() 
class sbl.sabre.interfaces.RelabelVentricularProximity(command=None, **inputs)

Relabel white matter hyperintensities (WMH) and black holes (BH) in a segmentation with respect to their proximity to ventricular CSF (vCSF), using sb-relabel_ventricular_wmh.

Any lesion in the lesion segmentation connected in 3D to ventricular CSF in the T1 segmentation is relabelled as periventricular by adding the offset value to each connected voxel.

Input attributes:

Parameters:
  • input_segmentation – Input segmentation as an existing file name
  • input_lesions – Input lesion segmentation as an existing file name
  • vcsf_value – Value corresponding to cerebrospinal fluid (CSF) in segmentation as an integer
  • offset_value – Offset to apply to values of voxels connected to vCSF as an integer
  • output_image – Output image as a file name (optional; mutually exclusive with output_suffix)
  • output_suffix – Output suffix as a string (optional; mutually exclusive with output_image; default=_vprox)

Output attributes:

Parameters:output_image – Output image as an existing file name

Example:

>>> relabel = RelabelVentricularProximity()
>>> relabel.input_segmentation = '{session}_T1_seg_vcsf.nii.gz'
>>> relabel.input_lesions = '{session}_T1_lesions.nii.gz'
>>> relabel.vcsf_value = 7
>>> relabel.offset_value = 2
>>> relabel.cmdline
'relabel_black_holes -t1seg {session}_T1_seg_vcsf.nii.gz -lseg {session}_T1_lesions.nii.gz -vcsf 7 -offset 2 -out {session}_T1_seg_vcsf_vprox.nii.gz'
>>> relabel.run() 

Table Of Contents

Previous topic

AC/PC alignment

Next topic

Brain region parcellation

This Page