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
-
Method Summary
Modifier and TypeMethodDescriptiondouble[]
getConc
(double[] t) Returns the concentration values at a set of time-points.static AIF
newInstance
(double dt, float[] conc) Returns a newAIF
instance, created from tabulated concentration values.static AIF
newInstance
(File aifInputFile) Creates anAIF
from an input file.static AIF
newInstance
(File aifInputFile, boolean fit, Double t0, boolean fitT0, String progName, boolean verbose) Creates anAIF
from an input file.double[]
resample
(double dt) Resamples theAIF
to the given time-base.double[]
Resamples theAIF
to the given time-base, padding at the end of the AIF, and writing the resulting resampled data to a file.void
Show an AIF graph in a pop-up dialog.void
Write an AIF to aFile
as a set of tabulated values.
-
Constructor Details
-
AIF
Creates a newAIF
from 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 newAIF
from 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 theAIF
fails to converge.
-
-
Method Details
-
newInstance
Returns a newAIF
instance, 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 anAIF
from an input file.- Parameters:
aifInputFile
- theFile
from which to read the AIF.- Returns:
- a new AIF instance.
- Throws:
IOException
- if anIOException
occurrs.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 anAIF
from an input file.- Parameters:
aifInputFile
- theFile
from 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 anIOException
occurrs.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 aFile
as 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 theAIF
to the given time-base.- Parameters:
dt
- the new time between samples.- Returns:
- the concentration values with the given time-between-samples.
-
resample
Resamples theAIF
to 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.
-