gdcmJPEGCodec.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 GDCMJPEGCODEC_H
#define GDCMJPEGCODEC_H
#include "gdcmImageCodec.h"
namespace gdcm
{
class PixelFormat;
class TransferSyntax;
class GDCM_EXPORT JPEGCodec : public ImageCodec
{
friend class ImageRegionReader;
public:
JPEGCodec();
~JPEGCodec() override;
bool CanDecode(TransferSyntax const &ts) const override;
bool CanCode(TransferSyntax const &ts) const override;
bool Decode(DataElement const &is, DataElement &os) override;
void SetPixelFormat(PixelFormat const &pf) override;
void ComputeOffsetTable(bool b);
bool Code(DataElement const &in, DataElement &out) override;
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override;
ImageCodec * Clone() const override;
//void SetReversible(bool res);
void SetQuality(double q);
double GetQuality() const;
void SetLossless(bool l);
bool GetLossless() const;
virtual bool EncodeBuffer( std::ostream & out,
const char *inbuffer, size_t inlen);
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 IsValid(PhotometricInterpretation const &pi) 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;
protected:
// Internal method called by SetPixelFormat
// Instantiate the right jpeg codec (8, 12 or 16)
void SetBitSample(int bit);
virtual bool IsStateSuspension() const;
protected:
int BitSample;
//bool Lossless;
int Quality;
private:
void SetupJPEGBitCodec(int bit);
JPEGCodec *Internal;
};
} // end namespace gdcm
#endif //GDCMJPEGCODEC_H
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::ImageCodec::ImageCodec
ImageCodec()
gdcm::JPEGCodec::SetPixelFormat
void SetPixelFormat(PixelFormat const &pf) override
gdcm::JPEGCodec::GetQuality
double GetQuality() const
gdcm::JPEGCodec::Decode
bool Decode(DataElement const &is, DataElement &os) override
Decode.
gdcm::JPEGCodec::ComputeOffsetTable
void ComputeOffsetTable(bool b)
Compute the offset table:
gdcm::JPEGCodec::GetLossless
bool GetLossless() const
gdcm::JPEGCodec::ImageRegionReader
friend class ImageRegionReader
Definition gdcmJPEGCodec.h:42
gdcm::JPEGCodec::IsFrameEncoder
bool IsFrameEncoder() override
gdcm::JPEGCodec::BitSample
int BitSample
Definition gdcmJPEGCodec.h:98
gdcm::JPEGCodec::CanCode
bool CanCode(TransferSyntax const &ts) const override
Return whether this coder support this transfer syntax (can code it).
gdcm::JPEGCodec::StartEncode
bool StartEncode(std::ostream &) override
gdcm::JPEGCodec::AppendRowEncode
bool AppendRowEncode(std::ostream &out, const char *data, size_t datalen) override
gdcm::JPEGCodec::CanDecode
bool CanDecode(TransferSyntax const &ts) const override
Return whether this decoder support this transfer syntax (can decode it).
gdcm::JPEGCodec::AppendFrameEncode
bool AppendFrameEncode(std::ostream &out, const char *data, size_t datalen) override
gdcm::JPEGCodec::~JPEGCodec
~JPEGCodec() override
gdcm::JPEGCodec::SetLossless
void SetLossless(bool l)
gdcm::JPEGCodec::Quality
int Quality
Definition gdcmJPEGCodec.h:100
gdcm::JPEGCodec::StopEncode
bool StopEncode(std::ostream &) override
gdcm::JPEGCodec::GetHeaderInfo
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override
gdcm::JPEGCodec::DecodeByStreams
bool DecodeByStreams(std::istream &is, std::ostream &os) override
gdcm::JPEGCodec::IsStateSuspension
virtual bool IsStateSuspension() const
gdcm::JPEGCodec::SetQuality
void SetQuality(double q)
gdcm::JPEGCodec::SetBitSample
void SetBitSample(int bit)
gdcm::JPEGCodec::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::JPEGCodec::IsValid
bool IsValid(PhotometricInterpretation const &pi) override
gdcm::JPEGCodec::JPEGCodec
JPEGCodec()
gdcm::JPEGCodec::IsRowEncoder
bool IsRowEncoder() override
gdcm::JPEGCodec::Code
bool Code(DataElement const &in, DataElement &out) override
Compress into JPEG.
gdcm::JPEGCodec::Clone
ImageCodec * Clone() const override
gdcm::JPEGCodec::EncodeBuffer
virtual bool EncodeBuffer(std::ostream &out, const char *inbuffer, size_t inlen)
gdcm::PhotometricInterpretation
Class to represent an PhotometricInterpretation.
Definition gdcmPhotometricInterpretation.h:29
gdcm::PixelFormat
PixelFormat.
Definition gdcmPixelFormat.h:46
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