Cli Tac Fitting#
Command-line interface (CLI) for fitting Tissue Compartment Models (TCM) to PET Time-Activity Curves (TACs).
This module provides a CLI to interact with the tac_fitting module. It utilizes argparse to handle command-line arguments.
- The user must provide:
Input TAC file path
Region of Interest (ROI) TAC file path
Compartment model name for fitting. Supported models are ‘1tcm’, ‘2tcm-k4zero’, or ‘serial-2tcm’.
Filename prefix for the output files
Output directory where the analysis results will be saved
Whether to ignore blood volume contributions while fitting
Threshold in minutes (input fitting threshold)
- User can optionally provide:
Initial guesses for the fitting parameters
Lower and upper bounds for the fitting parameters
Maximum number of function iterations
Decay constant (in minutes) for per-frame weighting
- This script utilizes the
TCMAnalysisclass to perform the TAC fitting and save the results accordingly.
Examples
In the proceeding example, we assume that we have an input TAC named ‘input_tac.txt’, and an ROI TAC named ‘roi_tac.tsv’. We want to try fitting a serial 2TCM to the ROI tac.
petpal-tcm-fit interp -i "input_tac.tsv"\
-r "roi_tac.tsv"\
-m "serial-2tcm"\
-o "./" -p "cli_"\
-t 35.0\
-g 0.1 0.1 0.1 0.1 0.1\
-l 0.0 0.0 0.0 0.0 0.0\
-u 5.0 5.0 5.0 5.0 5.0\
-f 2500 -n 4096 -b --print
- In this next example, we assume that we have an input TAC named ‘input_tac.txt’, an ROI TACs directory
named ‘./roi_tas/’ which contains TACs for different ROIs, and a scan/image metadata file called ‘scan_info.json’. We want to try fitting serial 2TCM to the ROI tacs, with the default bounds.
petpal-tcm-fit frame_avgd -i "input_tac.tsv"\
-r "./roi_tacs/"\
-s "scan_info.json"\
-m "serial-2tcm"\
-o "./" -p "cli_"\
-f 2500 -n 4096 -b --print
See also
petpal.tac_fitting - module for fitting TACs with TCMs.
Attributes#
Functions#
|
Adds common input/output arguments to the provided argument parser. |
|
Adds common analysis-related arguments to the provided argument parser. |
|
Adds common verbosity/printing arguments to the provided argument parser. |
|
Generates and handles the arguments for the command-line interface. |
|
Generates the bounds for the fitting parameters. |
|
Nicely formats and prints fit parameter estimates and uncertainties. |
Module Contents#
- petpal.cli.cli_tac_fitting._EXAMPLE_ = Multiline-String#
Show Value
"""Fitting a TAC to the serial 2TCM using the interpolation strategy: petpal-tcm-fit interp -i "input_tac.txt" -r "2tcm_tac.txt" -m "serial-2tcm" -o "./" -p "cli_" -t 35.0 -g 0.1 0.1 0.1 0.1 0.1 -l 0.0 0.0 0.0 0.0 0.0 -u 5.0 5.0 5.0 5.0 5.0 -f 2500 -n 4096 -b --print Fitting a TAC to the serial 2TCM using the frame averaged strategy: petpal-tcm-fit frame_avgd -i "input_tac.txt" -r "2tcm_tac.txt" -s scan_metadata.json -m "serial-2tcm" -o "./" -p "cli_" -g 0.1 0.1 0.1 0.1 0.1 -l 0.0 0.0 0.0 0.0 0.0 -u 5.0 5.0 5.0 5.0 5.0 -f 2500 -n 4096 -b --print"""