X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestMakeDicomDir.cxx;h=50148523f3101885d38330f44eee9286d8a41db1;hb=359ebc818c100156bd8f7a3a8783f2c538474990;hp=3d6b1bc325decba7eccaf9b5f8ba5bdec73b9ce5;hpb=577f36c1b267196a8bdaf33be0ce9a7322af2e88;p=gdcm.git diff --git a/Testing/TestMakeDicomDir.cxx b/Testing/TestMakeDicomDir.cxx index 3d6b1bc3..50148523 100644 --- a/Testing/TestMakeDicomDir.cxx +++ b/Testing/TestMakeDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestMakeDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/07/21 04:51:26 $ - Version: $Revision: 1.5 $ + Date: $Date: 2005/11/28 16:31:19 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,14 +19,59 @@ #include "gdcmDicomDir.h" #include "gdcmDicomDirPatient.h" #include "gdcmDirList.h" +#include "gdcmCommandManager.h" #include "gdcmDebug.h" // --- -void StartMethod(void *startMethod) +class CommandStart : public gdcm::Command { - (void)startMethod; - std::cout<<"Start parsing"<(GetObject()); + + if(dd) + std::cerr << "Progress parsing (" << dd->GetProgress() << ")" << std::endl; + else + std::cerr << "Progress parsing (NULL)" << std::endl; + } + +protected : + CommandProgress() {} +}; void EndMethod(void *endMethod) { @@ -62,32 +107,40 @@ int TestMakeDicomDir(int argc, char *argv[]) gdcm::DicomDir *dcmdir; // new style (user is allowed no to load Sequences an/or Shadow Groups) - dcmdir = new gdcm::DicomDir( ); + dcmdir = gdcm::DicomDir::New( ); - // dcmdir->SetLoadMode(NO_SEQ | NO_SHADOW); + gdcm::Command *cmd; + cmd = CommandStart::New(); + gdcm::CommandManager::SetCommand(dcmdir,gdcm::CMD_STARTPROGRESS,cmd); + cmd->Delete(); + cmd = CommandProgress::New(); + gdcm::CommandManager::SetCommand(dcmdir,gdcm::CMD_PROGRESS,cmd); + cmd->Delete(); + cmd = CommandEnd::New(); + gdcm::CommandManager::SetCommand(dcmdir,gdcm::CMD_ENDPROGRESS,cmd); + cmd->Delete(); + + // dcmdir->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW); // some images have a wrong length for element 0x0000 of private groups - dcmdir->SetLoadMode(NO_SEQ); + dcmdir->SetLoadMode(gdcm::LD_NOSEQ); dcmdir->SetDirectoryName(dirName); - dcmdir->Load( ); + dcmdir->Load(); - dcmdir->SetStartMethod(StartMethod, (void *) NULL); - dcmdir->SetEndMethod(EndMethod); - if ( !dcmdir->GetFirstPatient() ) { std::cout << "makeDicomDir: no patient found. Exiting." << std::endl; - delete dcmdir; + dcmdir->Delete(); return 1; } // Create the corresponding DicomDir - dcmdir->WriteDicomDir("NewDICOMDIR"); - delete dcmdir; + dcmdir->Write("NewDICOMDIR"); + dcmdir->Delete(); // Read from disc the just written DicomDir - gdcm::DicomDir *newDicomDir = new gdcm::DicomDir(); + gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New(); newDicomDir->SetFileName("NewDICOMDIR"); newDicomDir->Load(); @@ -97,7 +150,7 @@ int TestMakeDicomDir(int argc, char *argv[]) <<" is not readable"<Delete(); return 1; } @@ -107,11 +160,11 @@ int TestMakeDicomDir(int argc, char *argv[]) <<" has no patient"<Delete(); return(1); } std::cout<Delete(); return 0; }