GDCM: gdcmJPEGCodec.h Source File

GDCM 3.0.26

gdcmJPEGCodec.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 GDCMJPEGCODEC_H
15#define GDCMJPEGCODEC_H
16
17#include "gdcmImageCodec.h"
18
19namespace gdcm
20{
21
22class PixelFormat;
23class TransferSyntax;
40 class GDCM_EXPORT JPEGCodec : public ImageCodec
41{
42 friend class ImageRegionReader;
43public:
44 JPEGCodec();
45 ~JPEGCodec() override;
46 bool CanDecode(TransferSyntax const &ts) const override;
47 bool CanCode(TransferSyntax const &ts) const override;
48 bool Decode(DataElement const &is, DataElement &os) override;
49 void SetPixelFormat(PixelFormat const &pf) override;
50
52 void ComputeOffsetTable(bool b);
53
55 bool Code(DataElement const &in, DataElement &out) override;
56
57 bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override;
58 ImageCodec * Clone() const override;
59
60 //void SetReversible(bool res);
61
62 void SetQuality(double q);
63 double GetQuality() const;
64
65 void SetLossless(bool l);
66 bool GetLossless() const;
67
68 virtual bool EncodeBuffer( std::ostream & out,
69 const char *inbuffer, size_t inlen);
70
71protected:
72 bool DecodeExtent(
73 char *buffer,
74 unsigned int xmin, unsigned int xmax,
75 unsigned int ymin, unsigned int ymax,
76 unsigned int zmin, unsigned int zmax,
77 std::istream & is
78 );
79
80 bool DecodeByStreams(std::istream &is, std::ostream &os) override;
81 bool IsValid(PhotometricInterpretation const &pi) override;
82
83 bool StartEncode( std::ostream & ) override;
84 bool IsRowEncoder() override;
85 bool IsFrameEncoder() override;
86 bool AppendRowEncode( std::ostream & out, const char * data, size_t datalen ) override;
87 bool AppendFrameEncode( std::ostream & out, const char * data, size_t datalen ) override;
88 bool StopEncode( std::ostream & ) override;
89
90protected:
91 // Internal method called by SetPixelFormat
92 // Instantiate the right jpeg codec (8, 12 or 16)
93 void SetBitSample(int bit);
94
95 virtual bool IsStateSuspension() const;
96
97protected:
98 int BitSample;
99 //bool Lossless;
100 int Quality;
101
102private:
103 void SetupJPEGBitCodec(int bit);
104 JPEGCodec *Internal;
105};
106
107} // end namespace gdcm
108
109#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