nighres.microscopy.mgdm_cells(contrast_image1, contrast_type1, contrast_image2=None, contrast_type2=None, contrast_image3=None, contrast_type3=None, stack_dimension='2D', force_weight=0.6, curvature_weight=0.3, cell_threshold=0.1, max_iterations=200, min_change=0.0001, topology='wcs', topology_lut_dir=None, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

MGDM cell segmentation

Estimates cell structures using a Multiple Object Geometric Deformable Model (MGDM)

  • contrast_image1 (niimg) – First input image to perform segmentation on
  • contrast_type1 ({"centroid-proba", "local-maxima","foreground-proba",) – “image-intensities”} Contrast type of first input image
  • contrast_image2 (niimg, optional) – Additional input image to inform segmentation, must be in the same space as constrast_image1, requires contrast_type2
  • contrast_type2 (str, {"centroid-proba", "local-maxima","foreground-proba",) – “image-intensities”}, optional Contrast type of second input image
  • contrast_image3 (niimg, optional) – Additional input image to inform segmentation, must be in the same space as constrast_image1, requires contrast_type3
  • contrast_type3 ({"centroid-proba", "local-maxima","foreground-proba",) – “image-intensities”}, optional Contrast type of third input image
  • stack_dimension ({'2D','3D'}, optional) – Dimension of the data for processing, either a stack of independent 2D slices or a fully 3D stack
  • max_iterations (int, optional) – Maximum number of iterations per step for MGDM (default is 800, set to 1 for quick testing of registration of priors, which does not perform true segmentation)
  • min_change (float, optional) – Minimum amount of change in the segmentation for MGDM to stop (default is 0.001)
  • force_weight (float, optional) – Forces to drive MGDM to cell boundaries (default is 0.5)
  • curvature_weight (float, optional) – Curvature regularization forces (default is 0.1)
  • cell_threshold (float, optional) – Ratio of lower intensities from the local maximum to be included in a given cell (default is 0.1)
  • topology ({'wcs', 'no'}, optional) – Topology setting, choose ‘wcs’ (well-composed surfaces) for strongest topology constraint, ‘no’ for no topology constraint (default is ‘wcs’)
  • topology_lut_dir (str, optional) – Path to directory in which topology files are stored (default is stored in TOPOLOGY_LUT_DIR)
  • save_data (bool, optional) – Save output data to file (default is False)
  • overwrite (bool, optional) – 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)

  • segmentation (niimg): Hard brain segmentation with topological constraints (if chosen) (_mgdmc-seg)
  • distance (niimg): Minimum distance to a segmentation boundary (_mgdmc-dist)

Return type:



Original Java module by Pierre-Louis Bazin. Algorithm details can be found in [1] and [2]


[1]Bogovic, Prince and Bazin (2013). A multiple object geometric deformable model for image segmentation. doi:10.1016/j.cviu.2012.10.006.A
[2]Fan, Bazin and Prince (2008). A multi-compartment segmentation framework with homeomorphic level sets. DOI: 10.1109/CVPR.2008.4587475