1 /*=========================================================================
4 Module: $RCSfile: gdcmPixelConvert.h,v $
6 Date: $Date: 2004/10/12 04:35:47 $
7 Version: $Revision: 1.6 $
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"
32 * \brief Utility container for gathering the various forms the pixel data
33 * migth take during the user demanded processes.
35 class GDCM_EXPORT PixelConvert {
37 /// Pixel data represented as RGB after color interpretation
39 size_t RGBSize; //aka ImageDataSize
40 /// Pixel data after decompression and bit/byte rearrangement.
41 uint8_t* Uncompressed;
42 size_t UncompressedSize;
47 uint8_t* GetRGB() { return RGB; }
48 void SetRGBSize( size_t size ) { RGBSize = size; }
49 size_t GetRGBSize() { return RGBSize; }
52 uint8_t* GetUncompressed() { return Uncompressed; }
53 void SetUncompressedSize( size_t size ) { UncompressedSize = size; }
54 size_t GetUncompressedSize() { return UncompressedSize; }
55 void AllocateUncompressed();
58 //////////////////////////////////////////////////////////
60 static bool UncompressRLE16BitsFromRLE8Bits(
64 uint8_t* fixMemUncompressed );
65 static bool ReadAndUncompressRLEFragment(
68 long uncompressedSegmentSize,
70 static bool ReadAndDecompressRLEFile(
76 RLEFramesInfo* RLEInfo,
78 static void ConvertDecompress12BitsTo16Bits(
82 FILE* filePtr) throw ( FormatError );
83 static void SwapZone(void* im, int swap, int lgr, int nb);
84 static void ConvertReorderEndianity(
88 int numberBitsAllocated,
91 static bool ReadAndDecompressJPEGFile(
101 JPEGFragmentsInfo* JPEGInfo,
103 static bool PixelConvert::ConvertReArrangeBits(
105 size_t imageDataSize,
106 int numberBitsStored,
107 int numberBitsAllocated,
108 int highBitPosition ) throw ( FormatError );
112 } // end namespace gdcm
113 //-----------------------------------------------------------------------------