undo_decay_correction#

petpal.preproc.decay_correction.undo_decay_correction(input_image_path: str, output_image_path: str, metadata_dict: dict = None) ants.ANTsImage#

Uses decay factors from the metadata for an image to remove decay correction for each frame.

This function expects to find decay factors in the .json sidecar file, or the metadata_dict, if given. If there are no decay factors (either under the key ‘DecayFactor’ or the BIDS-required ‘DecayCorrectionFactor’) listed, it may result in unexpected behavior. In addition to returning an ANTsImage containing the “decay uncorrected” data, the function writes an image to output_image_path, unless it is passed as ‘None’.

Parameters:
  • input_image_path (str) – Path to input (.nii.gz or .nii) image. A .json sidecar file should exist in the same directory as the input image.

  • output_image_path (str) – Path to output (.nii.gz or .nii) output image. If None, no image will be written.

  • metadata_dict (dict, optional) – Metadata dictionary to use instead of corresponding .json sidecar. If not specified (default behavior), function will try to use sidecar .json in the same directory as input_image_path.

Returns:

ants.ANTsImage – ANTsImage with decay correction reversed.