Class DicomDictionary
The dictionary defines each tag on its own line, begining with the tag's ID in parenthesis, for example:
(01AC,1101),
where the initial 4 digits are the group number, and the second for digits are the element number. Following the
group and element, each attribute of the tag definition is specified by attribute type, followed by an "=",
then the attribute value in quotations. The attributes are separated by tabs, and are held in order:
- VERS (DICOM version)
- VR (Value Representation)
- VM (Value Multiplicity)
- KEYWORD (the NAME, without white-space)
- NAME (A real-world description of the meaning of this tag)
Once the dictionary is parsed, the tag values are blank, so that when FileDicom reads the new file, it sets the Hashtable in FileInfoDicom to this Hashtable and then sets the value attributes as it reads them in. This way all standard tags are accounted for and if their value attribute is null, the FileInfoDicom table will not display that tag.
Furthermore, the utility of this class is enhanced to provide two additional functions:
- It parses a dictionary file
- It has a static method to write out a dicom dictionary out to a file.
- Version:
- 1.0 Aug 1, 1999
- Author:
- Neva Cherniavsky
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intDOCUMENT ME!static final Stringdefault dictionary file name, "dicom_dictionary.txt".private static Hashtable<FileDicomKey, FileDicomTagInfo> Hashtable filled with known DICOM tags with empty value attributes.private static final longUse serialVersionUID for interoperability.protected static final intDOCUMENT ME!static final Stringsubset dictionary file name, "dicomsave.dictionary".private static Hashtable<FileDicomKey, FileDicomTagInfo> Hashtable filled with DICOM tags which are a subset (not necessarily a proper subset) of dicom tags in the master table. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsTag(FileDicomKey key) Returns whether the dicom dictionary contains a tag with the given key identifier.protected static FileDicomKeyConverts group numbers of 60xx or 50xx dicom key elements so that the dicom dictionary will be able to find them.static booleanQuietly checks to see if the subset dicom dictionary exists on disk.protected static booleanstatic Hashtable<FileDicomKey, FileDicomTagInfo> Returns a reference to the DICOM Hashtable.static Hashtable<FileDicomKey, FileDicomTagInfo> getDicomTagTable(boolean forceReload) Returns a reference to the DICOM Hashtable.protected static BufferedReadergetFileReader(String filename) Gets a buffered reader for a given file name.static FileDicomTagInfogetInfo(FileDicomKey key) Return information about a key in the dicom dictionary.static StringgetKeyFromTagName(String searchTagName) Find the key of the corresponding tag name in the hashtable.static StringgetKeyword(FileDicomKey key) Find the keyword of the tag given by the key in the hashtable.static StringgetName(FileDicomKey key) Find the realworld name of the tag given by the key in the hashtable.static Hashtable<FileDicomKey, FileDicomTagInfo> Returns a reference to the subset dicom tag table.static Hashtable<FileDicomKey, FileDicomTagInfo> getSubsetDicomTagTable(boolean forceReload) Returns a reference to the subset dicom tag table.static FileDicomTagInfo.VRgetType(FileDicomKey key) Accessor that returns the type of the tag (different from, but related to the vr).static intgetVM(FileDicomKey key) Accessor that returns the value multiplicity of the tag.static FileDicomTagInfo.VRgetVR(FileDicomKey key) Accessor that returns the value representation of the tag.protected static voidparseFile(int dictionary_type) Method called once when the user opens MIPAV.static FileDicomKey[]sortTagKeys(Hashtable<FileDicomKey, FileDicomTagInfo> dicomTagsList) Sorts the list of tags and returns it as an array in order of FileDicomKeys.static voidwriteFile(File dictFile, Hashtable<FileDicomKey, FileDicomTagInfo> dicomHash) Writes the DICOMHashtable given to the file that the CreateDicomFiles points to.static voidwriteFile(File dictFile, Hashtable<FileDicomKey, FileDicomTagInfo> dicomHash, String altComment) Writes the DICOMHashtable given to the file that the CreateDicomFiles points to.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
DEFAULT_DICTIONARY_FILENAME
default dictionary file name, "dicom_dictionary.txt".- See Also:
-
SUBSET_DICTIONARY_FILENAME
subset dictionary file name, "dicomsave.dictionary".- See Also:
-
DEFAULT_DICTIONARY
protected static final int DEFAULT_DICTIONARYDOCUMENT ME!- See Also:
-
SUBSET_DICTIONARY
protected static final int SUBSET_DICTIONARYDOCUMENT ME!- See Also:
-
masterHashtable
Hashtable filled with known DICOM tags with empty value attributes. -
subsetHashtable
Hashtable filled with DICOM tags which are a subset (not necessarily a proper subset) of dicom tags in the master table. This subset is then used to export dicom tags to the XML image format.
-
-
Constructor Details
-
DicomDictionary
public DicomDictionary()
-
-
Method Details
-
containsTag
Returns whether the dicom dictionary contains a tag with the given key identifier.- Parameters:
key- the key for this tag- Returns:
- whether a tag matching the given key is contained in the dicom dictionary.
-
getDicomTagTable
Returns a reference to the DICOM Hashtable.- Returns:
- a reference to the dicom tag table
-
getDicomTagTable
Returns a reference to the DICOM Hashtable.- Parameters:
forceReload- If true, forces the master tag table to be re-read from the dicom dictionary file- Returns:
- a reference to the dicom tag table
-
getInfo
Return information about a key in the dicom dictionary.- Parameters:
key- the key to retreive information about- Returns:
- information about the requested key
-
getKeyFromTagName
Find the key of the corresponding tag name in the hashtable. Returns null if it no key is found.- Parameters:
searchTagName- The name of the tag for which you want the key.- Returns:
- The key as a String, for example "0010,0028" If the tag name is not in the hashtable,
nullis returned.
-
getKeyword
Find the keyword of the tag given by the key in the hashtable.- Parameters:
key- the key of the desired name.- Returns:
- the keyword (the 2nd-to-last entry in "dicom_dictionary.txt"). if the tag is not in the
hashtable,
nullis returned.
-
getName
Find the realworld name of the tag given by the key in the hashtable.- Parameters:
key- the key of the desired name.- Returns:
- the realworld name (the last enry in "dicom_dictionary.txt"). if the tag is not in the
hashtable,
nullis returned.
-
doesSubsetDicomTagTableExist
public static boolean doesSubsetDicomTagTableExist()Quietly checks to see if the subset dicom dictionary exists on disk. Can be used to avoid a call to getSubsetDicomTagTable() that might cause a warning dialog to appear.- Returns:
- True if
SUBSET_DICTIONARY_FILENAMEexists.
-
getSubsetDicomTagTable
Returns a reference to the subset dicom tag table.- Returns:
- A reference to the subset dicom tag table
-
getSubsetDicomTagTable
Returns a reference to the subset dicom tag table.- Parameters:
forceReload- If true, forces the subset tag table to be re-read from the dicom save dictionary file- Returns:
- A reference to the subset dicom tag table
-
getType
Accessor that returns the type of the tag (different from, but related to the vr).- Parameters:
key- the key of the desired name.- Returns:
- the type if the tag is not in the hashtable,
nullis returned.
-
getVM
Accessor that returns the value multiplicity of the tag. The value multiplicity is how many instances of this value representation (VR) there can be in one tag.- Parameters:
key- the key of the desired name.- Returns:
- the value multiplicity if the tag is not in the hashtable,
0is returned.
-
getVR
Accessor that returns the value representation of the tag. The value representation allows the reader the read and interpret the tag properly. Because private tags are not unique, the VR is null and they may be read and/or displayed improperly.- Parameters:
key- the key of the desired name.- Returns:
- the value representation if the tag is not in the hashtable,
nullis returned.
-
sortTagKeys
Sorts the list of tags and returns it as an array in order of FileDicomKeys.- Parameters:
dicomTagsList- The hashtable of DICOM tags (the keys are FileDicomKey and the object referred to by that key is the FileDicomTagInfo).- Returns:
- a sorted array of DICOM Keys.
-
writeFile
public static void writeFile(File dictFile, Hashtable<FileDicomKey, FileDicomTagInfo> dicomHash) throws IOExceptionWrites the DICOMHashtable given to the file that the CreateDicomFiles points to.- Parameters:
dictFile- the dicom dictionary file to write outdicomHash- the dicom tag mapping to write out- Throws:
IOException- when the file cannot be written to.
-
writeFile
public static void writeFile(File dictFile, Hashtable<FileDicomKey, FileDicomTagInfo> dicomHash, String altComment) throws IOExceptionWrites the DICOMHashtable given to the file that the CreateDicomFiles points to.- Parameters:
dictFile- the dicom dictionary file to write outdicomHash- the dicom tag mapping to write outaltComment- an additional comment to write out to the file- Throws:
IOException- when the file cannot be written to.
-
convertToWildKey
Converts group numbers of 60xx or 50xx dicom key elements so that the dicom dictionary will be able to find them. -
getFileReader
Gets a buffered reader for a given file name.- Parameters:
filename- The file we will be reading.- Returns:
- A reader for the given file name.
-
parseFile
protected static void parseFile(int dictionary_type) Method called once when the user opens MIPAV. It parses the dictionary file, normally called "dicom_dictionary.txt". The dictionary file is where all the tags are listed and stores these in the DICOMHashtable, with empty value attributes.- See Also:
-
doParseFile
protected static boolean doParseFile()
-