GDCM
2.0.18
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 #ifndef GDCMJPEGCODEC_H 00015 #define GDCMJPEGCODEC_H 00016 00017 #include "gdcmImageCodec.h" 00018 00019 namespace gdcm 00020 { 00021 00022 class PixelFormat; 00023 class TransferSyntax; 00040 class GDCM_EXPORT JPEGCodec : public ImageCodec 00041 { 00042 public: 00043 JPEGCodec(); 00044 ~JPEGCodec(); 00045 bool CanDecode(TransferSyntax const &ts) const; 00046 bool CanCode(TransferSyntax const &ts) const; 00047 bool Decode(DataElement const &is, DataElement &os); 00048 void SetPixelFormat(PixelFormat const &pf); 00049 00051 void ComputeOffsetTable(bool b); 00052 00054 bool Code(DataElement const &in, DataElement &out); 00055 00056 virtual bool GetHeaderInfo(std::istream &is, TransferSyntax &ts); 00057 00058 //void SetReversible(bool res); 00059 00060 void SetQuality(double q); 00061 double GetQuality() const; 00062 00063 void SetLossless(bool l); 00064 bool GetLossless() const; 00065 00066 protected: 00067 bool Decode(std::istream &is, std::ostream &os); 00068 bool IsValid(PhotometricInterpretation const &pi); 00069 00070 protected: 00071 // Internal method called by SetPixelFormat 00072 // Instantiate the right jpeg codec (8, 12 or 16) 00073 void SetBitSample(int bit); 00074 00075 protected: 00076 int BitSample; 00077 bool Lossless; 00078 int Quality; 00079 00080 private: 00081 void SetupJPEGBitCodec(int bit); 00082 JPEGCodec *Internal; 00083 }; 00084 00085 } // end namespace gdcm 00086 00087 #endif //GDCMJPEGCODEC_H