nighres.brain.extract_brain_region(segmentation, levelset_boundary, maximum_membership, maximum_label, extracted_region, atlas_file=None, normalize_probabilities=False, estimate_tissue_densities=False, partial_volume_distance=1.0, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

Extract Brain Region

Extracts masks, probability maps and levelset surfaces for specific brain regions and regions from a Multiple Object Geometric Deformable Model (MGDM) segmentation result.

  • segmentation (niimg) – Segmentation result from MGDM.
  • levelset_boundary (niimg) – Levelset boundary from MGDM.
  • maximum_membership (niimg) – 4D image of the maximum membership values from MGDM.
  • maximum_label (niimg) – 4D imageof the maximum labels from MGDM.
  • atlas_file (str, optional) – Path to plain text atlas file (default is stored in DEFAULT_ATLAS). or atlas name to be searched in ATLAS_DIR
  • extracted_region ({'left_cerebrum', 'right_cerebrum', 'cerebrum',) – ‘cerebellum’, ‘cerebellum_brainstem’, ‘subcortex’, ‘tissues(anat)’, ‘tissues(func)’, ‘brain_mask’} Region to be extracted from the MGDM segmentation.
  • normalize_probabilities (bool) – Whether to normalize the output probabilities to sum to 1 (default is False).
  • estimate_tissue_densities (bool) – Wheter to recompute partial volume densities from the probabilites (slow, default is False).
  • partial_volume_distance (float) – Distance in mm to use for tissues densities, if recomputed (default is 1mm).
  • save_data (bool) – Save output data to file (default is False)
  • overwrite (bool) – Overwrite existing results (default is False)
  • output_dir (str, optional) – Path to desired output directory, will be created if it doesn’t exist
  • file_name (str, optional) – Desired base name for output files with file extension (suffixes will be added)

Dictionary collecting outputs under the following keys (suffix of output files in brackets, # stands for shorthand names of the different extracted regions, respectively: rcr, lcr, cr, cb, cbs, sub, an, fn)

  • region_mask (niimg): Hard segmentation mask of the (GM) region of interest (_xmask-#gm)
  • inside_mask (niimg): Hard segmentation mask of the (WM) inside of the region of interest (_xmask-#wm)
  • background_mask (niimg): Hard segmentation mask of the (CSF) region background (_xmask-#bg)
  • region_proba (niimg): Probability map of the (GM) region of interest (_xproba-#gm)
  • inside_proba (niimg): Probability map of the (WM) inside of the region of interest (_xproba-#wm)
  • background_proba (niimg): Probability map of the (CSF) region background (_xproba-#bg)
  • region_lvl (niimg): Levelset surface of the (GM) region of interest (_xlvl-#gm)
  • inside_lvl (niimg): Levelset surface of the (WM) inside of the region of interest (_xlvl-#wm)
  • background_lvl (niimg): Levelset surface of the (CSF) region background (_xlvl-#bg)

Return type:



Original Java module by Pierre-Louis Bazin.

Examples using nighres.brain.extract_brain_region