GDCM 3.0.24
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;
41{
42friend class ImageRegionReader;
43public:
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:
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:
99 //bool Lossless;
101
102private:
103 void SetupJPEGBitCodec(int bit);
104 JPEGCodec *Internal;
105};
106
107} // end namespace gdcm
108
109#endif //GDCMJPEGCODEC_H
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
ImageCodec.
Definition gdcmImageCodec.h:31
ImageRegionReader.
Definition gdcmImageRegionReader.h:35
JPEG codec.
Definition gdcmJPEGCodec.h:41
void SetPixelFormat(PixelFormat const &pf) override
double GetQuality() const
bool Decode(DataElement const &is, DataElement &os) override
Decode.
void ComputeOffsetTable(bool b)
Compute the offset table:
bool GetLossless() const
bool IsFrameEncoder() override
int BitSample
Definition gdcmJPEGCodec.h:98
bool CanCode(TransferSyntax const &ts) const override
Return whether this coder support this transfer syntax (can code it)
bool StartEncode(std::ostream &) override
bool AppendRowEncode(std::ostream &out, const char *data, size_t datalen) override
bool CanDecode(TransferSyntax const &ts) const override
Return whether this decoder support this transfer syntax (can decode it)
bool AppendFrameEncode(std::ostream &out, const char *data, size_t datalen) override
~JPEGCodec() override
void SetLossless(bool l)
int Quality
Definition gdcmJPEGCodec.h:100
bool StopEncode(std::ostream &) override
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override
bool DecodeByStreams(std::istream &is, std::ostream &os) override
virtual bool IsStateSuspension() const
void SetQuality(double q)
void SetBitSample(int bit)
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 IsValid(PhotometricInterpretation const &pi) override
bool IsRowEncoder() override
bool Code(DataElement const &in, DataElement &out) override
Compress into JPEG.
ImageCodec * Clone() const override
virtual bool EncodeBuffer(std::ostream &out, const char *inbuffer, size_t inlen)
Class to represent an PhotometricInterpretation.
Definition gdcmPhotometricInterpretation.h:29
PixelFormat.
Definition gdcmPixelFormat.h:46
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21