]> Creatis software - gdcm.git/blobdiff - Example/MakeDicomDir.cxx
* Remove #define and replace then by the call to the corresponding
[gdcm.git] / Example / MakeDicomDir.cxx
index 0ad1aa94345d449c09d7737518c8f26623e00f66..76cf5b18f5f90ad62b65b325f3713484330b7122 100644 (file)
@@ -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/08/30 15:13:05 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -20,7 +20,6 @@
 #include "gdcmDicomDirPatient.h"
 #include "gdcmDirList.h"
 #include "gdcmDebug.h"
-
 #include "gdcmArgMgr.h"
 
 #include <iostream>
@@ -48,14 +47,17 @@ void EndMethod(void *toto) {
 int main(int argc, char *argv[]) 
 {
    START_USAGE(usage)
-   " \n MakeDicomDir :\n",
-   " Explores recursively the given directory, makes the relevant DICOMDIR",
-   "          and writes it as 'NewDICOMDIR'",
-   " usage: MakeDicomDir dirname=rootDirectoryName [noshadowseq][noshadow][noseq] [debug] ",
-   "        noshadowseq: user doesn't want to load Private Sequences",
-   "        noshadow : user doesn't want to load Private groups (odd number)",
-   "        noseq    : user doesn't want to load Sequences ",
-   "        debug    : user wants to run the program in 'debug mode' ",
+   " \n MakeDicomDir :\n                                                      ",
+   " Explores recursively the given directory, makes the relevant DICOMDIR    ",
+   "          and writes it as 'NewDICOMDIR'                                  ",
+   "                                                                          ", 
+   " usage: MakeDicomDir dirname=rootDirectoryName                            ",
+   "        [noshadowseq][noshadow][noseq] [debug]                            ",
+   "                                                                          ",
+   "        noshadowseq: user doesn't want to load Private Sequences          ",
+   "        noshadow : user doesn't want to load Private groups (odd number)  ",
+   "        noseq    : user doesn't want to load Sequences                    ",
+   "        debug    : user wants to run the program in 'debug mode'          ",
    FINISH_USAGE
 
    // ----- Initialize Arguments Manager ------   
@@ -71,15 +73,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"))
@@ -102,13 +104,14 @@ int main(int argc, char *argv[])
    // we ask for Directory parsing
 
    dcmdir = new gdcm::DicomDir( );
-   dcmdir->SetParseDir(true);
 
-   dcmdir->SetStartMethod(StartMethod, (void *) NULL);
+   dcmdir->SetStartMethod(StartMethod);
    dcmdir->SetEndMethod(EndMethod);
 
    dcmdir->SetLoadMode(loadMode);
-   dcmdir->Load(dirName);
+   dcmdir->SetDirectoryName(dirName);
+   //dcmdir->SetParseDir(true);
+   dcmdir->Load();
 
     // ----- Check the result
     
@@ -126,7 +129,9 @@ int main(int argc, char *argv[])
    delete dcmdir;
 
    // Read from disc the just written DicomDir
-   gdcm::DicomDir *newDicomDir = new gdcm::DicomDir("NewDICOMDIR");
+   gdcm::DicomDir *newDicomDir = new gdcm::DicomDir();
+   newDicomDir->SetFileName( "NewDICOMDIR" );
+   newDicomDir->Load();
    if( !newDicomDir->IsReadable() )
    {
       std::cout<<"          Written DicomDir 'NewDICOMDIR'"