vtk-dicom  0.8.17
vtkDICOMDictionary.h
1 /*=========================================================================
2 
3  Program: DICOM for VTK
4 
5  Copyright (c) 2012-2024 David Gobbi
6  All rights reserved.
7  See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef vtkDICOMDictionary_h
15 #define vtkDICOMDictionary_h
16 
17 #include "vtkDICOMModule.h" // For export macro
18 #include "vtkDICOMDictEntry.h"
19 #include "vtkDICOMDictHash.h"
20 
22 #define DICT_HASH_TABLE_SIZE 4096
23 #define DICT_PRIVATE_TABLE_SIZE 512
24 
26 class VTKDICOM_EXPORT vtkDICOMDictionary
27 {
28 public:
30  struct Dict
31  {
32  const char *Name;
33  unsigned short HashSize;
34  unsigned short DataSize;
35  const unsigned short *TagHashTable;
36  const unsigned short *KeyHashTable;
37  const vtkDICOMDictEntry::Entry *Contents;
38  };
39 
40  struct DictHashEntry;
41 
43  static vtkDICOMDictEntry FindDictEntry(const vtkDICOMTag tag) {
45  return vtkDICOMDictionary::FindDictEntry(tag, nullptr); }
46 
48  static vtkDICOMDictEntry FindDictEntry(const char *key) {
49  return vtkDICOMDictionary::FindDictEntry(key, nullptr); }
51 
53 
62  const vtkDICOMTag tag, const char *privateDict);
63 
65 
72  const char *key, const char *privateDict);
74 
76 
82  static void AddPrivateDictionary(Dict *dict);
83 
85  static void RemovePrivateDictionary(const char *name);
87 
88 private:
89  friend class vtkDICOMDictionaryInitializer;
90 
92 
96  static unsigned int HashLongString(const char *lo, char stripped[64]);
97 
99 
103  static Dict *FindPrivateDict(const char *name);
104 
106  static Dict DictData;
107 
109  static DictHashEntry *PrivateDictTable[DICT_PRIVATE_TABLE_SIZE];
110 };
111 
114 
118 class VTKDICOM_EXPORT vtkDICOMDictionaryInitializer
119 {
120 public:
121  vtkDICOMDictionaryInitializer();
122  ~vtkDICOMDictionaryInitializer();
123 private:
124  vtkDICOMDictionaryInitializer(const vtkDICOMDictionaryInitializer&);
125  vtkDICOMDictionaryInitializer& operator=(
126  const vtkDICOMDictionaryInitializer&);
127 };
128 
129 static vtkDICOMDictionaryInitializer vtkDICOMDictionaryInitializerInstance;
131 
132 #endif /* vtkDICOMDictionary_h */
133 // VTK-HeaderTest-Exclude: vtkDICOMDictionary.h
An entry in the DICOM dictionary.
Definition: vtkDICOMDictEntry.h:24
Provide access to the DICOM tag dictionary.
Definition: vtkDICOMDictionary.h:27
static void RemovePrivateDictionary(const char *name)
Remove a private dictionary.
static vtkDICOMDictEntry FindDictEntry(const vtkDICOMTag tag)
Find the dictionary entry for the given tag.
Definition: vtkDICOMDictionary.h:44
static vtkDICOMDictEntry FindDictEntry(const char *key, const char *privateDict)
Search for a private dictionary entry by key.
static vtkDICOMDictEntry FindDictEntry(const char *key)
Find the dictionary for the given key.
Definition: vtkDICOMDictionary.h:48
static vtkDICOMDictEntry FindDictEntry(const vtkDICOMTag tag, const char *privateDict)
Include a private dictionary when searching for the tag.
static void AddPrivateDictionary(Dict *dict)
Add the hash table for a private dictionary.
A (group,element) identifier tag for DICOM attributes.
Definition: vtkDICOMTag.h:23
A struct to statically store DICOM dictionary entries.
Definition: vtkDICOMDictEntry.h:28
A struct to store a DICOM dictionary hash table.
Definition: vtkDICOMDictionary.h:31