1 /*=========================================================================
4 Module: $RCSfile: gdcmPixelReadConvert.h,v $
6 Date: $Date: 2005/10/20 08:29:50 $
7 Version: $Revision: 1.25 $
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;
33 typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, File *);
36 * \brief Utility container for gathering the various forms the pixel data
37 * migth take during the user demanded processes.
38 * WARNING : *none* of these functions may be invoked by gdm user
41 class GDCM_EXPORT PixelReadConvert : public Base
45 virtual ~PixelReadConvert();
47 void Print( std::ostream &os = std::cout, std::string const &indent = "" );
50 uint8_t *GetRGB() { return RGB; }
51 size_t GetRGBSize() { return RGBSize; }
52 uint8_t *GetRaw() { return Raw; }
53 size_t GetRawSize() { return RawSize; }
54 uint8_t *GetLutRGBA() { return LutRGBA; }
55 int GetLutItemNumber() { return LutItemNumber; }
56 int GetLutItemSize() { return LutItemSize; }
61 void GrabInformationsFromFile( File *file );
62 bool ReadAndDecompressPixelData( std::ifstream *fp );
67 void SetUserFunction( VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
68 { UserFunction = userFunc; }
71 void ReadAndDecompress12BitsTo16Bits( std::ifstream *fp )
72 throw ( FormatError );
73 bool ReadAndDecompressJPEGFile( std::ifstream *fp );
75 // In place (within Decompressed and with no fp access) decompression
77 void ConvertSwapZone();
78 void ConvertReorderEndianity();
79 bool ConvertReArrangeBits() throw ( FormatError );
80 void ConvertFixGreyLevels();
81 void ConvertRGBPlanesToRGBPixels();
82 void ConvertYcBcRPlanesToRGBPixels();
83 void ConvertHandleColor();
85 void ComputeRawAndRGBSizes();
91 * \brief Pixel data represented as RGB after LUT color interpretation.
92 * 'uint8_t' is just to avoid warnings at compile time.
93 * feel free to cast it as uint16_t if you need
96 /// Size of RGB image.
98 /// Pixel data after decompression and bit/byte rearrangement.
100 /// Size of Decompressed image.
102 /// \brief Red/Green/Blue/Alpha LookUpTable build out of the
103 /// Red/Green/Blue LUT descriptors (see \ref BuildLUTRGBA ).
108 // *ALL* the following info belong to the FileHelper
109 // One should think there is an analyze error in the model !
112 size_t PixelDataLength;
120 //int PixelSize; // useless
125 bool IsPrivateGETransferSyntax;
134 RLEFramesInfo *RLEInfo;
135 JPEGFragmentsInfo *JPEGInfo;
137 // For handling color stage
138 int PlanarConfiguration;
144 // The 3 LUT descriptors may be different:
145 std::string LutRedDescriptor;
146 std::string LutGreenDescriptor;
147 std::string LutBlueDescriptor;
149 uint8_t *LutGreenData;
150 uint8_t *LutBlueData;
152 File *FileInternal; // must be passed to User Function
153 VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
155 } // end namespace gdcm
157 //-----------------------------------------------------------------------------