From: regrain Date: Wed, 2 Feb 2005 17:20:33 +0000 (+0000) Subject: * src/gdcmBinEntry.cxx : bug fix for BIG_ENDIAN part when writing the content X-Git-Tag: Version1.0.bp~102 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=018a3bbd1c375f4fdb1970cfc23f61b4fe04eb20;p=gdcm.git * src/gdcmBinEntry.cxx : bug fix for BIG_ENDIAN part when writing the content * gdcmPython/gdcm.i : rename gdcmHeader to gdcmHelper -- BeNours --- diff --git a/ChangeLog b/ChangeLog index c4a59b67..3c45b93a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,22 @@ +2005-01-31 Benoit Regrain + * 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 - *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 - * src/*.cxx : first parss to normalize file organisation + * src/*.cxx : first parss to normalize file organisation 2005-01-31 Benoit Regrain - * 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 - * 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 * SerieHeader::SetDirectory() allow recursive exploration of the Directory diff --git a/gdcmPython/gdcm.i b/gdcmPython/gdcm.i index 07d94731..4148b717 100644 --- a/gdcmPython/gdcm.i +++ b/gdcmPython/gdcm.i @@ -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" diff --git a/src/gdcmBinEntry.cxx b/src/gdcmBinEntry.cxx index e4460c60..678f6fb1 100644 --- a/src/gdcmBinEntry.cxx +++ b/src/gdcmBinEntry.cxx @@ -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> 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 {