detectShock

xripl.segmentation.detectShock(image, originalImage=None, medianDisk=40, gradientDiskMarkers=10, gradientThreshold=10, gradientDiskWatershed=4, morphDisk=10, compactness=0, plots=True, nSegs=3)[source]

This is a convenience function for applying watershed segmentation using regions of low gradient as markers, and using another gradient image for processing via watershed.

Steps: 1st the image is denoised using a median filter 2nd the gradient of the image is obtained and thresholded to generate markers to be used for watershed segmentation. 3rd Morphological closing operation is applied to markers to make the region boundaries thicker and the marker regions more continous. 4th Another gradient image is generated, which will be processed via watershed. 5th The gradient image in step 4 and the markers from step 3 are processed using watershed segmentation.

Parameters
  • image (numpy.ndarray) – Image to be processed for shock detection.

  • originalImage (numpy.ndarray) – Original image, in case user want to plot contours and segments over a different image. Default is None.

  • medianDisk (int) – Size of disk used in median filter application.

  • gradientDiskMarkers (int) – Size of disk used in gradient function for determining watershed markers. This makes the gradient image smoother.

  • gradientThreshold (int) – Maximum size of gradient to be used for selecting watershed markers.

  • gradientDiskWatershed (int) – Size of disk used in gradient function for generating image to be processed by watershed. This makes the gradient image smoother.

  • morphDisk (int) – Size of disk used in morphological closing of markers image. This cleans up the markers into more continuous regions. If zero, then this step is skipped.

  • compactness (float) – Compactness parameter for watershed. See skimage.morphology.watershed().

  • plots (bool) – Flag for plotting results

  • nSegs (int) – Obtains contours of the largest segments by filled area.