Package gov.nih.mipav.model.structures
Class MatrixHolder
- java.lang.Object
- 
- gov.nih.mipav.model.structures.ModelSerialCloneable
- 
- gov.nih.mipav.model.structures.MatrixHolder
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 
 public class MatrixHolder extends ModelSerialCloneable Class that stores matrices (owned by ModelImage) with accessor functions to the matrix map/adding and changing matrices.- Author:
- linkb
- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description private TransMatrixcompositeMatrixThe composite matrix formed by multiplying (in reverse order) all stored matrices.private java.util.LinkedHashMap<java.lang.String,TransMatrix>matrixMapLinked hash map that will store all of the images associated matrices.private static longserialVersionUID
 - 
Constructor SummaryConstructors Constructor Description MatrixHolder(int nDims)Default constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMatrix(TransMatrix mat)Adds a matrix to the map. matrices will be keyed by their type and sequential numberingvoidclearMatrices()Removes all matrices from the map.java.lang.Objectclone()Copies the object.booleancontainsType(int type)Determines if the map contains a matrix of the given type (checks for String.contains()).TransMatrixgetCompositeMatrix(boolean useDICOM)Gets the composite (dynamically built) matrix made by multiplying in forward order the image's matrices.java.util.Vector<TransMatrix>getMatrices()Gets a cloned copy of the image's matrices stored in a vector.TransMatrixgetMatrix(java.lang.Object key)Accessor that gets a matrix based on the key (for the linkedhashmap)java.util.LinkedHashMap<java.lang.String,TransMatrix>getMatrixMap()Gets the matrix map.TransMatrix[]getNIFTICompositeMatrices()Returns up to two composite TransMatrices that are NIFTI specificvoidremoveMatrix(java.lang.Object key)Safe method for removing matrices from the imagevoidreplaceMatrices(java.util.Vector<TransMatrix> matrixVector)Helper function for XML type images which may have several associated matrices.voidreplaceMatrix(java.lang.String key, TransMatrix newMatrix)Replaces the matrix at the given key (or inserts if that key is not present, which should not happen).java.lang.StringtoString()- 
Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneablenativeClone
 
- 
 
- 
- 
- 
Field Detail- 
serialVersionUIDprivate static final long serialVersionUID - See Also:
- Constant Field Values
 
 - 
compositeMatrixprivate TransMatrix compositeMatrix The composite matrix formed by multiplying (in reverse order) all stored matrices.
 - 
matrixMapprivate java.util.LinkedHashMap<java.lang.String,TransMatrix> matrixMap Linked hash map that will store all of the images associated matrices.
 
- 
 - 
Method Detail- 
addMatrixpublic void addMatrix(TransMatrix mat) Adds a matrix to the map. matrices will be keyed by their type and sequential numbering- Parameters:
- mat- DOCUMENT ME!
 
 - 
getNIFTICompositeMatricespublic TransMatrix[] getNIFTICompositeMatrices() Returns up to two composite TransMatrices that are NIFTI specific- Returns:
- 0,1, or 2 TransMatrices (related to NIFTI)
 
 - 
clearMatricespublic void clearMatrices() Removes all matrices from the map.
 - 
clonepublic java.lang.Object clone() Copies the object.- Overrides:
- clonein class- ModelSerialCloneable
- Returns:
- Object A copy of the file info.
 
 - 
containsTypepublic boolean containsType(int type) Determines if the map contains a matrix of the given type (checks for String.contains()).- Parameters:
- type- transformID to check
- Returns:
- whether the map contains this type of transform
 
 - 
getCompositeMatrixpublic TransMatrix getCompositeMatrix(boolean useDICOM) Gets the composite (dynamically built) matrix made by multiplying in forward order the image's matrices.- Parameters:
- useDICOM- whether to include the scanner anatomical matrix (if available)
- Returns:
- the composite TransMatrix
 
 - 
getMatrixpublic TransMatrix getMatrix(java.lang.Object key) Accessor that gets a matrix based on the key (for the linkedhashmap)- Parameters:
- key- key to the matrix
- Returns:
- the matrix associated with the key, null otherwise
 
 - 
getMatricespublic java.util.Vector<TransMatrix> getMatrices() Gets a cloned copy of the image's matrices stored in a vector.- Returns:
- Vector of image's matrices
 
 - 
getMatrixMappublic java.util.LinkedHashMap<java.lang.String,TransMatrix> getMatrixMap() Gets the matrix map.- Returns:
- the matrix map
 
 - 
removeMatrixpublic void removeMatrix(java.lang.Object key) Safe method for removing matrices from the image- Parameters:
- key- DOCUMENT ME!
 
 - 
replaceMatricespublic void replaceMatrices(java.util.Vector<TransMatrix> matrixVector) Helper function for XML type images which may have several associated matrices.- Parameters:
- matrixVector- Vector of matrices to replace the current matrices in the map
 
 - 
replaceMatrixpublic void replaceMatrix(java.lang.String key, TransMatrix newMatrix)Replaces the matrix at the given key (or inserts if that key is not present, which should not happen).- Parameters:
- key- the key for the matrix
- newMatrix- the new matrix
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-