Class FileInfoMinc
- All Implemented Interfaces:
Serializable,Cloneable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class gov.nih.mipav.model.file.FileInfoBase
FileInfoBase.AxisOrientation, FileInfoBase.ImageOrientation, FileInfoBase.Modality, FileInfoBase.Unit, FileInfoBase.UnitType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]Minc var equivalents to anonymizable Dicom tags.private FileMincDimElem[]DOCUMENT ME!private FileMincAttElem[]DOCUMENT ME!static final intNetCDF defined data type - attribute.static final intNetCDF defined data type - byte.static final intNetCDF defined data type - character.static final intNetCDF defined data type - dimension.static final intNetCDF defined data type - double.static final intNetCDF defined data type - float.static final intNetCDF defined data type - integer.static final intNetCDF defined data type - short.static final intNetCDF defined data type - variable.intDOCUMENT ME!private static final longUse serialVersionUID for interoperability.private FileMincVarElem[]DOCUMENT ME!doubleValid image maximum value.doubleValid image minimum value.Fields inherited from class gov.nih.mipav.model.file.FileInfoBase
ANGSTROMS, 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, dtiParams, 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 Summary
ConstructorsConstructorDescriptionFileInfoMinc(String name, String directory, int format) MINC file information constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttValue(FileMincAttElem elem, Object value, int index) Sets the value of the attribute element; used for setting attribute of variables.voidaddDimElem(String name, int length, int index) Puts a new dimension element with the specified parameters into the dimension array at the gievn index.voidaddGattElem(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(String name, int nelems, int[] dimid, int index) Puts a new variable element with the specified paramenters into the array at the given index.final voidanonymize(boolean[] list) Removes requested identifying info.static final 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 final doublecalculateSlope(double max, double min, double validMax, double validMin) Calculates rescale slope given a min and a max value.Returns all of the dicom-converted tags in the minc header as a tag-value hashtable.final voidcreateDimArray(int length) Constructs the dimension array with the specified length.final voidcreateGattArray(int length) Constructs the global attribute array with the specified length.final voidcreateVarArray(int length) Constructs the variable array with the specified length.voiddisplayAboutInfo(JDialogBase dlog, TransMatrix matrix) Displays important information about the image.static int[]Return the 3 axis orientation codes that correspond to the closest standard anatomical orientation of the (i,j,k) axes.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.getDicomValue(String dicomTag) Get the value from the minc info based on a given dicom tag id.final FileMincDimElem[]Gets the array with the dimension information.final FileMincDimElemgetDimElem(int index) Accessor that returns the dimension element at the indicated index in the dimension array.final FileMincAttElem[]Gets the array with the attribute information.final FileMincAttElemgetGattElem(int index) Accessor that returns the global attribute element at the indicated index in the global attribute array.private doubleReturn the slice thickness value stored in the minc header (var = 'acquisition', attrib = 'slice_thickness').final float[]Accessor that gets the "start" variable values, with the "xspace" in 0, "yspace" in 1, and "zspace" in 2.private static StringgetTagElem(String fullTag) Extract the element identifier (removing the group id).private static StringgetTagGroup(String fullTag) Extract the group to which a dicom or minc element belongs to.final FileMincVarElem[]Gets the array with the variable information.final FileMincVarElemgetVarElem(int index) Accessor that returns the variable element at the indicated index in the variable array.final voidSets necessary image information.voidSets the image modality based on the.static intsetOrientType(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.final voidsetStartLocations(double[] origin) Sets start locations of each axis.final voidsetUnits()Sets the units of the dimensions, as in millimeters, inches, etc.Methods inherited from class gov.nih.mipav.model.file.FileInfoBase
copyCoreInfo, copyCoreInfo, displayAboutInfo, displayPrimaryInfo, finalize, getAboutInfo, getAllSameDimUnits, getAreaUnitsOfMeasureStr, getAxisDirection, getAxisOrientation, getAxisOrientation, getAxisOrientationFromStr, getAxisOrientationStr, getCameraMake, getCameraModel, getCompressionType, getDataType, getDataTypeFromStr, getDTIParameters, 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, setDTIParameters, 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, toStringMethods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
clone, nativeClone
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
NC_BYTE
public static final int NC_BYTENetCDF defined data type - byte.- See Also:
-
NC_CHAR
public static final int NC_CHARNetCDF defined data type - character.- See Also:
-
NC_SHORT
public static final int NC_SHORTNetCDF defined data type - short.- See Also:
-
NC_INT
public static final int NC_INTNetCDF defined data type - integer.- See Also:
-
NC_FLOAT
public static final int NC_FLOATNetCDF defined data type - float.- See Also:
-
NC_DOUBLE
public static final int NC_DOUBLENetCDF defined data type - double.- See Also:
-
NC_DIMENSION
public static final int NC_DIMENSIONNetCDF defined data type - dimension.- See Also:
-
NC_VARIABLE
public static final int NC_VARIABLENetCDF defined data type - variable.- See Also:
-
NC_ATTRIBUTE
public static final int NC_ATTRIBUTENetCDF defined data type - attribute.- See Also:
-
dicomToMincVarMap
Minc var equivalents to anonymizable Dicom tags. Must be in the same order as FileInfoDicom.anonymizeTagIDs.- See Also:
-
numrecs
public int numrecsDOCUMENT ME! -
vmax
public double vmaxValid image maximum value. Default = -1. -
vmin
public double vminValid image minimum value. Default = -1. -
dimArray
DOCUMENT ME! -
gattArray
DOCUMENT ME! -
varArray
DOCUMENT ME!
-
-
Constructor Details
-
FileInfoMinc
MINC file information constructor.- Parameters:
name- file namedirectory- file directoryformat- format (in this case, MINC)
-
-
Method Details
-
addAttValue
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:
-
addDimElem
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 elementlength- the length of the dimension elementindex- the index to put this element into the array
-
addGattElem
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 elementtype- the data type, i.e. byte, char, int, etc (see statically defined types)length- the length of the elementindex- the index into the array to put this element at
-
addVarElem
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 elementnelems- the number of elements in the attribute arraydimid- the dimension id array, usually empty but for "image" containing information about the dimensionsindex- index into the variable array to put this variable- See Also:
-
anonymize
public 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:
IllegalArgumentException- DOCUMENT ME!
-
calculateIntercept
public 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.
-
calculateRescaleIntercept
public 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 setrescaleSlope- Array of rescale slopes to set
-
calculateSlope
public 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
-
convertTagsToTable
Returns all of the dicom-converted tags in the minc header as a tag-value hashtable.- Returns:
- a tag-value hashtable
-
createDimArray
public final void createDimArray(int length) Constructs the dimension array with the specified length.- Parameters:
length- the length of the array
-
createGattArray
public final void createGattArray(int length) Constructs the global attribute array with the specified length.- Parameters:
length- the length of the array
-
createVarArray
public final void createVarArray(int length) Constructs the variable array with the specified length.- Parameters:
length- the length of the array
-
displayAboutInfo
Displays important information about the image.- Specified by:
displayAboutInfoin classFileInfoBase- Parameters:
dlog- where to display the infomatrix- the transformation matrix
-
getConvertStartLocationsToDICOM
public 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.
-
getDicomValue
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)
-
getDimArray
Gets the array with the dimension information.- Returns:
- the array
-
getDimElem
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]
-
getGattArray
Gets the array with the attribute information.- Returns:
- the array
-
getGattElem
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]
-
getStartLocations
public 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.
-
getVarArray
Gets the array with the variable information.- Returns:
- the array
-
getVarElem
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]
-
setImportantImageInfo
public final void setImportantImageInfo()Sets necessary image information. -
setModality
public void setModality()Sets the image modality based on the. -
setResolutions
public 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).
-
setStartLocations
public final void setStartLocations(double[] origin) Sets start locations of each axis.- Parameters:
origin- the image origin
-
setUnits
public 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. -
getTagElem
Extract the element identifier (removing the group id).- Parameters:
fullTag- the full element identitfier- Returns:
- the element id
-
getTagGroup
Extract the group to which a dicom or minc element belongs to.- Parameters:
fullTag- the full element identitfier- Returns:
- the element group
-
getAxisOrientation
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
-
getMincSliceThickness
private 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).
-
setOrientType
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.
-
setStartLocation
private 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.
-