1 /*=========================================================================
4 Module: $RCSfile: TestDict.cxx,v $
6 Date: $Date: 2005/01/24 14:14:09 $
7 Version: $Revision: 1.5 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
18 #include "gdcmGlobal.h"
19 #include "gdcmDictSet.h"
21 #include "gdcmDictEntry.h"
26 int TestDict(int , char* [])
29 std::cout<<"#######################################################\n";
30 gdcm::DictSet *dicts=gdcm::Global::GetDicts();
33 std::cout<<"DictSet hasn't be found... Failed\n";
37 std::cout<<"DictSet content :\n";
39 gdcm::Dict *d = dicts->GetFirstEntry();
42 std::cout << "Dictset is empty" << std::endl;
47 std::cout << "------------- a Dict is found : ----------" << std::endl;
49 d = dicts->GetNextEntry();
52 // Print the Dict (public)
53 std::cout<<"#######################################################\n";
54 gdcm::Dict *pubDict=dicts->GetDefaultPubDict();
57 std::cout<<"The public Dict hasn't be found... Failed\n";
60 std::cout<<"Public Dict content :\n";
63 // Print the DictEntry (0x10,0x20)
64 std::cout<<"#######################################################\n";
65 const int ENTRY_GR = 0x10;
66 const int ENTRY_EL = 0x20;
67 std::string key=gdcm::DictEntry::TranslateToKey(ENTRY_GR,ENTRY_EL);
68 gdcm::DictEntry *entry=pubDict->GetEntry(ENTRY_GR,ENTRY_EL);
71 std::cout<<"The DictEntry hasn't be found... Failed\n";
74 std::cout<<"Entry "<<key<<" content :\n";
77 // Print all the DictEntry
78 std::cout<<"#######################################################\n";
79 entry=pubDict->GetFirstEntry();
82 std::cout << entry->GetGroup() << "|" << entry->GetElement()
83 << " [" << entry->GetVR() << "] - M" << entry->GetVM()
84 << " : " << entry->GetName() << " ( " << entry->GetKey() << ")\n";
85 entry=pubDict->GetNextEntry();