Package gov.nih.mipav.model.file
Class FileDicomKey
- java.lang.Object
- 
- gov.nih.mipav.model.structures.ModelSerialCloneable
- 
- gov.nih.mipav.model.file.FileDicomKey
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable,- java.lang.Comparable<FileDicomKey>
 - Direct Known Subclasses:
- PrivateFileDicomKey
 
 public class FileDicomKey extends ModelSerialCloneable implements java.lang.Comparable<FileDicomKey> FileDicomKey goes along with FileDicomTag - it is the key into the hashtable that corresponds to a tag. For most of the tags it is simply a String that is the unique combination of group name and element name (e.g., "0002,0010"). But there are some tags given in the element dictionary as "50xx,0010" or "60xx,0050". The "x"s are wildcards meaning that there can be any number of group names that start with "50" or "60". In this case we want the hashtable to recognize the tag in order to get the pertinent information from elmdict (such as "Overlay Origin" and what type of data this is) while still storing the tags as unique. This is accomplished through this class and some code in FileInfoDicom.getEntry(String).- Author:
- Neva Cherniavsky
- See Also:
- FileDicomTag,- FileInfoDicom, Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringkeyThe dicom tag identifier in the format 'group,element'.private static longserialVersionUIDUse serialVersionUID for interoperability.
 - 
Constructor SummaryConstructors Constructor Description FileDicomKey(int group, int element)Creates a Key from the given group and element numbers provided.FileDicomKey(java.lang.String keyStr)Creates new key with the given String as the unique identifier.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FileDicomKey toCompare)booleanequals(java.lang.Object obj)Objects are equal if both are of type FileDicomKey, and both refer to the same value; if the input type is a String and the String representation of the key matches.voidfinalize()Prepares this class for cleanup.java.lang.StringgetElement()returns only the element portion of the DICOM key.intgetElementNumber()Returns the element portion of a DICOM key as an integer.java.lang.StringgetGroup()returns only the group portion of the DICOM key.intgetGroupNumber()returns the group portion of the DICOM key as an integer.java.lang.StringgetKey()Gets the unique identifier.inthashCode()Returns the unique identifier's hash code.voidsetKey(java.lang.String key)Sets the unique identifier.java.lang.StringtoString()Returns the unique identifier.static booleanverify(java.lang.String keyStr)Checks that the String s indeed refers to a String that is a valid key, two comma-separated hexidecimal numbers in the format of "[four digit Group number],[four digit element number]".- 
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
 
 - 
keyprotected java.lang.String key The dicom tag identifier in the format 'group,element'. 'x' is allowed in the group number for wildcards in the dicom dictionary. E.g., '0002,0010' or '50xx,00E1'.
 
- 
 - 
Constructor Detail- 
FileDicomKeypublic FileDicomKey(java.lang.String keyStr) Creates new key with the given String as the unique identifier. The string is checked for proper format, that it specifies 2 hexadecimal strings, separated by a comma.- Parameters:
- keyStr- Unique identifier.
- Throws:
- java.lang.IllegalArgumentException- if s is null, or formatted incorrectly.
 
 - 
FileDicomKeypublic FileDicomKey(int group, int element) throws java.lang.NumberFormatExceptionCreates a Key from the given group and element numbers provided. Example call: new FileDicomKey(0x0080,0x001F);- Parameters:
- group- Dicom tag group number.
- element- Dicom tag element number.
- Throws:
- java.lang.NumberFormatException- If there is a problem converting the group and element numbers to hexidecimal strings.
 
 
- 
 - 
Method Detail- 
verifypublic static boolean verify(java.lang.String keyStr) Checks that the String s indeed refers to a String that is a valid key, two comma-separated hexidecimal numbers in the format of "[four digit Group number],[four digit element number]". The Group number must be four digits, but the final 2 digits may be the character "xx", which is used to represent a variable group.- Parameters:
- keyStr- a String which is in the format 'group,element' with 'xx' possibly replacing the last 2 digits of the group id
- Returns:
- true if the string input can be used to represent a DICOM key, false if it cannot.
- Throws:
- java.lang.IllegalArgumentException- If the inputted string cannot be used to represent a DICOM key.
 
 - 
equalspublic boolean equals(java.lang.Object obj) Objects are equal if both are of type FileDicomKey, and both refer to the same value; if the input type is a String and the String representation of the key matches. This equals method will check that the keys are exactly are equal or they are equal except for place-holding "x" characters.- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- obj- Object to compare to.
- Returns:
- trueif equal.
 
 - 
finalizepublic void finalize() Prepares this class for cleanup.- Overrides:
- finalizein class- java.lang.Object
 
 - 
getElementpublic final java.lang.String getElement() returns only the element portion of the DICOM key.- Returns:
- The Element portion of the DICOM key.
 
 - 
getElementNumberpublic final int getElementNumber() Returns the element portion of a DICOM key as an integer.- Returns:
- the element number as an integer of the key.
- Throws:
- java.lang.NumberFormatException- if the element is a partially defined value and cannot be converted without some effort (eg, the element number is ("51xx")). This is possible, but should not be discovered in elements, only in groups.
- See Also:
- getGroupNumber()
 
 - 
getGrouppublic final java.lang.String getGroup() returns only the group portion of the DICOM key.- Returns:
- The group portion of the DICOM key.
 
 - 
getGroupNumberpublic final int getGroupNumber() throws java.lang.NumberFormatExceptionreturns the group portion of the DICOM key as an integer.- Returns:
- The Group number as an integer of the key.
- Throws:
- java.lang.NumberFormatException- if the element is a partially defined value and cannot be converted without some idea of what the number really is, and therefor some effort. Group numbers may be only partially specified (eg., "60xx").
 
 - 
getKeypublic final java.lang.String getKey() Gets the unique identifier.- Returns:
- The unique identifier.
 
 - 
hashCodepublic int hashCode() Returns the unique identifier's hash code.- Overrides:
- hashCodein class- java.lang.Object
- Returns:
- The hash code.
 
 - 
setKeypublic final void setKey(java.lang.String key) Sets the unique identifier.- Parameters:
- key- The unique identifier.
- Throws:
- java.lang.IllegalArgumentException- If the inputted string cannot be used to represent a DICOM key.
 
 - 
toStringpublic java.lang.String toString() Returns the unique identifier.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- The unique identifier.
 
 - 
compareTopublic int compareTo(FileDicomKey toCompare) - Specified by:
- compareToin interface- java.lang.Comparable<FileDicomKey>
 
 
- 
 
-