contour_from_3dmask

formatreader.contour_from_3dmask(mask, slices, n_interp: int = 10)

From a 3D array containing the semgentation and the list of slices, it creates a set of interpolated slices between each pair of adjacent real slices using the sliceinterpolator module. Finally, calls the function analyze_slice_opencv() on each slice (real and interpolated) to get its contour and outpouts the external points of the whole segmentation and the covers.

Parameters:
  • mask (Numpy array) – Array containing the segmentation.

  • slices (List) – List of the slices present in the array.

  • n_interp (int) – Number of interpolated slices to generate between two real slices. The default is 10.

Returns:

  • contours_3d (Numpy array) – Contains the contours of every slice in voxel coordinates.

  • covers (Numpy array) – Contains the points from the top and bottom slices.