GDCM 3.2.1

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() 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
61 void SetNumberOfThreadsForDecompression(int nThreads);
62
63 void SetReversible(bool res);
64 void SetMCT(unsigned int mct);
65
66 protected:
67 bool DecodeExtent(
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
84 private:
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
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::ImageCodec::ImageCodec
ImageCodec()
gdcm::JPEG2000Codec::Bitmap
friend class Bitmap
Definition gdcmJPEG2000Codec.h:33
gdcm::JPEG2000Codec::JPEG2000Codec
JPEG2000Codec()
gdcm::JPEG2000Codec::SetNumberOfResolutions
void SetNumberOfResolutions(unsigned int nres)
gdcm::JPEG2000Codec::SetNumberOfThreadsForDecompression
void SetNumberOfThreadsForDecompression(int nThreads)
gdcm::JPEG2000Codec::ImageRegionReader
friend class ImageRegionReader
Definition gdcmJPEG2000Codec.h:32
gdcm::JPEG2000Codec::SetTileSize
void SetTileSize(unsigned int tx, unsigned int ty)
gdcm::JPEG2000Codec::DecodeByStreams
bool DecodeByStreams(std::istream &is, std::ostream &os) override
gdcm::JPEG2000Codec::IsFrameEncoder
bool IsFrameEncoder() override
gdcm::JPEG2000Codec::StartEncode
bool StartEncode(std::ostream &) override
gdcm::JPEG2000Codec::Clone
ImageCodec * Clone() const override
gdcm::JPEG2000Codec::AppendRowEncode
bool AppendRowEncode(std::ostream &out, const char *data, size_t datalen) override
gdcm::JPEG2000Codec::DecodeExtent
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)
gdcm::JPEG2000Codec::CanDecode
bool CanDecode(TransferSyntax const &ts) const override
Return whether this decoder support this transfer syntax (can decode it)
gdcm::JPEG2000Codec::Decode
bool Decode(DataElement const &is, DataElement &os) override
Decode.
gdcm::JPEG2000Codec::SetRate
void SetRate(unsigned int idx, double rate)
gdcm::JPEG2000Codec::AppendFrameEncode
bool AppendFrameEncode(std::ostream &out, const char *data, size_t datalen) override
gdcm::JPEG2000Codec::CanCode
bool CanCode(TransferSyntax const &ts) const override
Return whether this coder support this transfer syntax (can code it)
gdcm::JPEG2000Codec::GetHeaderInfo
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override
gdcm::JPEG2000Codec::Code
bool Code(DataElement const &in, DataElement &out) override
Code.
gdcm::JPEG2000Codec::GetRate
double GetRate(unsigned int idx=0) const
gdcm::JPEG2000Codec::SetQuality
void SetQuality(unsigned int idx, double q)
gdcm::JPEG2000Codec::IsRowEncoder
bool IsRowEncoder() override
gdcm::JPEG2000Codec::SetReversible
void SetReversible(bool res)
gdcm::JPEG2000Codec::StopEncode
bool StopEncode(std::ostream &) override
gdcm::JPEG2000Codec::GetQuality
double GetQuality(unsigned int idx=0) const
gdcm::JPEG2000Codec::~JPEG2000Codec
~JPEG2000Codec() override
gdcm::JPEG2000Codec::SetMCT
void SetMCT(unsigned int mct)
gdcm::TransferSyntax
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
gdcmImageCodec.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21