]> Creatis software - gdcm.git/blobdiff - Testing/TestCopyRescaleDicom.cxx
* Test/VTKTest*.cxx : remove the show variable in each test method because
[gdcm.git] / Testing / TestCopyRescaleDicom.cxx
index 275c532776cb1f2b0ba862abede8ee210cde0c61..eaff8b4c891e5678c8118a40243e90d0d98758df 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyRescaleDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/21 11:40:54 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2005/01/24 16:44:54 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -48,12 +48,6 @@ int CopyRescaleDicom(std::string const & filename,
 
    //First of all copy the header field by field
 
-   // Warning :Accessor gdcmElementSet::GetEntry() should not exist 
-   // It was commented out by Mathieu, that was a *good* idea
-   // (the user does NOT have to know the way we implemented the File !)
-   // Waiting for a 'clean' solution, I keep the method ...JPRx
-
-
    //////////////// Step 2:
    std::cout << "2...";
    // Copy of the header content
@@ -62,7 +56,7 @@ int CopyRescaleDicom(std::string const & filename,
    {
       if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
       {
-         copyH->ReplaceOrCreate
+         copyH->Insert
                               b->GetBinArea(),
                               b->GetLength(),
                               b->GetGroup(), 
@@ -71,7 +65,7 @@ int CopyRescaleDicom(std::string const & filename,
       }
       else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
       {   
-          copyH->ReplaceOrCreate
+          copyH->Insert
                               v->GetValue(),
                               v->GetGroup(), 
                               v->GetElement(),
@@ -93,14 +87,14 @@ int CopyRescaleDicom(std::string const & filename,
    size_t rescaleSize;
    uint8_t *rescaleImage;
 
-   const std::string & bitsStored    = originalH->GetEntry(0x0028,0x0101);
+   const std::string & bitsStored    = originalH->GetEntryValue(0x0028,0x0101);
    if( bitsStored == "16" )
    {
       std::cout << "Rescale...";
-      copyH->ReplaceOrCreate( "8", 0x0028, 0x0100); // BitsAllocated
-      copyH->ReplaceOrCreate( "8", 0x0028, 0x0101); // BitsStored
-      copyH->ReplaceOrCreate( "7", 0x0028, 0x0102); // HighBit
-      copyH->ReplaceOrCreate( "0", 0x0028, 0x0103); //Pixel Representation
+      copyH->Insert( "8", 0x0028, 0x0100); // BitsAllocated
+      copyH->Insert( "8", 0x0028, 0x0101); // BitsStored
+      copyH->Insert( "7", 0x0028, 0x0102); // HighBit
+      copyH->Insert( "0", 0x0028, 0x0103); //Pixel Representation
  
       // We assume the value were from 0 to uint16_t max
       rescaleSize = dataSize / 2;