GDCM: gdcmRLECodec.h Source File

GDCM 3.2.11

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;
36 class GDCM_EXPORT RLECodec : public ImageCodec
37{
38 friend class ImageRegionReader;
39public:
40 RLECodec();
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:
53 bool DecodeExtent(
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
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::Fragment
Class to represent a Fragment.
Definition gdcmFragment.h:44
gdcm::ImageCodec::ImageCodec
ImageCodec()
gdcm::RLECodec::DecodeByStreams
bool DecodeByStreams(std::istream &is, std::ostream &os) override
gdcm::RLECodec::RLECodec
RLECodec()
gdcm::RLECodec::ImageRegionReader
friend class ImageRegionReader
Definition gdcmRLECodec.h:38
gdcm::RLECodec::Clone
ImageCodec * Clone() const override
gdcm::RLECodec::AppendRowEncode
bool AppendRowEncode(std::ostream &out, const char *data, size_t datalen) override
gdcm::RLECodec::AppendFrameEncode
bool AppendFrameEncode(std::ostream &out, const char *data, size_t datalen) override
gdcm::RLECodec::CanCode
bool CanCode(TransferSyntax const &ts) const override
Return whether this coder support this transfer syntax (can code it).
gdcm::RLECodec::IsFrameEncoder
bool IsFrameEncoder() override
gdcm::RLECodec::Code
bool Code(DataElement const &in, DataElement &out) override
Code.
gdcm::RLECodec::GetBufferLength
unsigned long GetBufferLength() const
Definition gdcmRLECodec.h:45
gdcm::RLECodec::~RLECodec
~RLECodec() override
gdcm::RLECodec::StartEncode
bool StartEncode(std::ostream &) override
gdcm::RLECodec::DecodeExtent
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)
gdcm::RLECodec::GetHeaderInfo
bool GetHeaderInfo(std::istream &is, TransferSyntax &ts) override
gdcm::RLECodec::CanDecode
bool CanDecode(TransferSyntax const &ts) const override
Return whether this decoder support this transfer syntax (can decode it).
gdcm::RLECodec::SetLength
void SetLength(unsigned long l)
Definition gdcmRLECodec.h:64
gdcm::RLECodec::IsRowEncoder
bool IsRowEncoder() override
gdcm::RLECodec::SetBufferLength
void SetBufferLength(unsigned long l)
Definition gdcmRLECodec.h:46
gdcm::RLECodec::StopEncode
bool StopEncode(std::ostream &) override
gdcm::RLECodec::Decode
bool Decode(DataElement const &is, DataElement &os) override
Decode.
gdcm::TransferSyntax
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
gdcmImageCodec.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21