X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FMakeDicomDir.cxx;h=86f7ec752127633f5b62972a5bdf55edd36e1b00;hb=1b20e56c29494e7d1bef31d3ade5de833347c228;hp=597020a8471ae43b427c9a4bd7281361b0edaa58;hpb=9689c0978578896cab99394a3cbe4fdcb3583ff5;p=gdcm.git diff --git a/Example/MakeDicomDir.cxx b/Example/MakeDicomDir.cxx index 597020a8..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/08 10:15:04 $ - Version: $Revision: 1.9 $ + 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,11 @@ int main(int argc, char *argv[]) // we ask for Directory parsing - dcmdir = new gdcm::DicomDir( ); - - dcmdir->SetStartMethod(StartMethod, (void *) NULL); - dcmdir->SetEndMethod(EndMethod); + dcmdir = gdcm::DicomDir::New( ); dcmdir->SetLoadMode(loadMode); dcmdir->SetDirectoryName(dirName); -dcmdir->SetParseDir(true); + //dcmdir->SetParseDir(true); dcmdir->Load(); // ----- Check the result @@ -117,24 +104,26 @@ dcmdir->SetParseDir(true); { 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; } @@ -144,12 +133,12 @@ dcmdir->SetParseDir(true); <<" has no patient"<Delete(); return(1); } std::cout<Delete(); return 0; }