Package com.xinapse.apps.perfusion
Class AIF
java.lang.Object
com.xinapse.apps.perfusion.AIF
Class for writing and reading arterial input function data (graphs).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]getConc(double[] t) Returns the concentration values at a set of time-points.static AIFnewInstance(double dt, float[] conc) Returns a newAIFinstance, created from tabulated concentration values.static AIFnewInstance(File aifInputFile) Creates anAIFfrom an input file.static AIFnewInstance(File aifInputFile, boolean fit, Double t0, boolean fitT0, String progName, boolean verbose) Creates anAIFfrom an input file.double[]resample(double dt) Resamples theAIFto the given time-base.double[]Resamples theAIFto the given time-base, padding at the end of the AIF, and writing the resulting resampled data to a file.voidShow an AIF graph in a pop-up dialog.voidWrite an AIF to aFileas a set of tabulated values.
-
Constructor Details
-
AIF
Creates a newAIFfrom tabulated concentration values.- Parameters:
t- the time-point for each concentration value.conc- the concentration values. The contrast arrival time is the time at which the concentration rises above zero.- Throws:
InvalidArgumentException- if the AIF cannot be constructed from the supplied arguments.
-
AIF
public AIF(double[] t, double[] conc, Double t0, boolean fitT0, String progName, boolean verbose) throws ConvergenceException Creates a newAIFfrom tabulated concentration values.- Parameters:
t- the time-point for each concentration value.conc- the concentration values.t0- if non-null, the contrast arrival time. If null, the contrast arrival time will be estimated from the data.fitT0- whether to estimate the contrast arrival time.progName- the program name, used to contruct verbose messages.verbose- whether verbose reporting to System.out is turned on.- Throws:
ConvergenceException- if the iterative procedure to estimate theAIFfails to converge.
-
-
Method Details
-
newInstance
Returns a newAIFinstance, created from tabulated concentration values.- Parameters:
dt- the time between concentration values.conc- the concentration values. The first concentration value is assumed to be at t=0;- Returns:
- a new AIF constructed from the supplied concentration values.
- Throws:
InvalidArgumentException- if the dt is not positive.
-
newInstance
public static AIF newInstance(File aifInputFile) throws IOException, ParseException, InvalidArgumentException Creates anAIFfrom an input file.- Parameters:
aifInputFile- theFilefrom which to read the AIF.- Returns:
- a new AIF instance.
- Throws:
IOException- if anIOExceptionoccurrs.ParseException- if the AIF cannot be parsed.InvalidArgumentException- if creating the AIF from the values tabulated in the file fails.
-
newInstance
public static AIF newInstance(File aifInputFile, boolean fit, Double t0, boolean fitT0, String progName, boolean verbose) throws IOException, ParseException, NumericalException, InvalidArgumentException Creates anAIFfrom an input file.- Parameters:
aifInputFile- theFilefrom which to read the AIF.fit- whether to fit an AIF to the data in the file, to produce a smoother, more consistent AIF.t0- if non-null, the contrast arrival time. If null, the contrast arrival time will be estimated from the data.fitT0- whether to estimate the contrast arrival time.progName- the program name, used to contruct verbose messages.verbose- whether verbose reporting to System.out is turned on.- Returns:
- a new AIF instance.
- Throws:
IOException- if anIOExceptionoccurrs.ParseException- if the AIF cannot be parsed.InvalidArgumentException- if creating the AIF from the values tabulated in the file fails.NumericalException- if fitting an AIF to the data fails.
-
write
Write an AIF to aFileas a set of tabulated values.- Parameters:
dt- the time between samples to write to the output file.aifOutputFile- the outputFile.- Throws:
IOException- if an I/O error occurs.
-
resample
public double[] resample(double dt) Resamples theAIFto the given time-base.- Parameters:
dt- the new time between samples.- Returns:
- the concentration values with the given time-between-samples.
-
resample
Resamples theAIFto the given time-base, padding at the end of the AIF, and writing the resulting resampled data to a file.- Parameters:
dt- the new time between samples.nPad- the number of pad samples to add to add to the end of the concentration data.aifOutputFile- the outputFile.- Returns:
- the concentration values with the given time-between-samples.
- Throws:
IOException- if an I/O error occurs.
-
getConc
public double[] getConc(double[] t) Returns the concentration values at a set of time-points.- Parameters:
t- the time-points at which to return the concentration values.- Returns:
- an array of concentration values - one value at every time-point.
-
showGraph
Show an AIF graph in a pop-up dialog.- Parameters:
parentWindow- the parent of the dialog.dt- the time between concentration values to show.nPad- a number of pad time-points to add after the end of the AIF.
-