GDCM
2.2.3
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 #ifndef GDCMRLECODEC_H 00015 #define GDCMRLECODEC_H 00016 00017 #include "gdcmImageCodec.h" 00018 00019 namespace gdcm 00020 { 00021 00022 class Fragment; 00023 class RLEInternals; 00036 class GDCM_EXPORT RLECodec : public ImageCodec 00037 { 00038 friend class ImageRegionReader; 00039 public: 00040 RLECodec(); 00041 ~RLECodec(); 00042 bool CanCode(TransferSyntax const &ts) const; 00043 bool CanDecode(TransferSyntax const &ts) const; 00044 bool Decode(DataElement const &is, DataElement &os); 00045 unsigned long GetBufferLength() const { return BufferLength; } 00046 void SetBufferLength(unsigned long l) { BufferLength = l; } 00047 00048 bool Code(DataElement const &in, DataElement &out); 00049 bool GetHeaderInfo(std::istream &is, TransferSyntax &ts); 00050 00051 protected: 00052 bool DecodeExtent( 00053 char *buffer, 00054 unsigned int XMin, unsigned int XMax, 00055 unsigned int YMin, unsigned int YMax, 00056 unsigned int ZMin, unsigned int ZMax, 00057 std::istream & is 00058 ); 00059 00060 bool DecodeByStreams(std::istream &is, std::ostream &os); 00061 public: 00062 00063 void SetLength(unsigned long l) 00064 { 00065 Length = l; 00066 } 00067 private: 00068 bool DecodeByStreamsCommon(std::istream &is, std::ostream &os); 00069 RLEInternals *Internals; 00070 unsigned long Length; 00071 unsigned long BufferLength; 00072 size_t DecodeFragment(Fragment const & frag, char *buffer, unsigned long llen); 00073 }; 00074 00075 } // end namespace gdcm 00076 00077 #endif //GDCMRLECODEC_H