nifreeze.model.dmri module

class nifreeze.model.dmri.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.dmri.BaseDWIModel(self, gtab, S0=None, b_max=None, **kwargs)[source]

Bases: BaseModel

Interface and default methods for DWI models.

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.

fit(data, n_jobs=None, **kwargs)[source]

Fit the model chunk-by-chunk asynchronously

predict(gradient=None, **kwargs)[source]

Predict asynchronously chunk-by-chunk the diffusion signal.

nifreeze.model.dmri.DEFAULT_CLIP_PERCENTILE = 75

Upper percentile threshold for intensity clipping.

nifreeze.model.dmri.DEFAULT_HIGHB_THRESHOLD = 10000

A b-value cap for DWI data.

nifreeze.model.dmri.DEFAULT_LOWB_THRESHOLD = 50

The lower bound for the b-value so that the orientation is considered a DW volume.

nifreeze.model.dmri.DEFAULT_MAX_BVAL = 8000

Maximum b-value cap.

nifreeze.model.dmri.DEFAULT_MAX_BVALUE = 1000

Maximum allowed value for the b-value.

nifreeze.model.dmri.DEFAULT_MAX_S0 = 1.0

Maximum value when considering the \(S_{0}\) DWI signal.

nifreeze.model.dmri.DEFAULT_MIN_S0 = 1e-05

Minimum value when considering the \(S_{0}\) DWI signal.

nifreeze.model.dmri.DEFAULT_MULTISHELL_BIN_COUNT_THR = 7

Default bin count to consider a multishell scheme.

nifreeze.model.dmri.DEFAULT_NUM_BINS = 15

Number of bins to classify b-values.

class nifreeze.model.dmri.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.dmri.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.dmri.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.

nifreeze.model.dmri.find_shelling_scheme(bvals, num_bins=15, multishell_nonempty_bin_count_thr=7, bval_cap=8000)[source]

Find the shelling scheme on the given b-values.

Computes the histogram of the b-values according to num_bins and depending on the nonempty bin count, classify the shelling scheme as single-shell if they are 2 (low-b and a shell); multi-shell if they are below the multishell_nonempty_bin_count_thr value; and DSI otherwise.

Parameters:
  • bvals (list or ndarray) – List or array of b-values.

  • num_bins (int, optional) – Number of bins.

  • multishell_nonempty_bin_count_thr (int, optional) – Bin count to consider a multi-shell scheme.

Returns:

  • scheme (str) – Shelling scheme.

  • bval_groups (list) – List of grouped b-values.

  • bval_estimated (list) – List of ‘estimated’ b-values as the median value of each b-value group.