1 /*=========================================================================
4 Module: $RCSfile: gdcmPixelReadConvert.h,v $
6 Date: $Date: 2005/06/17 12:35:00 $
7 Version: $Revision: 1.23 $
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
24 #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 void Print( std::ostream &os = std::cout, std::string const &indent = "" );
46 uint8_t *GetRGB() { return RGB; }
47 size_t GetRGBSize() { return RGBSize; }
48 uint8_t *GetRaw() { return Raw; }
49 size_t GetRawSize() { return RawSize; }
50 uint8_t *GetLutRGBA() { return LutRGBA; }
51 int GetLutItemNumber() { return LutItemNumber; }
52 int GetLutItemSize() { return LutItemSize; }
57 void GrabInformationsFromFile( File *file );
58 bool ReadAndDecompressPixelData( std::ifstream *fp );
65 void ReadAndDecompress12BitsTo16Bits( std::ifstream *fp )
66 throw ( FormatError );
67 bool ReadAndDecompressJPEGFile( std::ifstream *fp );
69 // In place (within Decompressed and with no fp access) decompression
71 void ConvertSwapZone();
72 void ConvertReorderEndianity();
73 bool ConvertReArrangeBits() throw ( FormatError );
74 void ConvertFixGreyLevels();
75 void ConvertRGBPlanesToRGBPixels();
76 void ConvertYcBcRPlanesToRGBPixels();
77 void ConvertHandleColor();
79 void ComputeRawAndRGBSizes();
85 * \brief Pixel data represented as RGB after LUT color interpretation.
86 * 'uint8_t' is just to avoid warnings at compile time.
87 * feel free to cast it as uint16_t if you need
90 /// Size of RGB image.
92 /// Pixel data after decompression and bit/byte rearrangement.
94 /// Size of Decompressed image.
96 /// \brief Red/Green/Blue/Alpha LookUpTable build out of the
97 /// Red/Green/Blue LUT descriptors (see \ref BuildLUTRGBA ).
102 // *ALL* the following info belong to the FileHelper
103 // One should think there is an analyze error in the model !
106 size_t PixelDataLength;
127 RLEFramesInfo *RLEInfo;
128 JPEGFragmentsInfo *JPEGInfo;
130 // For handling color stage
131 int PlanarConfiguration;
137 // The 3 LUT descriptors may be different:
138 std::string LutRedDescriptor;
139 std::string LutGreenDescriptor;
140 std::string LutBlueDescriptor;
142 uint8_t *LutGreenData;
143 uint8_t *LutBlueData;
145 } // end namespace gdcm
147 //-----------------------------------------------------------------------------