]> Creatis software - gdcm.git/blobdiff - Example/TestChangeHeader.cxx
First stage of name normalisation : gdcm::File replace by gdcm::FileHelper
[gdcm.git] / Example / TestChangeHeader.cxx
index c0982e6d9095da93e149c005ef283f41a15b978a..6baada033ddfd82cf96e61edd57c2c0f4df5f892 100644 (file)
@@ -1,5 +1,22 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: TestChangeHeader.cxx,v $
+  Language:  C++
+  Date:      $Date: 2005/01/20 16:16:58 $
+  Version:   $Revision: 1.7 $
+                                                                                
+  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 "gdcmFileHelper.h"
 
 // This examples read two images (could be the same). Try to modify
 // Acquisition Matrix and then write the image again
@@ -10,29 +27,24 @@ int main(int argc, char* argv[])
     {
        std::cerr << "usage :" << std::endl <<
          argv[0] << " nomFichierPourEntete nomFichierPourDonnées" << 
-std::endl;
+         std::endl;
        return 1;
     }
 
-    gdcmHeader *h1 = new gdcmHeader( argv[1] );
-    gdcmFile  *f1 = new gdcmFile( h1 );
-    gdcmFile  *f2 = new gdcmFile( argv[2] );
+    gdcm::Header *h1 = new gdcm::Header( argv[1] );
+    gdcm::FileHelper  *f1 = new gdcm::FileHelper( h1 );
+    gdcm::FileHelper  *f2 = new gdcm::FileHelper( argv[2] );
 
     // 0018 1310 US ACQ Acquisition Matrix
-    gdcmDictEntry *dictEntry =
-         f2->GetHeader()->GetPubDict()->GetDictEntryByName( "Acquisition Matrix" );
+    gdcm::DictEntry *dictEntry =
+       f2->GetHeader()->GetPubDict()->GetDictEntry( 0x0018, 1310 );
     std::cerr << std::hex << dictEntry->GetGroup() << "," << dictEntry->GetElement() << std::endl;
 
-   // std::string matrix = f2->GetHeader()->GetEntryByNumber(0x0018, 0x1310);
-   // Or, strictly equivalent (a little bit longer at run-time !):
-    std::string matrix = f2->GetHeader()->GetEntryByName("Acquisition Matrix");  
+    std::string matrix = f2->GetHeader()->GetEntry(0x0018, 0x1310);
     if(matrix != "gdcm::Unfound")
     {
        std::cerr << "Aquisition Matrix:" << matrix << std::endl;
-      f1->GetHeader()->ReplaceOrCreateByNumber( matrix, 0x0018, 0x1310);
-      
-       //f1->GetHeader()->ReplaceOrCreateByNumber( matrix, dictEntry->GetGroup(),
-       //  dictEntry->GetElement());
+       f1->GetHeader()->ReplaceOrCreate( matrix, 0x0018, 0x1310);
     }
 
     f1->GetImageData();