]> Creatis software - gdcm.git/blobdiff - Testing/TestMakeDicomDir.cxx
* Remove #define and replace then by the call to the corresponding
[gdcm.git] / Testing / TestMakeDicomDir.cxx
index f73b0e49ad2c795537d38235de4ead2aee633c9e..695e230786805ea4be8b201a9d031a1497742eaf 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestMakeDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/02 10:41:10 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/08/30 15:13:07 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -47,7 +47,7 @@ void EndMethod(void *endMethod)
 
 int TestMakeDicomDir(int argc, char *argv[])
 {
-//   gdcm::Debug::DebugOn();
+   //gdcm::Debug::DebugOn();
    std::string dirName;   
 
    if (argc > 1)
@@ -58,11 +58,19 @@ int TestMakeDicomDir(int argc, char *argv[])
    {
       dirName = GDCM_DATA_ROOT;
    }
+   gdcm::DicomDir *dcmdir;
 
-    // we ask for Directory parsing
-    gdcm::DicomDir *dcmdir = new gdcm::DicomDir(dirName, true);
+   // new style (user is allowed no to load Sequences an/or Shadow Groups)
+   dcmdir = new gdcm::DicomDir( );
+   // 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->SetDirectoryName(dirName);
+   dcmdir->Load( );
 
-   dcmdir->SetStartMethod(StartMethod, (void *) NULL);
+   dcmdir->SetStartMethod(StartMethod);
    dcmdir->SetEndMethod(EndMethod);
    
    if ( !dcmdir->GetFirstPatient() ) 
@@ -79,7 +87,10 @@ int TestMakeDicomDir(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'"
@@ -101,7 +112,6 @@ int TestMakeDicomDir(int argc, char *argv[])
    }
 
    std::cout<<std::flush;
-
    delete newDicomDir;
    return 0;
 }