GDCM  2.2.6
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 protected:
84  // Internal method called by SetPixelFormat
85  // Instantiate the right jpeg codec (8, 12 or 16)
86  void SetBitSample(int bit);
87 
88  virtual bool IsStateSuspension() const;
89 
90 protected:
91  int BitSample;
92  bool Lossless;
93  int Quality;
94 
95 private:
96  void SetupJPEGBitCodec(int bit);
97  JPEGCodec *Internal;
98 };
99 
100 } // end namespace gdcm
101 
102 #endif //GDCMJPEGCODEC_H
int Quality
Definition: gdcmJPEGCodec.h:93
bool Lossless
Definition: gdcmJPEGCodec.h:92
#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:91
Class to manipulate Transfer Syntax.
Definition: gdcmTransferSyntax.h:39
Class to represent an PhotometricInterpretation.
Definition: gdcmPhotometricInterpretation.h:28
ImageRegionReader.
Definition: gdcmImageRegionReader.h:29
PixelFormat.
Definition: gdcmPixelFormat.h:36
JPEG codec Class to do JPEG (8bits, 12bits, 16bits lossy & lossless). It redispatch in between the di...
Definition: gdcmJPEGCodec.h:40

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo