1 /*=========================================================================
4 Module: $RCSfile: gdcmPixelConvert.h,v $
6 Date: $Date: 2004/10/10 16:44:00 $
7 Version: $Revision: 1.5 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 #ifndef GDCMPIXELCONVERT_H
21 #define GDCMPIXELCONVERTL_H
23 #include "gdcmCommon.h"
24 #include "gdcmRLEFramesInfo.h"
25 #include "gdcmJPEGFragmentsInfo.h"
26 #include "gdcmException.h"
29 * \brief Utility container for gathering the various forms the pixel data
30 * migth take during the user demanded processes.
32 class GDCM_EXPORT gdcmPixelConvert {
33 friend class gdcmFile;
34 /// Pixel data represented as RGB after color interpretation
36 size_t RGBSize; //aka ImageDataSize
37 /// Pixel data after decompression and bit/byte rearrangement.
38 uint8_t* Uncompressed;
39 size_t UncompressedSize;
44 uint8_t* GetRGB() { return RGB; }
45 void SetRGBSize( size_t size ) { RGBSize = size; }
46 size_t GetRGBSize() { return RGBSize; }
49 uint8_t* GetUncompressed() { return Uncompressed; }
50 void SetUncompressedSize( size_t size ) { UncompressedSize = size; }
51 size_t GetUncompressedSize() { return UncompressedSize; }
52 void AllocateUncompressed();
55 //////////////////////////////////////////////////////////
57 static bool UncompressRLE16BitsFromRLE8Bits(
61 uint8_t* fixMemUncompressed );
62 static bool ReadAndUncompressRLEFragment(
65 long uncompressedSegmentSize,
67 static bool ReadAndDecompressRLEFile(
73 gdcmRLEFramesInfo* RLEInfo,
75 static void ConvertDecompress12BitsTo16Bits(
79 FILE* filePtr) throw ( gdcmFormatError );
80 static void SwapZone(void* im, int swap, int lgr, int nb);
81 static void ConvertReorderEndianity(
85 int numberBitsAllocated,
88 static bool ReadAndDecompressJPEGFile(
98 gdcmJPEGFragmentsInfo* JPEGInfo,
100 static bool gdcmPixelConvert::ConvertReArrangeBits(
102 size_t imageDataSize,
103 int numberBitsStored,
104 int numberBitsAllocated,
105 int highBitPosition ) throw ( gdcmFormatError );
110 //-----------------------------------------------------------------------------