GDCM  2.4.5
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 
72  bool StartEncode( std::ostream & );
73  bool IsRowEncoder();
74  bool IsFrameEncoder();
75  bool AppendRowEncode( std::ostream & out, const char * data, size_t datalen );
76  bool AppendFrameEncode( std::ostream & out, const char * data, size_t datalen );
77  bool StopEncode( std::ostream & );
78 
79 private:
80  std::pair<char *, size_t> DecodeByStreamsCommon(char *dummy_buffer, size_t buf_size);
81  bool CodeFrameIntoBuffer(char * outdata, size_t outlen, size_t & complen, const char * indata, size_t inlen );
82  bool GetHeaderInfo(const char * dummy_buffer, size_t len, TransferSyntax &ts);
83  JPEG2000Internals *Internals;
84 };
85 
86 } // end namespace gdcm
87 
88 #endif //GDCMJPEG2000CODEC_H
Class to do JPEG 2000.
Definition: gdcmJPEG2000Codec.h:30
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
ImageCodec.
Definition: gdcmImageCodec.h:30
Bitmap class A bitmap based image. Used as parent for both IconImage and the main Pixel Data Image It...
Definition: gdcmBitmap.h:38
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
Class to manipulate Transfer Syntax.
Definition: gdcmTransferSyntax.h:39
ImageRegionReader.
Definition: gdcmImageRegionReader.h:29
Definition: gdcmASN1.h:20

Generated on Fri Sep 25 2015 17:58:23 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo