ReferenceTissueParametricImage ======================================================================== .. py: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. .. rubric:: Example .. code-block:: python 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. :param reference_tac_path: Path to the reference region TAC file. :type reference_tac_path: str :param pet_image_path: Path to the 4D PET image on which kinetic analysis is performed. :type pet_image_path: str :param mask_image_path: Path to image that masks the brain in the same space as the PET image. :type mask_image_path: str :param output_directory: Path to folder where analysis is saved. :type output_directory: str :param output_filename_prefix: Prefix for output files saved after analysis. :type output_filename_prefix: str :param method: RTM method to run. Default 'mrtm2'. :type method: str :raises ValueError: When pet_image_path and mask_image_path are not in same physical space. .. py:method:: init_analysis_props(method: str) -> dict Initializes the analysis properties dict based on the specified RTM analysis method. :param method: RTM analysis method. Must be one of 'srtm', 'frtm', 'mrtm-original', 'mrtm' or 'mrtm2'. :type method: str :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. .. py:method:: set_analysis_props(props: dict, bounds: Union[None, numpy.ndarray] = None, k2_prime: float = None, t_thresh_in_mins: float = None) Set kwargs used for running parametric analysis. :param rtm_kwargs: Dictionary of kwargs fed into RTM analysis. :type rtm_kwargs: dict .. py:method:: run_parametric_analysis(bounds: Union[None, numpy.ndarray] = None, k2_prime: float = None, t_thresh_in_mins: float = None) Run the analysis. :param method: The method to be used in voxel-wise analysis. Currently only mrtm2 is implemented. :type method: str :param bounds: Bounds on fit parameters. See :py:func:`get_rtm_kwargs`. Default None. :type bounds: Union[None, np.ndarray] :param k2_prime: k2' value set for all voxel-wise analysis. Default None. :type k2_prime: float :param t_thresh_in_mins: Threshold time after which kinetic parameters are fit. Default None. :type t_thresh_in_mins: float :returns: *fit_results (np.ndarray, Tuple[np.ndarray, np.ndarray])* -- Kinetic parameters and simulated data returned as arrays. .. py:method:: save_parametric_images() Save parametric images. .. py:method:: 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`. :param None: :returns: None :raises IOError: An error occurred accessing the output_directory or while writing to the JSON :raises file.: .. seealso:: * :func:`save_analysis_properties` .. py:method:: __call__(bounds: numpy.ndarray = None, t_thresh_in_mins: float = None, k2_prime: float = None)