#include <gdcmDict.h>
Inheritance diagram for GDCM_NAME_SPACE::Dict:
Public Member Functions | |
bool | AddDict (std::string const &filename) |
Add all the entries held in a source dictionary. | |
bool | RemoveDict (std::string const &filename) |
Removes from the current Dicom Dict all the entries held in a source dictionary. | |
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 *newEntry) |
adds a new Dicom Dictionary Entry | |
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 its "group" and "element"). | |
DictEntry * | GetEntry (TagKey const &key) |
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 | Delete () |
Delete the object. | |
void | Register () |
Register the object. | |
void | Unregister () |
Unregister the object. | |
const unsigned long & | GetRefCount () const |
Get the reference counting. | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Static Public Member Functions | |
static Dict * | New () |
Contructs an empty Dict with a RefCounter. | |
static Dict * | New (std::string const &filename) |
Contructs a Dict with a RefCounter. | |
Protected Member Functions | |
Dict () | |
Constructor. | |
Dict (std::string const &filename) | |
Constructor. | |
~Dict () | |
Destructor. | |
Protected Attributes | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Member Functions | |
gdcmTypeMacro (Dict) | |
void | DoTheLoadingJob (std::ifstream &ifs) |
Add all the dictionary entries from an already open source file. | |
Private Attributes | |
std::string | Filename |
ASCII file holding the Dictionnary. | |
TagKeyHT | KeyHt |
Access through TagKey. | |
TagKeyHT::iterator | ItKeyHt |
Iterator for the entries. |
Definition at line 47 of file gdcmDict.h.
|
Constructor.
Definition at line 39 of file gdcmDict.cxx. References Filename. 00040 { 00041 Filename=""; 00042 }
|
|
Constructor.
Definition at line 48 of file gdcmDict.cxx. References DoTheLoadingJob(), Filename, GDCM_NAME_SPACE::FillDefaultDataDict(), gdcmDebugMacro, and gdcmWarningMacro. 00049 { 00050 gdcmDebugMacro( "in Dict::Dict, filename =[" << filename << "]" ); 00051 std::ifstream from( filename.c_str() ); 00052 if ( !from ) 00053 { 00054 gdcmWarningMacro( "Can't open dictionary" << filename.c_str()); 00055 // Using default embeded one: 00056 FillDefaultDataDict( this ); 00057 } 00058 else 00059 { 00060 gdcmDebugMacro( "in Dict::Dict, DoTheLoadingJob filename =[" 00061 << filename << "]" ); 00062 DoTheLoadingJob(from); 00063 Filename = filename; 00064 } 00065 }
|
|
Destructor.
Definition at line 70 of file gdcmDict.cxx. References ClearEntry(). 00071 { 00072 ClearEntry(); 00073 }
|
|
Add all the entries held in a source dictionary.
Definition at line 83 of file gdcmDict.cxx. References DoTheLoadingJob(), and gdcmWarningMacro. 00084 { 00085 std::ifstream from( filename.c_str() ); 00086 if ( !from ) 00087 { 00088 gdcmWarningMacro( "Can't open dictionary" << filename.c_str()); 00089 return false; 00090 } 00091 else 00092 { 00093 DoTheLoadingJob(from); 00094 return true; 00095 } 00096 }
|
|
adds a new Dicom Dictionary Entry
Definition at line 145 of file gdcmDict.cxx. References gdcmErrorMacro, GDCM_NAME_SPACE::DictEntry::GetKey(), and KeyHt. Referenced by DoTheLoadingJob(), and GDCM_NAME_SPACE::FillDefaultDataDict(). 00146 { 00147 const TagKey &key = newEntry->GetKey(); 00148 00149 if ( KeyHt.count(key) == 1 ) 00150 { 00151 gdcmErrorMacro( "Already present:" << key ); 00152 return false; 00153 } 00154 else 00155 { 00156 newEntry->Register(); 00157 KeyHt.insert( TagKeyHT::value_type(key, newEntry)); 00158 return true; 00159 } 00160 }
|
|
Remove all Dicom Dictionary Entries.
Definition at line 221 of file gdcmDict.cxx. References KeyHt. Referenced by ~Dict(). 00222 { 00223 // we assume all the pointed DictEntries are already cleaned-up 00224 // when we clean KeyHt. 00225 TagKeyHT::const_iterator it; 00226 00227 for(it = KeyHt.begin();it!=KeyHt.end();++it) 00228 it->second->Unregister(); // delete the entry 00229 KeyHt.clear(); // remove all the entries from HTable 00230 00231 }
|
|
|
Add all the dictionary entries from an already open source file.
Definition at line 300 of file gdcmDict.cxx. References AddEntry(), GDCM_NAME_SPACE::RefCounter::Delete(), and GDCM_NAME_SPACE::DictEntry::New(). Referenced by AddDict(), and Dict(). 00301 { 00302 if (!from) 00303 return; 00304 00305 uint16_t group; 00306 uint16_t elem; 00307 VRKey vr; 00308 TagName vm; 00309 TagName name; 00310 00311 DictEntry *newEntry; 00312 while ( true ) 00313 { 00314 from >> std::hex; 00315 from >> group; 00316 from >> elem; 00317 from >> vr; 00318 from >> vm; 00319 from >> std::ws; //remove white space 00320 std::getline(from, name); 00321 00322 if(from.eof()) { 00323 break; 00324 } 00325 00326 newEntry = DictEntry::New(group, elem, vr, vm, name); 00327 AddEntry(newEntry); 00328 newEntry->Delete(); 00329 } 00330 from.close(); 00331 }
|
|
|
|
Get the dictionary entry identified by a given tag ("group|element").
Definition at line 238 of file gdcmDict.cxx. References KeyHt. 00239 { 00240 TagKeyHT::iterator it = KeyHt.find(key); 00241 if ( it == KeyHt.end() ) 00242 { 00243 return 0; 00244 } 00245 return it->second; 00246 }
|
|
Get the dictionary entry identified by its "group" and "element").
Definition at line 253 of file gdcmDict.cxx. References KeyHt, and GDCM_NAME_SPACE::DictEntry::TranslateToKey(). Referenced by GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), and GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(). 00254 { 00255 TagKey key = DictEntry::TranslateToKey(group, elem); 00256 TagKeyHT::iterator it = KeyHt.find(key); 00257 if ( it == KeyHt.end() ) 00258 { 00259 return 0; 00260 } 00261 return it->second; 00262 }
|
|
Get the first entry while visiting the Dict entries.
Definition at line 268 of file gdcmDict.cxx. References ItKeyHt, and KeyHt. 00269 { 00270 ItKeyHt = KeyHt.begin(); 00271 if ( ItKeyHt != KeyHt.end() ) 00272 return ItKeyHt->second; 00273 return NULL; 00274 }
|
|
Get the next entry while visiting the Hash table (KeyHt).
Definition at line 281 of file gdcmDict.cxx. References gdcmAssertMacro, ItKeyHt, and KeyHt. 00282 { 00283 gdcmAssertMacro (ItKeyHt != KeyHt.end()); 00284 00285 ++ItKeyHt; 00286 if (ItKeyHt != KeyHt.end()) 00287 return ItKeyHt->second; 00288 return NULL; 00289 }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Get the reference counting.
Definition at line 59 of file gdcmRefCounter.h. 00060 { 00061 return RefCount; 00062 }
|
|
Contructs a Dict with a RefCounter.
Definition at line 55 of file gdcmDict.h. 00055 {return new Dict(filename);}
|
|
Contructs an empty Dict with a RefCounter.
Definition at line 53 of file gdcmDict.h. Referenced by GDCM_NAME_SPACE::DictSet::DictSet(), and GDCM_NAME_SPACE::DictSet::LoadDictFromFile(). 00053 {return new Dict();}
|
|
Print all the dictionary entries contained in this dictionary. Entries will be sorted by tag i.e. the couple (group, element).
Reimplemented from GDCM_NAME_SPACE::Base. Definition at line 340 of file gdcmDict.cxx. References Filename, and KeyHt. 00341 { 00342 os << "Dict file name : [" << Filename << "]" << std::endl; 00343 std::ostringstream s; 00344 00345 for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) 00346 { 00347 std::cout << tag->second->GetKey() << " " << tag->second->GetName() 00348 << std::endl; 00349 s << "Entry : "; 00350 s << "(" << tag->second->GetKey() << ") = " 00351 << std::dec; 00352 s << tag->second->GetVR() << ", "; 00353 s << tag->second->GetVM() << ", "; 00354 s << tag->second->GetName() << "." << std::endl; 00355 00356 } 00357 os << s.str(); 00358 00359 }
|
|
Register the object.
Definition at line 46 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem(). 00046 { RefCount++; }
|
|
Removes from the current Dicom Dict all the entries held in a source dictionary.
Definition at line 103 of file gdcmDict.cxx. References gdcmWarningMacro, and RemoveEntry(). 00104 { 00105 std::ifstream from( filename.c_str() ); 00106 if ( !from ) 00107 { 00108 gdcmWarningMacro( "Can't open dictionary" << filename.c_str()); 00109 return false; 00110 } 00111 else 00112 { 00113 uint16_t group; 00114 uint16_t elem; 00115 TagName vr; 00116 TagName vm; 00117 TagName name; 00118 00119 while ( true ) 00120 { 00121 from >> std::hex; 00122 from >> group; 00123 00124 if (from.eof()) 00125 break; 00126 00127 from >> elem; 00128 from >> vr; 00129 from >> vm; 00130 // from >> std::ws; //remove white space 00131 std::getline(from, name); 00132 00133 RemoveEntry(group,elem); 00134 } 00135 from.close(); 00136 return true; 00137 } 00138 }
|
|
removes an already existing Dicom Dictionary Entry, identified by its group,element number
Definition at line 213 of file gdcmDict.cxx. References RemoveEntry(), and GDCM_NAME_SPACE::DictEntry::TranslateToKey(). 00214 { 00215 return RemoveEntry(DictEntry::TranslateToKey(group, elem)); 00216 }
|
|
removes an already existing Dicom Dictionary Entry, identified by its Tag
Definition at line 189 of file gdcmDict.cxx. References KeyHt. Referenced by RemoveDict(), and RemoveEntry(). 00190 { 00191 TagKeyHT::const_iterator it = KeyHt.find(key); 00192 if ( it != KeyHt.end() ) 00193 { 00194 it->second->Unregister(); // delete the entry 00195 KeyHt.erase(key); // remove pointer from HTable 00196 00197 return true; 00198 } 00199 else 00200 { 00201 gdcmWarningMacro( "Unfound entry" << key ); 00202 return false; 00203 } 00204 }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Unregister the object.
Definition at line 50 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper(). 00051 { 00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl; 00053 RefCount--; 00054 if(RefCount<=0) 00055 delete this; 00056 }
|
|
ASCII file holding the Dictionnary.
Definition at line 85 of file gdcmDict.h. |
|
Iterator for the entries.
Definition at line 90 of file gdcmDict.h. Referenced by GetFirstEntry(), and GetNextEntry(). |
|
Access through TagKey.
Definition at line 88 of file gdcmDict.h. Referenced by AddEntry(), ClearEntry(), GetEntry(), GetFirstEntry(), GetNextEntry(), Print(), and RemoveEntry(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print(). |