X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestMakeDicomDir.cxx;h=edfecb6607ad94c5d11fcddb9d6c70cf1b665219;hb=224876ca6cbe71952f2a1d66d9853eca7745d3a0;hp=c560f1b0fe3293990608d961bd89c6c214b4896d;hpb=4289ddedc713b40cb0af61e19e788bc63f0e5af0;p=gdcm.git diff --git a/Testing/TestMakeDicomDir.cxx b/Testing/TestMakeDicomDir.cxx index c560f1b0..edfecb66 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/08/31 09:29:11 $ - Version: $Revision: 1.9 $ + Date: $Date: 2007/06/21 14:59:06 $ + Version: $Revision: 1.13 $ 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_NAME_SPACE::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) { @@ -59,35 +104,43 @@ int TestMakeDicomDir(int argc, char *argv[]) dirName = GDCM_DATA_ROOT; } - gdcm::DicomDir *dcmdir; + GDCM_NAME_SPACE::DicomDir *dcmdir; // new style (user is allowed no to load Sequences an/or Shadow Groups) - dcmdir = new gdcm::DicomDir( ); + dcmdir = GDCM_NAME_SPACE::DicomDir::New( ); + GDCM_NAME_SPACE::Command *cmd; + cmd = CommandStart::New(); + GDCM_NAME_SPACE::CommandManager::SetCommand(dcmdir,GDCM_NAME_SPACE::CMD_STARTPROGRESS,cmd); + cmd->Delete(); + cmd = CommandProgress::New(); + GDCM_NAME_SPACE::CommandManager::SetCommand(dcmdir,GDCM_NAME_SPACE::CMD_PROGRESS,cmd); + cmd->Delete(); + cmd = CommandEnd::New(); + GDCM_NAME_SPACE::CommandManager::SetCommand(dcmdir,GDCM_NAME_SPACE::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(gdcm::LD_NOSEQ); + dcmdir->SetLoadMode(GDCM_NAME_SPACE::LD_NOSEQ); dcmdir->SetDirectoryName(dirName); - dcmdir->Load( ); + dcmdir->Load(); - dcmdir->SetStartMethod(StartMethod); - 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->Write("NewDICOMDIR"); - delete dcmdir; + dcmdir->Delete(); // Read from disc the just written DicomDir - gdcm::DicomDir *newDicomDir = new gdcm::DicomDir(); + GDCM_NAME_SPACE::DicomDir *newDicomDir = GDCM_NAME_SPACE::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; }