]> Creatis software - gdcm.git/blobdiff - Example/MakeDicomDir.cxx
* Fix compilation error due to the introduction of the CommandManager
[gdcm.git] / Example / MakeDicomDir.cxx
index b3465316bec24df647e59a827a90c48622910241..86f7ec752127633f5b62972a5bdf55edd36e1b00 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: MakeDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/08/29 12:29:47 $
-  Version:   $Revision: 1.12 $
+  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
 
 #include <iostream>
 
-// ---
-void StartMethod(void *toto) {
-  (void)toto;
-   std::cout<<"Start parsing"<<std::endl;
-}
-
-void EndMethod(void *toto) {
-  (void)toto;
-   std::cout<<"End parsing"<<std::endl;
-}
-// ---
-
 /**
   * \brief   Explores recursively the given directory
   *          orders the gdcm-readable found Files
@@ -73,15 +61,15 @@ int main(int argc, char *argv[])
    char *dirName;   
    dirName  = am->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"))
@@ -103,10 +91,7 @@ int main(int argc, char *argv[])
 
    // we ask for Directory parsing
 
-   dcmdir = new gdcm::DicomDir( );
-
-   dcmdir->SetStartMethod(StartMethod);
-   dcmdir->SetEndMethod(EndMethod);
+   dcmdir = gdcm::DicomDir::New( );
 
    dcmdir->SetLoadMode(loadMode);
    dcmdir->SetDirectoryName(dirName);
@@ -119,17 +104,17 @@ 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();
+   gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
    newDicomDir->SetFileName( "NewDICOMDIR" );
    newDicomDir->Load();
    if( !newDicomDir->IsReadable() )
@@ -138,7 +123,7 @@ int main(int argc, char *argv[])
                <<" is not readable"<<std::endl
                <<"          ...Failed"<<std::endl;
 
-      delete newDicomDir;
+      newDicomDir->Delete();
       return 1;
    }
 
@@ -148,12 +133,12 @@ int main(int argc, char *argv[])
                <<" has no patient"<<std::endl
                <<"          ...Failed"<<std::endl;
 
-      delete newDicomDir;
+      newDicomDir->Delete();
       return(1);
    }
 
    std::cout<<std::flush;
 
-   delete newDicomDir;
+   newDicomDir->Delete();
    return 0;
 }