Class FileInfoMinc
- java.lang.Object
- 
- gov.nih.mipav.model.structures.ModelSerialCloneable
- 
- gov.nih.mipav.model.file.FileInfoBase
- 
- gov.nih.mipav.model.file.FileInfoMinc
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 
 public class FileInfoMinc extends FileInfoBase This class holds all the file information for a MINC file. In addition, it has three classes to organize the data.MINC headers have three main parts: the dimensions, the global attributes, and the variables. There are typically three dimensions, representing the x, y, and z dimensions of the image. There is usually one global attribute, the history. There can be any number of variables. Variables have within them any number of attributes. So for example, "rootvariable", the first variable in all the MINC files I have seen so far, has the following attributes: varid (= "MINC standard variable"), vartype (= "group________"), version (= "MINC version 1.0"), parent (blank), and children (image). Usually there is a variable for each dimension, a variable for the image, a variable for image min, and a variable for image max. There can also be variables containing patient information or anything else useful. See the documentation for the classes MincDimElem, MincAttElem, and MincVarElem for further information. The classes are structured exactly like a MINC file. - Version:
- 1.0 July 1, 2000
- See Also:
- FileMinc, Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class gov.nih.mipav.model.file.FileInfoBaseFileInfoBase.AxisOrientation, FileInfoBase.ImageOrientation, FileInfoBase.Modality, FileInfoBase.Unit, FileInfoBase.UnitType
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.String[]dicomToMincVarMapMinc var equivalents to anonymizable Dicom tags.private FileMincDimElem[]dimArrayDOCUMENT ME!private FileMincAttElem[]gattArrayDOCUMENT ME!static intNC_ATTRIBUTENetCDF defined data type - attribute.static intNC_BYTENetCDF defined data type - byte.static intNC_CHARNetCDF defined data type - character.static intNC_DIMENSIONNetCDF defined data type - dimension.static intNC_DOUBLENetCDF defined data type - double.static intNC_FLOATNetCDF defined data type - float.static intNC_INTNetCDF defined data type - integer.static intNC_SHORTNetCDF defined data type - short.static intNC_VARIABLENetCDF defined data type - variable.intnumrecsDOCUMENT ME!private static longserialVersionUIDUse serialVersionUID for interoperability.private FileMincVarElem[]varArrayDOCUMENT ME!doublevmaxValid image maximum value.doublevminValid image minimum value.- 
Fields inherited from class gov.nih.mipav.model.file.FileInfoBaseANGSTROMS, ANGSTROMS_STRING, AXIAL, axisOrientation, axisOrientationStr, BIOMAGNETIC_IMAGING, cameraMake, cameraModel, CENTIMETERS, CENTIMETERS_STRING, COLOR_FLOW_DOPPLER, COMPRESSION_BZIP2, COMPRESSION_GZIP, COMPRESSION_NONE, COMPRESSION_ZIP, COMPUTED_RADIOGRAPHY, COMPUTED_TOMOGRAPHY, conversionSpaceTimeUnits, CORONAL, DEGREES, DEGREES_STRING, DIAPHANOGRAPHY, DIGITAL_RADIOGRAPHY, DUPLEX_DOPPLER, ENDOSCOPY, exposureTime, EXTERNAL_CAMERA_PHOTOGRAPHY, FA, fileName, fileSuffix, FNumber, focalLength, focalLength35, GENERAL_MICROSCOPY, HARDCOPY, HOURS, HOURS_STRING, HZ, HZ_STRING, ICG, imageOrientation, INCHES, INCHES_STRING, INTRAORAL_RADIOGRAPHY, ISOSpeedRating, KILOMETERS, KILOMETERS_STRING, LASER_SURFACE_SCAN, MAGNETIC_RESONANCE, MAGNETIC_RESONANCE_ANGIOGRAPHY, MAGNETIC_RESONANCE_SPECTROSCOPY, MAMMOGRAPHY, METERS, METERS_STRING, MICROMETERS, MICROMETERS_STRING, MICROSEC, MICROSEC_STRING, MILES, MILES_STRING, MILLIMETERS, MILLIMETERS_STRING, MILLISEC, MILLISEC_STRING, MILS, MILS_STRING, MINUTES, MINUTES_STRING, modality, NANOMETERS, NANOMETERS_STRING, NANOSEC, NANOSEC_STRING, NUCLEAR_MEDICINE, ORI_A2P_TYPE, ORI_I2S_TYPE, ORI_L2R_TYPE, ORI_P2A_TYPE, ORI_R2L_TYPE, ORI_S2I_TYPE, ORI_UNKNOWN_TYPE, origin, OTHER, PANORAMIC_XRAY, POSITRON_EMISSION_TOMOGRAPHY, PPM, PPM_STRING, RADIO_FLUOROSCOPY, RADIOGRAPHIC_IMAGING, RADIOTHERAPY_DOSE, RADIOTHERAPY_IMAGE, RADIOTHERAPY_PLAN, RADIOTHERAPY_RECORD, RADIOTHERAPY_STRUCTURE_SET, RADS, RADS_STRING, RED_FREE, SAGITTAL, SECONDS, SECONDS_STRING, SINGLE_PHOTON_EMISSION_COMPUTED_TOMOGRAPHY, SLIDE_MICROSCOPY, sUnits, tagDescription, tagName, THERMOGRAPHY, TRANSFORM_ANOTHER_DATASET, TRANSFORM_MNI_152, TRANSFORM_SCANNER_ANATOMICAL, TRANSFORM_TALAIRACH_TOURNOUX, TRANSFORM_UNKNOWN, tUnits, ULTRASOUND, unitsOfMeasure, UNKNOWN_MEASURE, UNKNOWN_MODALITY, UNKNOWN_ORIENT, UNKNOWN_STRING, XRAY_ANGIOGRAPHY
 
- 
 - 
Constructor SummaryConstructors Constructor Description FileInfoMinc(java.lang.String name, java.lang.String directory, int format)MINC file information constructor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttValue(FileMincAttElem elem, java.lang.Object value, int index)Sets the value of the attribute element; used for setting attribute of variables.voidaddDimElem(java.lang.String name, int length, int index)Puts a new dimension element with the specified parameters into the dimension array at the gievn index.voidaddGattElem(java.lang.String name, int type, int length, int index)Puts a new global attribute array element with the specified parameters into the global attribute array at the given index.voidaddVarElem(java.lang.String name, int nelems, int[] dimid, int index)Puts a new variable element with the specified paramenters into the array at the given index.voidanonymize(boolean[] list)Removes requested identifying info.static doublecalculateIntercept(double min, double slope, double validMin)Calculates rescale intercept given a min and a slope value.voidcalculateRescaleIntercept(double[] rescaleIntercept, double[] rescaleSlope)In MINC images, "real" values for pixels are calculated by taking the given image min and image max and rescaling the data accordingly.static doublecalculateSlope(double max, double min, double validMax, double validMin)Calculates rescale slope given a min and a max value.java.util.Hashtable<java.lang.String,java.lang.String>convertTagsToTable()Returns all of the dicom-converted tags in the minc header as a tag-value hashtable.voidcreateDimArray(int length)Constructs the dimension array with the specified length.voidcreateGattArray(int length)Constructs the global attribute array with the specified length.voidcreateVarArray(int length)Constructs the variable array with the specified length.voiddisplayAboutInfo(JDialogBase dlog, TransMatrix matrix)Displays important information about the image.static int[]getAxisOrientation(TransMatrix mat)Return the 3 axis orientation codes that correspond to the closest standard anatomical orientation of the (i,j,k) axes.double[]getConvertStartLocationsToDICOM(int slice, int time)Accessor that gets the "start" variable values, adjusted so that [0] holds the image x axis value, [1] the image y axis value, and [2] the image z axis value.java.lang.StringgetDicomValue(java.lang.String dicomTag)Get the value from the minc info based on a given dicom tag id.FileMincDimElem[]getDimArray()Gets the array with the dimension information.FileMincDimElemgetDimElem(int index)Accessor that returns the dimension element at the indicated index in the dimension array.FileMincAttElem[]getGattArray()Gets the array with the attribute information.FileMincAttElemgetGattElem(int index)Accessor that returns the global attribute element at the indicated index in the global attribute array.private doublegetMincSliceThickness()Return the slice thickness value stored in the minc header (var = 'acquisition', attrib = 'slice_thickness').float[]getStartLocations()Accessor that gets the "start" variable values, with the "xspace" in 0, "yspace" in 1, and "zspace" in 2.private static java.lang.StringgetTagElem(java.lang.String fullTag)Extract the element identifier (removing the group id).private static java.lang.StringgetTagGroup(java.lang.String fullTag)Extract the group to which a dicom or minc element belongs to.FileMincVarElem[]getVarArray()Gets the array with the variable information.FileMincVarElemgetVarElem(int index)Accessor that returns the variable element at the indicated index in the variable array.voidsetImportantImageInfo()Sets necessary image information.voidsetModality()Sets the image modality based on the.static intsetOrientType(java.lang.String space, boolean positive)Helper method to set the axis orientations.voidsetResolutions(int orientation)Sets the resolutions from the variable array based on the orientation of the image.private voidsetStartLocation(double originCoord, int axis)Sets the start location of the specified axis.voidsetStartLocations(double[] origin)Sets start locations of each axis.voidsetUnits()Sets the units of the dimensions, as in millimeters, inches, etc.- 
Methods inherited from class gov.nih.mipav.model.file.FileInfoBasecopyCoreInfo, copyCoreInfo, displayAboutInfo, displayPrimaryInfo, finalize, getAboutInfo, getAllSameDimUnits, getAreaUnitsOfMeasureStr, getAxisDirection, getAxisOrientation, getAxisOrientation, getAxisOrientationFromStr, getAxisOrientationStr, getCameraMake, getCameraModel, getCompressionType, getDataType, getDataTypeFromStr, getEndianess, getEndianessFromStr, getExposureTime, getExtents, getFileDirectory, getFileFormat, getFileName, getFileSuffix, getFNumber, getFocalLength, getFocalLength35, getImageOrientation, getImageOrientationFromStr, getImageOrientationStr, getIs2_5D, getISOSpeedRating, getLPSOrigin, getLUT, getMax, getMaxB, getMaxG, getMaxR, getMin, getMinB, getMinG, getMinR, getModality, getModalityFromStr, getModalityStr, getModalityStr, getMultiFile, getNumOfBytesPerPixel, getOffset, getOrigin, getOrigin, getOriginalEndianess, getOriginAtSlice, getPhotometric, getPixelPadValue, getPrimaryInfo, getRescaleIntercept, getRescaleSlope, getResolution, getResolutions, getSize, getSliceThickness, getUnitsOfMeasure, getUnitsOfMeasure, getUnitsOfMeasureAbbrevStr, getUnitsOfMeasureAbbrevStr, getUnitsOfMeasureFromStr, getUnitsOfMeasureStr, getUnitsOfMeasureStr, getVolumeUnitsOfMeasureStr, isDicomOrdered, oppositeOrient, sameAxis, setAxisOrientation, setAxisOrientation, setCameraMake, setCameraModel, setCompressionType, setDataType, setEndianess, setExposureTime, setExtents, setExtents, setFileDirectory, setFileFormat, setFileName, setFileSuffix, setFNumber, setFocalLength, setFocalLength35, setImageOrientation, setISOSpeedRating, setLUT, setMax, setMaxB, setMaxG, setMaxR, setMin, setMinB, setMinG, setMinR, setModality, setMultiFile, setOffset, setOrigin, setOrigin, setOriginalEndianess, setPhotometric, setPixelPadValue, setRescaleIntercept, setRescaleSlope, setResolutions, setResolutions, setSliceThickness, setTagDescription, setTagName, setUnitsOfMeasure, setUnitsOfMeasure, setUnitsOfMeasure, setUnitsOfMeasure, toString
 - 
Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneableclone, nativeClone
 
- 
 
- 
- 
- 
Field Detail- 
serialVersionUIDprivate static final long serialVersionUID Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
 
 - 
NC_BYTEpublic static final int NC_BYTE NetCDF defined data type - byte.- See Also:
- Constant Field Values
 
 - 
NC_CHARpublic static final int NC_CHAR NetCDF defined data type - character.- See Also:
- Constant Field Values
 
 - 
NC_SHORTpublic static final int NC_SHORT NetCDF defined data type - short.- See Also:
- Constant Field Values
 
 - 
NC_INTpublic static final int NC_INT NetCDF defined data type - integer.- See Also:
- Constant Field Values
 
 - 
NC_FLOATpublic static final int NC_FLOAT NetCDF defined data type - float.- See Also:
- Constant Field Values
 
 - 
NC_DOUBLEpublic static final int NC_DOUBLE NetCDF defined data type - double.- See Also:
- Constant Field Values
 
 - 
NC_DIMENSIONpublic static final int NC_DIMENSION NetCDF defined data type - dimension.- See Also:
- Constant Field Values
 
 - 
NC_VARIABLEpublic static final int NC_VARIABLE NetCDF defined data type - variable.- See Also:
- Constant Field Values
 
 - 
NC_ATTRIBUTEpublic static final int NC_ATTRIBUTE NetCDF defined data type - attribute.- See Also:
- Constant Field Values
 
 - 
dicomToMincVarMappublic static final java.lang.String[] dicomToMincVarMap Minc var equivalents to anonymizable Dicom tags. Must be in the same order as FileInfoDicom.anonymizeTagIDs.- See Also:
- FileInfoDicom.anonymizeTagIDs
 
 - 
numrecspublic int numrecs DOCUMENT ME!
 - 
vmaxpublic double vmax Valid image maximum value. Default = -1.
 - 
vminpublic double vmin Valid image minimum value. Default = -1.
 - 
dimArrayprivate FileMincDimElem[] dimArray DOCUMENT ME!
 - 
gattArrayprivate FileMincAttElem[] gattArray DOCUMENT ME!
 - 
varArrayprivate FileMincVarElem[] varArray DOCUMENT ME!
 
- 
 - 
Method Detail- 
addAttValuepublic void addAttValue(FileMincAttElem elem, java.lang.Object value, int index) Sets the value of the attribute element; used for setting attribute of variables. A MincVarElem has an array of attributes and this method is called on those attributes.- Parameters:
- elem- the attribute element to add the value to.
- value- the value to set the element to.
- index- the index into the value array to set this value at.
- See Also:
- FileMincAttElem.setValue(java.lang.Object, int)
 
 - 
addDimElempublic void addDimElem(java.lang.String name, int length, int index)Puts a new dimension element with the specified parameters into the dimension array at the gievn index. The name is usually xspace, yspace, or zspace; the length is the corresponding size of that dimension.- Parameters:
- name- the name of the dimension element
- length- the length of the dimension element
- index- the index to put this element into the array
 
 - 
addGattElempublic void addGattElem(java.lang.String name, int type, int length, int index)Puts a new global attribute array element with the specified parameters into the global attribute array at the given index. Usually there is only one element in the global attribute array: the history.- Parameters:
- name- the name of the global attribute element
- type- the data type, i.e. byte, char, int, etc (see statically defined types)
- length- the length of the element
- index- the index into the array to put this element at
 
 - 
addVarElempublic void addVarElem(java.lang.String name, int nelems, int[] dimid, int index)Puts a new variable element with the specified paramenters into the array at the given index. There are other attributes to set for variables, in particular the attribute array, but that gets set in a different place.- Parameters:
- name- the name of this variable element
- nelems- the number of elements in the attribute array
- dimid- the dimension id array, usually empty but for "image" containing information about the dimensions
- index- index into the variable array to put this variable
- See Also:
- FileMincVarElem
 
 - 
anonymizepublic final void anonymize(boolean[] list) Removes requested identifying info. Can remove info stored in the minc header in a dicom-like structure and in a more minc-like info structure.- Parameters:
- list- the list of tags to remove; it MUST correspond to anonymizeTagIDs list (or spurious errors result), and it must be of the same length, or this will throw an IllegalArgumentException.
- Throws:
- java.lang.IllegalArgumentException- DOCUMENT ME!
 
 - 
calculateInterceptpublic static final double calculateIntercept(double min, double slope, double validMin)Calculates rescale intercept given a min and a slope value.- Parameters:
- min- Min value.
- slope- Slope value.
- Returns:
- Rescale intercept.
 
 - 
calculateRescaleInterceptpublic void calculateRescaleIntercept(double[] rescaleIntercept, double[] rescaleSlope)In MINC images, "real" values for pixels are calculated by taking the given image min and image max and rescaling the data accordingly. Image min and image max are given per slice.- Parameters:
- rescaleIntercept- Array of rescale intercepts to set
- rescaleSlope- Array of rescale slopes to set
 
 - 
calculateSlopepublic static final double calculateSlope(double max, double min, double validMax, double validMin)Calculates rescale slope given a min and a max value.- Parameters:
- max- Max value.
- min- Min value.
- Returns:
- Rescale slope
 
 - 
convertTagsToTablepublic java.util.Hashtable<java.lang.String,java.lang.String> convertTagsToTable() Returns all of the dicom-converted tags in the minc header as a tag-value hashtable.- Returns:
- a tag-value hashtable
 
 - 
createDimArraypublic final void createDimArray(int length) Constructs the dimension array with the specified length.- Parameters:
- length- the length of the array
 
 - 
createGattArraypublic final void createGattArray(int length) Constructs the global attribute array with the specified length.- Parameters:
- length- the length of the array
 
 - 
createVarArraypublic final void createVarArray(int length) Constructs the variable array with the specified length.- Parameters:
- length- the length of the array
 
 - 
displayAboutInfopublic void displayAboutInfo(JDialogBase dlog, TransMatrix matrix) Displays important information about the image.- Specified by:
- displayAboutInfoin class- FileInfoBase
- Parameters:
- dlog- where to display the info
- matrix- the transformation matrix
 
 - 
getConvertStartLocationsToDICOMpublic final double[] getConvertStartLocationsToDICOM(int slice, int time)Accessor that gets the "start" variable values, adjusted so that [0] holds the image x axis value, [1] the image y axis value, and [2] the image z axis value.MINC positive axis is left to right; positive axis is posterior to anterior; postive axis is inferior to superior DICOM positive axis is right to left; positive axis is anterior to posterior; postive axis is inferior to superior If the space's alignment attribute has the value 'centre', then subtract half the space's step value (doesn't seem to apply to zspace for some reason..). Then transform the point by the inverse of the direction_cosines matrix (extracted from the spaces). The result then has some of the signs of its components flipped (which is determined by the image orientation) to get it from minc to dicom orientation. - Parameters:
- slice- slice to begin the start variable on.
- timeSlice- time to begin the start variable on
- Returns:
- The slice position in dicom (and mipav) space.
 
 - 
getDicomValuepublic java.lang.String getDicomValue(java.lang.String dicomTag) Get the value from the minc info based on a given dicom tag id.- Parameters:
- dicomTag- dicom tag (group,elem)
- Returns:
- the value stored in the info (or null if it doesn't exist)
 
 - 
getDimArraypublic final FileMincDimElem[] getDimArray() Gets the array with the dimension information.- Returns:
- the array
 
 - 
getDimElempublic final FileMincDimElem getDimElem(int index) Accessor that returns the dimension element at the indicated index in the dimension array.- Parameters:
- index- index where the dimension element is located
- Returns:
- dimArray[index]
 
 - 
getGattArraypublic final FileMincAttElem[] getGattArray() Gets the array with the attribute information.- Returns:
- the array
 
 - 
getGattElempublic final FileMincAttElem getGattElem(int index) Accessor that returns the global attribute element at the indicated index in the global attribute array.- Parameters:
- index- index where the global attribute element is located
- Returns:
- gattArray[index]
 
 - 
getStartLocationspublic final float[] getStartLocations() Accessor that gets the "start" variable values, with the "xspace" in 0, "yspace" in 1, and "zspace" in 2. This differs from the other methods because it doesn't place the values so that they correspond to image x, y, and z. Gets values as stored in MINC header, not modified to account for the different origin.- Returns:
- The "start" values for the image.
 
 - 
getVarArraypublic final FileMincVarElem[] getVarArray() Gets the array with the variable information.- Returns:
- the array
 
 - 
getVarElempublic final FileMincVarElem getVarElem(int index) Accessor that returns the variable element at the indicated index in the variable array.- Parameters:
- index- index where the variable element is located
- Returns:
- varArray[index]
 
 - 
setImportantImageInfopublic final void setImportantImageInfo() Sets necessary image information.
 - 
setModalitypublic void setModality() Sets the image modality based on the.
 - 
setResolutionspublic void setResolutions(int orientation) Sets the resolutions from the variable array based on the orientation of the image. The "zspace" in MINC refers to the inferior-superior axis, whereas in MIPAV the z resolution variable is the slices (space between slices) regardless of the orientation. Therefore for proper display we must convert between them.- Parameters:
- orientation- The orientation of the image (sagittal, coronal, or axial).
 
 - 
setStartLocationspublic final void setStartLocations(double[] origin) Sets start locations of each axis.- Parameters:
- origin- the image origin
 
 - 
setUnitspublic final void setUnits() Sets the units of the dimensions, as in millimeters, inches, etc. Called after the header has been read in so the values within the varArray have been set properly already.
 - 
getTagElemprivate static java.lang.String getTagElem(java.lang.String fullTag) Extract the element identifier (removing the group id).- Parameters:
- fullTag- the full element identitfier
- Returns:
- the element id
 
 - 
getTagGroupprivate static java.lang.String getTagGroup(java.lang.String fullTag) Extract the group to which a dicom or minc element belongs to.- Parameters:
- fullTag- the full element identitfier
- Returns:
- the element group
 
 - 
getAxisOrientationpublic static int[] getAxisOrientation(TransMatrix mat) Return the 3 axis orientation codes that correspond to the closest standard anatomical orientation of the (i,j,k) axes.- Parameters:
- mat- 4x4 matrix that transforms (i,j,k) indexes to x,y,z coordinates where +x = Right, +y = Anterior, +z = Superior Only the upper-left 3x3 corner of the matrix is used This routine finds the permutation of (x,y,z) which has the smallest angle to the (i,j,k) axes directions, which are columns of the input matrix Errors: The codes returned will be zero.
- Returns:
- codes
 
 - 
getMincSliceThicknessprivate double getMincSliceThickness() Return the slice thickness value stored in the minc header (var = 'acquisition', attrib = 'slice_thickness').- Returns:
- The slice thickness, if it is stored in the minc header (0 otherwise).
 
 - 
setOrientTypepublic static int setOrientType(java.lang.String space, boolean positive)Helper method to set the axis orientations.- Parameters:
- space- The space - "xspace", "yspace", or "zspace".
- positive- Flag indicating if the space is moving in a positive direction.
- Returns:
- The proper axis orientation for that space.
 
 - 
setStartLocationprivate void setStartLocation(double originCoord, int axis)Sets the start location of the specified axis.- Parameters:
- originCoord- origin coord.
- axis- Axis of orientation; x is 0, y is 1, z is 2.
 
 
- 
 
-