# 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-2010 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 Decode(DataElement const &in, char* outBuffer, uint32_t inBufferLength,
    00044               uint32_t inXMin, uint32_t inXMax, uint32_t inYMin,
    00045               uint32_t inYMax, uint32_t inZMin, uint32_t inZMax) { return false; }
    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 private:
    00067   unsigned long BufferLength;
    00068   bool Lossless;
    00069   int LossyError;
    00070 };
    00071
    00072 } // end namespace gdcm
    00073
    00074 #endif //GDCMJPEGLSCODEC_H