]> Creatis software - gdcm.git/commitdiff
* src/gdcmBinEntry.cxx : bug fix for BIG_ENDIAN part when writing the content
authorregrain <regrain>
Wed, 2 Feb 2005 17:20:33 +0000 (17:20 +0000)
committerregrain <regrain>
Wed, 2 Feb 2005 17:20:33 +0000 (17:20 +0000)
   * gdcmPython/gdcm.i : rename gdcmHeader to gdcmHelper
   -- BeNours

ChangeLog
gdcmPython/gdcm.i
src/gdcmBinEntry.cxx

index c4a59b672ae50a1f0f1633eadeff3faf2ede6064..3c45b93a00a8441e8dcf893e74fae738b7bf7a77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,18 +1,22 @@
+2005-01-31 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * src/gdcmBinEntry.cxx : bug fix for BIG_ENDIAN part when writing the content
+   * gdcmPython/gdcm.i : rename gdcmHeader to gdcmHelper
+
 2005-02-02 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
-  *FIX SQItem::AddEntry inserts now *in the right place* any Entry 
+   * FIX SQItem::AddEntry inserts now *in the right place* any Entry
               (Dicom Element) into the Sequence Item
 
 2005-01-31 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
-  * src/*.cxx : first parss to normalize file organisation
+   * src/*.cxx : first parss to normalize file organisation
 
 2005-01-31 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
-  * src/gdcmDirList.[h|cxx] : add method to find a directory
-  * Test/TestAllReadCompareDicom.cxx : bug fix under Windows
+   * src/gdcmDirList.[h|cxx] : add method to find a directory
+   * Test/TestAllReadCompareDicom.cxx : bug fix under Windows
 
 2005-01-31 Mathieu Malaterre  <Mathieu.Malaterre@creatis.insa-lyon.fr>
-  * Finish cleaning up my JPEG mess. Should be ok now.
-  * Getting toward a RLE very similar to JPEG. Every RLE stuff is now self
-        contained within the RLE* class(doh!)
+   * Finish cleaning up my JPEG mess. Should be ok now.
+   * Getting toward a RLE very similar to JPEG. Every RLE stuff is now self
+         contained within the RLE* class(doh!)
 
 2005-01-30 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
    * SerieHeader::SetDirectory() allow recursive exploration of the Directory
index 07d947319b093f52b8282e91888aeb5b5b79d3f6..4148b71780c776559625cad09051f209916b430d 100644 (file)
@@ -21,7 +21,7 @@
 #include "gdcmFileHelper.h"
 #include "gdcmGlobal.h"
 #include "gdcmFile.h"
-#include "gdcmSerieHeader.h"
+#include "gdcmSerieHelper.h"
 #include "gdcmRLEFramesInfo.h"
 #include "gdcmJPEGFragmentsInfo.h"
 #include "gdcmSQItem.h"
@@ -357,7 +357,7 @@ typedef unsigned long long uint64_t;
 %include "gdcmDicomDirMeta.h"
 %include "gdcmDocument.h"
 %include "gdcmFile.h"
-%include "gdcmSerieHeader.h"
+%include "gdcmSerieHelper.h"
 %include "gdcmFile.h"
 %include "gdcmUtil.h"
 %include "gdcmGlobal.h"
index e4460c60b12c365f6e3b306dee341bc7f762e131..678f6fb1d004069922a0e1fa86c318e9ebdfb40d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/02 10:02:16 $
-  Version:   $Revision: 1.61 $
+  Date:      $Date: 2005/02/02 17:20:34 $
+  Version:   $Revision: 1.62 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -86,23 +86,18 @@ void BinEntry::WriteContent(std::ofstream *fp, FileType filetype)
    //   and we are working on Little Endian Processor
 
 #ifdef GDCM_WORDS_BIGENDIAN
-      // Be carefull with *any* 16 bits words 'binEntries !'
-      // if ( GetVR() == "OW") // to be used later
-
       // TODO FIXME Right now, we only care of Pixels element
 
       // 8 Bits Pixels *are* OB, 16 Bits Pixels *are* OW
       // -value forced while Reading process-
       if (GetGroup() == 0x7fe0 && GetVR() == "OW")
       {     
-         uint16_t *currPosition = (uint16_t *)binArea;
-
-         // TODO FIXME : Maybe we should allocate somewhere a static buffer,
-         // in order not to have to alloc/delete for almost every BinEntry ...
          uint16_t *buffer = new uint16_t[BUFFER_SIZE];
 
          // how many BUFFER_SIZE long pieces in binArea ?
          int nbPieces = lgr/BUFFER_SIZE/2; //(16 bits = 2 Bytes)
+         int remainingSize = lgr%BUFFER_SIZE;
+
          uint16_t *binArea16 = (uint16_t*)binArea;
          for (int j=0;j<nbPieces;j++)
          {
@@ -110,15 +105,18 @@ void BinEntry::WriteContent(std::ofstream *fp, FileType filetype)
             {
                buffer[i] =  (binArea16[i] >> 8) | (binArea16[i] << 8);
             }
-            fp->write ( (char*)currPosition, BUFFER_SIZE );
-            currPosition += BUFFER_SIZE/2;
+            fp->write ( (char*)buffer, BUFFER_SIZE );
+            binArea16 += BUFFER_SIZE/2;
          }
-         int remainingSize = lgr%BUFFER_SIZE;
-         if ( remainingSize != 0)
+         if ( remainingSize > 0)
          {
-            fp->write ( (char*)currPosition, remainingSize );   
+            for (int i = 0; i < remainingSize/2; i++)
+            {
+               buffer[i] =  (binArea16[i] >> 8) | (binArea16[i] << 8);
+            }
+            fp->write ( (char*)buffer, remainingSize );
          } 
-         delete[] buffer; 
+         delete[] buffer;
       }
       else
       {