1 /*=========================================================================
4 Module: $RCSfile: TestDict.cxx,v $
6 Date: $Date: 2007/05/23 14:18:06 $
7 Version: $Revision: 1.13 $
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 << "----- Test Default Dicom Dictionary : ----------" << std::endl;
30 // Just to improve test coverage:
31 GDCM_NAME_SPACE::Dict *tempDict = GDCM_NAME_SPACE::Dict::New("dummyFileNameThatDoesntExist");
32 // Default dict is supposed to be used.
34 std::cout << "---- end Test Default Dicom Dictionary : -------" << std::endl;
41 std::cout<<"#######################################################\n";
42 GDCM_NAME_SPACE::DictSet *dicts=GDCM_NAME_SPACE::Global::GetDicts();
45 std::cout<<"DictSet hasn't be found... Failed\n";
49 std::cout<<"DictSet content :\n";
51 GDCM_NAME_SPACE::Dict *d = dicts->GetFirstDict();
54 std::cout << "Dictset is empty" << std::endl;
58 std::cout << "----------- Print DictSet contents: ----------" << std::endl;
60 std::cout << "----------- End Print DictSet contents: ------" << std::endl;
64 std::cout << "------------- a Dict is found : ----------" << std::endl;
66 d = dicts->GetNextDict();
69 // Print the Dict (public)
70 std::cout<<"#######################################################\n";
71 GDCM_NAME_SPACE::Dict *pubDict=dicts->GetDefaultPubDict();
74 std::cout<<"The public Dict hasn't be found... Failed\n";
77 std::cout<<"Public Dict content :\n";
80 // Print the DictEntry (0x10,0x20)
81 std::cout<<"#######################################################\n";
82 const int ENTRY_GR = 0x10;
83 const int ENTRY_EL = 0x20;
84 GDCM_NAME_SPACE::TagKey key = GDCM_NAME_SPACE::DictEntry::TranslateToKey(ENTRY_GR,ENTRY_EL);
85 GDCM_NAME_SPACE::DictEntry *entry=pubDict->GetEntry(ENTRY_GR,ENTRY_EL);
88 std::cout<<"The DictEntry hasn't be found... Failed\n";
91 std::cout<<"Entry "<<key<<" content :\n";
94 // Print all the DictEntry
95 std::cout<<"#######################################################\n";
96 entry=pubDict->GetFirstEntry();
99 std::cout << std::hex << entry->GetGroup() << "|" << entry->GetElement()
100 << " [" << entry->GetVR() << "] - VM [" << entry->GetVM()
101 << "] : " << entry->GetName() << " ( " << entry->GetKey() << ")\n";
102 entry=pubDict->GetNextEntry();
105 /* // Let's play with DicEntry stuff !
106 // First, we try to break an Entry.
107 entry=pubDict->GetFirstEntry();
109 // Should warn us !*/