]> Creatis software - gdcm.git/blobdiff - Example/TestCopyDicom.cxx
COMP: Fix warnings about unused var on SunOS
[gdcm.git] / Example / TestCopyDicom.cxx
index eda53d6720a35b61ccfb8465950ddf44be0b6c77..e7ced62bee59791c01d68ae2d0694bae9a3798e2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/16 04:26:18 $
-  Version:   $Revision: 1.12 $
+  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
@@ -87,10 +87,10 @@ int main(int argc, char* argv[])
    
       gdcm::File *copy = new gdcm::File( output );
 
-      const gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetTagHT();
-
       size_t dataSize = original->GetImageDataSize();
       uint8_t* imageData = original->GetImageData();
+      (void)imageData;
+      (void)dataSize;
   
       //First of all copy the header field by field
   
@@ -99,15 +99,12 @@ 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
 
-      gdcm::DocEntry* d;
-
-      for (gdcm::TagDocEntryHT::const_iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
+      gdcm::DocEntry* d=original->GetHeader()->GetFirstEntry();
+      while(d)
       {
-         d = tag->second;
-         d->Print(); std::cout << std::endl;
          if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
          {              
-            copy->GetHeader()->ReplaceOrCreateByNumber
+            copy->GetHeader()->ReplaceOrCreate( 
                                  b->GetBinArea(),
                                  b->GetLength(),
                                  b->GetGroup(), 
@@ -116,7 +113,7 @@ int main(int argc, char* argv[])
          }
          else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
          {   
-            copy->GetHeader()->ReplaceOrCreateByNumber
+            copy->GetHeader()->ReplaceOrCreate( 
                                  v->GetValue(),
                                  v->GetGroup(), 
                                  v->GetElement(),
@@ -130,14 +127,12 @@ int main(int argc, char* argv[])
           //          << d->GetGroup() << " " << d->GetElement()
           //  << std::endl;    
          }
-      }
-
-
-
 
+         d=original->GetHeader()->GetNextEntry();
+      }
 
       //copy->GetImageData();
-      copy->SetImageData(imageData, dataSize);
+      //copy->SetImageData(imageData, dataSize);
 
       std::cout << "--- Copy ----------------------" << std::endl;
       std::cout <<std::endl << "DO NOT care about Offset"  <<std::endl<<std::endl;;