X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestBuildUpDicomDir.cxx;h=a30c88c5008b6c8ddd1575fb2f3ad899f9701d88;hb=209f09716365d35c7cdc5b94684d1d1fb00335c7;hp=1aa9cb6fcf95cc0873c0a785bd55a13bf68e8d97;hpb=2ce6422178e709073fc24aa2e3d4f5069711cd18;p=gdcm.git diff --git a/Testing/TestBuildUpDicomDir.cxx b/Testing/TestBuildUpDicomDir.cxx index 1aa9cb6f..a30c88c5 100644 --- a/Testing/TestBuildUpDicomDir.cxx +++ b/Testing/TestBuildUpDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestBuildUpDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/10/19 13:15:36 $ - Version: $Revision: 1.6 $ + Date: $Date: 2006/04/11 16:05:03 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -39,11 +39,14 @@ int TestBuildUpDicomDir(int argc, char *argv[]) { std::cerr << "Usage: " << argv[0] << " dummy " << std::endl; } - + + //gdcm::Debug::DebugOn(); + + bool errorFound = false; gdcm::DicomDir *dcmdir; std::string dirName; - dcmdir = new gdcm::DicomDir(); + dcmdir = gdcm::DicomDir::New(); gdcm::DicomDirPatient *p1; // --- Forget these 4 lines : @@ -73,17 +76,17 @@ int TestBuildUpDicomDir(int argc, char *argv[]) s11 = p1->NewStudy(); s11->SetEntryString("StudyDescrOne.One_",0x0008, 0x1030); // we know entry (0008,1060) is not yet created - s11->InsertEntryString("Dr Mabuse", 0x0008, 0x1060); + s11->InsertEntryString("Dr^Mabuse", 0x0008, 0x1060, "PN"); // fill here other Study characteristics gdcm::DicomDirStudy *s12 = p1->NewStudy(); s12->SetEntryString("StudyDescrOne.Two",0x0008, 0x1030); - s12->InsertEntryString("Dr Zorglub", 0x0008, 0x1060); + s12->InsertEntryString("Dr^Zorglub", 0x0008, 0x1060, "PN"); // fill here other Study characteristics gdcm::DicomDirStudy *s13 = p1->NewStudy(); s13->SetEntryString("StudyDescrOne.Tree",0x0008, 0x1030); - s13->InsertEntryString("Dr Follamour", 0x0008, 0x1060); + s13->InsertEntryString("Dr^Follamour", 0x0008, 0x1060, "PN"); // fill here other Study characteristics gdcm::DicomDirSerie *s111; @@ -170,7 +173,7 @@ int TestBuildUpDicomDir(int argc, char *argv[]) <<" is not readable"<Delete(); return 1; } @@ -183,10 +186,10 @@ int TestBuildUpDicomDir(int argc, char *argv[]) // Write it on disc dcmdir->Write("NewDICOMDIR"); - delete dcmdir; + dcmdir->Delete(); // Read the newly written DicomDir - gdcm::DicomDir *newDicomDir = new gdcm::DicomDir(); + gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New(); newDicomDir->SetFileName("NewDICOMDIR"); newDicomDir->Load( ); if( !newDicomDir->IsReadable() ) @@ -195,7 +198,7 @@ int TestBuildUpDicomDir(int argc, char *argv[]) <<" is not readable"<Delete(); return 1; } // Check some value we are sure @@ -207,7 +210,7 @@ int TestBuildUpDicomDir(int argc, char *argv[]) { std::cout << "A patient is missing in written DicomDir" << std::endl; - delete newDicomDir; + newDicomDir->Delete(); return 1; } @@ -215,7 +218,6 @@ int TestBuildUpDicomDir(int argc, char *argv[]) << "----------Final Check ---------------------" <GetEntryString(0x0008, 0x1060); - if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr Mabuse") ) +std::cout << "----------------length-----------------" << valueStuff.length() << +std::endl; + if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr^Mabuse") ) { std::cout << "2 : 0x0008,0x1060 [" << s11->GetEntryString(0x0008,0x1060) @@ -259,7 +263,7 @@ int TestBuildUpDicomDir(int argc, char *argv[]) errorFound = true; break; } - std::cout << "Pysician : [" + std::cout << "Physician : [" << valueStuff << "]" << std::endl; if ( (s12 = p1->GetNextStudy()) == 0 ) @@ -281,7 +285,7 @@ int TestBuildUpDicomDir(int argc, char *argv[]) << "]" << std::endl; if ( gdcm::Util::DicomStringEqual(s12->GetEntryString(0x0008, - 0x1060),"Dr Zorglub " )) + 0x1060),"Dr^Zorglub " )) { std::cout << "4 0x0008,0x1060 [" << s12->GetEntryString(0x0008,0x1060) @@ -289,7 +293,8 @@ int TestBuildUpDicomDir(int argc, char *argv[]) errorFound = true; break; } - std::cout << "Pysician : [" + std::cout << "___________________________________" << std::endl; + std::cout << "Pysician Reading Study: [" << s12->GetEntryString(0x0008,0x1060) << "]" << std::endl; @@ -308,7 +313,7 @@ int TestBuildUpDicomDir(int argc, char *argv[]) << "]" << std::endl; valueStuff = s13->GetEntryString(0x0008, 0x1060); - if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr Follamour") ) + if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr^Follamour") ) { std::cout << "5 0x0008,0x1060 [" << valueStuff @@ -357,14 +362,13 @@ int TestBuildUpDicomDir(int argc, char *argv[]) break; // No error found. Stop looping } - delete newDicomDir; if ( errorFound ) { std::cout << "MissWritting / MissReading " << std::endl; - std::cout<Delete(); + + return errorFound; }