]> Creatis software - gdcm.git/blobdiff - Testing/TestCopyDicom.cxx
* src/gdcmDocument.cxx : now, when using the ReplaceOrCreateByNumber to
[gdcm.git] / Testing / TestCopyDicom.cxx
index 29588aefc33385a86d6ef45761b2b3a8e88b7319..9706397c7a37bde09657f98ab7d7fe0b288ba8a1 100644 (file)
@@ -1,3 +1,20 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: TestCopyDicom.cxx,v $
+  Language:  C++
+  Date:      $Date: 2004/11/17 10:20:06 $
+  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
+  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"
@@ -69,7 +86,7 @@ int TestCopyDicom(int , char* [])
       gdcm::File *original = new gdcm::File( filename );
       gdcm::File *copy = new gdcm::File( output );
 
-      gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
+      const gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetTagHT();
 
       size_t dataSize = original->GetImageDataSize();
       uint8_t* imageData = original->GetImageData();
@@ -83,11 +100,11 @@ int TestCopyDicom(int , char* [])
 
       gdcm::DocEntry* d;
 
-      for (gdcm::TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
+      for (gdcm::TagDocEntryHT::const_iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
       {
          d = tag->second;
          if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
-         {              
+         {
             copy->GetHeader()->ReplaceOrCreateByNumber( 
                                  b->GetBinArea(),
                                  b->GetLength(),
@@ -113,7 +130,9 @@ int TestCopyDicom(int , char* [])
          }
       }
 
-      copy->SetImageData(imageData, dataSize);
+      // Useless to set the image datas, because it's already made when
+      // copying the corresponding BinEntry that contains the pixel datas
+      //copy->SetImageData(imageData, dataSize);
       original->GetHeader()->SetImageDataSize(dataSize);
 
       copy->WriteDcmExplVR( output );