get_mask_nifti

formatreader.get_mask_nifti(filename: str, mask_id=[0], n_interp: int = 10, smooth_slices: bool = True)

Retrieves the surface points of the 3D volume defined by a NIfTI file.

Parameters:
  • filename (str) – Path to the NIfTI file.

  • mask_id (int default = 0. If 0 all masks are merged into a single point cloud) –

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

  • smooth_slices (boolean) – If True, binary slices are smoothed via erosion/dilation operations. Default = True

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.

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