get_mask_from_images

formatreader.get_mask_from_images(dirname, ext, z_size=30.0, n_interp=10, smooth_slices=True)

Retrieves the surface points of the 3D volume defined in multiple individual images. Images are automatically binarized via Otsu thresholding.

Parameters:
  • dirname (string) – The directory containing the images.

  • ext (string) – File extension (ej: .jpg, .png).

  • z_size (float) – Vertical distance between slices.

  • n_interp (int) – Number of slices interpolated between every consecutive original images. Default = 10.

  • smooth_slices (bool) – If True, original binarized images are smoothed via erosion/dilation operations. Default = True

Returns:

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

  • covers (Numpy array) – Contains the points from the top and bottom slices. Needed to close the .stl geometry.

  • transf_mat (Numpy array) – Transformation matrix to convert from voxel coordinates to space coordinates.