GDCM  2.2.3
gdcmJPEG2000Codec.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 GDCMJPEG2000CODEC_H
00015 #define GDCMJPEG2000CODEC_H
00016 
00017 #include "gdcmImageCodec.h"
00018 
00019 namespace gdcm
00020 {
00021 
00022 class JPEG2000Internals;
00030 class GDCM_EXPORT JPEG2000Codec : public ImageCodec
00031 {
00032 friend class ImageRegionReader;
00033   friend class Bitmap;
00034 public:
00035   JPEG2000Codec();
00036   ~JPEG2000Codec();
00037 
00038   bool CanDecode(TransferSyntax const &ts) const;
00039   bool CanCode(TransferSyntax const &ts) const;
00040 
00041   bool Decode(DataElement const &is, DataElement &os);
00042   bool Code(DataElement const &in, DataElement &out);
00043 
00044   virtual bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
00045 
00046   // JPEG-2000 / OpenJPEG specific way of encoding lossy-ness
00047   // ref: http://www.openjpeg.org/index.php?menu=doc#encoder
00048   void SetRate(unsigned int idx, double rate);
00049   double GetRate(unsigned int idx = 0) const;
00050 
00051   void SetQuality(unsigned int idx, double q);
00052   double GetQuality(unsigned int idx = 0) const;
00053 
00054   void SetTileSize(unsigned int tx, unsigned int ty);
00055 
00056   void SetNumberOfResolutions(unsigned int nres);
00057 
00058   void SetReversible(bool res);
00059 
00060 protected:
00061   bool DecodeExtent(
00062     char *buffer,
00063     unsigned int xmin, unsigned int xmax,
00064     unsigned int ymin, unsigned int ymax,
00065     unsigned int zmin, unsigned int zmax,
00066     std::istream & is
00067   );
00068 
00069   bool DecodeByStreams(std::istream &is, std::ostream &os);
00070 private:
00071   std::pair<char *, size_t> DecodeByStreamsCommon(char *dummy_buffer, size_t buf_size);
00072   bool GetHeaderInfo(const char * dummy_buffer, size_t len, TransferSyntax &ts);
00073   JPEG2000Internals *Internals;
00074 };
00075 
00076 } // end namespace gdcm
00077 
00078 #endif //GDCMJPEG2000CODEC_H

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