#include <gdcmDict.h>
Inheritance diagram for gdcm::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 | ReplaceEntry (DictEntry *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 it's "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::FillDefaultDataDict(), and gdcmWarningMacro. 00049 { 00050 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 DoTheLoadingJob(from); 00061 Filename = filename; 00062 } 00063 }
|
|
Destructor.
Definition at line 68 of file gdcmDict.cxx. References ClearEntry(). 00069 { 00070 ClearEntry(); 00071 }
|
|
Add all the entries held in a source dictionary.
Definition at line 81 of file gdcmDict.cxx. References DoTheLoadingJob(), and gdcmWarningMacro. 00082 { 00083 00084 std::ifstream from( filename.c_str() ); 00085 if ( !from ) 00086 { 00087 gdcmWarningMacro( "Can't open dictionary" << filename.c_str()); 00088 return false; 00089 } 00090 else 00091 { 00092 DoTheLoadingJob(from); 00093 return true; 00094 } 00095 }
|
|
adds a new Dicom Dictionary Entry
Definition at line 141 of file gdcmDict.cxx. References gdcmErrorMacro, gdcm::DictEntry::GetKey(), KeyHt, and gdcm::RefCounter::Register(). Referenced by DoTheLoadingJob(). 00142 { 00143 const TagKey &key = newEntry->GetKey(); 00144 00145 if ( KeyHt.count(key) == 1 ) 00146 { 00147 gdcmErrorMacro( "Already present:" << key ); 00148 return false; 00149 } 00150 else 00151 { 00152 newEntry->Register(); 00153 KeyHt.insert( TagKeyHT::value_type(key, newEntry)); 00154 return true; 00155 } 00156 }
|
|
Remove all Dicom Dictionary Entries.
Definition at line 213 of file gdcmDict.cxx. References KeyHt. Referenced by ~Dict(). 00214 { 00215 // we assume all the pointed DictEntries are already cleaned-up 00216 // when we clean KeyHt. 00217 TagKeyHT::const_iterator it; 00218 for(it = KeyHt.begin();it!=KeyHt.end();++it) 00219 it->second->Unregister(); 00220 KeyHt.clear(); 00221 }
|
|
|
Add all the dictionary entries from an already open source file.
Definition at line 290 of file gdcmDict.cxx. References AddEntry(), gdcm::RefCounter::Delete(), and gdcm::DictEntry::New(). Referenced by AddDict(), and Dict(). 00291 { 00292 uint16_t group; 00293 uint16_t elem; 00294 VRKey vr; 00295 TagName vm; 00296 TagName name; 00297 00298 DictEntry *newEntry; 00299 while (!from.eof() && from) 00300 { 00301 from >> std::hex; 00302 from >> group; 00303 from >> elem; 00304 from >> vr; 00305 from >> vm; 00306 from >> std::ws; //remove white space 00307 std::getline(from, name); 00308 00309 newEntry = DictEntry::New(group, elem, vr, vm, name); 00310 AddEntry(newEntry); 00311 newEntry->Delete(); 00312 } 00313 from.close(); 00314 }
|
|
|
|
Get the dictionary entry identified by a given tag ("group|element").
Definition at line 228 of file gdcmDict.cxx. References KeyHt. 00229 { 00230 TagKeyHT::iterator it = KeyHt.find(key); 00231 if ( it == KeyHt.end() ) 00232 { 00233 return 0; 00234 } 00235 return it->second; 00236 }
|
|
Get the dictionary entry identified by it's "group" and "element").
Definition at line 243 of file gdcmDict.cxx. References KeyHt, and gdcm::DictEntry::TranslateToKey(). Referenced by gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::GetDictEntry(), and gdcm::DicomDir::SetElement(). 00244 { 00245 TagKey key = DictEntry::TranslateToKey(group, elem); 00246 TagKeyHT::iterator it = KeyHt.find(key); 00247 if ( it == KeyHt.end() ) 00248 { 00249 return 0; 00250 } 00251 return it->second; 00252 }
|
|
Get the first entry while visiting the Dict entries.
Definition at line 258 of file gdcmDict.cxx. References ItKeyHt, and KeyHt. 00259 { 00260 ItKeyHt = KeyHt.begin(); 00261 if ( ItKeyHt != KeyHt.end() ) 00262 return ItKeyHt->second; 00263 return NULL; 00264 }
|
|
Get the next entry while visiting the Hash table (KeyHt).
Definition at line 271 of file gdcmDict.cxx. References gdcmAssertMacro, ItKeyHt, and KeyHt. 00272 { 00273 gdcmAssertMacro (ItKeyHt != KeyHt.end()); 00274 00275 ++ItKeyHt; 00276 if (ItKeyHt != KeyHt.end()) 00277 return ItKeyHt->second; 00278 return NULL; 00279 }
|
|
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 56 of file gdcmRefCounter.h. 00057 { 00058 return RefCount; 00059 }
|
|
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::DictSet::DictSet(), and gdcm::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::Base. Definition at line 323 of file gdcmDict.cxx. References Filename, and KeyHt. 00324 { 00325 os << "Dict file name : " << Filename << std::endl; 00326 std::ostringstream s; 00327 00328 for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) 00329 { 00330 s << "Entry : "; 00331 s << "(" << tag->second->GetKey() << ") = " 00332 << std::dec; 00333 s << tag->second->GetVR() << ", "; 00334 s << tag->second->GetVM() << ", "; 00335 s << tag->second->GetName() << "." << std::endl; 00336 } 00337 os << s.str(); 00338 }
|
|
Register the object.
Definition at line 44 of file gdcmRefCounter.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem(). 00044 { 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 (!from.eof() && from) 00120 { 00121 from >> std::hex; 00122 from >> group; 00123 from >> elem; 00124 from >> vr; 00125 from >> vm; 00126 // from >> std::ws; //remove white space 00127 std::getline(from, name); 00128 00129 RemoveEntry(group,elem); 00130 } 00131 from.close(); 00132 return true; 00133 } 00134 }
|
|
removes an already existing Dicom Dictionary Entry, identified by its group,element number
Definition at line 205 of file gdcmDict.cxx. References RemoveEntry(), and gdcm::DictEntry::TranslateToKey(). 00206 { 00207 return RemoveEntry(DictEntry::TranslateToKey(group, elem)); 00208 }
|
|
removes an already existing Dicom Dictionary Entry, identified by its Tag
Definition at line 181 of file gdcmDict.cxx. References gdcmWarningMacro, and KeyHt. Referenced by RemoveDict(), RemoveEntry(), and ReplaceEntry(). 00182 { 00183 TagKeyHT::const_iterator it = KeyHt.find(key); 00184 if ( it != KeyHt.end() ) 00185 { 00186 it->second->Unregister(); 00187 KeyHt.erase(key); 00188 00189 return true; 00190 } 00191 else 00192 { 00193 gdcmWarningMacro( "Unfound entry" << key ); 00194 return false; 00195 } 00196 }
|
|
replaces an already existing Dicom Element by a new one
Definition at line 163 of file gdcmDict.cxx. References gdcm::DictEntry::GetKey(), KeyHt, gdcm::RefCounter::Register(), and RemoveEntry(). 00164 { 00165 const TagKey &key = newEntry->GetKey(); 00166 if ( RemoveEntry(key) ) 00167 { 00168 newEntry->Register(); 00169 KeyHt.insert( TagKeyHT::value_type(key, newEntry)); 00170 return true; 00171 } 00172 return false; 00173 }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Unregister the object.
Definition at line 48 of file gdcmRefCounter.h. Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().
|
|
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(), RemoveEntry(), and ReplaceEntry(). |
|
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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print(). |