#include <gdcmDict.h>
Inheritance diagram for gdcm::Dict:

Public Member Functions | |
| Dict () | |
| Constructor. | |
| Dict (std::string const &filename) | |
| Constructor. | |
| ~Dict () | |
| Destructor. | |
| void | Print (std::ostream &os=std::cout, std::string const &indent="") |
| Print all the dictionary entries contained in this dictionary. Entries will be sorted by tag i.e. the couple (group, element). | |
| bool | AddEntry (DictEntry const &newEntry) |
| adds a new Dicom Dictionary Entry | |
| bool | ReplaceEntry (DictEntry const &newEntry) |
| replaces an already existing Dicom Element by a new one | |
| bool | RemoveEntry (TagKey const &key) |
| removes an already existing Dicom Dictionary Entry, identified by its Tag | |
| bool | RemoveEntry (uint16_t group, uint16_t elem) |
| removes an already existing Dicom Dictionary Entry, identified by its group,element number | |
| void | ClearEntry () |
| Remove all Dicom Dictionary Entries. | |
| DictEntry * | GetEntry (uint16_t group, uint16_t elem) |
| Get the dictionary entry identified by a given tag (group,element). | |
| DictEntry * | GetFirstEntry () |
| Get the first entry while visiting the Dict entries. | |
| DictEntry * | GetNextEntry () |
| Get the next entry while visiting the Hash table (KeyHt). | |
| void | SetPrintLevel (int level) |
| Sets the print level for the Dicom Header Elements. | |
| int | GetPrintLevel () |
| Gets the print level for the Dicom Entries. | |
Protected Attributes | |
| int | PrintLevel |
| Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Attributes | |
| std::string | Filename |
| ASCII file holding the Dictionnary. | |
| TagKeyHT | KeyHt |
| Access through TagKey. | |
| TagKeyHT::iterator | ItKeyHt |
Definition at line 45 of file gdcmDict.h.
|
|
Constructor.
Definition at line 37 of file gdcmDict.cxx. References Filename.
00038 {
00039 Filename="";
00040 }
|
|
|
Constructor.
Definition at line 46 of file gdcmDict.cxx. References AddEntry(), Filename, gdcm::FillDefaultDataDict(), gdcmWarningMacro, and gdcm::TagName.
00047 {
00048 uint16_t group;
00049 uint16_t element;
00050 TagName vr;
00051 TagName vm;
00052 TagName name;
00053
00054 std::ifstream from( filename.c_str() );
00055 if( !from )
00056 {
00057 gdcmWarningMacro( "Can't open dictionary" << filename.c_str());
00058 // Using default embeded one:
00059 FillDefaultDataDict( this );
00060 }
00061 else
00062 {
00063 while (!from.eof())
00064 {
00065 from >> std::hex;
00066 from >> group;
00067 from >> element;
00068 from >> vr;
00069 from >> vm;
00070 from >> std::ws; //remove white space
00071 std::getline(from, name);
00072
00073 const DictEntry newEntry(group, element, vr, vm, name);
00074 AddEntry(newEntry);
00075 }
00076
00077 Filename = filename;
00078 from.close();
00079 }
00080 }
|
|
|
Destructor.
Definition at line 85 of file gdcmDict.cxx. References ClearEntry().
00086 {
00087 ClearEntry();
00088 }
|
|
|
adds a new Dicom Dictionary Entry
Definition at line 97 of file gdcmDict.cxx. References gdcmWarningMacro, gdcm::DictEntry::GetKey(), KeyHt, and gdcm::TagKey. Referenced by Dict().
00098 {
00099 const TagKey &key = newEntry.GetKey();
00100
00101 if(KeyHt.count(key) == 1)
00102 {
00103 gdcmWarningMacro( "Already present" << key.c_str());
00104 return false;
00105 }
00106 else
00107 {
00108 KeyHt.insert( TagKeyHT::value_type(newEntry.GetKey(), newEntry));
00109 return true;
00110 }
00111 }
|
|
|
Remove all Dicom Dictionary Entries.
Definition at line 165 of file gdcmDict.cxx. References KeyHt. Referenced by ~Dict().
00166 {
00167 // we assume all the pointed DictEntries are already cleaned-up
00168 // when we clean KeyHt.
00169 KeyHt.clear();
00170 }
|
|
||||||||||||
|
Get the dictionary entry identified by a given tag (group,element).
Definition at line 178 of file gdcmDict.cxx. References KeyHt, and gdcm::TagKey. Referenced by gdcm::DocEntrySet::GetDictEntry(), and gdcm::DicomDir::SetElement().
|
|
|
Get the first entry while visiting the Dict entries.
Definition at line 193 of file gdcmDict.cxx. References ItKeyHt, and KeyHt.
|
|
|
Get the next entry while visiting the Hash table (KeyHt).
Definition at line 206 of file gdcmDict.cxx. References gdcmAssertMacro, ItKeyHt, and KeyHt.
|
|
|
Gets the print level for the Dicom Entries.
Definition at line 48 of file gdcmBase.h.
00048 { return PrintLevel; };
|
|
||||||||||||
|
Print all the dictionary entries contained in this dictionary. Entries will be sorted by tag i.e. the couple (group, element).
Reimplemented from gdcm::Base. Definition at line 230 of file gdcmDict.cxx. References Filename, and KeyHt.
00231 {
00232 os << "Dict file name : " << Filename << std::endl;
00233 std::ostringstream s;
00234
00235 for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
00236 {
00237 s << "Entry : ";
00238 s << "(" << std::hex << std::setw(4) << tag->second.GetGroup() << ',';
00239 s << std::hex << std::setw(4) << tag->second.GetElement() << ") = "
00240 << std::dec;
00241 s << tag->second.GetVR() << ", ";
00242 s << tag->second.GetVM() << ", ";
00243 s << tag->second.GetName() << "." << std::endl;
00244 }
00245 os << s.str();
00246 }
|
|
||||||||||||
|
removes an already existing Dicom Dictionary Entry, identified by its group,element number
Definition at line 157 of file gdcmDict.cxx. References RemoveEntry().
00158 {
00159 return RemoveEntry(DictEntry::TranslateToKey(group, elem));
00160 }
|
|
|
removes an already existing Dicom Dictionary Entry, identified by its Tag
Definition at line 134 of file gdcmDict.cxx. References gdcmWarningMacro, KeyHt, and gdcm::TagKey. Referenced by RemoveEntry(), and ReplaceEntry().
00135 {
00136 TagKeyHT::const_iterator it = KeyHt.find(key);
00137 if(it != KeyHt.end())
00138 {
00139 KeyHt.erase(key);
00140
00141 return true;
00142 }
00143 else
00144 {
00145 gdcmWarningMacro( "Unfound entry" << key.c_str());
00146 return false;
00147 }
00148 }
|
|
|
replaces an already existing Dicom Element by a new one
Definition at line 118 of file gdcmDict.cxx. References gdcm::DictEntry::GetKey(), KeyHt, and RemoveEntry().
00119 {
00120 if ( RemoveEntry(newEntry.GetKey()) )
00121 {
00122 KeyHt.insert( TagKeyHT::value_type(newEntry.GetKey(), newEntry));
00123 return true;
00124 }
00125 return false;
00126 }
|
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 45 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().
00045 { PrintLevel = level; };
|
|
|
ASCII file holding the Dictionnary.
Definition at line 70 of file gdcmDict.h. |
|
|
Definition at line 74 of file gdcmDict.h. Referenced by GetFirstEntry(), and GetNextEntry(). |
|
|
Access through TagKey.
Definition at line 73 of file gdcmDict.h. Referenced by AddEntry(), ClearEntry(), GetEntry(), GetFirstEntry(), GetNextEntry(), Print(), RemoveEntry(), and ReplaceEntry(). |
|
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 53 of file gdcmBase.h. Referenced by gdcm::Base::Base(). |
1.3.6