]> Creatis software - gdcm.git/blobdiff - Example/TestCopyDicom.cxx
First stage of name normalisation : gdcm::File replace by gdcm::FileHelper
[gdcm.git] / Example / TestCopyDicom.cxx
index 2edc47f8597b8a04dc85164c64c009ea80af353e..8d386103252e2a5c10f1a966909b1eaf18f0bdde 100644 (file)
@@ -1,3 +1,20 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: TestCopyDicom.cxx,v $
+  Language:  C++
+  Date:      $Date: 2005/01/20 16:16:58 $
+  Version:   $Revision: 1.18 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*/
 #include "gdcmHeader.h"
 #include "gdcmFile.h"
 #include "gdcmDocument.h"
@@ -63,17 +80,17 @@ int main(int argc, char* argv[])
             return 1;
          }
       }
-      gdcmFile *original = new gdcmFile( filename );
+      gdcm::FileHelper *original = new gdcm::FileHelper( filename );
    
       std::cout << "--- Original ----------------------" << std::endl;
       //original->GetHeader()->Print();
    
-      gdcmFile *copy = new gdcmFile( output );
-
-      TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
+      gdcm::FileHelper *copy = new gdcm::FileHelper( output );
 
       size_t dataSize = original->GetImageDataSize();
       uint8_t* imageData = original->GetImageData();
+      (void)imageData;
+      (void)dataSize;
   
       //First of all copy the header field by field
   
@@ -82,24 +99,21 @@ 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
 
-      gdcmDocEntry* d;
-
-      for (TagDocEntryHT::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 ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
+         if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
          {              
-            copy->GetHeader()->ReplaceOrCreateByNumber
+            copy->GetHeader()->ReplaceOrCreate( 
                                  b->GetBinArea(),
                                  b->GetLength(),
                                  b->GetGroup(), 
                                  b->GetElement(),
                                  b->GetVR() );
          }
-         else if ( gdcmValEntry* v = dynamic_cast<gdcmValEntry*>(d) )
+         else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
          {   
-            copy->GetHeader()->ReplaceOrCreateByNumber
+            copy->GetHeader()->ReplaceOrCreate( 
                                  v->GetValue(),
                                  v->GetGroup(), 
                                  v->GetElement(),
@@ -113,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;;