mymesh.mesh.mesh.imread#

mesh.imread(voxelsize, scalefactor=1, scaleorder=1, return_nodedata=False, return_gradient=False, gaussian_sigma=1, threshold=None, crop=None, threshold_direction=1)[source]#

Load an image into a voxel mesh. :func:~mymesh.converter.im2voxel is used to perform the conversion.

Parameters:
  • img (str or np.ndarray) – If a str, should be the directory to an image stack of tiff or dicom files. If an array, shoud be a 3D array of image data.

  • voxelsize (float) – Size of voxel (based on image resolution).

  • scalefactor (float, optional) – Scale factor for resampling the image. If greater than 1, there will be more than 1 elements per voxel. If less than 1, will coarsen the image, by default 1.

  • scaleorder (int, optional) – Interpolation order for scaling the image (see scipy.ndimage.zoom), by default 1. Must be 0-5.

  • threshold (float, optional) – Voxel intensity threshold, by default None. If given, elements with all nodes less than threshold will be discarded.

Returns:

M – Mesh object, containing image data for elements and nodes in M.ElemData[‘Image Data’] and M.NodeData[‘Image Data’].

Return type:

mesh.mesh