Class AIF

java.lang.Object
com.xinapse.apps.perfusion.AIF

public class AIF extends Object
Class for writing and reading arterial input function data (graphs).
  • Constructor Summary

    Constructors
    Constructor
    Description
    AIF(double[] t, double[] conc)
    Creates a new AIF from tabulated concentration values.
    AIF(double[] t, double[] conc, Double t0, boolean fitT0, String progName, boolean verbose)
    Creates a new AIF from tabulated concentration values.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    getConc(double[] t)
    Returns the concentration values at a set of time-points.
    static AIF
    newInstance(double dt, float[] conc)
    Returns a new AIF instance, created from tabulated concentration values.
    static AIF
    newInstance(File aifInputFile)
    Creates an AIF from an input file.
    static AIF
    newInstance(File aifInputFile, boolean fit, Double t0, boolean fitT0, String progName, boolean verbose)
    Creates an AIF from an input file.
    double[]
    resample(double dt)
    Resamples the AIF to the given time-base.
    double[]
    resample(double dt, int nPad, File aifOutputFile)
    Resamples the AIF to the given time-base, padding at the end of the AIF, and writing the resulting resampled data to a file.
    void
    showGraph(Window parentWindow, double dt, int nPad)
    Show an AIF graph in a pop-up dialog.
    void
    write(double dt, File aifOutputFile)
    Write an AIF to a File as a set of tabulated values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AIF

      public AIF(double[] t, double[] conc) throws InvalidArgumentException
      Creates a new AIF 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 new AIF 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 the AIF fails to converge.
  • Method Details

    • newInstance

      public static AIF newInstance(double dt, float[] conc) throws InvalidArgumentException
      Returns a new AIF 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 an AIF from an input file.
      Parameters:
      aifInputFile - the File from which to read the AIF.
      Returns:
      a new AIF instance.
      Throws:
      IOException - if an IOException 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 an AIF from an input file.
      Parameters:
      aifInputFile - the File 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 an IOException 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

      public void write(double dt, File aifOutputFile) throws IOException
      Write an AIF to a File as a set of tabulated values.
      Parameters:
      dt - the time between samples to write to the output file.
      aifOutputFile - the output File.
      Throws:
      IOException - if an I/O error occurs.
    • resample

      public double[] resample(double dt)
      Resamples the AIF to the given time-base.
      Parameters:
      dt - the new time between samples.
      Returns:
      the concentration values with the given time-between-samples.
    • resample

      public double[] resample(double dt, int nPad, File aifOutputFile) throws IOException
      Resamples the AIF 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 output File.
      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

      public void showGraph(Window parentWindow, double dt, int nPad)
      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.