]> Creatis software - gdcm.git/blob - src/gdcmRLEFrame.h
Fix mistypings
[gdcm.git] / src / gdcmRLEFrame.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmRLEFrame.h,v $
5   Language:  C++
6   Date:      $Date: 2007/09/17 12:16:01 $
7   Version:   $Revision: 1.23 $
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 _GDCMRLEFRAME_H_
21 #define _GDCMRLEFRAME_H_
22
23 #include "gdcmBase.h"
24
25 #include <iostream>
26 #include <fstream>
27
28 namespace GDCM_NAME_SPACE
29 {
30 /**
31  * \brief Utility class for summerizing the informations of a SINGLE RLE
32  *        frame of an "Encapsulated RLE Compressed Image" (refer to
33  *        PS 3.5-2003 annex G).
34  *        This information is a mix of:
35  *        - the RLE Header (see PS 3.5-2003 section G5) and
36  *        - the lengths of each RLE segment [ which can be decuded from
37  *          both the above RLE Header and the itemlength of the frame).
38  *
39  *        Each instance of this class (they can be as many instances for
40  *        a given Document as they are frames and they are collected in
41  *        a RLEFramesInfo ) describes :
42  *        - the total number of segments (up to 15),
43  *        - the offsets of each segment of the frame,
44  *        - the (corresponding) lengths of each segment of the frame.
45  */
46 class GDCM_EXPORT RLEFrame : public Base
47 {
48 friend class File;
49 friend class RLEFramesInfo;
50 private:
51    RLEFrame() { NumberOfFragments = 0; }
52    void Print( std::ostream &os = std::cout, std::string const &indent = "" );
53
54    void SetNumberOfFragments(unsigned int number) 
55                                        { NumberOfFragments = number; }   
56    unsigned int GetNumberOfFragments() { return NumberOfFragments; }
57    void SetOffset(unsigned int id, long offset);
58    long GetOffset(unsigned int id);
59    void SetLength(unsigned int id, long length);
60    long GetLength(unsigned int id);
61
62    uint8_t *ReadAndDecompressRLEFrame( uint8_t *subRaw,long rawSegmentSize,
63                                        std::ifstream *fp );
64    bool ReadAndDecompressRLEFragment( uint8_t *subRaw, long fragmentSize,
65                                       long rawSegmentSize, std::ifstream *fp );
66
67    unsigned int NumberOfFragments;
68    long Offset[15];
69    long Length[15];
70 };
71 } // end namespace gdcm
72 //-----------------------------------------------------------------------------
73 #endif