nifreeze.model package

Data models.

class nifreeze.model.AverageDWModel(self, **kwargs)[source]

Bases: BaseDWIModel

A trivial model that returns an average map.

Implement object initialization.

Parameters:
  • th_low (numbers.Number) – A lower bound for the b-value corresponding to the diffusion weighted images that will be averaged.

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

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

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

fit(data, **kwargs)[source]

Calculate the average.

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

Return the average map.

class nifreeze.model.AverageModel(self, **kwargs)[source]

Bases: BaseModel

A trivial model that returns an average map.

Initialize a new model.

fit(data, **kwargs)[source]

Calculate the average.

property is_fitted
predict(*_, **kwargs)[source]

Return the average map.

class nifreeze.model.DKIModel(self, gtab, S0=None, b_max=None, **kwargs)[source]

Bases: BaseDWIModel

A wrapper of dipy.reconst.dki.DiffusionKurtosisModel.

Initialization.

Parameters:
  • gtab (numpy.ndarray) – An \(N imes 4\) table, where rows (N) are diffusion gradients and columns are b-vector components and corresponding b-value, respectively.

  • S0 (numpy.ndarray) – \(S_{0}\) signal.

  • b_max (int) – Maximum value to cap b-values.

class nifreeze.model.DTIModel(self, gtab, S0=None, b_max=None, **kwargs)[source]

Bases: BaseDWIModel

A wrapper of dipy.reconst.dti.TensorModel.

Initialization.

Parameters:
  • gtab (numpy.ndarray) – An \(N imes 4\) table, where rows (N) are diffusion gradients and columns are b-vector components and corresponding b-value, respectively.

  • S0 (numpy.ndarray) – \(S_{0}\) signal.

  • b_max (int) – Maximum value to cap b-values.

class nifreeze.model.GPModel(self, gtab, S0=None, b_max=None, **kwargs)[source]

Bases: BaseDWIModel

A wrapper of GaussianProcessModel.

Initialization.

Parameters:
  • gtab (numpy.ndarray) – An \(N imes 4\) table, where rows (N) are diffusion gradients and columns are b-vector components and corresponding b-value, respectively.

  • S0 (numpy.ndarray) – \(S_{0}\) signal.

  • b_max (int) – Maximum value to cap b-values.

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

Bases: object

A factory for instantiating diffusion models.

static init(model='DTI', **kwargs)[source]

Instantiate a diffusion model.

Parameters:

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

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, predicted=None, **kwargs)[source]

Bases: BaseModel

A trivial model that returns a given map always.

Implement object initialization.

fit(data, **kwargs)[source]

Do nothing.

property is_fitted
predict(*_, **kwargs)[source]

Return the b=0 map.

Submodules