Graphical Analysis#
This module provides functions and a key class, GraphicalAnalysis, for performing
graphical analysis on Time Activity Curve (TAC) data. It heavily utilizes Numpy and supports
various analysis methods like Patlak, Logan, and alternative Logan analysis.
The GraphicalAnalysis class encapsulates the main functionality of the module. It provides
an organized way to perform graphical analysis where it initializes with paths to input data and
output details, runs an analysis using a specific method, calculates the best fit parameters,
computes properties related to the fitting process, and stores the analysis results. All these
properties and results are stored within an instance’s ‘analysis_props’ dictionary, providing an
organized storage of result of an analysis task.
Todo
Check if it makes more sense to lift out the more mathy methods out into a separate module.
Add references for the TCMs and Patlak. Could maybe rely on Turku PET Center.
Handle cases when tac_vals = 0.0. Might be able to use t_thresh so that we are past the 0-values.
Add more detailed documentation to patlak analysis.
Classes#
|
|
A class that performs graphical analysis on multiple tissue TACs (Time Activity Curves). |
Functions#
|
Generates the RHS matrix for linear least squares fitting |
|
Find the linear least squares solution given the x and y variables. |
Fits a line to the data using least squares and explicitly computes the r-squared value. |
|
|
Fits a line to the data using least squares and explicitly computes: |
|
Calculates the cumulative integral of ydata over xdata using the trapezoidal rule. |
|
Calculates the x-variable in Patlak analysis |
|
Get the index after which all times are greater than the threshold. |
|
Performs Patlak analysis given the input TAC, region TAC, times and threshold. |
|
Performs Patlak analysis given the input TAC, region TAC, times and threshold. |
|
Performs Logan analysis on given input TAC, regional TAC, times and threshold, considering |
|
Performs Logan analysis on given input TAC, regional TAC, times and threshold. |
|
Performs Logan with reference region input function on given input TAC, regional TAC, times, |
|
Performs Logan with reference region input function on given input TAC, regional TAC, times, |
|
Performs Alternative Logan analysis on given input TAC, regional TAC, times and threshold, |
Performs alternative logan analysis on given input TAC, regional TAC, times and threshold. |
|
|
Function for obtaining the appropriate graphical analysis method. |
Function for obtaining the appropriate graphical analysis method which also calculates the |
|
|
Saves the analysis results to a TSV file as a table with fit parameters for each ROI. |
|
Saves the analysis results to a JSON file for each segment/TAC. |