gdcmJPEG2000Codec.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMJPEG2000CODEC_H
#define GDCMJPEG2000CODEC_H
#include "gdcmImageCodec.h"
namespace gdcm
{
class JPEG2000Internals;
class GDCM_EXPORT JPEG2000Codec : public ImageCodec
{
friend class ImageRegionReader;
friend class Bitmap;
public:
JPEG2000Codec();
~JPEG2000Codec() override;
bool CanDecode(TransferSyntax const &ts) const override;
bool CanCode(TransferSyntax const &ts) const override;
bool Decode(DataElement const &is, DataElement &os) override;
bool Code(DataElement const &in, DataElement &out) override;
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override;
ImageCodec * Clone() const override;
// JPEG-2000 / OpenJPEG specific way of encoding lossy-ness
// ref: http://www.openjpeg.org/index.php?menu=doc#encoder
void SetRate(unsigned int idx, double rate);
double GetRate(unsigned int idx = 0) const;
void SetQuality(unsigned int idx, double q);
double GetQuality(unsigned int idx = 0) const;
void SetTileSize(unsigned int tx, unsigned int ty);
void SetNumberOfResolutions(unsigned int nres);
void SetNumberOfThreadsForDecompression(int nThreads);
void SetReversible(bool res);
void SetMCT(unsigned int mct);
protected:
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 DecodeByStreams(std::istream &is, std::ostream &os) override;
bool StartEncode( std::ostream & ) override;
bool IsRowEncoder() override;
bool IsFrameEncoder() override;
bool AppendRowEncode( std::ostream & out, const char * data, size_t datalen ) override;
bool AppendFrameEncode( std::ostream & out, const char * data, size_t datalen ) override;
bool StopEncode( std::ostream & ) override;
private:
std::pair<char *, size_t> DecodeByStreamsCommon(char *dummy_buffer, size_t buf_size);
bool CodeFrameIntoBuffer(char * outdata, size_t outlen, size_t & complen, const char * indata, size_t inlen );
bool GetHeaderInfo(const char * dummy_buffer, size_t len, TransferSyntax &ts);
JPEG2000Internals *Internals;
};
} // end namespace gdcm
#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