]> Creatis software - gdcm.git/blob - src/gdcmRLEFramesInfo.h
ENH: Getting toward a nice gdcmDecompressor. Now RLE and JPEG are getting similar...
[gdcm.git] / src / gdcmRLEFramesInfo.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmRLEFramesInfo.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/31 05:24:22 $
7   Version:   $Revision: 1.16 $
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 GDCMRLEFRAMESINFO_H
21 #define GDCMRLEFRAMESINFO_H
22
23 #include "gdcmRLEFrame.h"
24
25 #include <list>
26
27 namespace gdcm 
28 {
29 /**
30  * \brief Utility class for gathering the informations of the collection
31  *        of RLE frame[s] (see \ref RLEFrame)  when handling
32  *        "Encapsulated RLE Compressed Images" (see PS 3.5-2003 annex G). 
33  *        Note: a classical image can be considered as the degenerated case
34  *              of a multiframe image. In this case the collection is limited
35  *              to a single individual frame.
36  *        The informations on each frame are obtained during the pixel parsing
37  *        of a gdcm::File (refer to
38  *          \ref File::ComputeRLEInfo() ).
39  *        They shall be used when (if necessary) decoding the frames.
40  *
41  *        This class is simply a stl list<> of \ref RLEFrame.
42  */
43 class GDCM_EXPORT RLEFramesInfo
44 {
45 public:
46    ~RLEFramesInfo();
47    void Print( std::ostream &os = std::cout, std::string indent = "" );
48    bool ReadAndDecompressRLEFile( std::ifstream *fp, uint8_t *subRaw, int xSize, int ySize, int zSize, int bitsAllocated );
49    bool ReadAndDecompressRLEFragment(
50                   uint8_t *subDecompressed,
51                   long fragmentSize,
52                   long decompressedSegmentSize,
53                   std::ifstream *fp );
54    bool DecompressRLE16BitsFromRLE8Bits( uint8_t* subRaw, int xSize, int ySize, int NumberOfFrames );
55
56    void AddFrame(RLEFrame *frame);
57
58    RLEFrame *GetFirstFrame();
59    RLEFrame *GetNextFrame();
60
61 private:
62    typedef std::list<RLEFrame *> RLEFrameList;
63
64    RLEFrameList Frames;
65    RLEFrameList::iterator ItFrames;
66 };
67 } // end namespace gdcm
68
69 //-----------------------------------------------------------------------------
70 #endif