Class FileAfni


  • public class FileAfni
    extends FileBase
    Afni file format.

    In Afni 3 .HEAD files may be present with just 1 .BRIK file containing the original Data. The +orig.BRIK file will contain the data, the +orig.HEAD file will describe transformation to create the original image, the +acpc.HEAD file will describe the transformation needed to create the acpc image, and the +tlrc.HEAD file will describe the transformation needed to create the Talairach image.

    Special notes:

    The document README.attributes specifies DICOM order for MARKS_XYZ, but the sample file anat+orig.HEAD has dataset order. The sample file anat+ACPC.HEAD has DICOM order.

    The original data must be resampled to cubic voxels for +acpc and +tlrc space. In FAQ 67, How can I compare 'small' and 'big' in Talairach box datasets, the text states:
    If you have used the default 1 mm. voxel size in +tlrc coordinates(as almost everyone does)...

    The function THD_3dmm_to_dicomm does changes the ordering of x, y, and z, but never inverts them. That is either R-L or L-R could be present in AFNI's Dicom ordering, either S-I or I-S could be present in AFNI's dicom ordering, and either A-P or P-A could be present in AFNI's dicom ordering. I perform inversions in my code so that I always have x = R-L, Y = A-P, and Z = I-S, the standard dicom ordering.

    To obtain the afni rr, bvec, and svec values, I must not invert axes in dicom ordering, and I must not adjust the marker coordinates for resolution and origin.

    The function of the SKIP fields is not defined in the AFNI documentation.

    Note that AFNI code uses mfor for forward transformation and mbac for backward transformation. Our interpolation routines perform a output to input mapping so since I am skipping the transform() section of AlgorithmTransform which has the line xfrm = matrixtoInverseArray(transMatrix);
    I wish to use mbac in FileAfni and ViewJFrameTriImage.
    For +orig to +acpc mapping mbac is simply the transpose(also the inverse) of mfor.
    For +acpc to +tlrc use 1 over the scale factors in mbac as opposed to the scale factors in mfor.

    Note that in the sample files func+orig.head and anat+orig.head the origin location in millimeters is chosen so that 0,0,0 in millimeters is at the center of the image. In anat+acpc.head and anat+tlrc.head the origin location in millimeters ensures that the Talairach center is at 0,0,0.

    AFNI:Software for Analysis and Visualization of Functional Magnetic Resonance Neuroimages by Robert W. Cox states: "In some applications, gaps are present between the functional slices. For example, some investigators using sagittal functional images do not collect data that spans the longitudinal fissure, but instead leave a 3-5 mm gap there. The auxiliary program abut can provide zero-filled images to fill in the gaps, and can resample the nonzero slices to a finer mesh if needed(e.g., to fill a 2 mm gap in a series of 4 mm functional slices). Resampling in the slice select direction between contiguous input slices can be done using nearest- neighbor, linear, or cubic interpolation, at the user's discretion. Interpolation is not done across the boundaries between the gap-filling zero images and the nonzero user-supplied images; that is, interpolation is only done inside spatially contiguous blocks of actual input data."

    A second special consideration exists in the interpolation of functional data. The MCW AFNI - User Manual states: "In this version of AFNI, the threshold data (e.g., correlation coefficient) is always resampled using the nearest neighbor method. This is because thresholding with an interpolated nonlinear statistic is a somewhat dubious procedure." At another point the manual states: "Threshold data in functional datasets is always resampled using the nearest neighbor mode. This is becasue it is somewhat unreasonable to interpolate a nonlinear statistic (such as correlation coefficient) between voxels, and then to interpret this statistic using probabilistic models that assume independence."

    v1:time+orig.HEAD has 1 = ORI_L2R_TYPE for the third ORIENT_SPECIFIC value, -53 for the third ORIGIN value, and 7 for the third delta value. However, delta should be negative for ORI_L2R_TYPE. I changed the values to those found in v2:time+orig.HEAD, namely 1 for the third ORIENT_SPECIFIC value, 52 for the third ORIGIN value, and -7 for the third delta value. The observed overlap was then excellent for v1_time+orig.HEAD and anat+orig.HEAD, anat+ACPC.HEAD, and anat+TLRC.HEAD.

    Author:
    William Gandler
    See Also:
    FileIO
    • Field Detail

      • INTEGER_ATTRIBUTE

        public static final int INTEGER_ATTRIBUTE
        attribute types.
        See Also:
        Constant Field Values
      • STRING_ATTRIBUTE

        public static final int STRING_ATTRIBUTE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • ANAT_SPGR_TYPE

        public static final int ANAT_SPGR_TYPE
        funcType for anatType == true.
        See Also:
        Constant Field Values
      • FUNC_FIM_TYPE

        public static final int FUNC_FIM_TYPE
        funcType for anatType == false.
        See Also:
        Constant Field Values
      • FUNC_THR_SCALE_SHORT

        public static final float FUNC_THR_SCALE_SHORT
        Unfortunately, the func type codes overlap for Func and Anat datasets. This means that one cannot tell the contents of a dataset from a single attribute. Default scale factors for functional data threshold values stored as shorts If BRICK_FLOAT_FACS is not supplied and the threshold functional data is stored as shorts, then AFNI will apply a default scale factor unless the data is FUNC_FIM_TYPE with only an intensity value and no threshold value or FUNC_BUCK_TYPE which has a default scale factor of 1.
        See Also:
        Constant Field Values
      • FUNC_COR_SCALE_SHORT

        public static final float FUNC_COR_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_TT_SCALE_SHORT

        public static final float FUNC_TT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_FT_SCALE_SHORT

        public static final float FUNC_FT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_ZT_SCALE_SHORT

        public static final float FUNC_ZT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_CT_SCALE_SHORT

        public static final float FUNC_CT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_BT_SCALE_SHORT

        public static final float FUNC_BT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_BN_SCALE_SHORT

        public static final float FUNC_BN_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_GT_SCALE_SHORT

        public static final float FUNC_GT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_PT_SCALE_SHORT

        public static final float FUNC_PT_SCALE_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_THR_SCALE_BYTE

        public static final float FUNC_THR_SCALE_BYTE
        6 funcType of functional data have default scaling for byte data.
        See Also:
        Constant Field Values
      • FUNC_COR_SCALE_BYTE

        public static final float FUNC_COR_SCALE_BYTE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_TT_SCALE_BYTE

        public static final float FUNC_TT_SCALE_BYTE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_ZT_SCALE_BYTE

        public static final float FUNC_ZT_SCALE_BYTE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_BT_SCALE_BYTE

        public static final float FUNC_BT_SCALE_BYTE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • FUNC_GT_SCALE_BYTE

        public static final float FUNC_GT_SCALE_BYTE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • MARKSET_BOUNDING

        public static final int MARKSET_BOUNDING
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • WARP_TALAIRACH_12_TYPE

        public static final int WARP_TALAIRACH_12_TYPE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • UNITS_MSEC_TYPE

        public static final int UNITS_MSEC_TYPE
        time step units.
        See Also:
        Constant Field Values
      • ATLAS_FRONT_TO_AC

        private static final float ATLAS_FRONT_TO_AC
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • ATLAS_PC_TO_BACK

        private static final float ATLAS_PC_TO_BACK
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • ATLAS_BOT_TO_AC

        private static final float ATLAS_BOT_TO_AC
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • ATLAS_AC_TO_TOP

        private static final float ATLAS_AC_TO_TOP
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • ATLAS_AC_TO_LAT

        private static final float ATLAS_AC_TO_LAT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • acpcAC

        private WildMagic.LibFoundation.Mathematics.Vector3f acpcAC
        Anterior Comissure in acpc space.
      • acpcMaxPt

        private WildMagic.LibFoundation.Mathematics.Vector3f acpcMaxPt
        DOCUMENT ME!
      • acpcMinPt

        private WildMagic.LibFoundation.Mathematics.Vector3f acpcMinPt
        DOCUMENT ME!
      • acpcName

        private java.lang.String acpcName
        DOCUMENT ME!
      • acpcPC

        private WildMagic.LibFoundation.Mathematics.Vector3f acpcPC
        DOCUMENT ME!
      • acpcRes

        private float acpcRes
        DOCUMENT ME!
      • acquisitionDuration

        private float acquisitionDuration
        DOCUMENT ME!
      • alsoAcpc

        private boolean alsoAcpc
        DOCUMENT ME!
      • alsoOrig

        private boolean alsoOrig
        DOCUMENT ME!
      • anatomyParentnameString

        private java.lang.String anatomyParentnameString
        DOCUMENT ME!
      • anatType

        private boolean anatType
        DOCUMENT ME!
      • anotherPtDicom

        private WildMagic.LibFoundation.Mathematics.Vector3f anotherPtDicom
        DOCUMENT ME!
      • brickFloatFacs

        private float[] brickFloatFacs
        DOCUMENT ME!
      • brickKeywordsString

        private java.lang.String brickKeywordsString
        DOCUMENT ME!
      • brickLabsString

        private java.lang.String[] brickLabsString
        Sub-brick names
      • brickStatAux

        private float[] brickStatAux
        Each BLT is defined by a struct that contains two 3x3 matrices and four 3-vectors (2*3*3 + 4*3 = the 30 numbers). These values are: [mfor] = 3x3 forward transformation matrix [0..8] 0,1,2 correspond to alpha.X, alpha.Y, alpha.Z 3,4,5 correspond to beta.X, beta.Y, beta.Z 6,7,8 correspond to gamma.X, gamma.Y, gamma.Z [mbac] = 3x3 backward transformation matrix [0..17] [bvec] = 3-vector for forward transformation [18..20] [svec] = 3-vector for backward transformation [21..23] [bot] [24..26] [top] [27..29] The matrices are stored in row major order; e.g., [ 0 1 2] [mfor] = [ 3 4 5] [ 6 7 8] the indices of the [mfor] matrix The forward transformation is [x_map] = [mfor][x_in] - [bvec] The backward transformation is [x_in] = [mbac][x_map] - [svec] which implies [svec] = -[mbac][bvec] and [mbac] = Inverse{[mfor]} The forward transformation is the transformation of Dicom order coordinates from the warp parent dataset (usually in the +orig view) to the warped dataset (usually +acpc or +tlrc). The backward transformation is just the inverse of the forward transformation, and is stored for convenience. It could be recomputed from the forward transformation whenever it was needed. The identity BLT would be stored as these 30 numbers: 1 0 0 0 1 0 [mfor] = I 0 0 1 1 0 0 0 1 0 [mbac] = I 0 0 1 0 0 0 [bvec] = 0 0 0 0 [svec] = 0 botx boty botz topx topy topz bot and top numbers depend on the application. If the transformation is WARP_TALAIRACH_TYPE, then each BLT type only applies to a bounded region of 3-space. The [bot] and [top] vectors define the limits for each BLT, in the warped [x_map] coordinates. These values are used in the function AFNI_transform_vector() to compute the transformation of a 3-vector between +orig and +tlrc coordinates. For example, to compute the transformation from +tlrc back to +orig of a vector [x_tlrc], the code must scan all 12 [bot]..[top] regions to see which BLT to use. Similarly, to transform [x_orig] from +orig to +tlrc, the vector must be transformed with each BLT and the result tested to see if it lies within the BLT's [bot]..[top] region. (if a lower bound is supposed to be -infinity, then that element of [bot] is -9999; if an upper bound is supposed to be +infinity then that element of [top] is +9999. For the +orig to +acpc transformation (of WARP_AFFINE_TYPE), the [bot] and [top] vectors store the bounding box of the transformed dataset. However, this fact isn't used much.
      • brickStats

        private float[] brickStats
        DOCUMENT ME!
      • brickType

        private int brickType
        DOCUMENT ME!
      • brickTypeNumber

        private int brickTypeNumber
        DOCUMENT ME!
      • brikDataType

        private int brikDataType
        DOCUMENT ME!
      • brikFileName

        private java.lang.String brikFileName
        DOCUMENT ME!
      • bufferSize

        private int bufferSize
        DOCUMENT ME!
      • dataExtents

        private int[] dataExtents
        DOCUMENT ME!
      • dataOrient

        private int[] dataOrient
        DOCUMENT ME!
      • datasetKeywordsString

        private java.lang.String datasetKeywordsString
        DOCUMENT ME!
      • datasetNameString

        private java.lang.String datasetNameString
        DOCUMENT ME!
      • ddof

        private int ddof
        DOCUMENT ME!
      • delta

        private float[] delta
        DOCUMENT ME!
      • dicomDelta

        private float[] dicomDelta
        DOCUMENT ME!
      • dicomHighestX

        private float dicomHighestX
        DOCUMENT ME!
      • dicomHighestY

        private float dicomHighestY
        DOCUMENT ME!
      • dicomHighestZ

        private float dicomHighestZ
        DOCUMENT ME!
      • dicomLowestX

        private float dicomLowestX
        Dicom ordered bounding box in mm.
      • dicomLowestY

        private float dicomLowestY
        Dicom ordered bounding box in mm.
      • dicomLowestZ

        private float dicomLowestZ
        Dicom ordered bounding box in mm.
      • dicomOrientation

        private int[] dicomOrientation
        DOCUMENT ME!
      • dicomOrigin

        private float[] dicomOrigin
        DOCUMENT ME!
      • dicomSliceSize

        private int dicomSliceSize
        DOCUMENT ME!
      • dicomXDim

        private int dicomXDim
        DOCUMENT ME!
      • dicomYDim

        private int dicomYDim
        DOCUMENT ME!
      • dicomZDim

        private int dicomZDim
        DOCUMENT ME!
      • dist_ant

        private float dist_ant
        DOCUMENT ME!
      • dist_med

        private float dist_med
        DOCUMENT ME!
      • dist_pos

        private float dist_pos
        DOCUMENT ME!
      • dist_sup

        private float dist_sup
        DOCUMENT ME!
      • dist_inf

        private float dist_inf
        DOCUMENT ME!
      • dist_lef

        private float dist_lef
        DOCUMENT ME!
      • dist_rig

        private float dist_rig
        DOCUMENT ME!
      • doDicom

        private boolean doDicom
        DOCUMENT ME!
      • dof

        private int dof
        FUNC_TT_TYPE Student t Degrees-of-Freedom (DOF).
      • endianess

        private boolean endianess
        DOCUMENT ME!
      • file

        private java.io.File file
        DOCUMENT ME!
      • fileDir

        private java.lang.String fileDir
        DOCUMENT ME!
      • fileLength

        private long fileLength
        DOCUMENT ME!
      • fileName

        private java.lang.String fileName
        DOCUMENT ME!
      • firstPtDicom

        private WildMagic.LibFoundation.Mathematics.Vector3f firstPtDicom
        DOCUMENT ME!
      • floatsPerTag

        private int floatsPerTag
        DOCUMENT ME!
      • funcType

        private int funcType
        DOCUMENT ME!
      • haveReadACPC

        private boolean haveReadACPC
        DOCUMENT ME!
      • haveReadOrig

        private boolean haveReadOrig
        DOCUMENT ME!
      • historyNoteString

        private java.lang.String historyNoteString
        DOCUMENT ME!
      • idcodeAnatParentString

        private java.lang.String idcodeAnatParentString
        DOCUMENT ME!
      • idcodeDateString

        private java.lang.String idcodeDateString
        DOCUMENT ME!
      • idcodeString

        private java.lang.String idcodeString
        DOCUMENT ME!
      • idcodeWarpParentString

        private java.lang.String idcodeWarpParentString
        DOCUMENT ME!
      • img2Buffer

        private float[] img2Buffer
        DOCUMENT ME!
      • imgBuffer

        private float[] imgBuffer
        DOCUMENT ME!
      • imgExtents

        private int[] imgExtents
        DOCUMENT ME!
      • imgResols

        private float[] imgResols
        DOCUMENT ME!
      • invertX

        private boolean invertX
        DOCUMENT ME!
      • invertY

        private boolean invertY
        DOCUMENT ME!
      • invertZ

        private boolean invertZ
        DOCUMENT ME!
      • label1String

        private java.lang.String label1String
        DOCUMENT ME!
      • label2String

        private java.lang.String label2String
        DOCUMENT ME!
      • loadB

        private boolean loadB
        DOCUMENT ME!
      • lowestX

        private float lowestX
        Dataset ordered bounding box in mm.
      • lowestY

        private float lowestY
        Dataset ordered bounding box in mm.
      • lowestZ

        private float lowestZ
        Dataset ordered bounding box in mm.
      • highestX

        private float highestX
        Dataset ordered bounding box in mm.
      • highestY

        private float highestY
        Dataset ordered bounding box in mm.
      • highestZ

        private float highestZ
        Dataset ordered bounding box in mm.
      • marksFlag

        private int marksFlag
        DOCUMENT ME!
      • marksFlags

        private int marksFlags
        DOCUMENT ME!
      • marksHelpString

        private java.lang.String[] marksHelpString
        DOCUMENT ME!
      • marksLabString

        private java.lang.String[] marksLabString
        DOCUMENT ME!
      • marksXYZ

        private float[] marksXYZ
        DOCUMENT ME!
      • ndof

        private int ndof
        FUNC_FT_TYPE F ratio Numerator DOF, Denominator DOF.
      • noteDate001String

        private java.lang.String noteDate001String
        DOCUMENT ME!
      • noteDate002String

        private java.lang.String noteDate002String
        DOCUMENT ME!
      • noteDate003String

        private java.lang.String noteDate003String
        DOCUMENT ME!
      • noteDate004String

        private java.lang.String noteDate004String
        DOCUMENT ME!
      • noteDate005String

        private java.lang.String noteDate005String
        DOCUMENT ME!
      • noteNumber001String

        private java.lang.String noteNumber001String
        DOCUMENT ME!
      • noteNumber002String

        private java.lang.String noteNumber002String
        DOCUMENT ME!
      • noteNumber003String

        private java.lang.String noteNumber003String
        DOCUMENT ME!
      • noteNumber004String

        private java.lang.String noteNumber004String
        DOCUMENT ME!
      • noteNumber005String

        private java.lang.String noteNumber005String
        DOCUMENT ME!
      • notesCount

        private int notesCount
        DOCUMENT ME!
      • numberDicomSlices

        private int numberDicomSlices
        DOCUMENT ME!
      • numberSlices

        private int numberSlices
        DOCUMENT ME!
      • numFitParam

        private int numFitParam
        DOCUMENT ME!
      • numNuisanceParam

        private int numNuisanceParam
        DOCUMENT ME!
      • numSamples

        private int numSamples
        DOCUMENT ME!
      • numTrials

        private int numTrials
        FUNC_BN_TYPE Binomial # Trials, Probability per trial.
      • orientSpecific

        private int[] orientSpecific
        DOCUMENT ME!
      • origAC

        private WildMagic.LibFoundation.Mathematics.Vector3f origAC
        DOCUMENT ME!
      • origDelta

        private float[] origDelta
        DOCUMENT ME!
      • origDicom

        private boolean origDicom
        DOCUMENT ME!
      • origExtents

        private int[] origExtents
        DOCUMENT ME!
      • origin

        private float[] origin
        DOCUMENT ME!
      • originalFileName

        private java.lang.String originalFileName
        DOCUMENT ME!
      • origName

        private java.lang.String origName
        DOCUMENT ME!
      • origOrigin

        private float[] origOrigin
        DOCUMENT ME!
      • origXDim

        private int origXDim
        DOCUMENT ME!
      • origYDim

        private int origYDim
        DOCUMENT ME!
      • origZDim

        private int origZDim
        DOCUMENT ME!
      • pcDicom

        private WildMagic.LibFoundation.Mathematics.Vector3f pcDicom
        DOCUMENT ME!
      • pointMarker

        private WildMagic.LibFoundation.Mathematics.Vector3f pointMarker
        DOCUMENT ME!
      • posteriorMarginDicom

        private WildMagic.LibFoundation.Mathematics.Vector3f posteriorMarginDicom
        DOCUMENT ME!
      • presentViewType

        private int presentViewType
        DOCUMENT ME!
      • readACPC

        private boolean readACPC
        DOCUMENT ME!
      • readTLRC

        private boolean readTLRC
        DOCUMENT ME!
      • scale_A

        private float scale_A
        DOCUMENT ME!
      • scale_M

        private float scale_M
        DOCUMENT ME!
      • scale_P

        private float scale_P
        DOCUMENT ME!
      • scale_S

        private float scale_S
        DOCUMENT ME!
      • scale_I

        private float scale_I
        DOCUMENT ME!
      • scale_L

        private float scale_L
        DOCUMENT ME!
      • scale_R

        private float scale_R
        DOCUMENT ME!
      • skip

        private float[] skip
        DOCUMENT ME!
      • sliceSize

        private int sliceSize
        DOCUMENT ME!
      • slicesWithTimeOffsets

        private int slicesWithTimeOffsets
        DOCUMENT ME!
      • statAux

        private float[] statAux
        # orts are nuisance parameters whose number is >= 1.
      • statCode

        private int statCode
        DOCUMENT ME!
      • subBrickIndex

        private int subBrickIndex
        DOCUMENT ME!
      • subBrickNumber

        private int subBrickNumber
        DOCUMENT ME!
      • superiorEdgeDicom

        private WildMagic.LibFoundation.Mathematics.Vector3f superiorEdgeDicom
        DOCUMENT ME!
      • tagAlignMatvec

        private float[] tagAlignMatvec
        The "p-values" for fico, fitt, and fizt datasets are 2-sided: that is, the value displayed by AFNI (below the slider) is the probability that the absolute value of such a deviate will exceed the threshold value on the slider. The "p-values" for the other types are 1-sided: that is, the value displayed by AFNI is the probability that the value of the deviate will exceed the threshold value. (Of course, these probabilities are computed under the appropriate null hypothesis, and assuming that the distributional model holds exactly. The latter assumption, in particular, is fairly dubious.) Registration attributes Note that the MATVEC attributes are transformations of Dicom-ordered coordinates, and so have to be permuted to transform dataset-ordered xyz-coordinates. The MATVEC attributes describe the transformation of coordinates from the input dataset to the output dataset in the form [xyz_out] = [mat] ([xyz_in] - [xyz_cen]) + [vec] + [xyz_cen] where [mat] is a 3x3 orthogonal matrix [vec] is a 3-vector [xyz_in] is the input vector [xyz_cen] is the center of rotation (usually the center of the dataset) [xyz_out] is the output vector Dicom coordinate order is used for these matrices and vectors, which means that they need to be permuted to dataset order for application
      • tagNumber

        private int tagNumber
        DOCUMENT ME!
      • tagsetFloats

        private float[] tagsetFloats
        DOCUMENT ME!
      • tagsetLabelsString

        private java.lang.String tagsetLabelsString
        2560 characters giving the help strings for the markers (256 chars per marker, EXACTLY, including the NULS).
      • tAxisOffsets

        private float[] tAxisOffsets
        DOCUMENT ME!
      • tDim

        private int tDim
        DOCUMENT ME!
      • timeOrigin

        private float timeOrigin
        DOCUMENT ME!
      • timeStep

        private float timeStep
        DOCUMENT ME!
      • timeStepUnit

        private int timeStepUnit
        DOCUMENT ME!
      • tlrcRes

        private float[] tlrcRes
        DOCUMENT ME!
      • typeString

        private java.lang.String typeString
        DOCUMENT ME!
      • typeStringType

        private int typeStringType
        DOCUMENT ME!
      • viewType

        private int viewType
        DOCUMENT ME!
      • volregBaseIdcodeString

        private java.lang.String volregBaseIdcodeString
        DOCUMENT ME!
      • volregBaseNameString

        private java.lang.String volregBaseNameString
        DOCUMENT ME!
      • volregCenterBase

        private float[] volregCenterBase
        DOCUMENT ME!
      • volregCenterOld

        private float[] volregCenterOld
        For sub-brick #xxxxxx (so a max of 999,999 sub-bricks can be used), this stores 12 numbers for the matrix-vector of transformation from 3dvolreg.
      • volregGridparentIdcodeString

        private java.lang.String volregGridparentIdcodeString
        DOCUMENT ME!
      • volregGridparentNameString

        private java.lang.String volregGridparentNameString
        DOCUMENT ME!
      • volregInputIdcodeString

        private java.lang.String volregInputIdcodeString
        DOCUMENT ME!
      • volregInputNameString

        private java.lang.String volregInputNameString
        DOCUMENT ME!
      • volregMatvec000000

        private float[] volregMatvec000000
        DOCUMENT ME!
      • volregMatvec000001

        private float[] volregMatvec000001
        DOCUMENT ME!
      • volregMatvec000002

        private float[] volregMatvec000002
        DOCUMENT ME!
      • volregMatvec000003

        private float[] volregMatvec000003
        DOCUMENT ME!
      • volregMatvec000004

        private float[] volregMatvec000004
        DOCUMENT ME!
      • volregMatvec000005

        private float[] volregMatvec000005
        DOCUMENT ME!
      • volregMatvec000006

        private float[] volregMatvec000006
        DOCUMENT ME!
      • volregMatvec000007

        private float[] volregMatvec000007
        DOCUMENT ME!
      • volregMatvec000008

        private float[] volregMatvec000008
        DOCUMENT ME!
      • volregMatvec000009

        private float[] volregMatvec000009
        DOCUMENT ME!
      • volregRotcomNum

        private int volregRotcomNum
        DOCUMENT ME!
      • volregRotparentIdcodeString

        private java.lang.String volregRotparentIdcodeString
        DOCUMENT ME!
      • volregRotparentNameString

        private java.lang.String volregRotparentNameString
        DOCUMENT ME!
      • warpData

        private float[] warpData
        DOCUMENT ME!
      • warpParentnameString

        private java.lang.String warpParentnameString
        DOCUMENT ME!
      • warpType

        private int warpType
        DOCUMENT ME!
      • xDim

        private int xDim
        DOCUMENT ME!
      • yDim

        private int yDim
        DOCUMENT ME!
      • zAxisOffset

        private float zAxisOffset
        DOCUMENT ME!
      • zAxisStep

        private float zAxisStep
        DOCUMENT ME!
      • zDim

        private int zDim
        DOCUMENT ME!
      • zeroPad

        private int[] zeroPad
        DOCUMENT ME!
    • Constructor Detail

      • FileAfni

        public FileAfni​(java.lang.String fileName,
                        java.lang.String fileDir,
                        boolean loadB,
                        boolean doRead)
                 throws java.io.IOException
        Afni reader constructor.
        Parameters:
        fileName - file name
        fileDir - file directory
        loadB - flag indicating if this is a B image
        doRead - whether class is created for reading afni file, or for writing
        Throws:
        java.io.IOException - if there is an error making the file
    • Method Detail

      • finalize

        public void finalize()
        Prepares this class for cleanup. Calls the finalize method for existing elements, closes any open files and sets other elements to null.
        Overrides:
        finalize in class FileBase
      • getFileInfo

        public FileInfoBase getFileInfo()
        getFileInfo - accessor that returns the file info.
        Returns:
        FileInfoBase containing the file info
      • getImageBuffer

        public float[] getImageBuffer()
        getImageBuffer - accessor that returns the image buffer.
        Returns:
        buffer of image.
      • readImage

        public ModelImage readImage()
                             throws java.io.IOException
        readImage.
        Returns:
        returns the image
        Throws:
        java.io.IOException - if there is an error reading the file
      • setFileName

        public void setFileName​(java.lang.String fName)
        setFileName - accessor to set the file name (used when reading TIFF multiFile).
        Parameters:
        fName - file name of image to read.
      • getModelLUT

        public ModelLUT getModelLUT()
      • writeImage

        public void writeImage​(ModelImage image,
                               FileWriteOptions options)
                        throws java.io.IOException
        Writes a AFNI format type image.
        Parameters:
        image - Image model of data to write.
        options - options such as starting and ending slices and times
        Throws:
        java.io.IOException - if there is an error writing the file
      • calcOriginalMarker

        private void calcOriginalMarker​(int markerNumber)
        DOCUMENT ME!
        Parameters:
        markerNumber - DOCUMENT ME!
      • createOrderDialog

        private void createOrderDialog()
        DOCUMENT ME!
      • crossProduct

        private WildMagic.LibFoundation.Mathematics.Vector3f crossProduct​(WildMagic.LibFoundation.Mathematics.Vector3f pt1,
                                                                          WildMagic.LibFoundation.Mathematics.Vector3f pt2)
        Finds crossproduct of two vectors.
        Parameters:
        pt1 - First vector.
        pt2 - Second vector
        Returns:
        Cross product of pt1 and pt2.
      • dicomMarker

        private WildMagic.LibFoundation.Mathematics.Vector3f dicomMarker​(WildMagic.LibFoundation.Mathematics.Vector3f pMarker)
        DOCUMENT ME!
        Parameters:
        pMarker - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • dist

        private float dist​(WildMagic.LibFoundation.Mathematics.Vector3f pt1,
                           WildMagic.LibFoundation.Mathematics.Vector3f pt2,
                           float[] resol)
        DOCUMENT ME!
        Parameters:
        pt1 - DOCUMENT ME!
        pt2 - DOCUMENT ME!
        resol - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • dotProduct

        private float dotProduct​(WildMagic.LibFoundation.Mathematics.Vector3f pt1,
                                 WildMagic.LibFoundation.Mathematics.Vector3f pt2)
        DOCUMENT ME!
        Parameters:
        pt1 - DOCUMENT ME!
        pt2 - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • makemmVector3f

        private WildMagic.LibFoundation.Mathematics.Vector3f makemmVector3f​(WildMagic.LibFoundation.Mathematics.Vector3f pt,
                                                                            float[] resol)
        DOCUMENT ME!
        Parameters:
        pt - DOCUMENT ME!
        resol - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • makeVoxelCoord3Df

        private WildMagic.LibFoundation.Mathematics.Vector3f makeVoxelCoord3Df​(WildMagic.LibFoundation.Mathematics.Vector3f pt,
                                                                               float[] resol)
        DOCUMENT ME!
        Parameters:
        pt - DOCUMENT ME!
        resol - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • norm

        private WildMagic.LibFoundation.Mathematics.Vector3f norm​(WildMagic.LibFoundation.Mathematics.Vector3f pt)
        Finds the normal to the vector.
        Parameters:
        pt - Vector to find normal to.
        Returns:
        Normal of pt.
      • readBuffer

        public void readBuffer​(int slice,
                               float[] buffer,
                               float scaleFact,
                               int numRead)
                        throws java.io.IOException
        Reads a slice of data at a time and stores the results in the buffer.
        Parameters:
        slice - offset into the file stored in the dataOffset array
        buffer - buffer where the info is stored
        scaleFact - if zero data unscaled, if > 0 data is scaled by scaleFact
        numRead - DOCUMENT ME!
        Throws:
        java.io.IOException - if there is an error reading the file
      • readHeader

        public boolean readHeader()
                           throws java.io.IOException
        Reads AFNI header (.HEAD file)
        Throws:
        java.io.IOException - if there is an error reading the file
      • readImage2

        private ModelImage readImage2()
                               throws java.io.IOException
        Reads AFNI image (.BRIK file)
        Returns:
        Generated modelImage
        Throws:
        java.io.IOException - data reading problem occured
      • readLine

        private java.lang.String readLine()
                                   throws java.io.IOException
        readLine() - reads a line of the file and strips comments indicated by the # symbol.
        Returns:
        the line read in
        Throws:
        java.io.IOException - if there is an error reading the file
      • readXYZBuffer

        public void readXYZBuffer​(int slice,
                                  float[] buffer,
                                  float[] dicomBuffer,
                                  float scaleFact)
                           throws java.io.IOException
        Reads a slice of data at a time and stores the results in the buffer.
        Parameters:
        slice - offset into the file stored in the dataOffset array
        buffer - buffer where the info is read into
        dicomBuffer - buffer into which the data is reordered
        scaleFact - if zero data unscaled, if > 0 data is scaled by scaleFact
        Throws:
        java.io.IOException - if there is an error reading the file
      • removeWhiteSpace

        private java.lang.String removeWhiteSpace​(java.lang.String inString)
        DOCUMENT ME!
        Parameters:
        inString - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • reposMarker

        private void reposMarker​(int markerNumber)
        DOCUMENT ME!
        Parameters:
        markerNumber - DOCUMENT ME!
      • sclAdd

        private WildMagic.LibFoundation.Mathematics.Vector3f sclAdd​(float fa,
                                                                    WildMagic.LibFoundation.Mathematics.Vector3f a,
                                                                    float fb,
                                                                    WildMagic.LibFoundation.Mathematics.Vector3f b)
        scale and add two vectors.
        Parameters:
        fa - DOCUMENT ME!
        a - DOCUMENT ME!
        fb - DOCUMENT ME!
        b - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • sub

        private WildMagic.LibFoundation.Mathematics.Vector3f sub​(WildMagic.LibFoundation.Mathematics.Vector3f pt1,
                                                                 WildMagic.LibFoundation.Mathematics.Vector3f pt2)
        DOCUMENT ME!
        Parameters:
        pt1 - DOCUMENT ME!
        pt2 - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • transformACPCTrilinear

        private void transformACPCTrilinear​(float[] imgBuffer,
                                            TransMatrix xfrm,
                                            float iXres,
                                            float iYres,
                                            float iZres,
                                            int iXdim,
                                            int iYdim,
                                            int iZdim,
                                            float oXres,
                                            float oYres,
                                            float oZres,
                                            int oXdim,
                                            int oYdim,
                                            int oZdim)
        transformACPCTrilinear - transforms and resamples volume using trilinear interpolation.
        Parameters:
        imgBuffer - image array
        xfrm - transformation matrix to be applied
        iXres - DOCUMENT ME!
        iYres - DOCUMENT ME!
        iZres - DOCUMENT ME!
        iXdim - DOCUMENT ME!
        iYdim - DOCUMENT ME!
        iZdim - DOCUMENT ME!
        oXres - DOCUMENT ME!
        oYres - DOCUMENT ME!
        oZres - DOCUMENT ME!
        oXdim - DOCUMENT ME!
        oYdim - DOCUMENT ME!
        oZdim - DOCUMENT ME!
      • transformTalairachTrilinear

        private void transformTalairachTrilinear​(float[] imgBuffer,
                                                 TransMatrix xfrm,
                                                 float iXres,
                                                 float iYres,
                                                 float iZres,
                                                 int iXdim,
                                                 int iYdim,
                                                 int iZdim,
                                                 float oXres,
                                                 float oYres,
                                                 float oZres,
                                                 int oXdim,
                                                 int botX,
                                                 int botY,
                                                 int botZ,
                                                 int topX,
                                                 int topY,
                                                 int topZ)
        transformTalairachTrilinear - transforms and resamples volume using trilinear interpolation.
        Parameters:
        imgBuffer - image array
        xfrm - transformation matrix to be applied
        iXres - DOCUMENT ME!
        iYres - DOCUMENT ME!
        iZres - DOCUMENT ME!
        iXdim - DOCUMENT ME!
        iYdim - DOCUMENT ME!
        iZdim - DOCUMENT ME!
        oXres - DOCUMENT ME!
        oYres - DOCUMENT ME!
        oZres - DOCUMENT ME!
        oXdim - DOCUMENT ME!
        botX - DOCUMENT ME!
        botY - DOCUMENT ME!
        botZ - DOCUMENT ME!
        topX - DOCUMENT ME!
        topY - DOCUMENT ME!
        topZ - DOCUMENT ME!