GDCM  2.2.3
gdcmJPEGCodec.h
Go to the documentation of this file.
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 friend class ImageRegionReader;
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 DecodeExtent(
00069     char *buffer,
00070     unsigned int xmin, unsigned int xmax,
00071     unsigned int ymin, unsigned int ymax,
00072     unsigned int zmin, unsigned int zmax,
00073     std::istream & is
00074   );
00075 
00076   bool DecodeByStreams(std::istream &is, std::ostream &os);
00077   bool IsValid(PhotometricInterpretation const &pi);
00078 
00079 protected:
00080   // Internal method called by SetPixelFormat
00081   // Instantiate the right jpeg codec (8, 12 or 16)
00082   void SetBitSample(int bit);
00083 
00084   virtual bool IsStateSuspension() const;
00085 
00086 protected:
00087   int BitSample;
00088   bool Lossless;
00089   int Quality;
00090 
00091 private:
00092   void SetupJPEGBitCodec(int bit);
00093   JPEGCodec *Internal;
00094 };
00095 
00096 } // end namespace gdcm
00097 
00098 #endif //GDCMJPEGCODEC_H

Generated on Thu Nov 28 2013 07:02:50 for GDCM by doxygen 1.7.6.1
SourceForge.net Logo