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:
Serializable,Cloneable
Class that stores matrices (owned by ModelImage) with accessor functions to the matrix map/adding and changing
matrices.
- Author:
- linkb
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TransMatrixThe composite matrix formed by multiplying (in reverse order) all stored matrices.private LinkedHashMap<String, TransMatrix> Linked hash map that will store all of the images associated matrices.private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMatrix(TransMatrix mat) Adds a matrix to the map. matrices will be keyed by their type and sequential numberingvoidRemoves all matrices from the map.clone()Copies the object.booleancontainsType(int type) Determines if the map contains a matrix of the given type (checks for String.contains()).getCompositeMatrix(boolean useDICOM) Gets the composite (dynamically built) matrix made by multiplying in forward order the image's matrices.Gets a cloned copy of the image's matrices stored in a vector.Accessor that gets a matrix based on the key (for the linkedhashmap)Gets the matrix map.Returns up to two composite TransMatrices that are NIFTI specificvoidremoveMatrix(Object key) Safe method for removing matrices from the imagevoidreplaceMatrices(Vector<TransMatrix> matrixVector) Helper function for XML type images which may have several associated matrices.voidreplaceMatrix(String key, TransMatrix newMatrix) Replaces the matrix at the given key (or inserts if that key is not present, which should not happen).toString()Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
nativeClone
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
compositeMatrix
The composite matrix formed by multiplying (in reverse order) all stored matrices. -
matrixMap
Linked hash map that will store all of the images associated matrices.
-
-
Constructor Details
-
MatrixHolder
public MatrixHolder(int nDims) Default constructor.- Parameters:
nDims- dimensions of image
-
-
Method Details
-
addMatrix
Adds a matrix to the map. matrices will be keyed by their type and sequential numbering- Parameters:
mat- DOCUMENT ME!
-
getNIFTICompositeMatrices
Returns up to two composite TransMatrices that are NIFTI specific- Returns:
- 0,1, or 2 TransMatrices (related to NIFTI)
-
clearMatrices
public void clearMatrices()Removes all matrices from the map. -
clone
Copies the object.- Overrides:
clonein classModelSerialCloneable- Returns:
- Object A copy of the file info.
-
containsType
public 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
-
getCompositeMatrix
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
-
getMatrix
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
-
getMatrices
Gets a cloned copy of the image's matrices stored in a vector.- Returns:
- Vector of image's matrices
-
getMatrixMap
Gets the matrix map.- Returns:
- the matrix map
-
removeMatrix
Safe method for removing matrices from the image- Parameters:
key- DOCUMENT ME!
-
replaceMatrices
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
-
replaceMatrix
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 matrixnewMatrix- the new matrix
-
toString
-