Class FileInfoSPM

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class FileInfoSPM
    extends FileInfoBase
    This structures contains the information that describes how an SPM image is stored on disk. We have extended this format to store image orientation and start locations. We have used unused variables to store these data. Almost all programs ignore these variables and should not have any problems reading images saved with MIPAV.

    Differences between MIPAV ANALYZE and SPM: In MIPAV ANALYZE we have location 60 cal_units 4 unsigned characters location 64 - X-axis orientation @see FileInfoBase for static variables that are set. location 66 - Y-axis orientation // All three unused variables are of short type. location 68 - Z-axis orientation In SPM we have location 60 cal_units 8 unsigned characters location 68 unused1

    In MIPAV ANALYZE we have location 112 Funused1 - X-axis starting location (origin from upper left-hand corner) location 116 Funused2 - Y-axis starting location (origin from upper left-hand corner) location 120 Funused3 - Z-axis starting location (origin is the first image slice) In SPM we have location 112 Funused1 scale a floating point scale factor applied during memory mapping location 116 Funused2 location 120 Funused3

    In MIPAV ANALYZE we have location 253 originator with 10 characters In SPM we have location 253 origin with 5 shorts. If the first 3 shorts of a 3D image are set to 0, 0, 0, the origin is assumed to be at the center of the volume, since in SPM the corner voxel is at 1, 1, 1. The position(x,y,z) in mm. is determined by the distance(x,y,z) from the origin multiplied by the vox_units(x,y,z).

    In SPM the signed byte datatype was added with DT_BYTE = 130. MIPAV ANALYZE uses UNSIGNED_SHORT = 6 while SPM uses DT_UNSIGNED_SHORT = 132. The SPM standard also provides for an unsigned int = 136, but MIPAV does not used the unsigned int data type. Note that in SPM while DATA = datatype * 256 for swapped bytes, only datatype and not DATA is written to the file, so in this program we need never consider the multiplicative factors of 256.

    RGB SPM images are store in chunky format rgb, rgb, rgb ......

    Version:
    1.0 July, 2002
    Author:
    Matthew J. McAuliffe, Ph.D.
    See Also:
    FileSPM, Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • DT_UNSIGNED_CHAR

        public static final int DT_UNSIGNED_CHAR
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • DT_UNSIGNED_SHORT

        public static final int DT_UNSIGNED_SHORT
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • UNKNOWN_ORIENT

        public static final byte UNKNOWN_ORIENT
        The data_history substructure is not required, but the orient element is used to indicate individual slice orientation and determines whetther the SPM Movie program will attempt to flip the images before displaying a movie sequence. 0 - transverse unflipped 1 - coronal unflipped 2 - sagitttal unflipped 3 - transverse flipped 4 - coronal flipped 5 - sagitttal flipped
        See Also:
        Constant Field Values
      • TRANSVERSE_UNFLIPPED

        public static final byte TRANSVERSE_UNFLIPPED
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • CORONAL_UNFLIPPED

        public static final byte CORONAL_UNFLIPPED
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • SAGITTAL_UNFLIPPED

        public static final byte SAGITTAL_UNFLIPPED
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • TRANSVERSE_FLIPPED

        public static final byte TRANSVERSE_FLIPPED
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • SAGITTAL_FLIPPED

        public static final byte SAGITTAL_FLIPPED
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • aux_file

        private java.lang.String aux_file
        DOCUMENT ME!
      • bitpix

        private short bitpix
        DOCUMENT ME!
      • cal_max

        private float cal_max
        DOCUMENT ME!
      • cal_min

        private float cal_min
        DOCUMENT ME!
      • cal_units

        private java.lang.String cal_units
        DOCUMENT ME!
      • compressed

        private float compressed
        DOCUMENT ME!
      • data_type

        private java.lang.String data_type
        DOCUMENT ME!
      • datatype

        private short datatype
        DOCUMENT ME!
      • db_name

        private java.lang.String db_name
        DOCUMENT ME!
      • descrip

        private java.lang.String descrip
        DOCUMENT ME!
      • dim_un0

        private short dim_un0
        DOCUMENT ME!
      • exp_date

        private java.lang.String exp_date
        DOCUMENT ME!
      • exp_time

        private java.lang.String exp_time
        DOCUMENT ME!
      • extents

        private int extents
        DOCUMENT ME!
      • field_skip

        private int field_skip
        DOCUMENT ME!
      • generated

        private java.lang.String generated
        DOCUMENT ME!
      • glmax

        private int glmax
        DOCUMENT ME!
      • glmin

        private int glmin
        DOCUMENT ME!
      • hist_un0

        private java.lang.String hist_un0
        DOCUMENT ME!
      • hkey_un0

        private char hkey_un0
        DOCUMENT ME!
      • omax

        private int omax
        DOCUMENT ME!
      • omin

        private int omin
        DOCUMENT ME!
      • orient

        private byte orient
        DOCUMENT ME!
      • origin

        private short[] origin
        DOCUMENT ME!
      • patient_id

        private java.lang.String patient_id
        DOCUMENT ME!
      • regular

        private char regular
        DOCUMENT ME!
      • scale

        private float scale
        a floating point scale factor used during memory mapping.
      • scannum

        private java.lang.String scannum
        DOCUMENT ME!
      • session_error

        private short session_error
        DOCUMENT ME!
      • sizeof_hdr

        private int sizeof_hdr
        DOCUMENT ME!
      • smax

        private int smax
        DOCUMENT ME!
      • smin

        private int smin
        DOCUMENT ME!
      • start_field

        private int start_field
        DOCUMENT ME!
      • verified

        private float verified
        DOCUMENT ME!
      • views

        private int views
        DOCUMENT ME!
      • vols_added

        private int vols_added
        DOCUMENT ME!
      • vox_offset

        private float vox_offset
        public float pixdim = new float[8]; // image resolutions info mm or ms stored in FileInfoBase pixdim[0] = number of dimensions pixdim[1] = voxel width pixdim[2] = voxel height pixdim[3] = voxel thickness pixdim[4] = time.
      • vox_units

        private java.lang.String vox_units
        public short dim[] = new short[8]; // image dimension data stored in FileInfoBase dim[0] = number of dimensions; usally 4 dim[1] = image width dim[2] = image height dim[3] = image depth (# of slices) dim[4] = volumes in image --- must be one for 3D image.
    • Constructor Detail

      • FileInfoSPM

        public FileInfoSPM​(java.lang.String name,
                           java.lang.String directory,
                           int format)
        file info storage constructor.
        Parameters:
        name - file name
        directory - directory
        format - file format
    • Method Detail

      • displayAboutInfo

        public void displayAboutInfo​(JDialogBase dlog,
                                     TransMatrix matrix)
        displays the file information.
        Specified by:
        displayAboutInfo in class FileInfoBase
        Parameters:
        dlog - dialog box that is written to
        matrix - transformation matrix
      • getAuxFile

        public java.lang.String getAuxFile()
        accessor to the aux_file string.
        Returns:
        String aux_file
      • getBitPix

        public short getBitPix()
        accessor to the bitpix value.
        Returns:
        short the bitpix value.
      • getCalMax

        public float getCalMax()
        accessor to cal-max.
        Returns:
        float cal_max
      • getCalMin

        public float getCalMin()
        accessor to cal-min.
        Returns:
        float cal_min
      • getCalUnits

        public java.lang.String getCalUnits()
        provides the string for cal units.
        Returns:
        String string for cal_units
      • getCompressed

        public float getCompressed()
        provides the compressed value.
        Returns:
        float compressed
      • getDataTypeCode

        public short getDataTypeCode()
        accessor to coded datatype value.
        Returns:
        short datatype
      • getDataTypeName

        public java.lang.String getDataTypeName()
        Accessor to the 10 character string of data-type.
        Returns:
        String returns data_type
      • getDBname

        public java.lang.String getDBname()
        accessor to DB_name.
        Returns:
        String database name
      • getDescription

        public java.lang.String getDescription()
        accessor to the current SPM-image description.
        Returns:
        String description
      • getDim

        public short getDim()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getExperimentDate

        public java.lang.String getExperimentDate()
        provides the current experiment date string.
        Returns:
        String the experiment date.
      • getExperimentTime

        public java.lang.String getExperimentTime()
        provides the current experiment time string.
        Returns:
        String the experiment time
      • getFieldSkip

        public int getFieldSkip()
        provides the current field_skip value.
        Returns:
        int the field_skip value
      • getFileExtents

        public int getFileExtents()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getGenerated

        public java.lang.String getGenerated()
        provides the current generated string.
        Returns:
        String generated string
      • getGLmax

        public int getGLmax()
        provides the value of glmax.
        Returns:
        int glmax
      • getGLmin

        public int getGLmin()
        provides the value of glmin.
        Returns:
        int glmin
      • getHist

        public java.lang.String getHist()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getHkey

        public char getHkey()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getOmax

        public int getOmax()
        provides current omax value.
        Returns:
        int the omax value
      • getOmin

        public int getOmin()
        provides current omin value.
        Returns:
        int the omin value
      • getOrientation

        public byte getOrientation()
        provides the current orientation value.
        Returns:
        byte orientation value
      • getOriginLoc

        public short[] getOriginLoc()
        DOCUMENT ME!
        Returns:
        origin
      • getPatientID

        public java.lang.String getPatientID()
        provides the current patient id.
        Returns:
        String the patient id
      • getRegular

        public char getRegular()
        provides the value of regular character.
        Returns:
        char value of regular character
      • getScale

        public float getScale()
        DOCUMENT ME!
        Returns:
        float scale
      • getScanNum

        public java.lang.String getScanNum()
        provides the current scannum string.
        Returns:
        String current scannum string
      • getSessionErr

        public short getSessionErr()
        provide the value of session err.
        Returns:
        short session_error
      • getSizeOfHeader

        public int getSizeOfHeader()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getSmax

        public int getSmax()
        provides current smax value.
        Returns:
        int the smax value
      • getSmin

        public int getSmin()
        provides current smin value.
        Returns:
        int the smin value
      • getStartField

        public int getStartField()
        provides the current value for the start_field.
        Returns:
        int the start_field
      • getVerified

        public float getVerified()
        provides the verified value.
        Returns:
        float verified
      • getViews

        public int getViews()
        provides current views value.
        Returns:
        int the view
      • getVolsAdded

        public int getVolsAdded()
        provides the current vols_added value.
        Returns:
        int the vols_added
      • getVoxOffset

        public float getVoxOffset()
        accessor to the vox offset value.
        Returns:
        float vox_offset
      • getVoxUnits

        public java.lang.String getVoxUnits()
        provides the string for vox-units.
        Returns:
        String string for vox_units
      • setAuxFile

        public void setAuxFile​(java.lang.String aux)
        supplies auxiliary-file string; permits no more than 24 characters.
        Parameters:
        aux - DOCUMENT ME!
      • setBitPix

        public void setBitPix​(short bp)
        sets bitpix; any value other than 1, 8, 16, 32, 64, or 24 gets set to the dissalowed trap value, -1.
        Parameters:
        bp - DOCUMENT ME!
      • setCalMax

        public void setCalMax​(float cal)
        sets cal-max. if supplied value is less than cal-min, the cal-min gets reset to the supplied value as well, so that cal-min is still no greater than cal-max.
        Parameters:
        cal - DOCUMENT ME!
      • setCalMin

        public void setCalMin​(float cal)
        sets cal-min. if supplied value is greater than cal-max, the cal-max gets reset to the supplied value as well, so that cal-max is still no less than cal-min.
        Parameters:
        cal - DOCUMENT ME!
      • setCalUnits

        public void setCalUnits​(java.lang.String cal)
        allows no more than 8 characters for the string describing the cal units.
        Parameters:
        cal - DOCUMENT ME!
      • setCompressed

        public void setCompressed​(float comp)
        sets the compressed variable.
        Parameters:
        comp - DOCUMENT ME!
      • setDataType

        public void setDataType​(java.lang.String dtype)
        permits 10 charactar large string for data-type.
        Parameters:
        dtype - DOCUMENT ME!
      • setDataType

        public void setDataType​(short dtype)
        accessor to supply coded datatype.
        Parameters:
        dtype - DOCUMENT ME!
      • setDBname

        public void setDBname​(java.lang.String dbname)
        18 character max to set the DB_NAME value.
        Parameters:
        dbname - DOCUMENT ME!
      • setDescription

        public void setDescription​(java.lang.String description)
        allows no more than 80 characters to fill in the SPM-image description.
        Parameters:
        description - DOCUMENT ME!
      • setDim

        public void setDim​(short un0)
        DOCUMENT ME!
        Parameters:
        un0 - DOCUMENT ME!
      • setExperimentDate

        public void setExperimentDate​(java.lang.String date)
        allows a maximum of 10 characters to set the experiment date string.
        Parameters:
        date - DOCUMENT ME!
      • setExperimentTime

        public void setExperimentTime​(java.lang.String time)
        allows a maximum of 10 characters to set the experiment time string.
        Parameters:
        time - DOCUMENT ME!
      • setFieldSkip

        public void setFieldSkip​(int field)
        supplies the submitted value to the field_sip variable.
        Parameters:
        field - DOCUMENT ME!
      • setFileExtents

        public void setFileExtents​(int ext)
        DOCUMENT ME!
        Parameters:
        ext - DOCUMENT ME!
      • setGenerated

        public void setGenerated​(java.lang.String gen)
        allows a maximum of 10 characters to set the generated string.
        Parameters:
        gen - DOCUMENT ME!
      • setGLmax

        public void setGLmax​(int gl)
        sets glmax. if supplied value is less than glmin, the glmin gets reset to the supplied value as well, so that glmin is still no greater than glmax.
        Parameters:
        gl - DOCUMENT ME!
      • setGLmin

        public void setGLmin​(int gl)
        sets glmin. if supplied value is greater than glmax, the glmax gets reset to the supplied value as well, so that glmax is still no less than glmin.
        Parameters:
        gl - DOCUMENT ME!
      • setHist

        public void setHist​(java.lang.String hist)
        DOCUMENT ME!
        Parameters:
        hist - DOCUMENT ME!
      • setHkey

        public void setHkey​(char hk)
        DOCUMENT ME!
        Parameters:
        hk - DOCUMENT ME!
      • setOmax

        public void setOmax​(int o)
        sets omax. if supplied value is less than omin, the omin gets reset to the supplied value as well, so that omin is still no greater than omax.
        Parameters:
        o - DOCUMENT ME!
      • setOmin

        public void setOmin​(int o)
        sets omin. if supplied value is greater than omax, the omax gets reset to the supplied value as well, so that omax is still no less than omin.
        Parameters:
        o - DOCUMENT ME!
      • setOrientation

        public void setOrientation​(byte orientation)
        Sets the image orientation converting from SPM specific orientation to general orientation. Value may be transverse, coronal, or sagittal.

        see the top of this document for all possible values. supplying a value other than one of these 6 possiblities sets the orientation to an impossible 'flag' value.

        See Also:
        FileInfoBase.setImageOrientation(int)
      • setOrigin

        public void setOrigin​(short[] origin)
        DOCUMENT ME!
        Parameters:
        origin - DOCUMENT ME!
      • setMipavOrigin

        public void setMipavOrigin​(float[] mipavOrigin)
        Parameters:
        mipavOrigin -
      • setPatientID

        public void setPatientID​(java.lang.String IDnum)
        allows a maximum of 10 characters to set the patient ID string.
        Parameters:
        IDnum - DOCUMENT ME!
      • setRegular

        public void setRegular​(char ch)
        supply the value of regular character.
        Parameters:
        ch - DOCUMENT ME!
      • setScale

        public void setScale​(float scale)
        DOCUMENT ME!
        Parameters:
        scale - DOCUMENT ME!
      • setScanNum

        public void setScanNum​(java.lang.String num)
        allows a maximum of 10 characters to set the scannum string.
        Parameters:
        num - DOCUMENT ME!
      • setSessionErr

        public void setSessionErr​(short s)
        supply the value of session error.
        Parameters:
        s - DOCUMENT ME!
      • setSizeOfHeader

        public void setSizeOfHeader​(int size)
        DOCUMENT ME!
        Parameters:
        size - DOCUMENT ME!
      • setSmax

        public void setSmax​(int s)
        sets smax. if supplied value is less than smin, the smin gets reset to the supplied value as well, so that smin is still no greater than smax.
        Parameters:
        s - DOCUMENT ME!
      • setSmin

        public void setSmin​(int s)
        sets smin. if supplied value is greater than smax, the smax gets reset to the supplied value as well, so that smax is still no less than smin.
        Parameters:
        s - DOCUMENT ME!
      • setStartField

        public void setStartField​(int field)
        supplies the submitted value to the start_field variable.
        Parameters:
        field - DOCUMENT ME!
      • setVerified

        public void setVerified​(float veri)
        supply the value to verified.
        Parameters:
        veri - DOCUMENT ME!
      • setViews

        public void setViews​(int view)
        sets the views variable.
        Parameters:
        view - DOCUMENT ME!
      • setVolsAdded

        public void setVolsAdded​(int vols)
        supplies a value to the vols_added valiable.
        Parameters:
        vols - DOCUMENT ME!
      • setVoxOffset

        public void setVoxOffset​(float vox)
        sets vox offset value.
        Parameters:
        vox - DOCUMENT ME!
      • setVoxUnits

        public void setVoxUnits​(java.lang.String vox)
        allows no more than 4 characters for the string describing the vox units.
        Parameters:
        vox - DOCUMENT ME!
      • stateChanged

        public void stateChanged​(java.util.Vector ce)
        .
        ce[0] = table 0 = primary, 1 = secondary, etC
        ce[1] = line of table
        ce[2] = string name eg, "Type"
        ce[3] = Vector codeValue eg, "B"
        ce[4] = string value eg, "Big"
        "ce" comes from ChangeEvent upon which this is based. care to make our own ChangeEvent to store and handle this?
        Parameters:
        ce - DOCUMENT ME!
      • updateFileInfos

        public void updateFileInfos​(FileInfoSPM fInfo)
        Propogates the current file info to another FileInfoSPM except for the 3 start locations kept in funused1, funused2, funused3.

        It does not copy over the datatypeCode. (though, aside from, "it isn't in the about table", I can't think of a reason why it shouldn't. but it doesn't.) Also, copied over is bitPix, aux_file.

        Some variables, such as the unused1, unused2, unused3, are really taken from unused, rather than from the start locations as we are re-using the funused variables. This means that if the unused variables are not right to begin with, this certainly won't correct them!

        Parameters:
        fInfo - DOCUMENT ME!
      • setString

        protected java.lang.String setString​(java.lang.String str,
                                             int len)
        verifies string is not larger than len length; strings larger than len, are clipped before being returned.
        Returns:
        String new substring
        See Also:
        String.substring(int, int)
      • selectOrientationText

        private java.lang.String selectOrientationText​(int or)
        selection of text for the table and the editpanel.
        Parameters:
        or - DOCUMENT ME!
        Returns:
        String the orientation string