GDCM 2.2.1

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

- File List
- File Members

gdcmJPEG2000Codec.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 GDCMJPEG2000CODEC_H
15 #define GDCMJPEG2000CODEC_H
16
17 #include "gdcmImageCodec.h"
18
19 namespace gdcm
20 {
21
22 class JPEG2000Internals;
30 class GDCM_EXPORT JPEG2000Codec : public ImageCodec
31 {
32 friend class ImageRegionReader;
33 friend class Bitmap;
34 public:
35 JPEG2000Codec();
36 ~JPEG2000Codec();
37
38 bool CanDecode(TransferSyntax const &ts) const;
39 bool CanCode(TransferSyntax const &ts) const;
40
41 bool Decode(DataElement const &is, DataElement &os);
42 bool Code(DataElement const &in, DataElement &out);
43
44 virtual bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
45
46 // JPEG-2000 / OpenJPEG specific way of encoding lossy-ness
47 // ref: http://www.openjpeg.org/index.php?menu=doc#encoder
48 void SetRate(unsigned int idx, double rate);
49 double GetRate(unsigned int idx = 0) const;
50
51 void SetQuality(unsigned int idx, double q);
52 double GetQuality(unsigned int idx = 0) const;
53
54 void SetTileSize(unsigned int tx, unsigned int ty);
55
56 void SetNumberOfResolutions(unsigned int nres);
57
58 void SetReversible(bool res);
59
60 protected:
61 bool DecodeExtent(
62 char *buffer,
63 unsigned int xmin, unsigned int xmax,
64 unsigned int ymin, unsigned int ymax,
65 unsigned int zmin, unsigned int zmax,
66 std::istream & is
67 );
68
69 bool DecodeByStreams(std::istream &is, std::ostream &os);
70 private:
71 std::pair<char *, size_t> DecodeByStreamsCommon(char *dummy_buffer, size_t buf_size);
72 bool GetHeaderInfo(const char * dummy_buffer, size_t len, TransferSyntax &ts);
73 JPEG2000Internals *Internals;
74 };
75
76 } // end namespace gdcm
77
78 #endif //GDCMJPEG2000CODEC_H