GDCM 3.0.24
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
19namespace gdcm
20{
21
22class JPEG2000Internals;
31{
32friend class ImageRegionReader;
33 friend class Bitmap;
34public:
36 ~JPEG2000Codec() override;
37
38 bool CanDecode(TransferSyntax const &ts) const override;
39 bool CanCode(TransferSyntax const &ts) const override;
40
41 bool Decode(DataElement const &is, DataElement &os) override;
42 bool Code(DataElement const &in, DataElement &out) override;
43
44 bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override;
45 ImageCodec * Clone() const override;
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
62
63 void SetReversible(bool res);
64 void SetMCT(unsigned int mct);
65
66protected:
68 char *buffer,
69 unsigned int xmin, unsigned int xmax,
70 unsigned int ymin, unsigned int ymax,
71 unsigned int zmin, unsigned int zmax,
72 std::istream & is
73 );
74
75 bool DecodeByStreams(std::istream &is, std::ostream &os) override;
76
77 bool StartEncode( std::ostream & ) override;
78 bool IsRowEncoder() override;
79 bool IsFrameEncoder() override;
80 bool AppendRowEncode( std::ostream & out, const char * data, size_t datalen ) override;
81 bool AppendFrameEncode( std::ostream & out, const char * data, size_t datalen ) override;
82 bool StopEncode( std::ostream & ) override;
83
84private:
85 std::pair<char *, size_t> DecodeByStreamsCommon(char *dummy_buffer, size_t buf_size);
86 bool CodeFrameIntoBuffer(char * outdata, size_t outlen, size_t & complen, const char * indata, size_t inlen );
87 bool GetHeaderInfo(const char * dummy_buffer, size_t len, TransferSyntax &ts);
88 JPEG2000Internals *Internals;
89};
90
91} // end namespace gdcm
92
93#endif //GDCMJPEG2000CODEC_H
Bitmap class.
Definition gdcmBitmap.h:39
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
ImageCodec.
Definition gdcmImageCodec.h:31
ImageRegionReader.
Definition gdcmImageRegionReader.h:35
Class to do JPEG 2000.
Definition gdcmJPEG2000Codec.h:31
void SetNumberOfResolutions(unsigned int nres)
void SetNumberOfThreadsForDecompression(int nThreads)
void SetTileSize(unsigned int tx, unsigned int ty)
bool DecodeByStreams(std::istream &is, std::ostream &os) override
bool IsFrameEncoder() override
bool StartEncode(std::ostream &) override
ImageCodec * Clone() const override
bool AppendRowEncode(std::ostream &out, const char *data, size_t datalen) override
bool DecodeExtent(char *buffer, unsigned int xmin, unsigned int xmax, unsigned int ymin, unsigned int ymax, unsigned int zmin, unsigned int zmax, std::istream &is)
bool CanDecode(TransferSyntax const &ts) const override
Return whether this decoder support this transfer syntax (can decode it)
bool Decode(DataElement const &is, DataElement &os) override
Decode.
void SetRate(unsigned int idx, double rate)
bool AppendFrameEncode(std::ostream &out, const char *data, size_t datalen) override
bool CanCode(TransferSyntax const &ts) const override
Return whether this coder support this transfer syntax (can code it)
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override
bool Code(DataElement const &in, DataElement &out) override
Code.
double GetRate(unsigned int idx=0) const
void SetQuality(unsigned int idx, double q)
bool IsRowEncoder() override
void SetReversible(bool res)
bool StopEncode(std::ostream &) override
double GetQuality(unsigned int idx=0) const
~JPEG2000Codec() override
void SetMCT(unsigned int mct)
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21