]> Creatis software - gdcm.git/blob - src/gdcmJPEGFragmentsInfo.h
Cosmetics
[gdcm.git] / src / gdcmJPEGFragmentsInfo.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmJPEGFragmentsInfo.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/30 17:30:57 $
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 GDCMJPEGFRAGMENTSINFO_H
21 #define GDCMJPEGFRAGMENTSINFO_H
22
23 #include "gdcmJPEGFragment.h"
24
25 #include <list>
26 #include <iostream>
27
28 namespace gdcm 
29 {
30 /**
31  * \brief Utility class for gathering the informations of the collection
32  *        of JPEG fragment[s] (see \ref JPEGFragment)  when handling
33  *        "Encapsulated JPEG Compressed Images". 
34  *        The informations on each frame are obtained during the pixel parsing
35  *        of a gdcm::File (refer to \ref File::ComputeJPEGFragmentInfo() ).
36  *        They shall be used when (if necessary) decoding the fragments.
37  *
38  *        This class is simply a stl list<> of \ref JPEGFragment.
39  */
40 class GDCM_EXPORT JPEGFragmentsInfo
41 {
42 public:
43    JPEGFragmentsInfo();
44    ~JPEGFragmentsInfo();
45    void Print( std::ostream &os = std::cout, std::string const & indent = "" );
46    size_t GetFragmentsLength();
47    void ReadAllFragments(std::ifstream *fp, JOCTET *buffer );
48
49    void DecompressJPEGFramesFromFile(std::ifstream *fp, uint8_t *buffer, int nBits, int numBytes, int length);
50
51    void AddFragment(JPEGFragment *fragment);
52    JPEGFragment *GetFirstFragment();
53    JPEGFragment *GetNextFragment();
54    unsigned int GetFragmentCount();
55
56 private:
57    typedef std::list<JPEGFragment *> JPEGFragmentsList;
58
59     //Some mathieu hack:
60    int StateSuspension;
61    void *SampBuffer;
62    char* pimage;
63    JPEGFragmentsList Fragments;
64    JPEGFragmentsList::iterator ItFragments;
65 };
66 } // end namespace gdcm
67
68 //-----------------------------------------------------------------------------
69 #endif
70