get_hdr_metadata

bidsaid.metadata.get_hdr_metadata(metadata_name, nifti_file_or_img=None, nifti_header=None, return_header=False)[source]

Get metadata from a NIfTI header.

Parameters

metadata_namestr

Name of the metadata field to return.

nifti_file_or_imgstr, Path, or Nifti1Image, default=None

Path to the NIfTI file or a NIfTI image. Must be specified if nifti_header is None.

nifti_headerNifti1Header, default=None

Path to the NIfTI file or a NIfTI image. Must be specified if nifti_file_or_img is None.

return_headerbool

Returns the NIfTI header

Returns

Any or tuple[Any, Nifti1Header]

If return_header is False, only returns the associated value of the metadata. If return_header is True returns a tuple containing the assoicated value of the metadata and the NIfTI header.