]> Creatis software - gdcm.git/commitdiff
BUG: This super duper HACK should solve the problem on the dashboard. This is a hack...
authormalaterre <malaterre>
Tue, 11 Jan 2005 20:49:44 +0000 (20:49 +0000)
committermalaterre <malaterre>
Tue, 11 Jan 2005 20:49:44 +0000 (20:49 +0000)
src/gdcmBinEntry.cxx
src/gdcmHeader.cxx

index f1e234a1ecb278b9251314f50ed7dd5ac8699efd..e54c1a76259bc8451adf13187d14284df7a753a8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/08 23:14:05 $
-  Version:   $Revision: 1.45 $
+  Date:      $Date: 2005/01/11 20:49:44 $
+  Version:   $Revision: 1.46 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -121,7 +121,7 @@ void BinEntry::WriteContent(std::ofstream *fp, FileType filetype)
    }
    else
    {
-    // nothing was loaded, but we need to skip space on disc
+      // nothing was loaded, but we need to skip space on disc
       fp->seekp(lgr, std::ios::cur);
    }
 }
index c560a82a9407b2b913d508788a0136c6512c369e..bc79a67529d62409f16936ade3ec814f1ecbcae5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/11 11:37:14 $
-  Version:   $Revision: 1.229 $
+  Date:      $Date: 2005/01/11 20:49:44 $
+  Version:   $Revision: 1.230 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -22,6 +22,7 @@
 #include "gdcmDebug.h"
 #include "gdcmTS.h"
 #include "gdcmValEntry.h"
+#include "gdcmBinEntry.h"
 #include <stdio.h> //sscanf
 
 #include <vector>
@@ -194,8 +195,37 @@ bool Header::Write(std::string fileName, FileType filetype)
           RemoveEntryNoDestroy(e);
       }
    }
+
+#ifdef GDCM_WORDS_BIGENDIAN
+   // Super Duper hack that will make gdcm a BOMB ! but should
+   // Fix temporarily the dashboard
+   BinEntry *b = GetBinEntry(0x7fe0,0x0010);
+   if ( GetEntry(0x0028,0x0100) ==  "16")
+   {
+      uint16_t *im16 = (uint16_t*)b->GetBinArea();
+      int lgr = b->GetLength();
+      for( int i = 0; i < lgr / 2; i++ )
+      {
+         im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+      }
+   }
+#endif //GDCM_WORDS_BIGENDIAN
+
    Document::WriteContent(fp,filetype);
 
+#ifdef GDCM_WORDS_BIGENDIAN
+   // Flip back the pixel ... I told you this is a hack
+   if ( GetEntry(0x0028,0x0100) ==  "16")
+   {
+      uint16_t *im16 = (uint16_t*)b->GetBinArea();
+      int lgr = b->GetLength();
+      for( int i = 0; i < lgr / 2; i++ )
+      {
+         im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+      }
+   }
+#endif //GDCM_WORDS_BIGENDIAN
+
    fp->close();
    delete fp;