GDCM  2.2.6
gdcmJPEGLSCodec.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMJPEGLSCODEC_H
15 #define GDCMJPEGLSCODEC_H
16 
17 #include "gdcmImageCodec.h"
18 
19 namespace gdcm
20 {
21 
22 class JPEGLSInternals;
31 {
32 friend class ImageRegionReader;
33 public:
34  JPEGLSCodec();
35  ~JPEGLSCodec();
36  bool CanDecode(TransferSyntax const &ts) const;
37  bool CanCode(TransferSyntax const &ts) const;
38 
39  unsigned long GetBufferLength() const { return BufferLength; }
40  void SetBufferLength(unsigned long l) { BufferLength = l; }
41 
42  bool Decode(DataElement const &is, DataElement &os);
43  bool Decode(DataElement const &in, char* outBuffer, size_t inBufferLength,
44  uint32_t inXMin, uint32_t inXMax, uint32_t inYMin,
45  uint32_t inYMax, uint32_t inZMin, uint32_t inZMax);
46  bool Code(DataElement const &in, DataElement &out);
47 
48  bool GetHeaderInfo(std::istream &is, TransferSyntax &ts);
49  virtual ImageCodec * Clone() const;
50 
51  void SetLossless(bool l);
52  bool GetLossless() const;
53 
54 /*
55  * test.acr can look pretty bad, even with a lossy error of 2. Explanation follows:
56  * I agree that the test image looks ugly. In this particular case I can
57  * explain though.
58  *
59  * The image is 8 bit, but it does not use the full 8 bit dynamic range. The
60  * black pixels have value 234 and the white 255. If you set allowed lossy
61  * error to 2, you allow an error of about 10% of the actual dynamic range.
62  * That is of course very visible.
63  */
65  void SetLossyError(int error);
66 
67 protected:
68  bool DecodeExtent(
69  char *buffer,
70  unsigned int xmin, unsigned int xmax,
71  unsigned int ymin, unsigned int ymax,
72  unsigned int zmin, unsigned int zmax,
73  std::istream & is
74  );
75 
76 private:
77  bool DecodeByStreamsCommon(char *buffer, size_t totalLen, std::vector<unsigned char> &rgbyteOut);
78  unsigned long BufferLength;
79  bool Lossless;
80  int LossyError;
81 };
82 
83 } // end namespace gdcm
84 
85 #endif //GDCMJPEGLSCODEC_H
JPEG-LS.
Definition: gdcmJPEGLSCodec.h:30
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
ImageCodec.
Definition: gdcmImageCodec.h:30
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
unsigned long GetBufferLength() const
Definition: gdcmJPEGLSCodec.h:39
Class to manipulate Transfer Syntax.
Definition: gdcmTransferSyntax.h:39
ImageRegionReader.
Definition: gdcmImageRegionReader.h:29
void SetBufferLength(unsigned long l)
Definition: gdcmJPEGLSCodec.h:40

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo