]> Creatis software - gdcm.git/blob - src/gdcmJPEGFragment.h
Fix mistypings
[gdcm.git] / src / gdcmJPEGFragment.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmJPEGFragment.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 _GDCMJPEGFRAGMENT_H_
21 #define _GDCMJPEGFRAGMENT_H_
22
23 #include "gdcmBase.h"
24
25 #include <iostream>
26 #include <fstream>
27
28 namespace GDCM_NAME_SPACE 
29 {
30 /**
31  * \brief *very* internal class . Shouldn't appear here !
32  *         Utility class for summerizing the informations of a JPEG
33  *        fragment of an "Encapsulated JPEG Compressed Image".
34  *        This information is a mix of:
35  *        - the fragment offset
36  *        - the fragment length 
37  *
38  *        Each instance of this class (they can be as many instances for
39  *        a given Document as they are JPEG fragments and they are
40  *        collected in a JPEGFragmentsInfo )
41  */
42 class GDCM_EXPORT JPEGFragment : public Base
43 {
44 public:
45    JPEGFragment();
46    void Print( std::ostream &os = std::cout, std::string const &indent = "" );
47    void DecompressJPEGFramesFromFile(std::ifstream *fp, 
48                                      uint8_t *buffer, int nBits, 
49                                      int &statesuspension);
50
51    bool ReadJPEGFile8  (std::ifstream *fp, void *image_buffer, int &statesuspension );
52    bool ReadJPEGFile12 (std::ifstream *fp, void *image_buffer, int &statesuspension );
53    bool ReadJPEGFile16 (std::ifstream *fp, void *image_buffer, int &statesuspension );
54
55    void SetLength(uint32_t length) { Length = length; }
56    uint32_t GetLength()            { return Length;   }
57    void SetOffset(uint32_t offset) { Offset = offset; }
58    uint32_t GetOffset()            { return Offset;   }
59    uint8_t *GetImage()             { return pImage;   }
60
61 private:
62    uint32_t Offset;
63    uint32_t Length;
64
65    uint8_t *pImage;
66 };
67 } // end namespace gdcm
68
69 //-----------------------------------------------------------------------------
70 #endif