GDCM  2.4.5
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 
19 namespace gdcm
20 {
21 
22 class PixelFormat;
23 class TransferSyntax;
41 {
42 friend class ImageRegionReader;
43 public:
44  JPEGCodec();
45  ~JPEGCodec();
46  bool CanDecode(TransferSyntax const &ts) const;
47  bool CanCode(TransferSyntax const &ts) const;
48  bool Decode(DataElement const &is, DataElement &os);
49  void SetPixelFormat(PixelFormat const &pf);
50 
52  void ComputeOffsetTable(bool b);
53 
55  bool Code(DataElement const &in, DataElement &out);
56 
57  virtual bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
58  virtual ImageCodec * Clone() const;
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 
71 protected:
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);
81  bool IsValid(PhotometricInterpretation const &pi);
82 
83  bool StartEncode( std::ostream & );
84  bool IsRowEncoder();
85  bool IsFrameEncoder();
86  bool AppendRowEncode( std::ostream & out, const char * data, size_t datalen );
87  bool AppendFrameEncode( std::ostream & out, const char * data, size_t datalen );
88  bool StopEncode( std::ostream & );
89 
90 protected:
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 
97 protected:
98  int BitSample;
99  //bool Lossless;
100  int Quality;
101 
102 private:
103  void SetupJPEGBitCodec(int bit);
104  JPEGCodec *Internal;
105 };
106 
107 } // end namespace gdcm
108 
109 #endif //GDCMJPEGCODEC_H
int Quality
Definition: gdcmJPEGCodec.h:100
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
ImageCodec.
Definition: gdcmImageCodec.h:30
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
int BitSample
Definition: gdcmJPEGCodec.h:98
Class to manipulate Transfer Syntax.
Definition: gdcmTransferSyntax.h:39
Class to represent an PhotometricInterpretation.
Definition: gdcmPhotometricInterpretation.h:28
ImageRegionReader.
Definition: gdcmImageRegionReader.h:29
Definition: gdcmASN1.h:20
PixelFormat.
Definition: gdcmPixelFormat.h:45
JPEG codec Class to do JPEG (8bits, 12bits, 16bits lossy & lossless). It redispatch in between the di...
Definition: gdcmJPEGCodec.h:40

Generated on Fri Sep 25 2015 17:58:23 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo