GDCM  2.2.4
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 
50  void SetLossless(bool l);
51  bool GetLossless() const;
52 
53 /*
54  * test.acr can look pretty bad, even with a lossy error of 2. Explanation follows:
55  * I agree that the test image looks ugly. In this particular case I can
56  * explain though.
57  *
58  * The image is 8 bit, but it does not use the full 8 bit dynamic range. The
59  * black pixels have value 234 and the white 255. If you set allowed lossy
60  * error to 2, you allow an error of about 10% of the actual dynamic range.
61  * That is of course very visible.
62  */
64  void SetLossyError(int error);
65 
66 protected:
67  bool DecodeExtent(
68  char *buffer,
69  unsigned int xmin, unsigned int xmax,
70  unsigned int ymin, unsigned int ymax,
71  unsigned int zmin, unsigned int zmax,
72  std::istream & is
73  );
74 
75 private:
76  bool DecodeByStreamsCommon(char *buffer, size_t totalLen, std::vector<unsigned char> &rgbyteOut);
77  unsigned long BufferLength;
78  bool Lossless;
79  int LossyError;
80 };
81 
82 } // end namespace gdcm
83 
84 #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 Nov 16 2013 18:10:55 for GDCM by doxygen 1.8.5
SourceForge.net Logo