# gdcmJPEGCodec.h

Go to the documentation of this file.

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