nifreeze.model.gqi module

Classes and functions for generalized q-sampling

class nifreeze.model.gqi.GeneralizedQSamplingFit(self, model, data)[source]

Bases: ReconstFit

Calculates PDF and ODF for a single voxel

Parameters:
  • model (object,) – DiffusionSpectrumModel

  • data (1d ndarray,) – signal values

fit(data, *, mask=None)[source]
odf()[source]

Calculates the discrete ODF for a given discrete sphere.

predict(gtab, *, S0=None)[source]

Predict using the fit model.

class nifreeze.model.gqi.GeneralizedQSamplingModel(self, gtab, *, method='standard', sampling_length=1.2, normalize_peaks=False, sphere=None)[source]

Bases: ReconstModel

Generalized Q-Sampling Imaging.

fit(data, **kwargs)[source]
predict(odf, *, S0=None)[source]

Predict a signal for this GeneralizedQSamplingModel instance given parameters.

Parameters:
  • odf (ndarray) – Map of ODFs.

  • gtab (ndarray) – Orientations where signal will be simulated

  • sphere (Sphere) – A sphere object, must be the same used for calculating the ODFs.

nifreeze.model.gqi.equatorial_maximum(vertices, odf, pole, width)[source]
nifreeze.model.gqi.equatorial_zone_vertices(vertices, pole, *, width=5)[source]

finds the ‘vertices’ in the equatorial zone conjugate to ‘pole’ with width half ‘width’ degrees

nifreeze.model.gqi.gqi_kernel(gtab, param_lambda, sphere, method='standard')[source]
nifreeze.model.gqi.normalize_qa(qa, *, max_qa=None)[source]

Normalize quantitative anisotropy.

Used mostly with GQI rather than GQI2.

Parameters:
  • qa (array, shape (X, Y, Z, N)) – where N is the maximum number of peaks stored

  • max_qa (float,) – maximum qa value. Usually found in the CSF (corticospinal fluid).

Returns:

nqa – normalized quantitative anisotropy

Return type:

array, shape (x, Y, Z, N)

Notes

Normalized quantitative anisotropy has the very useful property to be very small near gray matter and background areas. Therefore, it can be used to mask out white matter areas.

nifreeze.model.gqi.npa(self, odf, *, width=5)[source]

non-parametric anisotropy

Nimmo-Smith et al. ISMRM 2011

nifreeze.model.gqi.odf_sum(odf)[source]
nifreeze.model.gqi.patch_maximum(vertices, odf, pole, width)[source]
nifreeze.model.gqi.patch_sum(vertices, odf, pole, width)[source]
nifreeze.model.gqi.patch_vertices(vertices, pole, width)[source]

find ‘vertices’ within the cone of ‘width’ degrees around ‘pole’

nifreeze.model.gqi.polar_zone_vertices(vertices, pole, *, width=5)[source]

finds the ‘vertices’ in the equatorial band around the ‘pole’ of radius ‘width’ degrees

nifreeze.model.gqi.prediction_kernel(gtab, param_lambda, sphere, method='standard')[source]

Predict a signal given the ODF.

Parameters:
  • odf (ndarray) – ODF parameters.

  • gtab (GradientTable) – The gradient table for this prediction

Notes

The predicted signal is given by:

\[S(\theta, b) = K_{ii}^{-1} \cdot ODF\]

where $K_{ii}^{-1}$, is the inverse of the GQI kernels for the direction(s) $ii$ given by gtab.

nifreeze.model.gqi.squared_radial_component(x, *, tol=0.01)[source]

Part of the GQI2 integral.

nifreeze.model.gqi.triple_odf_maxima(vertices, odf, width)[source]
nifreeze.model.gqi.upper_hemi_map(v)[source]

maps a 3-vector into the z-upper hemisphere