get_mask

formatreader.get_mask(selected_path: str, file_format: str, n_interp: int = 10, smooth_slices: bool = True, **kwargs)

Calls the corresponding function depending on the file format selected and retrieves its outputs.

Parameters:
  • selected_path (string) – Path to the selected folder or file.

  • file_format (string) – File format chosen in the GUI (nifti, tiff, dicom-seg, image).

  • n_interp (int) – Number of interpolated slices to generate between two real slices. The default is 10.

  • smooth_slices (boolean) – If True, calls the function smooth_mask() on each of the real slices. The default is True.

  • **kwargs

    Additional keyword arguments passed. mask_id : list of int

    Merge the specified mask ids into a single volume. Default = [0]. If [0] all masks are merged into a single point cloud.

    zsizefloat

    Distance between slices. Needed when loading slices from multiple single images.

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.