GDCM  2.4.0
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;
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  virtual ImageCodec * Clone() const;
46 
47  // JPEG-2000 / OpenJPEG specific way of encoding lossy-ness
48  // ref: http://www.openjpeg.org/index.php?menu=doc#encoder
49  void SetRate(unsigned int idx, double rate);
50  double GetRate(unsigned int idx = 0) const;
51 
52  void SetQuality(unsigned int idx, double q);
53  double GetQuality(unsigned int idx = 0) const;
54 
55  void SetTileSize(unsigned int tx, unsigned int ty);
56 
57  void SetNumberOfResolutions(unsigned int nres);
58 
59  void SetReversible(bool res);
60 
61 protected:
62  bool DecodeExtent(
63  char *buffer,
64  unsigned int xmin, unsigned int xmax,
65  unsigned int ymin, unsigned int ymax,
66  unsigned int zmin, unsigned int zmax,
67  std::istream & is
68  );
69 
70  bool DecodeByStreams(std::istream &is, std::ostream &os);
71 private:
72  std::pair<char *, size_t> DecodeByStreamsCommon(char *dummy_buffer, size_t buf_size);
73  bool GetHeaderInfo(const char * dummy_buffer, size_t len, TransferSyntax &ts);
74  JPEG2000Internals *Internals;
75 };
76 
77 } // end namespace gdcm
78 
79 #endif //GDCMJPEG2000CODEC_H

Generated on Thu Oct 17 2013 10:05:56 for GDCM by doxygen 1.8.4
SourceForge.net Logo