GDCM 3.0.24
gdcmRLECodec.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 GDCMRLECODEC_H
15#define GDCMRLECODEC_H
16
17#include "gdcmImageCodec.h"
18
19namespace gdcm
20{
21
22class Fragment;
23class RLEInternals;
37{
38friend class ImageRegionReader;
39public:
41 ~RLECodec() override;
42 bool CanCode(TransferSyntax const &ts) const override;
43 bool CanDecode(TransferSyntax const &ts) const override;
44 bool Decode(DataElement const &is, DataElement &os) override;
45 unsigned long GetBufferLength() const { return BufferLength; }
46 void SetBufferLength(unsigned long l) { BufferLength = l; }
47
48 bool Code(DataElement const &in, DataElement &out) override;
49 bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override;
50 ImageCodec * Clone() const override;
51
52protected:
54 char *buffer,
55 unsigned int XMin, unsigned int XMax,
56 unsigned int YMin, unsigned int YMax,
57 unsigned int ZMin, unsigned int ZMax,
58 std::istream & is
59 );
60
61 bool DecodeByStreams(std::istream &is, std::ostream &os) override;
62public:
63
64 void SetLength(unsigned long l)
65 {
66 Length = l;
67 }
68
69protected:
70 bool StartEncode( std::ostream & ) override;
71 bool IsRowEncoder() override;
72 bool IsFrameEncoder() override;
73 bool AppendRowEncode( std::ostream & out, const char * data, size_t datalen ) override;
74 bool AppendFrameEncode( std::ostream & out, const char * data, size_t datalen ) override;
75 bool StopEncode( std::ostream & ) override;
76
77private:
78 bool DecodeByStreamsCommon(std::istream &is, std::ostream &os);
79 RLEInternals *Internals;
80 unsigned long Length;
81 unsigned long BufferLength;
82 size_t DecodeFragment(Fragment const & frag, char *buffer, size_t llen);
83};
84
85} // end namespace gdcm
86
87#endif //GDCMRLECODEC_H
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
Class to represent a Fragment.
Definition gdcmFragment.h:44
ImageCodec.
Definition gdcmImageCodec.h:31
ImageRegionReader.
Definition gdcmImageRegionReader.h:35
Class to do RLE.
Definition gdcmRLECodec.h:37
bool DecodeByStreams(std::istream &is, std::ostream &os) override
ImageCodec * Clone() const override
bool AppendRowEncode(std::ostream &out, const char *data, size_t datalen) override
bool AppendFrameEncode(std::ostream &out, const char *data, size_t datalen) override
bool CanCode(TransferSyntax const &ts) const override
Return whether this coder support this transfer syntax (can code it)
bool IsFrameEncoder() override
bool Code(DataElement const &in, DataElement &out) override
Code.
unsigned long GetBufferLength() const
Definition gdcmRLECodec.h:45
~RLECodec() override
bool StartEncode(std::ostream &) override
bool DecodeExtent(char *buffer, unsigned int XMin, unsigned int XMax, unsigned int YMin, unsigned int YMax, unsigned int ZMin, unsigned int ZMax, std::istream &is)
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override
bool CanDecode(TransferSyntax const &ts) const override
Return whether this decoder support this transfer syntax (can decode it)
void SetLength(unsigned long l)
Definition gdcmRLECodec.h:64
bool IsRowEncoder() override
void SetBufferLength(unsigned long l)
Definition gdcmRLECodec.h:46
bool StopEncode(std::ostream &) override
bool Decode(DataElement const &is, DataElement &os) override
Decode.
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21