nifreeze.model package

Data models.

class nifreeze.model.AverageDWIModel(self, dataset: nifreeze.data.dmri.DWI, stat: str = 'median', th_low: float = 100.0, th_high: float = 100.0, detrend: bool = False, **kwargs)[source]

Bases: ExpectationModel

A trivial model that returns an average DWI volume.

Implement object initialization.

Parameters:
  • dataset (DWI) – Reference to a DWI object.

  • stat (str, optional) – Whether the summary statistic to apply is "mean" or "median".

  • th_low (float, optional) – A lower bound for the b-value corresponding to the diffusion weighted images that will be averaged.

  • th_high (float, optional) – An upper bound for the b-value corresponding to the diffusion weighted images that will be averaged.

  • detrend (bool, optional) – Whether the overall distribution of each diffusion weighted image will be standardized and centered around the src.nifreeze.model.base.DEFAULT_CLIP_PERCENTILE percentile.

fit_predict(index, *_, **kwargs)[source]

Return the average map.

class nifreeze.model.DKIModel(self, dataset: nifreeze.data.dmri.DWI, **kwargs)[source]

Bases: BaseDWIModel

A wrapper of dipy.reconst.dki.DiffusionKurtosisModel.

Initialization.

Parameters:

dataset (DWI) – Reference to a DWI object.

class nifreeze.model.DTIModel(self, dataset: nifreeze.data.dmri.DWI, **kwargs)[source]

Bases: BaseDWIModel

A wrapper of dipy.reconst.dti.TensorModel.

Initialization.

Parameters:

dataset (DWI) – Reference to a DWI object.

class nifreeze.model.ExpectationModel(self, dataset, stat='median', **kwargs)[source]

Bases: BaseModel

A trivial model that returns an expectation map (for example, average).

Initialize a new model.

fit_predict(index: int, **kwargs)[source]

Return the expectation map.

Parameters:

index (int) – The volume index that is left-out in fitting, and then predicted.

class nifreeze.model.GPModel(self, dataset: nifreeze.data.dmri.DWI, **kwargs)[source]

Bases: BaseDWIModel

A wrapper of GaussianProcessModel.

Initialization.

Parameters:

dataset (DWI) – Reference to a DWI object.

class nifreeze.model.ModelFactory(self, /, *args, **kwargs)[source]

Bases: object

A factory for instantiating data models.

static init(model: str | None = None, **kwargs)[source]

Instantiate a diffusion model.

Parameters:

model (str) – Diffusion model. Options: "DTI", "DKI", "S0", "AverageDWI"

Returns:

model – A model object compliant with DIPY’s interface.

Return type:

ReconstModel

class nifreeze.model.PETModel(self, timepoints=None, xlim=None, n_ctrl=None, order=3, **kwargs)[source]

Bases: BaseModel

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

Create the B-Spline interpolating matrix.

Parameters:

timepointslist

The timing (in sec) of each PET volume. E.g., [15.,   45.,   75.,  105.,  135.,  165.,  210.,  270.,  330., 420.,  540.,  750., 1050., 1350., 1650., 1950., 2250., 2550.]

n_ctrlint

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.

fit(data, **kwargs)[source]

Fit the model.

property is_fitted
predict(index=None, **kwargs)[source]

Return the corrected volume using B-spline interpolation.

class nifreeze.model.TrivialModel(self, dataset, predicted=None, **kwargs)[source]

Bases: BaseModel

A trivial model that returns a given map always.

Implement object initialization.

fit_predict(*_, **kwargs)[source]

Return the reference map.

Submodules