PetPvc#
- class petpal.preproc.partial_volume_corrections.PetPvc#
Handles operations for PET partial volume correction using a Docker container.
This class manages the setup and execution of processes using the PETPVC package, accessible via PETPVC on GitHub and a Docker image hosted on DockerHub. It manages image retrieval, input/output setup, and command execution.
- Variables:
client (docker.DockerClient) – A Docker client connected to the local system.
image_name (str) – The Docker image name to use for PETPVC processes.
Examples
Initialize the PETPVC handler and run a correction process:
from petpvc_module import PetPvc petpvc_handler = PetPvc() petpvc_handler.run_petpvc( pet_4d_filepath="/path/to/input/pet_image.nii", output_filepath="/path/to/output/corrected_pet_image.nii", pvc_method="RBV", psf_dimensions=(6.0, 6.0, 6.0), mask_filepath="/path/to/input/brain_mask.nii", verbose=True)
Initializes the PetPvc instance and ensures the required Docker image is available.
- run_petpvc(pet_4d_filepath: str, output_filepath: str, pvc_method: str, psf_dimensions: Tuple[float, float, float] | float, mask_filepath: str = None, verbose: bool = False, debug: bool = False) None#
Executes the PETPVC correction process within a Docker container.
- Parameters:
pet_4d_filepath (str) – The file path to the input 4D PET image.
output_filepath (str) – The file path where the output image should be saved.
pvc_method (str) – The partial volume correction method to apply.
psf_dimensions (Union[Tuple[float, float, float], float]) – The full-width half-max (FWHM) in mm along x, y, z axes.
mask_filepath (str, optional) – The file path to the mask image. Defaults to None.
verbose (bool, optional) – If True, prints the output from the Docker container. Defaults to False.
debug (bool, optional) – If True, adds the –debug flag to the command for detailed logs. Defaults to False.
- Prints:
Outputs from the Docker container if verbose is True.
- Raises:
docker.errors.ImageNotFound – If the Docker image is not available.
docker.errors.APIError – If the Docker client encounters an API error.
- _pull_image_if_not_exists() None#
Checks if the Docker image is locally available and pulls it if not.