linumpy.segmentation.brain#

Brain segmentation utilities.

Functions#

segment_oct_3d(vol[, k, use_log, threshold_method])

To segment an S-OCT brain in 3D using thresholding and morphological watershed.

fill_holes_2d_and_3d(mask)

Fill holes in a 2D or 3D mask.

remove_bottom(mask[, k, axis, inverse, fill_holes])

Remove the bottom side of the mask.

Module Contents#

linumpy.segmentation.brain.segment_oct_3d(vol, k=5, use_log=True, threshold_method='otsu')[source]#

To segment an S-OCT brain in 3D using thresholding and morphological watershed.

Parameters:
  • vol (numpy.ndarray) – The OCT brain to segment

  • k (int) – Median smoothing kernel size in pixel

  • use_log (bool) – Transform the pixel intensity with a log before computing mask

  • threshold_method (str) – ‘ostu’, ‘triangle’

Returns:

The brain mask

Return type:

ndarray

linumpy.segmentation.brain.fill_holes_2d_and_3d(mask)[source]#

Fill holes in a 2D or 3D mask.

Parameters:

mask (numpy.ndarray) – The mask to fill

Returns:

The filled mask

Return type:

ndarray

linumpy.segmentation.brain.remove_bottom(mask, k=10, axis=2, inverse=False, fill_holes=False)[source]#

Remove the bottom side of the mask.

Parameters:
  • mask (numpy.ndarray) – Mask to modify. The 3rd axis is assumed to be the dimension direction to modify.

  • k (int) – Number of pixel to erode

  • axis (int) – Axis to erode

  • inverse (bool) – Inverse the operation

  • fill_holes (bool) – Fill holes in the mask

Returns:

Modified mask

Return type:

ndarray