topology_correction

nighres.shape.topology_correction(image, shape_type, connectivity='wcs', propagation='object->background', minimum_distance=1e-05, topology_lut_dir=None, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

Topology correction

Corrects the topology of a binary image, a probability map or a levelset surface to spherical with a fast marching technique [1].

Parameters:
  • image (niimg) – Image representing the shape of interest
  • shape_type ({'binary_object','probability_map','signed_distance_function'}) – Which type of image is used as input
  • connectivity ({'wcs','6/18','6/26','18/6','26/6'}) – What connectivity type to use (default is wcs: well-composed surfaces)
  • propagation ({'object->background','background->object'}) – Which direction to use to enforce topology changes (default is ‘object->background’ )
  • minimum_distance (float, optional) – Minimum distance to impose between successive voxels (default is 1e-5)
  • 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)
Returns:

Dictionary collecting outputs under the following keys (suffix of output files in brackets)

  • corrected (niimg): Corrected image (output file suffix _tpc-img)
  • object (niimg): Corrected binary object (output file suffix _tpc-obj)

Return type:

dict

Notes

Original Java module by Pierre-Louis Bazin

References

[1]Bazin and Pham (2007). Topology correction of segmented medical images using a fast marching algorithm doi:10.1016/j.cmpb.2007.08.006