nifreeze.model.pet module

Models for nuclear imaging.

class nifreeze.model.pet.BSplinePETModel(self, dataset: nifreeze.data.pet.base.PET, n_ctrl: int | None = None, order: int = 3, **kwargs)[source]

Bases: BasePETModel

A PET imaging realignment model based on B-Spline approximation.

Create the B-Spline interpolating matrix.

Parameters:
  • n_ctrl (int, optional) – Number of B-Spline control points. If None, then one control point every six timepoints will be used. The less control points, the smoother is the model.

  • order (int, optional) – Order of the B-Spline approximation.

fit_predict(index: int | None = None, **kwargs) ndarray | None[source]

Return the corrected volume using B-spline interpolation.

Predictions for times earlier than the configured start time will return the prediction for the start time.

class nifreeze.model.pet.BasePETModel(self, dataset: nifreeze.data.pet.base.PET, start_index: int | None = None, smooth_fwhm: float = 10.0, thresh_pct: float = 20.0, **kwargs)[source]

Bases: BaseModel, ABC

Interface and default methods for PET models.

Initialization.

Parameters:
  • start_index (int, optional) – If provided, the model will be fitted using only timepoints starting from this index (inclusive). Predictions for timepoints earlier than the specified start will reuse the predicted volume for the start timepoint. This is useful, for example, to discard a number of frames at the beginning of the sequence, which due to their little SNR may impact registration negatively.

  • smooth_fwhm (obj:float, optional) – FWHM in mm over which to smooth the signal.

  • thresh_pct (obj:float, optional) – Thresholding percentile for the signal.

abstract fit_predict(index: int | None = None, **kwargs) ndarray | None[source]

Predict the corrected volume.

property is_fitted: bool
nifreeze.model.pet.DEFAULT_TIMEPOINT_TOL = 0.01

Time frame tolerance in seconds.

nifreeze.model.pet.PET_MIDFRAME_ERROR_MSG = "Dataset MUST have a 'midframe'."

PET midframe error message.

nifreeze.model.pet.PET_OBJECT_ERROR_MSG = 'Dataset MUST be a PET object.'

PET object error message.

nifreeze.model.pet.START_INDEX_RANGE_ERROR_MSG = "'start_index' must be within the range of the dataset 'midframe' length."

PET model fitting start index allowed values error.