ReferenceTissueParametricImage#
- class petpal.kinetic_modeling.parametric_images.ReferenceTissueParametricImage(reference_tac_path: str, pet_image_path: str, mask_image_path: str, output_directory: str, output_filename_prefix: str, method: str = 'mrtm2')#
Class for generating parametric images of 4D-PET images using reference tissue model (RTM) methods.
Example
from petpal.kinetic_modeling import parametric_images rtm_parametric = ReferenceTissueParametricImage(reference_tac_path='/path/to/tac.tsv', pet_image_path='/path/to/pet.nii.gz', mask_image_path='/path/to/mask.nii.gz', output_directory='/path/to/output, output_filename_prefix='sub-001_mrtm2') rtm_parametric.run_parametric_analysis(method='mrtm2', k2_prime=0.01, t_thresh_in_mins=30) rtm_parametric.save_parametric_images()
Initialize ReferenceTissueParametricImage with input values.
- Parameters:
reference_tac_path (str) – Path to the reference region TAC file.
pet_image_path (str) – Path to the 4D PET image on which kinetic analysis is performed.
mask_image_path (str) – Path to image that masks the brain in the same space as the PET image.
output_directory (str) – Path to folder where analysis is saved.
output_filename_prefix (str) – Prefix for output files saved after analysis.
method (str) – RTM method to run. Default ‘mrtm2’.
- Raises:
ValueError – When pet_image_path and mask_image_path are not in same physical space.
- init_analysis_props(method: str) dict#
Initializes the analysis properties dict based on the specified RTM analysis method.
- Parameters:
method (str) – RTM analysis method. Must be one of ‘srtm’, ‘frtm’, ‘mrtm-original’, ‘mrtm’ or ‘mrtm2’.
- Returns:
dict – A dictionary containing method-specific property keys and default values.
- Raises:
ValueError – If input method is not one of the supported RTM methods.
- set_analysis_props(props: dict, bounds: None | numpy.ndarray = None, k2_prime: float = None, t_thresh_in_mins: float = None)#
Set kwargs used for running parametric analysis.
- Parameters:
rtm_kwargs (dict) – Dictionary of kwargs fed into RTM analysis.
- run_parametric_analysis(bounds: None | numpy.ndarray = None, k2_prime: float = None, t_thresh_in_mins: float = None)#
Run the analysis.
- Parameters:
method (str) – The method to be used in voxel-wise analysis. Currently only mrtm2 is implemented.
bounds (Union[None, np.ndarray]) – Bounds on fit parameters. See
get_rtm_kwargs(). Default None.k2_prime (float) – k2’ value set for all voxel-wise analysis. Default None.
t_thresh_in_mins (float) – Threshold time after which kinetic parameters are fit. Default None.
- Returns:
fit_results (np.ndarray, Tuple[np.ndarray, np.ndarray]) –
- Kinetic parameters and
simulated data returned as arrays.
- save_parametric_images()#
Save parametric images.
- save_analysis_properties()#
Saves the analysis properties to a JSON file in the output directory.
This method involves saving a dictionary of analysis properties, which include file paths, analysis method, start and end frame times, threshold time, number of points fitted, and various properties like the maximum, minimum, mean, and variance of slopes and intercepts found in the analysis. These analysis properties are written to a JSON file in the output directory with the name following the pattern {output_filename_prefix}-analysis-props.json.
- Parameters:
None
- Returns:
None
- Raises:
IOError – An error occurred accessing the output_directory or while writing to the JSON
file. –
See also
- __call__(bounds: numpy.ndarray = None, t_thresh_in_mins: float = None, k2_prime: float = None)#