1 /*=========================================================================
4 Module: $RCSfile: TestDict.cxx,v $
6 Date: $Date: 2005/10/25 14:52:30 $
7 Version: $Revision: 1.10 $
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::Dict *tempDict = gdcm::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::DictSet *dicts=gdcm::Global::GetDicts();
45 std::cout<<"DictSet hasn't be found... Failed\n";
49 std::cout<<"DictSet content :\n";
51 gdcm::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::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::TagKey key = gdcm::DictEntry::TranslateToKey(ENTRY_GR,ENTRY_EL);
85 gdcm::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 << entry->GetGroup() << "|" << entry->GetElement()
100 << " [" << entry->GetVR() << "] - M" << entry->GetVM()
101 << " : " << entry->GetName() << " ( " << entry->GetKey() << ")\n";
102 entry=pubDict->GetNextEntry();
105 // Let's play with DicEntry stuff !
107 // First, we try to break an Entry.
108 entry=pubDict->GetFirstEntry();