GDCM  2.2.3
gdcmJPEGLSCodec.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 GDCMJPEGLSCODEC_H
00015 #define GDCMJPEGLSCODEC_H
00016 
00017 #include "gdcmImageCodec.h"
00018 
00019 namespace gdcm
00020 {
00021 
00022 class JPEGLSInternals;
00030 class GDCM_EXPORT JPEGLSCodec : public ImageCodec
00031 {
00032 friend class ImageRegionReader;
00033 public:
00034   JPEGLSCodec();
00035   ~JPEGLSCodec();
00036   bool CanDecode(TransferSyntax const &ts) const;
00037   bool CanCode(TransferSyntax const &ts) const;
00038 
00039   unsigned long GetBufferLength() const { return BufferLength; }
00040   void SetBufferLength(unsigned long l) { BufferLength = l; }
00041 
00042   bool Decode(DataElement const &is, DataElement &os);
00043   bool Decode(DataElement const &in, char* outBuffer, size_t inBufferLength,
00044               uint32_t inXMin, uint32_t inXMax, uint32_t inYMin,
00045               uint32_t inYMax, uint32_t inZMin, uint32_t inZMax);
00046   bool Code(DataElement const &in, DataElement &out);
00047 
00048   bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
00049 
00050   void SetLossless(bool l);
00051   bool GetLossless() const;
00052 
00053 /*
00054  * test.acr can look pretty bad, even with a lossy error of 2. Explanation follows:
00055  * I agree that the test image looks ugly. In this particular case I can
00056  * explain though.
00057  *
00058  * The image is 8 bit, but it does not use the full 8 bit dynamic range. The
00059  * black pixels have value 234 and the white 255. If you set allowed lossy
00060  * error to 2, you allow an error of about 10% of the actual dynamic range.
00061  * That is of course very visible.
00062  */
00064   void SetLossyError(int error);
00065 
00066 protected:
00067   bool DecodeExtent(
00068     char *buffer,
00069     unsigned int xmin, unsigned int xmax,
00070     unsigned int ymin, unsigned int ymax,
00071     unsigned int zmin, unsigned int zmax,
00072     std::istream & is
00073   );
00074 
00075 private:
00076   bool DecodeByStreamsCommon(char *buffer, size_t totalLen, std::vector<unsigned char> &rgbyteOut);
00077   unsigned long BufferLength;
00078   bool Lossless;
00079   int LossyError;
00080 };
00081 
00082 } // end namespace gdcm
00083 
00084 #endif //GDCMJPEGLSCODEC_H

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