X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestDict.cxx;h=8cf93f70b91684ee70b927cf3b92bea16071fe6e;hb=ac82e0644ab1582869eadef9b0a3af17a6a5a2df;hp=6d5b4e207fe7bf7a3dde828beb0486c14b4ffda8;hpb=95484666ccfcdb26d6ff1ea57cb1cde7826b7a28;p=gdcm.git diff --git a/Testing/TestDict.cxx b/Testing/TestDict.cxx index 6d5b4e20..8cf93f70 100644 --- a/Testing/TestDict.cxx +++ b/Testing/TestDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDict.cxx,v $ Language: C++ - Date: $Date: 2005/01/18 07:56:21 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/02/02 10:05:26 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,8 +23,20 @@ #include #include -int TestDict(int , char* []) -{ +int TestDict(int , char *[]) +{ + + std::cout << "----- Test Default Dicom Dictionary : ----------" << std::endl; + // Just to improve test coverage: + gdcm::Dict *tempDict = new gdcm::Dict("dummyFileNameThatDoesntExist"); + // Default dict is supposed to be used. + tempDict->Print(); + std::cout << "---- end Test Default Dicom Dictionary : -------" << std::endl; + + // Lets delete it. + delete tempDict; + + // Print the DictSet std::cout<<"#######################################################\n"; gdcm::DictSet *dicts=gdcm::Global::GetDicts(); @@ -42,6 +54,11 @@ int TestDict(int , char* []) std::cout << "Dictset is empty" << std::endl; return 1; } + + std::cout << "----------- Print DictSet contents: ----------" << std::endl; + dicts->Print(); + std::cout << "----------- End Print DictSet contents: ------" << std::endl; + while (d) { std::cout << "------------- a Dict is found : ----------" << std::endl; @@ -65,7 +82,7 @@ int TestDict(int , char* []) const int ENTRY_GR = 0x10; const int ENTRY_EL = 0x20; std::string key=gdcm::DictEntry::TranslateToKey(ENTRY_GR,ENTRY_EL); - gdcm::DictEntry *entry=pubDict->GetDictEntry(ENTRY_GR,ENTRY_EL); + gdcm::DictEntry *entry=pubDict->GetEntry(ENTRY_GR,ENTRY_EL); if(!entry) { std::cout<<"The DictEntry hasn't be found... Failed\n"; @@ -79,9 +96,18 @@ int TestDict(int , char* []) entry=pubDict->GetFirstEntry(); while(entry) { - entry->Print(); + std::cout << entry->GetGroup() << "|" << entry->GetElement() + << " [" << entry->GetVR() << "] - M" << entry->GetVM() + << " : " << entry->GetName() << " ( " << entry->GetKey() << ")\n"; entry=pubDict->GetNextEntry(); } + // Let's play with DicEntry stuff ! + + // First, we try to break an Entry. + entry=pubDict->GetFirstEntry(); + entry->SetVR("PN"); + // Should warn us ! + return(0); }