GDCM  2.2.4
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 
59  //void SetReversible(bool res);
60 
61  void SetQuality(double q);
62  double GetQuality() const;
63 
64  void SetLossless(bool l);
65  bool GetLossless() const;
66 
67 protected:
68  bool DecodeExtent(
69  char *buffer,
70  unsigned int xmin, unsigned int xmax,
71  unsigned int ymin, unsigned int ymax,
72  unsigned int zmin, unsigned int zmax,
73  std::istream & is
74  );
75 
76  bool DecodeByStreams(std::istream &is, std::ostream &os);
77  bool IsValid(PhotometricInterpretation const &pi);
78 
79 protected:
80  // Internal method called by SetPixelFormat
81  // Instantiate the right jpeg codec (8, 12 or 16)
82  void SetBitSample(int bit);
83 
84  virtual bool IsStateSuspension() const;
85 
86 protected:
87  int BitSample;
88  bool Lossless;
89  int Quality;
90 
91 private:
92  void SetupJPEGBitCodec(int bit);
93  JPEGCodec *Internal;
94 };
95 
96 } // end namespace gdcm
97 
98 #endif //GDCMJPEGCODEC_H

Generated on Tue Aug 13 2013 15:28:54 for GDCM by doxygen 1.8.4
SourceForge.net Logo