]> Creatis software - gdcm.git/commitdiff
Use new method GetFirstEntry instead of InitTraversal+GetNextEntry
authorjpr <jpr>
Tue, 18 Jan 2005 07:55:16 +0000 (07:55 +0000)
committerjpr <jpr>
Tue, 18 Jan 2005 07:55:16 +0000 (07:55 +0000)
Example/PrintDicomDir.cxx
Example/TestCopyDicom.cxx
Example/TestFromScratch.cxx
Example/makeDicomDir.cxx
Testing/TestCopyDicom.cxx
Testing/TestCopyRescaleDicom.cxx
Testing/TestDicomDir.cxx
Testing/TestDict.cxx

index 3303d67bf9e8b7097101b40b085517c93e0999f8..5e589900e755b4e46a25e1e34cc2c555cb85ac34 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PrintDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/17 13:47:22 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2005/01/18 07:55:16 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -71,8 +71,7 @@ int main(int argc, char* argv[])
    }
 
    // Test if the DicomDir contains any Patient
-   e1->InitTraversal();
-   pa = e1->GetNextEntry();
+   pa = e1->GetFirstEntry();
    if ( pa  == 0)
    {
       std::cout<<"          DicomDir '"<<fileName
@@ -92,8 +91,7 @@ int main(int argc, char* argv[])
        << " =  PATIENT List ==========================================" 
        << std::endl<< std::endl;
 
-      e1->InitTraversal();
-      pa = e1->GetNextEntry();
+      pa = e1->GetFirstEntry();
       while (pa) 
       {
          std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name   
@@ -106,13 +104,11 @@ int main(int argc, char* argv[])
         << " = PATIENT/STUDY List =======================================" 
         << std::endl<< std::endl;
 
-      e1->InitTraversal();
-      pa = e1->GetNextEntry();
+      pa = e1->GetFirstEntry();
       while ( pa ) // on degouline les PATIENT de ce DICOMDIR
       {  
          std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name 
-         pa->InitTraversal();
-         st = pa->GetNextEntry();
+         st = pa->GetFirstEntry();
          while ( st ) { // on degouline les STUDY de ce patient
             std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description
             st = pa->GetNextEntry();
@@ -126,22 +122,19 @@ int main(int argc, char* argv[])
         << " =  PATIENT/STUDY/SERIE List ==================================" 
         << std::endl<< std::endl;
 
-      e1->InitTraversal();
-      pa = e1->GetNextEntry(); 
+      pa = e1->GetFirstEntry(); 
       while ( pa )   // on degouline les PATIENT de ce DICOMDIR
       {
        // Patient's Name, Patient ID 
          std::cout << "Pat.Name:[" << pa->GetEntry(0x0010, 0x0010) <<"]"; // Patient's Name
          std::cout << " Pat.ID:[";
          std::cout << pa->GetEntry(0x0010, 0x0020) << "]" << std::endl; // Patient ID
-         pa->InitTraversal();
-         st = pa->GetNextEntry();
+         st = pa->GetFirstEntry();
          while ( st ) { // on degouline les STUDY de ce patient
             std::cout << "--- Stud.descr:["    << st->GetEntry(0x0008, 0x1030) << "]";// Study Description 
             std::cout << " Stud.ID:["          << st->GetEntry(0x0020, 0x0010);       // Study ID
             std::cout << "]" << std::endl;
-            st->InitTraversal();
-            se = st->GetNextEntry();
+            se = st->GetFirstEntry();
             while ( se ) { // on degouline les SERIES de cette study
                std::cout << "--- --- Ser.Descr:["<< se->GetEntry(0x0008, 0x103e)<< "]";  // Series Description
                std::cout << " Ser.nb:["         <<  se->GetEntry(0x0020, 0x0011);        // Series number
@@ -160,23 +153,19 @@ int main(int argc, char* argv[])
            << " = PATIENT/STUDY/SERIE/IMAGE List ============================" 
            << std::endl<< std::endl;
  
-      e1->InitTraversal();
-      pa = e1->GetNextEntry(); 
+      pa = e1->GetFirstEntry(); 
       while ( pa ) {  // les PATIENT de ce DICOMDIR
          std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
-         pa->InitTraversal();
-         st = pa->GetNextEntry();
+         st = pa->GetFirstEntry();
          while ( st ) { // on degouline les STUDY de ce patient
             std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl;    // Study Description
             std::cout << " Stud.ID:["          << st->GetEntry(0x0020, 0x0010); // Study ID
-            st->InitTraversal();
-            se = st->GetNextEntry();
+            se = st->GetFirstEntry();
             while ( se ) { // on degouline les SERIES de cette study
                std::cout << "--- --- "<< se->GetEntry(0x0008, 0x103e) << std::endl;      // Serie Description
                std::cout << " Ser.nb:["         <<  se->GetEntry(0x0020, 0x0011);        // Series number
                std::cout << "] Mod.:["          <<  se->GetEntry(0x0008, 0x0060) << "]"; // Modality
-               se->InitTraversal();
-               im = se->GetNextEntry();
+               im = se->GetFirstEntry();
                while ( im ) { // on degouline les Images de cette serie
                   std::cout << "--- --- --- "<< im->GetEntry(0x0004, 0x1500) << std::endl; // File name
                   im = se->GetNextEntry();   
index bc1313cf552297f83edb101e3800fc312da2ace9..e7ced62bee59791c01d68ae2d0694bae9a3798e2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/14 11:28:28 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2005/01/18 07:55:16 $
+  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
@@ -99,8 +99,7 @@ int main(int argc, char* argv[])
       // (the user does NOT have to know the way we implemented the Header !)
       // Waiting for a 'clean' solution, I keep the method ...JPRx
 
-      original->GetHeader()->InitTraversal();
-      gdcm::DocEntry* d=original->GetHeader()->GetNextEntry();
+      gdcm::DocEntry* d=original->GetHeader()->GetFirstEntry();
       while(d)
       {
          if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
index e9760b86cc997558a3f98b031c05b72e0af57d64..6b1ebaa0bfc899cd8df0fc66e55cbe3f481fad7c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestFromScratch.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/14 11:28:28 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2005/01/18 07:55:16 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -42,7 +42,6 @@ int main(int argc, char *argv[])
    //gdcm::Debug::GetReference().SetDebug(1);
 
    std::string filename = argv[1];
-   //gdcm::File *f1 = new gdcm::File( "/home/malaterre/Creatis/gdcmData/012345.002.050.dcm" );
    gdcm::File *f1 = new gdcm::File( filename );
    gdcm::Header *h1 = f1->GetHeader();
 
@@ -55,8 +54,7 @@ int main(int argc, char *argv[])
    gdcm::Header *h2 = new gdcm::Header();
 
    // Copy of the header content
-   h1->InitTraversal();
-   gdcm::DocEntry* d = h1->GetNextEntry();
+   gdcm::DocEntry* d = h1->GetFirstEntry();
    while(d)
    {
       if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
index 73b7406b12a23cb7d3a70e524f9b44a4d66e0297..948e24f7e38758ba7cb6d09f5b0f9b5aef3819df 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: makeDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/17 11:01:55 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2005/01/18 07:55:16 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -57,8 +57,7 @@ int main(int argc, char* argv[]) {
    dcmdir->SetStartMethod(StartMethod, (void *) NULL);
    dcmdir->SetEndMethod(EndMethod);
    
-   dcmdir->InitTraversal();
-   if ( !dcmdir->GetNextEntry() ) 
+   if ( !dcmdir->GetFirstEntry() ) 
    {
       std::cout << "makeDicomDir: no patient list present. Exiting."
                 << std::endl;
index af7f4d45e46005e8358e9970056c1b83d949cc5c..77178d2da0abb503ff92f1fffd4969315bad8475 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/14 11:28:29 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2005/01/18 07:56:21 $
+  Version:   $Revision: 1.30 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -85,8 +85,7 @@ int CopyDicom(std::string const & filename,
 
       //////////////// Step 2:
       std::cout << "2...";
-      originalH->InitTraversal();
-      gdcm::DocEntry* d=originalH->GetNextEntry();
+      gdcm::DocEntry* d=originalH->GetFirstEntry();
       while(d)
       {
          if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
index 975d91c8742ab1c2509e4f921db442976191ab9b..e566dda4f02424f8607c15f84876b79fa08747f4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyRescaleDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/14 11:28:29 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2005/01/18 07:56:21 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -57,8 +57,7 @@ int CopyRescaleDicom(std::string const & filename,
    //////////////// Step 2:
    std::cout << "2...";
    // Copy of the header content
-   originalH->InitTraversal();
-   gdcm::DocEntry* d = originalH->GetNextEntry();
+   gdcm::DocEntry* d = originalH->GetFirstEntry();
    while(d)
    {
       if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
index b3d6ad38af95b3cc40c82c1c2c5d36eb43ff48b5..7a70e90b22dbc6d027bdbefd9ab7c659cff38d8f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/17 13:47:23 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2005/01/18 07:56:21 $
+  Version:   $Revision: 1.30 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -70,8 +70,7 @@ int TestDicomDir(int argc, char* argv[])
    }
 
    // Test if the DicomDir contains any Patient
-   e1->InitTraversal();
-   if( !e1->GetNextEntry() )
+   if( !e1->GetFirstEntry() )
    {
       std::cout<<"          DicomDir '"<<file
                <<" has no patient"<<std::endl
@@ -87,23 +86,19 @@ int TestDicomDir(int argc, char* argv[])
              << " = PATIENT/STUDY/SERIE/IMAGE List ============================" 
              << std::endl<< std::endl;
   
-   e1->InitTraversal();
-   pa = e1->GetNextEntry(); 
+   pa = e1->GetFirstEntry(); 
    while ( pa ) {  // we process all the PATIENT of this DICOMDIR 
       std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
-      pa->InitTraversal();
-      st = pa->GetNextEntry();
+      st = pa->GetFirstEntry();
       while ( st ) { // we process all the STUDY of this patient
          std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl;    // Study Description
          std::cout << " Stud.ID:["          << st->GetEntry(0x0020, 0x0010); // Study ID
-         st->InitTraversal();
-         se = st->GetNextEntry();
+         se = st->GetFirstEntry();
          while ( se ) { // we process all the SERIES of this study
             std::cout << "--- --- "<< se->GetEntry(0x0008, 0x103e) << std::endl;      // Serie Description
             std::cout << " Ser.nb:["         <<  se->GetEntry(0x0020, 0x0011);        // Series number
             std::cout << "] Mod.:["          <<  se->GetEntry(0x0008, 0x0060) << "]"; // Modality
-            se->InitTraversal();
-            im = se->GetNextEntry();
+            im = se->GetFirstEntry();
             while ( im ) { // we process all the IMAGE of this serie
                std::cout << "--- --- --- "<< im->GetEntry(0x0004, 0x1500) << std::endl; // File name
                im = se->GetNextEntry();   
index c85556867871211d25f79b0ec32341bcedae602d..6d5b4e207fe7bf7a3dde828beb0486c14b4ffda8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestDict.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/17 14:18:48 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/01/18 07:56:21 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -36,8 +36,7 @@ int TestDict(int , char* [])
 
    std::cout<<"DictSet content :\n";
 
-   dicts->InitTraversal();
-   gdcm::Dict *d = dicts->GetNextEntry();
+   gdcm::Dict *d = dicts->GetFirstEntry();
    if (!d)
    {
       std::cout << "Dictset is empty" << std::endl;
@@ -77,8 +76,7 @@ int TestDict(int , char* [])
 
    // Print all the DictEntry
    std::cout<<"#######################################################\n";
-   pubDict->InitTraversal();
-   entry=pubDict->GetNextEntry();
+   entry=pubDict->GetFirstEntry();
    while(entry)
    {
       entry->Print();