nifreeze.data.pet.io module

Input/Output utilities for PET objects.

nifreeze.data.pet.io.FRAME_TIME_START_KEY = 'FrameTimesStart'

PET frame time start key.

nifreeze.data.pet.io.TEMPORAL_FILE_KEY_ERROR_MSG = '{key} key not found in temporal file'

PET temporal file key error message.

nifreeze.data.pet.io.from_nii(filename: Path | str, temporal_file: Path | str, brainmask_file: Path | str | None = None) PET[source]

Load PET data from NIfTI, creating a PET object with appropriate metadata.

Parameters:
  • filename (os.pathlike) – The NIfTI file.

  • temporal_file (os.pathlike) – A JSON file containing temporal data. It must at least contain FrameTimesStart data.

  • brainmask_file (os.pathlike, optional) – A brainmask NIfTI file. If provided, will be loaded and stored in the returned dataset.

Returns:

A PET object storing the data, metadata, and any optional mask.

Return type:

PET

Raises:

RuntimeError – If FrameTimesStart is not provided (BIDS requires it).