X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmRLEFramesInfo.cxx;h=189596db1740804240f9f442c0305f4640a07416;hb=721d134c6e594b9a23bf1ce002ed87bfbc1576a7;hp=8a8ed7cb8201a73b27816e0bf802e0187019a03d;hpb=6e4cc88754328a1fbd54f9ca9f722675f346ea20;p=gdcm.git diff --git a/src/gdcmRLEFramesInfo.cxx b/src/gdcmRLEFramesInfo.cxx index 8a8ed7cb..189596db 100644 --- a/src/gdcmRLEFramesInfo.cxx +++ b/src/gdcmRLEFramesInfo.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmRLEFramesInfo.cxx,v $ Language: C++ - Date: $Date: 2005/06/17 12:27:52 $ - Version: $Revision: 1.16 $ + Date: $Date: 2007/05/23 14:18:11 $ + Version: $Revision: 1.22 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,7 +20,11 @@ #include "gdcmDebug.h" #include "gdcmUtil.h" -namespace gdcm +#if defined(__BORLANDC__) + #include // for memset +#endif + +namespace GDCM_NAME_SPACE { //------------------------------------------------------------------------- // Constructor / Destructor @@ -67,15 +71,16 @@ RLEFrame *RLEFramesInfo::GetNextFrame() * @param xSize x Size * @param ySize y Size * @param zSize z Size + * @param tSize t Size * @param bitsAllocated Bits allocated * @return Boolean */ bool RLEFramesInfo::DecompressRLEFile( std::ifstream *fp , uint8_t *raw, int xSize, int ySize, int zSize, - int bitsAllocated ) + int tSize, int bitsAllocated ) { uint8_t *subRaw = raw; - long rawSegmentSize = xSize * ySize; + long rawSegmentSize = xSize * ySize * tSize; // Loop on the frame[s] for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it) @@ -86,7 +91,7 @@ bool RLEFramesInfo::DecompressRLEFile( std::ifstream *fp , uint8_t *raw, if ( bitsAllocated == 16 ) { // Try to deal with RLE 16 Bits - ConvertRLE16BitsFromRLE8Bits( raw, xSize, ySize, zSize ); + ConvertRLE16BitsFromRLE8Bits( raw, xSize, ySize, zSize, tSize ); } return true; @@ -99,13 +104,15 @@ bool RLEFramesInfo::DecompressRLEFile( std::ifstream *fp , uint8_t *raw, * @param raw raw * @param xSize x Size * @param ySize y Size + * @param tSize t Size * @param numberOfFrames number of frames * @return Boolean always true */ bool RLEFramesInfo::ConvertRLE16BitsFromRLE8Bits(uint8_t *raw, int xSize, - int ySize, int numberOfFrames) + int ySize, int tSize, + int numberOfFrames) { - size_t pixelNumber = xSize * ySize; + size_t pixelNumber = xSize * ySize * tSize; size_t rawSize = pixelNumber * numberOfFrames * 2; // We assumed Raw contains the decoded RLE pixels but as @@ -124,13 +131,13 @@ bool RLEFramesInfo::ConvertRLE16BitsFromRLE8Bits(uint8_t *raw, int xSize, if ( !Util::IsCurrentProcessorBigEndian() ) { - a = copyRaw; // begining of 'low bytes' - b = a + pixelNumber; // begining of 'hight bytes' + a = copyRaw; // beginning of 'low bytes' + b = a + pixelNumber; // beginning of 'hight bytes' } else { - b = copyRaw; // begining of 'low bytes' - a = b + pixelNumber; // begining of 'hight bytes' + b = copyRaw; // beginning of 'low bytes' + a = b + pixelNumber; // beginning of 'hight bytes' } // Re order bytes @@ -143,7 +150,6 @@ bool RLEFramesInfo::ConvertRLE16BitsFromRLE8Bits(uint8_t *raw, int xSize, } } - delete[] copyRaw; return true; @@ -172,6 +178,8 @@ void RLEFramesInfo::Print( std::ostream &os, std::string indent ) << "Total number of Frames : " << Frames.size() << std::endl; int frameNumber = 0; + /// \todo : find an example, to know haow 3rd and 4th dimension + /// works together for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it) { os << indent