DecayFix ======================================== .. py:class:: petpal.preproc.decay_correction.DecayFix(image_loader: Optional[petpal.io.image.ImageLoader] = None) Bases: :py:obj:`DecayCorrect` Special case for decay correction where the dynamic PET image was scaled with the wrong isotope but JSON metadata retains accurate decay correction factors. .. py:method:: fix_factor(input_image_path: str, isotope_to_remove: str) -> numpy.ndarray[float] Get ratio of the expected decay correction factor to the factor that was incorrectly applied to PET image. :param input_image_path: Path to dynamic PET image. :type input_image_path: str :param isotope_to_remove: Name of the isotope that was incorrectly used to scale dynamic PET image, such as 'o15' or 'c11'. :type isotope_to_remove: str :returns: *fix_factor (np.ndarray[float])* -- Scalar array with the correction factor to apply to each frame in dynamic PET. .. py:method:: __call__(input_image_path: str, output_image_path: str, isotope_to_remove: str) Calculate correction factor based on the accurate metadata and name of the isotope incorrectly used to scale image data. :param input_image_path: Path to dynamic PET image. :type input_image_path: str :param output_image_path: Path to where corrected image is saved. :type output_image_path: str :param isotope_to_remove: Name of the isotope that was incorrectly used to scale dynamic PET image, such as 'o15' or 'c11'. :type isotope_to_remove: str .. py:method:: apply_factor(input_image_path: str, correction_factor: numpy.ndarray[float]) Apply fix factor to image and write output. :param input_image_path: Path to dynamic PET image. :type input_image_path: str :param correction_factor_path: Path to file with correction factors, one per frame. File must have exactly one column, with a header followed by one scalar per line. :type correction_factor_path: str .. py:method:: save_modified_pet(input_image_path: str, output_image_path: str) Save the modified PET image :param input_image_path: Path to dynamic PET image. :type input_image_path: str :param output_image_path: Path to where corrected image is saved. :type output_image_path: str .. py:method:: decay_correct_factor_from_file(input_image_path: str, output_image_path: str, correction_factor_path: str) Apply a set of correction factors to each frame in a PET image. Provide path to dynamic PET image, path to where corrected image is saved, and path to a file containing factors for each frame. File containing correction factors must have exactly one column, with a header followed by one scalar per line to apply to the corresponding frame in the PET. Reads image and correction factors, applies them, and saves result. :param input_image_path: Path to dynamic PET image. :type input_image_path: str :param output_image_path: Path to where corrected image is saved. :type output_image_path: str :param correction_factor_path: Path to file with correction factors, one per frame. File must have exactly one column, with a header followed by one scalar per line. :type correction_factor_path: str