# gdcmJPEGLSCodec.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 __gdcmJPEGLScodec_h
    00016 #define __gdcmJPEGLScodec_h
    00017
    00018 #include "gdcmImageCodec.h"
    00019
    00020 namespace gdcm
    00021 {
    00022
    00023 class JPEGLSInternals;
    00031 class GDCM_EXPORT JPEGLSCodec : public ImageCodec
    00032 {
    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 Code(DataElement const &in, DataElement &out);
    00044
    00045   bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
    00046
    00047   void SetLossless(bool l);
    00048   bool GetLossless() const;
    00049
    00050 /*
    00051  * test.acr can look pretty bad, even with a lossy error of 2. Explanation follows:
    00052  * I agree that the test image looks ugly. In this particular case I can
    00053  * explain though.
    00054  *
    00055  * The image is 8 bit, but it does not use the full 8 bit dynamic range. The
    00056  * black pixels have value 234 and the white 255. If you set allowed lossy
    00057  * error to 2, you allow an error of about 10% of the actual dynamic range.
    00058  * That is of course very visible.
    00059  */
    00061   void SetLossyError(int error);
    00062
    00063 private:
    00064   unsigned long BufferLength;
    00065   bool Lossless;
    00066   int LossyError;
    00067 };
    00068
    00069 } // end namespace gdcm
    00070
    00071 #endif //__gdcmJPEGLScodec_h