protoclass.extraction.ToftsQuantificationExtraction¶
-
class
protoclass.extraction.
ToftsQuantificationExtraction
(base_modality, T10, r1, hematocrit=0.42, random_state=None)[source]¶ Enhancement signal extraction from temporal modality.
Parameters: base_modality : object
The base modality on which the normalization will be applied. The base modality should inherate from TemporalModality class.
T10 : float
Relaxation time without contrast agent. Perfectly it should be given using a T1 map. We do not have such data for the moment. The unit is s.
r1 : float
Relaxivity of the contrast agent. The unit is mmol.L.s^{-1}.
hematocrit : float, optional (default=0.42)
Hematrocrit level in percentage.
Attributes
base_modality (object) The base modality on which the normalization will be applied. The base modality should inherate from TemporalModality class. roi_data_ (ndarray, shape flexible) Corresponds to the index to consider in order to fit the data. T10_ (float) Relaxation time without contrast agent. Perfectly it should be given using a T1 map. We do not have such data for the moment. The unit is s. r1 (float) Relaxivity of the contrast agent. The unit is mmol.L.s^{-1}. hematocrit_ (float) Hematrocrit level in percentage. TR_ (float) Repetition time in s units. flip_angle (float) Flip angle in deg units. cb_t_ (ndarray, shape (n_series, )) The blood concentration associated with the AIF. cp_t_ (ndarray, shape (n_series, )) The plasma concentration associated with the AIF. start_enh_ (int) The time index from which the contrast appear in the blood. Methods
compute_aif
(dce_modality[, n_clusters, ...])Determine the AIF by segmenting the aorta in the kinetic sequence. conc_to_signal
(conc, s_pre_contrast)Given the concentration compute the MRI signal using FLASH sequence. fit
(modality[, ground_truth, cat, fit_aif, ...])Find the parameters needed to apply the extraction. load_from_pickles
(filename)Function to load a normalization object. population_based_aif
(modality[, A, T, ...])Generate an AIF from a population-based AIF. save_to_pickles
(filename)Function to save a normalizatio object using pickles. signal_to_conc
(signal, s_pre_contrast)Given the MRI signal compute the concentration using FLASH sequence. transform
(modality[, ground_truth, cat, kind])Extract the data from the given modality. Methods
__init__
(base_modality, T10, r1[, ...])compute_aif
(dce_modality[, n_clusters, ...])Determine the AIF by segmenting the aorta in the kinetic sequence. conc_to_signal
(conc, s_pre_contrast)Given the concentration compute the MRI signal using FLASH sequence. fit
(modality[, ground_truth, cat, fit_aif, ...])Find the parameters needed to apply the extraction. load_from_pickles
(filename)Function to load a normalization object. population_based_aif
(modality[, A, T, ...])Generate an AIF from a population-based AIF. save_to_pickles
(filename)Function to save a normalizatio object using pickles. signal_to_conc
(signal, s_pre_contrast)Given the MRI signal compute the concentration using FLASH sequence. transform
(modality[, ground_truth, cat, kind])Extract the data from the given modality. -
static
compute_aif
(dce_modality, n_clusters=6, eccentricity=0.5, diameter=(10.0, 20.0), area=(100.0, 400.0), thres_sel=0.9, estimator='median', random_state=None)[source]¶ Determine the AIF by segmenting the aorta in the kinetic sequence.
Parameters: dce_modality : object DCEModality
The modality to use to compute the AIF, signal.
n_clusters : int, optional (default=6)
The number of clusters to use to make the detection of the zone of interest to later segment the aorta or veins.
eccentricity : float, optional (default=.5)
The eccentricity is the ratio of the focal distance (distance between focal points) over the major axis length. The value is in the interval [0, 1). When it is 0, the ellipse becomes a circle. Greater is more permissive and find more regions of interest.
diameter : tuple of float, optional (default=(10., 20.))
Tuple of the minimum and maximum value of the diameters of the region. The region having a diameter included in this interval will be kept as potential region.
area : tuple of float, optional (default=(100., 400.))
Tuple of the minimum and maximum area in between which the region of interest will be kept.
thres_sel : float, optional (default=0.9)
For each region detected only the voxels with an enhancement greater than this threshold will be kept to compute the final AIF. The value should be in the range [0., 1.].
estimator : str, optional (default=’median’)
The estimator used to estimate the AIF from the segmented region. Can be the following: ‘median’, ‘max’, and ‘mean’
random_state : integer or numpy.RandomState, optional (default=None)
The generator used to initialize the centers. If an integer is given, it fixes the seed. Defaults to the global numpy random number generator.
Returns: aif : ndarray, shape (n_series, )
The estimated AIF signal in au.
Notes
The selection of the most enhanced voxels is done to address the problem of partial volume effects. The proposed thresholding is taken from [R1].
References
[R1] (1, 2) Schabel, Matthias C., and Dennis L. Parker. “Uncertainty and bias in contrast concentration measurements using spoiled gradient echo pulse sequences.” Physics in medicine and biology 53.9 (2008): 2345.
-
conc_to_signal
(conc, s_pre_contrast)[source]¶ Given the concentration compute the MRI signal using FLASH sequence.
Parameters: conc : ndarray, shape (n_series, )
Concentration in mMol.
s_pre_contrast : float
Signal before injection of contrast agent.
Returns: signal : ndarray, shape (n_series, )
Concentration related to the signal.
Notes
The nonlinear approach is based on [R2].
References
[R2] (1, 2) Dale, B. M., Jesberger, J. A., Lewin, J. S., Hillenbrand, C. M., & Duerk, J. L. (2003). Determining and optimizing the precision of quantitative measurements of perfusion from dynamic contrast enhanced MRI. Journal of Magnetic Resonance Imaging, 18(5), 575-584.
-
fit
(modality, ground_truth=None, cat=None, fit_aif=True, aif_params=[[48.54, 19.8], [10.2276, 21.9], [3.378, 7.92], 1.05, 0.0028083, 0.63463, 28.98])[source]¶ Find the parameters needed to apply the extraction.
Parameters: modality : object of type TemporalModality
The modality object of interest.
ground-truth : object of type GTModality or None
The ground-truth of GTModality. If None, the whole data will be considered.
cat : str or None
String corresponding at the ground-truth of interest. Cannot be None if ground-truth is not None.
fit_aif : bool, optional (default=True)
Either to estimate the AIF from the data or from a population-based studdy.
aif_params : list
In case that fit_aif is False, the list of the parameters for the population-based AIF can be given.
-
load_from_pickles
(filename)¶ Function to load a normalization object.
Parameters: filename : str
Filename to the pickle file. The extension should be .p.
Returns: bpp : object
Returns the loaded object.
-
static
population_based_aif
(modality, A=(48.54, 19.8), T=(10.2276, 21.9), sigma=(3.378, 7.92), alpha=1.05, beta=0.0028083, s=0.63463, tau=28.98, delay=0)[source]¶ Generate an AIF from a population-based AIF.
The model is based on a mixture of 2 Guassians plus an exponential modulated with a sigmoid function.
Parameters: A : tuple of 2 floats, optional (default=(48.54, 19.8))
Scaling constants of the Gaussians.
T : tuple of 2 floats, optional (default=(10.2276, 21.9))
Center of the Gaussians.
sigma : tuple of 2 floats, optional (default=(3.378, 7.92))
Width of the Gaussians.
alpha : float, optional (default=1.050)
Amplitude of the exponential.
beta : float, optional (default=0.0028083)
Decay of the exponential.
s : float, optional (default=0.63463)
Width of the sigmoid.
tau : float, optional (default=28.98)
Center of the sigmoid.
delay : int, optional (default=0)
From which time (index) the AIF will start.
Returns: cb_t : ndarray, shape (n_serie, )
Concentration in mMol of the an population-based AIF.
Notes
The method is based on [R3]. The default parameters have been found infered from 67 AIFs.
References
[R3] (1, 2) Parker, G.J., Roberts, C., Macdonald, A., Buonaccorsi, G.A., Cheung, S., Buckley, D.L., Jackson, A., Watson, Y., Davies, K. and Jayson, G.C. (2006). Experimentally-derived functional form for a population-averaged high-temporal-resolution arterial input function for dynamic contrast-enhanced MRI. Magnetic resonance in medicine, 56(5), 993-1000.
-
save_to_pickles
(filename)¶ Function to save a normalizatio object using pickles.
Parameters: filename : str
Filename to the pickle file. The extension should be .p.
Returns: None
-
signal_to_conc
(signal, s_pre_contrast)[source]¶ Given the MRI signal compute the concentration using FLASH sequence.
Parameters: signal : ndarray, shape (n_series, )
Signal obtained from the DCE modality.
s_pre_contrast : float or ndarray, shape (n_series, )
Signal before injection of contrast agent.
Returns: C_t : ndarray, shape (n_series, )
Concentration related to the signal in mMol.
Notes
The nonlinear approach is based on [R4].
References
[R4] (1, 2) Dale, B. M., Jesberger, J. A., Lewin, J. S., Hillenbrand, C. M., & Duerk, J. L. (2003). Determining and optimizing the precision of quantitative measurements of perfusion from dynamic contrast enhanced MRI. Journal of Magnetic Resonance Imaging, 18(5), 575-584.
-
transform
(modality, ground_truth=None, cat=None, kind='extended')[source]¶ Extract the data from the given modality.
Parameters: modality : object of type TemporalModality
The modality object of interest.
ground-truth : object of type GTModality or None
The ground-truth of GTModality. If None, the whole data will be considered.
cat : str or None
String corresponding at the ground-truth of interest. Cannot be None if ground-truth is not None.
kind : string, optional (default=’extended’)
Type of Tofts model to use: ‘regular’ or ‘extended’.
Returns
——
data : ndarray, shape (n_sample, n_feature)
A matrix containing the features extracted. The number of samples is equal to the number of positive label in the ground-truth. The feature will be the following:
- If ‘regular’: 1st feature will be Ktrans and the 2nd will be
ve. - If ‘extended’: 1st feature will be Ktrans, the 2nd will be ve, and the third will be vp.
-
static