replace_probabilistic_region ============================================================== .. py:function:: petpal.preproc.segmentation_tools.replace_probabilistic_region(segmentation_numpy: numpy.ndarray, segmentation_zooms: list, blur_size_mm: float, regions: list, regions_to_replace: list) Runs a correction on a segmentation by replacing a list of regions with a set of nearby regions. This is accomplished by creating masks of the nearby regions, blurring them to create probabilistic segmentation maps, finding the highest probability nearby region in the region to replace, and replacing values with the respective nearby region. This is useful for protocols where there residual regions not intended to be carried forward after generating new regions or merging segmentations. :param segmentation_numpy: Input segmentation array. :type segmentation_numpy: np.ndarray :param segmentation_zooms: X,Y,Z side length of voxels in mm. :type segmentation_zooms: list :param blur_size_mm: FWHM of Gaussian kernal used to blur regions. :type blur_size_mm: float :param regions: List of region indices to replace residual regions. :type regions: list :param regions_to_replace: List of regions to be replaced by nearby regions listed in ``regions``. :type regions_to_replace: list :returns: *segmentation_numpy (np.ndarray)* -- The input segmentation with replaced regions.