mymesh.curvature.ImageCurvature#

mymesh.curvature.ImageCurvature(I, NodeCoords=None, gaussian_sigma=1, voxelsize=1, brightobject=True, mode='wrap')[source]#

Calculate curvatures based on a 3D image. Curvature values are calculated for all voxels in the image, however, these curvature values are only meaningful at the surface of the imaged object(s). This can be used with utils.grid2fun, converter.im2voxel, contours.MarchingCubesImage to evaluate the voxel curvatures at points on the surface of the imaged object(s). Based on Curvature formulas for implicit curves and surfaces, Ron Goldman (2005). [Gol05]

Note

Errors can occur if surface is too close to the boundary of the image. Consider building in padding based on gaussian_sigma.

Parameters:
  • I (np.ndarray) – 3D array of grayscale voxel data.

  • NodeCoords (array_like) – If provided, curvature from the grid will be evaluated at these points and returned. If not, the returned values will be of the full image

  • gaussian_sigma (int, optional) – Standard deviation used in calculating image gradients (in voxels), by default 1. See scipy.ndimage.gaussian_filter.

  • voxelsize (int, float, optional) – Voxel size of the image, by default 1. This is necessary to determine the correct magnitudes of curvature. By default, the image coordinate system will be used, so principal curvatures will be in units of (voxel)^-1

  • brightobject (bool, optional) – Specifies whether the foreground of the image is bright or dark, by default True. If the imaged object is darker than the background, set brightobject=False. This is important for determining the directionality of curvatures.

  • mode (str, optional) – Method used for handling edges of the image. See scipy.ndimage.gaussian_filter

Returns:

  • MaxPrincipal (np.ndarray) – Maximum principal curvatures for either each voxel or each node (if NodeCoords is provided).

  • MinPrincipal (np.ndarray) – Minimum principal curvatures for either each voxel or each node (if NodeCoords is provided)

  • gaussian (np.ndarray) – Gaussian curvatures for either each voxel or each node (if NodeCoords is provided)

  • mean (np.ndarray) – Mean curvatures for either each voxel or each node (if NodeCoords is provided)