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:
Serializable,Cloneable,Comparable<FileDicomKey>
- Direct Known Subclasses:
PrivateFileDicomKey
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe dicom tag identifier in the format 'group,element'.private static final longUse serialVersionUID for interoperability. -
Constructor Summary
ConstructorsConstructorDescriptionFileDicomKey(int group, int element) Creates a Key from the given group and element numbers provided.FileDicomKey(String keyStr) Creates new key with the given String as the unique identifier. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(FileDicomKey toCompare) booleanObjects 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.final Stringreturns only the element portion of the DICOM key.final intReturns the element portion of a DICOM key as an integer.final StringgetGroup()returns only the group portion of the DICOM key.final intreturns the group portion of the DICOM key as an integer.final StringgetKey()Gets the unique identifier.inthashCode()Returns the unique identifier's hash code.final voidSets the unique identifier.toString()Returns the unique identifier.static booleanChecks 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.ModelSerialCloneable
clone, nativeClone
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
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 Details
-
FileDicomKey
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:
IllegalArgumentException- if s is null, or formatted incorrectly.
-
FileDicomKey
Creates 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:
NumberFormatException- If there is a problem converting the group and element numbers to hexidecimal strings.
-
-
Method Details
-
verify
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:
IllegalArgumentException- If the inputted string cannot be used to represent a DICOM key.
-
equals
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. -
finalize
public void finalize()Prepares this class for cleanup. -
getElement
returns only the element portion of the DICOM key.- Returns:
- The Element portion of the DICOM key.
-
getElementNumber
public 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:
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:
-
getGroup
returns only the group portion of the DICOM key.- Returns:
- The group portion of the DICOM key.
-
getGroupNumber
returns the group portion of the DICOM key as an integer.- Returns:
- The Group number as an integer of the key.
- Throws:
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").
-
getKey
Gets the unique identifier.- Returns:
- The unique identifier.
-
hashCode
public int hashCode()Returns the unique identifier's hash code. -
setKey
Sets the unique identifier.- Parameters:
key- The unique identifier.- Throws:
IllegalArgumentException- If the inputted string cannot be used to represent a DICOM key.
-
toString
Returns the unique identifier. -
compareTo
- Specified by:
compareToin interfaceComparable<FileDicomKey>
-