GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmJPEGCodec.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMJPEGCODEC_H
15 #define GDCMJPEGCODEC_H
16
17 #include "gdcmImageCodec.h"
18
19 namespace gdcm
20 {
21
22 class PixelFormat;
23 class TransferSyntax;
40 class GDCM_EXPORT JPEGCodec : public ImageCodec
41 {
42 friend class ImageRegionReader;
43 public:
44 JPEGCodec();
45 ~JPEGCodec();
46 bool CanDecode(TransferSyntax const &ts) const;
47 bool CanCode(TransferSyntax const &ts) const;
48 bool Decode(DataElement const &is, DataElement &os);
49 void SetPixelFormat(PixelFormat const &pf);
50
52 void ComputeOffsetTable(bool b);
53
55 bool Code(DataElement const &in, DataElement &out);
56
57 virtual bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
58
59 //void SetReversible(bool res);
60
61 void SetQuality(double q);
62 double GetQuality() const;
63
64 void SetLossless(bool l);
65 bool GetLossless() const;
66
67 protected:
68 bool DecodeExtent(
69 char *buffer,
70 unsigned int xmin, unsigned int xmax,
71 unsigned int ymin, unsigned int ymax,
72 unsigned int zmin, unsigned int zmax,
73 std::istream & is
74 );
75
76 bool DecodeByStreams(std::istream &is, std::ostream &os);
77 bool IsValid(PhotometricInterpretation const &pi);
78
79 protected:
80 // Internal method called by SetPixelFormat
81 // Instantiate the right jpeg codec (8, 12 or 16)
82 void SetBitSample(int bit);
83
84 protected:
85 int BitSample;
86 bool Lossless;
87 int Quality;
88
89 private:
90 void SetupJPEGBitCodec(int bit);
91 JPEGCodec *Internal;
92 };
93
94 } // end namespace gdcm
95
96 #endif //GDCMJPEGCODEC_H