Package gov.nih.mipav.model.file
Class FileDicomTagTable
java.lang.Object
gov.nih.mipav.model.file.FileDicomTagTable
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
FileDicomSQItem
A table containing dicom tags. Common tags are not stored here and instead
should be stored in the reference tag table. The reference tag table may refer
to another table within a FileInfoDicom.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileDicomTagTable[]A list of tag tables which point to this as their reference tag table.protected booleanWhether this tag table is a reference table (meaning it contains all of the tags for a given fileInfo and does not need to refer anywhere else when retrieving values).protected FileInfoDicomThe dicom file info that this tag table belongs to.protected FileDicomTagTableThe reference table to check when a tag is not found in this table.private static final longUse serialVersionUID for interoperability.protected Hashtable<FileDicomKey, FileDicomTag> Tags unique to this slice, or all of the tags for this slice if this is a reference tag table.protected FileInfoDicom.VRtypeVR_type to indicate explicit/implicit nature of tags contained in tag table -
Constructor Summary
ConstructorsConstructorDescriptionFileDicomTagTable(FileInfoDicom parent, FileDicomTagTable firstSliceTags, FileInfoDicom.VRtype vr_type) Creates a new FileDicomTagTable object.FileDicomTagTable(FileInfoDicom parent, FileInfoDicom.VRtype vr_type) Creates a new FileDicomTagTable object. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidattachChildTagTables(FileDicomTagTable[] children) Sets the list of tag tables which point to this as their reference tag table.clone()Perform a deep copy of this tag table.final booleancontainsTag(FileDicomKey key) Returns whether the tag table contains a tag with the given key identifier, either in the reference tag table or the slice-specific tablefinal booleancontainsTag(String keyStr) Returns whether the tag table contains a tag with the given key identifier, either in the reference tag table or the slice-specific tablefinal booleanReturns whether this specific tag table contains a tag with the given key identifier, does not check the reference tag tablefinal booleancontainsUniqueTag(String keyStr) Returns whether this specific tag table contains a tag with the given key identifier, does not check the reference tag tablevoidfinalize()Prepares this class for cleanup.final FileDicomTagget(FileDicomKey key) Accessor that returns the tag with a certain hexadecimal key.final FileDicomTagAccessor that returns the tag with a certain hexadecimal key.intgetDataLength(boolean includeTagID) Calculates the number of bytes that the data (the object value) takes to be stored.final intGets the number of elements in the data set (# of tags in item).final FileDicomTagTablefinal Vector<FileDicomTag> Returns a list of the sequence tags in this tag table (and reference tag table).final Hashtable<FileDicomKey, FileDicomTag> Deprecated.See getTagListCopy()final Hashtable<FileDicomKey, FileDicomTag> Returns a copy of all of the tags in this table, including tags from the reference tag table.final Hashtable<FileDicomKey, FileDicomTag> Returns only the tags stored directly in this tag table, not including tags from the reference tag table.final ObjectgetValue(FileDicomKey key) Returns the value matching the key as a meaningful (ie., non-coded) string .final ObjectgetValue(FileDicomKey key, boolean parse) Returns the value matching the key as a Java data elementget(key).getValue(parse).final ObjectReturns the value matching the key as a meaningful (ie., non-coded) string .final ObjectReturns the value matching the key as a Java data elementget(keyStr).getValue(parse).final FileInfoDicom.VRtypefinal voidimportTags(FileInfoDicom srcDicomInfo) Sets the tags in this tag table to match the tags contained in the tag table of a dicom file info.booleanReturns true if this dicom tag table is a root tag table, not attached to a reference table.protected final booleanReturns true if a given tag is in the reference tag table and has the same value as the tag in the reference table.protected final voidput(FileDicomTag tag) Adds a tag to the tag table, overwriting if a value is already in the table under this tag's key.final voidAdds a private tag to the tag table using some dicom info.final voidremoveTag(FileDicomKey key) Remove a tag from this tag table (does not affect reference table, if this is a non-reference table).final voidRemove a tag from this tag table (does not affect reference table, if this is a non-reference table).final voidreset()Remove all of the tags from this table (does not affect reference table, if this is a non-reference table).final voidsetLength(FileDicomKey key, int length) Sets the length of the tag.final voidSets the length of the tag.final voidsetValue(FileDicomKey key, FileDicomTag tag, Object value, int length) Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name.voidsetValue(FileDicomKey key, Object value) Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name.final voidsetValue(FileDicomKey key, Object value, int length) Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name.final voidSets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name.final voidSets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name.final voidsetVr_type(FileInfoDicom.VRtype vr_type) static final FileDicomTag[]sortTagsList(Collection<FileDicomTag> tagList) Sorts the list of tags and returns it as an array in order.static final FileDicomTag[]sortTagsList(Dictionary<FileDicomKey, FileDicomTag> tagList) Sorts the list of tags and returns it as an array in order.toString()Returns a string containing information about this tag table.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
childTagTables
A list of tag tables which point to this as their reference tag table. -
isReferenceTagTable
protected boolean isReferenceTagTableWhether this tag table is a reference table (meaning it contains all of the tags for a given fileInfo and does not need to refer anywhere else when retrieving values). -
parentFileInfo
The dicom file info that this tag table belongs to. Used to update file info fields based on tag table changes. -
referenceTagTable
The reference table to check when a tag is not found in this table. If this table is a reference table, then the value should bethisand no checking of the referenceTagTable should take place. -
tagTable
Tags unique to this slice, or all of the tags for this slice if this is a reference tag table. -
vr_type
VR_type to indicate explicit/implicit nature of tags contained in tag table
-
-
Constructor Details
-
FileDicomTagTable
Creates a new FileDicomTagTable object. Should be used for the tags from the first slice of an image volume.- Parameters:
parent- The dicom file info that this tag table belongs to.
-
FileDicomTagTable
public FileDicomTagTable(FileInfoDicom parent, FileDicomTagTable firstSliceTags, FileInfoDicom.VRtype vr_type) Creates a new FileDicomTagTable object.- Parameters:
parent- The dicom file info that this tag table belongs to.firstSliceTags- A reference to the tag table for the first slice of the image volume
-
-
Method Details
-
sortTagsList
Sorts the list of tags and returns it as an array in order.- Parameters:
tagList- A table of tags to sort according to their keys.- Returns:
- The sorted list.
-
sortTagsList
Sorts the list of tags and returns it as an array in order.- Parameters:
tagList- A collection of tags to sort according to their keys.- Returns:
- The sorted list.
-
attachChildTagTables
Sets the list of tag tables which point to this as their reference tag table.- Parameters:
children- A list of tag tables which point to this as their reference tag table.
-
clone
Perform a deep copy of this tag table. -
containsTag
Returns whether the tag table contains a tag with the given key identifier, either in the reference tag table or the slice-specific table- Parameters:
keyStr- the string representing the key for this tag -- 'group,element'- Returns:
- whether a tag matching the given key is contained in this tag table (checks reference tag table).
-
containsTag
Returns whether the tag table contains a tag with the given key identifier, either in the reference tag table or the slice-specific table- Parameters:
key- the key for this tag- Returns:
- whether a tag matching the given key is contained in this tag table (checks reference tag table).
-
containsUniqueTag
Returns whether this specific tag table contains a tag with the given key identifier, does not check the reference tag table- Parameters:
keyStr- the string representing the key for this tag -- 'group,element'- Returns:
- whether a tag matching the given key is contained in this tag table (does not check reference tag table).
-
containsUniqueTag
Returns whether this specific tag table contains a tag with the given key identifier, does not check the reference tag table- Parameters:
key- the key for this tag- Returns:
- whether a tag matching the given key is contained in this tag table (does not check the reference tag table).
-
get
Accessor that returns the tag with a certain hexadecimal key.- Parameters:
keyStr- the string representing the key for this tag -- 'group,element'- Returns:
- the tag matching that key string
-
get
Accessor that returns the tag with a certain hexadecimal key.- Parameters:
key- the key for this tag- Returns:
- the tag matching that key
-
getDataLength
public int getDataLength(boolean includeTagID) Calculates the number of bytes that the data (the object value) takes to be stored. This method returns the number of data items times the sizeof the data type. This method will be so much simpler when (if) the tags are separated out as individual classes.- Returns:
- size of the value in bytes
-
getNumberOfElements
public final int getNumberOfElements()Gets the number of elements in the data set (# of tags in item).- Returns:
- the number of elements
-
getTagList
Deprecated.See getTagListCopy()Returns a copy of all of the tags in this table, including tags from the reference tag table.- Returns:
- A copy of all of the dicom tags.
-
getTagListCopy
Returns a copy of all of the tags in this table, including tags from the reference tag table.- Returns:
- A copy of all of the dicom tags.
-
getTagListUnique
Returns only the tags stored directly in this tag table, not including tags from the reference tag table.- Returns:
- The tags stored directly in this table.
-
getSeqTagList
Returns a list of the sequence tags in this tag table (and reference tag table).- Returns:
- A list of the sequence tags in this tag table (and reference tag table).
-
getReferenceTagTable
- Returns:
- the referenceTagTable
-
getValue
Returns the value matching the key as a meaningful (ie., non-coded) string . This is the equivalent of callingget(key).getValue(true).- Parameters:
key- the key to search for- Returns:
- the value that this key matches to as a String for output
- See Also:
-
getValue
Returns the value matching the key as a Java data elementget(key).getValue(parse).- Parameters:
key- the key to search forparse- whether to parse the tag value to a non-coded string- Returns:
- the value that this key matches to as a String for output
- See Also:
-
getValue
Returns the value matching the key as a meaningful (ie., non-coded) string . This is the equivalent of callingget(keyStr).getValue(true).- Parameters:
keyStr- the hexidecimal key to search for -- 'group,element'- Returns:
- the value that this key matches to as a String for output
- See Also:
-
getValue
Returns the value matching the key as a Java data elementget(keyStr).getValue(parse).- Parameters:
keyStr- the hexidecimal key to search for -- 'group,element'parse- whether to parse the tag value to a non-coded string- Returns:
- the value that this key matches to as a String for output
- See Also:
-
getVr_type
- Returns:
- the vr_type
-
importTags
Sets the tags in this tag table to match the tags contained in the tag table of a dicom file info. All tags already in this table are removed (does not effect tags in its reference tag table).- Parameters:
srcDicomInfo- The dicom file info to copy tags from.
-
putPrivateTagValue
Adds a private tag to the tag table using some dicom info.- Parameters:
info- information about the private dicom tag.
-
removeTag
Remove a tag from this tag table (does not affect reference table, if this is a non-reference table). If this is a reference table, the removal is dumb and doesn't copy the tag to the child tag tables.- Parameters:
keyStr- the hexidecimal key to search for -- 'group,element'
-
removeTag
Remove a tag from this tag table (does not affect reference table, if this is a non-reference table). If this is a reference table, the removal is dumb and doesn't copy the tag to the child tag tables.- Parameters:
key- the key to search for
-
reset
public final void reset()Remove all of the tags from this table (does not affect reference table, if this is a non-reference table). -
setLength
Sets the length of the tag.- Parameters:
key- the key to search forlength- length to set
-
setLength
Sets the length of the tag.- Parameters:
keyStr- the hexidecimal key to search for -- 'group,element'length- length to set
-
setValue
Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name. The tag names are unique and that's why they are the keys to the Hashtable. This function also sets modality and other important file information. Should not be used for the values of private tags, unless they are already in the tag table (through a call to putPrivateTagValue()), since the value representation is unknown.- Parameters:
value- the value to set the DicomTag tokey- the key for the DicomTag in tagsList
-
setValue
Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name. The tag names are unique and that's why they are the keys to the Hashtable. This function also sets modality and other important file information. Should not be used for the values of private tags, unless they are already in the tag table (through a call to putPrivateTagValue()), since the value representation is unknown.- Parameters:
key- the key for the DicomTag in tagsListvalue- the value to set the DicomTag to
-
setValue
Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name. The tag names are unique and that's why they are the keys to the Hashtable. This function also sets modality and other important file information. Should not be used for the values of private tags, unless they are already in the tag table (through a call to putPrivateTagValue()), since the value representation is unknown.- Parameters:
name- the key for the DicomTag in tagsList (Group, element)value- the value to set the DicomTag tolength- the length of the tag
-
setValue
Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name. The tag names are unique and that's why they are the keys to the Hashtable. This function also sets modality and other important file information. Should not be used for the values of private tags, unless they are already in the tag table (through a call to putPrivateTagValue()), since the value representation is unknown.- Parameters:
key- the key for the DicomTag in tagsListvalue- the value to set the DicomTag tolength- the length of the tag
-
setValue
Sets the value of the DicomTag in the tagsList Hashtable with the same hexadecimal tag name. The tag names are unique and that's why they are the keys to the Hashtable. This function also sets modality and other important file information. This function handles private tags appropriately without them first being added to the tagTable.- Parameters:
key- the key for the DicomTag in tagsListvalue- the value to set the DicomTag tolength- the length of the tag
-
setVr_type
- Parameters:
vr_type- the vr_type to set
-
toString
Returns a string containing information about this tag table. -
isTagSameAsReferenceTag
Returns true if a given tag is in the reference tag table and has the same value as the tag in the reference table. Returns false if called from the reference tag table.- Parameters:
tag- The tag to check against the reference tag table.- Returns:
- Whether the tag is the same as the one in the reference tag table, false otherwise or if this is the reference tag table.
-
put
Adds a tag to the tag table, overwriting if a value is already in the table under this tag's key. If this is a reference tag table, then the current value in the tag table must be copied over to all of the tag tables which refer to this one.- Parameters:
tag- A tag to add to the table.
-
finalize
public void finalize()Prepares this class for cleanup. -
isReferenceTagTable
public boolean isReferenceTagTable()Returns true if this dicom tag table is a root tag table, not attached to a reference table.- Returns:
- true if this dicom tag table is a root tag table, not attached to a reference table.
-