]> Creatis software - gdcm.git/commitdiff
* src/gdcmDocument.cxx : now, when using the ReplaceOrCreateByNumber to
authorregrain <regrain>
Wed, 17 Nov 2004 10:20:05 +0000 (10:20 +0000)
committerregrain <regrain>
Wed, 17 Nov 2004 10:20:05 +0000 (10:20 +0000)
     set a BinEntry, the binArea is copied (like to set a ValEntry, the string
     is copied).
   * Test/TestCopyDicom.cxx, Example/TestCopyDicom.cxx : the image data isn't      set because already copied when copying the BinEntry's of the header
   * Test/TestAllReadCompareDicom.cxx : remove warnings
   -- BeNours

ChangeLog
Example/TestCopyDicom.cxx
Testing/TestAllReadCompareDicom.cxx
Testing/TestCopyDicom.cxx
src/gdcmDocument.cxx

index 85e4a7e9de967b7f568fc96710e7a87dde95e62f..3aab041b9a3bb210637c474348763d24e90159a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-11-15 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * src/gdcmDocument.cxx : now, when using the ReplaceOrCreateByNumber to
+     set a BinEntry, the binArea is copied (like to set a ValEntry, the string
+     is copied).
+   * Test/TestCopyDicom.cxx, Example/TestCopyDicom.cxx : the image data isn't 
+     set because already copied when copying the BinEntry's of the header
+   * Test/TestAllReadCompareDicom.cxx : remove warnings
+
 2004-11-15 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * FIX : now, the DocEntries are all deleted in the gdcmElementSet.
      Two problems appear when doing it :
index eda53d6720a35b61ccfb8465950ddf44be0b6c77..24400816bab017ec246e08936efd8cd927a762b4 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: 2004/11/17 10:20:06 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -137,7 +137,7 @@ int main(int argc, char* argv[])
 
 
       //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;; 
index 2eb4cf604b9844aee238f8d91ae5a4eaba91e2eb..8dc649f59a6a8bc778c4485effaa9590fc0a2303 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/16 14:48:19 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2004/11/17 10:20:06 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,6 +45,8 @@ int InternalTest(std::string const & filename,
       {
       ////// Step 3a:
          uint8_t* testedImageData = tested->GetImageData(); // Kludge
+         (void)testedImageData;
+
          tested->WriteDcmExplVR( referenceFileName );
          std::cerr << "      Creating reference baseline file :" << std::endl
                    << "      " << referenceFileName 
index 70284c3a36aaa2be2a27d049c7b94184cd0591a5..9706397c7a37bde09657f98ab7d7fe0b288ba8a1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/16 04:28:20 $
-  Version:   $Revision: 1.16 $
+  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
@@ -104,7 +104,7 @@ int TestCopyDicom(int , char* [])
       {
          d = tag->second;
          if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
-         {              
+         {
             copy->GetHeader()->ReplaceOrCreateByNumber( 
                                  b->GetBinArea(),
                                  b->GetLength(),
@@ -130,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 );
index a569ccac7c5d11c9649b53d9762fe03f64234130..854e6db28d1193494b02061ea6219ec690e3aed7 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/17 03:20:05 $
-  Version:   $Revision: 1.132 $
+  Date:      $Date: 2004/11/17 10:20:07 $
+  Version:   $Revision: 1.133 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -619,6 +619,7 @@ ValEntry* Document::ReplaceOrCreateByNumber(
 /*
  * \brief   Modifies the value of a given Header Entry (Dicom Element)
  *          when it exists. Create it with the given value when unexistant.
+ *          A copy of the binArea is made to be kept in the Document.
  * @param   binArea (binary) value to be set
  * @param   Group   Group number of the Entry 
  * @param   Elem  Element number of the Entry
@@ -690,7 +691,23 @@ BinEntry* Document::ReplaceOrCreateByNumber(
       }
    }
 
-   SetEntryByNumber(binArea, lgth, group, elem);
+   uint8_t *tmpArea;
+   if (lgth>0 && binArea)
+   {
+      tmpArea = new uint8_t[lgth];
+      memcpy(tmpArea,binArea,lgth);
+   }
+   else
+   {
+      tmpArea = 0;
+   }
+   if (!SetEntryByNumber(tmpArea, lgth, group, elem))
+   {
+      if (tmpArea)
+      {
+         delete[] tmpArea;
+      }
+   }
 
    return binEntry;
 }