get_n_slices

bidsaid.metadata.get_n_slices(nifti_file_or_img, slice_axis=None, verbose=False)[source]

Gets the number of slices from the header of a NIfTI image.

Parameters

nifti_file_or_imgstr, Path, or Nifti1Image

Path to the NIfTI file or a NIfTI image.

slice_axisLiteral["i", "j", "k"] or None, default=None

Axis the image slices were collected in. If None, determines the slice axis using metadata (“slice_end”) from the NIfTI header.

verbosebool, default=False

Logs information.

Returns

int

The number of slices.