Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

gdcmPixelReadConvert.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmPixelReadConvert.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/02/03 10:03:07 $
00007   Version:   $Revision: 1.18 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 
00020 #ifndef GDCMPIXELREADCONVERT_H
00021 #define GDCMPIXELREADCONVERT_H
00022 
00023 #include "gdcmCommon.h"
00024 #include "gdcmBase.h"
00025 #include "gdcmException.h"
00026 
00027 namespace gdcm
00028 {
00029 class File;
00030 class RLEFramesInfo;
00031 class JPEGFragmentsInfo;
00032 
00037 class GDCM_EXPORT PixelReadConvert : public Base
00038 {
00039 public:
00040    PixelReadConvert();
00041    virtual ~PixelReadConvert();
00042 
00043    void Print( std::ostream &os = std::cout, std::string const &indent = "" );
00044 
00045    // Getter accessors:
00046    uint8_t *GetRGB()     { return RGB;     }
00047    size_t   GetRGBSize() { return RGBSize; }
00048    uint8_t *GetRaw()     { return Raw;     }
00049    size_t   GetRawSize() { return RawSize; }
00050    uint8_t *GetLutRGBA() { return LutRGBA; }
00051 
00052    // Predicates:
00053    bool IsRawRGB();
00054 
00055 // In progress
00056    void GrabInformationsFromFile( File *file );
00057    bool ReadAndDecompressPixelData( std::ifstream *fp );
00058    void Squeeze();
00059    bool BuildRGBImage();
00060 
00061 private:
00062    // Use the fp:
00063    void ReadAndDecompress12BitsTo16Bits( std::ifstream *fp ) 
00064                                  throw ( FormatError );
00065    bool ReadAndDecompressJPEGFile( std::ifstream *fp );
00066 
00067    // In place (within Decompressed and with no fp access) decompression
00068    // or convertion:
00069    void BuildLUTRGBA();
00070    void ConvertSwapZone();
00071    void ConvertReorderEndianity();
00072    bool ConvertReArrangeBits() throw ( FormatError );
00073    void ConvertRGBPlanesToRGBPixels();
00074    void ConvertYcBcRPlanesToRGBPixels();
00075    void ConvertHandleColor();
00076 
00077    void ComputeRawAndRGBSizes();
00078    void AllocateRGB();
00079    void AllocateRaw();
00080 
00081 // Variables
00083    uint8_t *RGB;
00085    size_t   RGBSize;
00087    uint8_t *Raw;
00089    size_t   RawSize;
00092    uint8_t *LutRGBA;
00093 
00094    size_t PixelOffset;
00095    size_t PixelDataLength;
00096    int XSize;
00097    int YSize;
00098    int ZSize;
00099    int BitsAllocated;
00100    int BitsStored;
00101    int HighBitPosition;
00102    int SamplesPerPixel;
00103    int PixelSize;
00104    bool PixelSign;
00105    int SwapCode;
00106 
00107    bool IsRaw;
00108    bool IsJPEG2000;
00109    bool IsJPEGLS;
00110    bool IsJPEGLossless;
00111    bool IsJPEGLossy;
00112    bool IsJPEG;
00113    bool IsRLELossless;
00114 
00115    RLEFramesInfo *RLEInfo;
00116    JPEGFragmentsInfo *JPEGInfo;
00117 
00118    // For handling color stage
00119    int PlanarConfiguration;
00120    bool IsMonochrome;
00121    bool IsPaletteColor;
00122    bool IsYBRFull;
00123    bool HasLUT;
00124    // The 3 LUT descriptors may be different:
00125    std::string LutRedDescriptor;
00126    std::string LutGreenDescriptor;
00127    std::string LutBlueDescriptor;
00128    uint8_t *LutRedData;
00129    uint8_t *LutGreenData;
00130    uint8_t *LutBlueData;
00131 
00132 };
00133 } // end namespace gdcm
00134 
00135 //-----------------------------------------------------------------------------
00136 #endif

Generated on Thu Feb 10 22:17:59 2005 for gdcm by doxygen 1.3.6