1 /*=========================================================================
4 Module: $RCSfile: gdcmPixelReadConvert.h,v $
6 Date: $Date: 2005/01/31 05:24:21 $
7 Version: $Revision: 1.16 $
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 GDCMPIXELREADCONVERT_H
21 #define GDCMPIXELREADCONVERT_H
23 #include "gdcmCommon.h"
25 #include "gdcmException.h"
31 class JPEGFragmentsInfo;
34 * \brief Utility container for gathering the various forms the pixel data
35 * migth take during the user demanded processes.
37 class GDCM_EXPORT PixelReadConvert : public Base
41 virtual ~PixelReadConvert();
43 //// Getter accessors:
44 uint8_t* GetRGB() { return RGB; }
45 size_t GetRGBSize() { return RGBSize; }
46 uint8_t* GetRaw() { return Raw; }
47 size_t GetRawSize() { return RawSize; }
48 uint8_t* GetLutRGBA() { return LutRGBA; }
53 void Print( std::ostream &os = std::cout, std::string const & indent = "" );
56 void GrabInformationsFromFile( File *file );
57 bool ReadAndDecompressPixelData( std::ifstream *fp );
63 void ReadAndDecompress12BitsTo16Bits( std::ifstream *fp ) throw ( FormatError );
64 bool ReadAndDecompressJPEGFile( std::ifstream *fp );
66 void BuildLUTRGBA( std::ifstream *fp );
68 // In place (within Decompressed and with no fp access) decompression
71 void ConvertSwapZone();
72 void ConvertReorderEndianity();
73 bool ConvertReArrangeBits() throw ( FormatError );
74 void ConvertRGBPlanesToRGBPixels();
75 void ConvertYcBcRPlanesToRGBPixels();
76 void ConvertHandleColor();
78 void ComputeRawAndRGBSizes();
83 /// Pixel data represented as RGB after LUT color interpretation.
85 /// Size of RGB image.
87 /// Pixel data after decompression and bit/byte rearrangement.
89 /// Size of Decompressed image.
91 /// \brief Red/Green/Blue/Alpha LookUpTable build out of the
92 /// Red/Green/Blue LUT descriptors (see \ref BuildLUTRGBA ).
96 size_t PixelDataLength;
116 RLEFramesInfo *RLEInfo;
117 JPEGFragmentsInfo *JPEGInfo;
119 // For handling color stage
120 int PlanarConfiguration;
125 // The 3 LUT descriptors may be different:
126 std::string LutRedDescriptor;
127 std::string LutGreenDescriptor;
128 std::string LutBlueDescriptor;
130 uint8_t *LutGreenData;
131 uint8_t *LutBlueData;
134 } // end namespace gdcm
136 //-----------------------------------------------------------------------------