]> Creatis software - gdcm.git/blob - src/gdcmPixelConvert.h
* CLEANUP_ROUND (8) for gdcmPixelConvert (end of RLE nigthmare)
[gdcm.git] / src / gdcmPixelConvert.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmPixelConvert.h,v $
5   Language:  C++
6   Date:      $Date: 2004/10/08 16:27:20 $
7   Version:   $Revision: 1.3 $
8                                                                                 
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18
19
20 #ifndef GDCMPIXELCONVERT_H
21 #define GDCMPIXELCONVERTL_H
22
23 #include "gdcmCommon.h"
24 #include "gdcmRLEFramesInfo.h"
25
26 /*
27  * \brief Utility container for gathering the various forms the pixel data
28  *        migth take during the user demanded processes.
29  */
30 class GDCM_EXPORT gdcmPixelConvert {
31 friend class gdcmFile;
32    /// Pixel data represented as RGB after color interpretation
33    uint8_t* RGB;
34    size_t   RGBSize;          //aka ImageDataSize
35    /// Pixel data after decompression and bit/byte rearrangement.
36    uint8_t* Uncompressed;
37    size_t   UncompressedSize;
38 public:
39    gdcmPixelConvert();
40    ~gdcmPixelConvert();
41
42    uint8_t* GetRGB() { return RGB; }
43    void     SetRGBSize( size_t size ) { RGBSize = size; }
44    size_t   GetRGBSize() { return RGBSize; }
45    void     AllocateRGB();
46
47    uint8_t* GetUncompressed() { return Uncompressed; }
48    void     SetUncompressedSize( size_t size ) { UncompressedSize = size; }
49    size_t   GetUncompressedSize() { return UncompressedSize; }
50    void     AllocateUncompressed();
51
52    void Squeeze();
53 //////////////////////////////////////////////////////////
54 // In progress
55 bool ReadAndUncompress12Bits( FILE* filePointer,
56                               size_t uncompressedSize,
57                               size_t PixelNumber );
58 bool ReadUncompressed( FILE* filePointer,
59                        size_t uncompressedSize,
60                        size_t expectedSize );
61 bool ConvertGrayAndLutToRGB( uint8_t *lutRGBA );
62 bool ReadAndUncompressRLE8Bits(FILE* fp, size_t uncompressedSize );
63 static bool UncompressRLE16BitsFromRLE8Bits(
64                        int XSize,
65                        int YSize,
66                        int NumberOfFrames,
67                        uint8_t* fixMemUncompressed );
68 static bool ReadAndUncompressRLEFragment(
69                                     uint8_t* decodedZone,
70                                     long fragmentSize,
71                                     long uncompressedSegmentSize,
72                                     FILE* fp );
73 static bool gdcm_read_RLE_file   ( void* image_buffer,
74                                    int XSize,
75                                    int YSize,
76                                    int ZSize,
77                                    int BitsAllocated,
78                                    gdcmRLEFramesInfo* RLEInfo,
79                                    FILE* fp );
80
81
82  
83
84 };
85
86 //-----------------------------------------------------------------------------
87 #endif