X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=Example%2FMakeDicomDir.cxx;h=86f7ec752127633f5b62972a5bdf55edd36e1b00;hb=dbfde634eb0ab3ace5b6655146d4a1c6ca3a9796;hp=0ad1aa94345d449c09d7737518c8f26623e00f66;hpb=db9e1c1788506828aa1f7b2f6e69cf44372129b6;p=gdcm.git diff --git a/Example/MakeDicomDir.cxx b/Example/MakeDicomDir.cxx index 0ad1aa94..86f7ec75 100644 --- a/Example/MakeDicomDir.cxx +++ b/Example/MakeDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: MakeDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/07/05 13:26:32 $ - Version: $Revision: 1.7 $ + Date: $Date: 2005/11/28 17:09:22 $ + Version: $Revision: 1.17 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,23 +20,10 @@ #include "gdcmDicomDirPatient.h" #include "gdcmDirList.h" #include "gdcmDebug.h" - #include "gdcmArgMgr.h" #include -// --- -void StartMethod(void *toto) { - (void)toto; - std::cout<<"Start parsing"<ArgMgrGetString("dirName",(char *)"."); - int loadMode = 0x00000000; + int loadMode = gdcm::LD_ALL; if ( am->ArgMgrDefined("noshadowseq") ) - loadMode |= NO_SHADOWSEQ; + loadMode |= gdcm::LD_NOSHADOWSEQ; else { if ( am->ArgMgrDefined("noshadow") ) - loadMode |= NO_SHADOW; + loadMode |= gdcm::LD_NOSHADOW; if ( am->ArgMgrDefined("noseq") ) - loadMode |= NO_SEQ; + loadMode |= gdcm::LD_NOSEQ; } if (am->ArgMgrDefined("debug")) @@ -101,14 +91,12 @@ int main(int argc, char *argv[]) // we ask for Directory parsing - dcmdir = new gdcm::DicomDir( ); - dcmdir->SetParseDir(true); - - dcmdir->SetStartMethod(StartMethod, (void *) NULL); - dcmdir->SetEndMethod(EndMethod); + dcmdir = gdcm::DicomDir::New( ); dcmdir->SetLoadMode(loadMode); - dcmdir->Load(dirName); + dcmdir->SetDirectoryName(dirName); + //dcmdir->SetParseDir(true); + dcmdir->Load(); // ----- Check the result @@ -116,24 +104,26 @@ int main(int argc, char *argv[]) { 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("NewDICOMDIR"); + gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New(); + newDicomDir->SetFileName( "NewDICOMDIR" ); + newDicomDir->Load(); if( !newDicomDir->IsReadable() ) { std::cout<<" Written DicomDir 'NewDICOMDIR'" <<" is not readable"<Delete(); return 1; } @@ -143,12 +133,12 @@ int main(int argc, char *argv[]) <<" has no patient"<Delete(); return(1); } std::cout<Delete(); return 0; }