#include <gdcmRLEFrame.h>
Inheritance diagram for GDCM_NAME_SPACE::RLEFrame:
Public Member Functions | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Protected Attributes | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Member Functions | |
RLEFrame () | |
void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Print self. | |
void | SetNumberOfFragments (unsigned int number) |
unsigned int | GetNumberOfFragments () |
void | SetOffset (unsigned int id, long offset) |
long | GetOffset (unsigned int id) |
void | SetLength (unsigned int id, long length) |
long | GetLength (unsigned int id) |
uint8_t * | ReadAndDecompressRLEFrame (uint8_t *subRaw, long rawSegmentSize, std::ifstream *fp) |
bool | ReadAndDecompressRLEFragment (uint8_t *subRaw, long fragmentSize, long rawSegmentSize, std::ifstream *fp) |
Implementation of the RLE decoding algorithm for decompressing a RLE fragment. [refer to PS 3.5-2003, section G.3.2 p 86]. | |
Private Attributes | |
unsigned int | NumberOfFragments |
long | Offset [15] |
long | Length [15] |
Friends | |
class | File |
class | RLEFramesInfo |
Each instance of this class (they can be as many instances for a given Document as they are frames and they are collected in a RLEFramesInfo ) describes :
Definition at line 46 of file gdcmRLEFrame.h.
|
Definition at line 51 of file gdcmRLEFrame.h. 00051 { NumberOfFragments = 0; }
|
|
Definition at line 47 of file gdcmRLEFrame.cxx. References gdcmAssertMacro, and Length. 00048 { 00049 gdcmAssertMacro(id<15); 00050 return Length[id]; 00051 }
|
|
Definition at line 56 of file gdcmRLEFrame.h. 00056 { return NumberOfFragments; }
|
|
Definition at line 35 of file gdcmRLEFrame.cxx. References gdcmAssertMacro, and Offset. 00036 { 00037 gdcmAssertMacro(id<15); 00038 return Offset[id]; 00039 }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Print self.
Reimplemented from GDCM_NAME_SPACE::Base. Definition at line 144 of file gdcmRLEFrame.cxx. References Length, NumberOfFragments, and Offset. 00145 { 00146 os << indent 00147 << "--- fragments" 00148 << std::endl; 00149 for ( unsigned int i = 0; i < NumberOfFragments; i++ ) 00150 { 00151 os << indent 00152 << " offset : " << Offset[i] 00153 << " length : " << Length[i] 00154 << std::endl; 00155 } 00156 }
|
|
Implementation of the RLE decoding algorithm for decompressing a RLE fragment. [refer to PS 3.5-2003, section G.3.2 p 86].
Definition at line 79 of file gdcmRLEFrame.cxx. References gdcmWarningMacro. Referenced by ReadAndDecompressRLEFrame(). 00083 { 00084 int8_t count; 00085 long numberOfOutputBytes = 0; 00086 long numberOfReadBytes = 0; 00087 00088 while( numberOfOutputBytes < rawSegmentSize ) 00089 { 00090 fp->read( (char*)&count, 1 ); 00091 numberOfReadBytes += 1; 00092 if ( count >= 0 ) 00093 // Note: count <= 127 comparison is always true due to limited range 00094 // of data type int8_t [since the maximum of an exact width 00095 // signed integer of width N is 2^(N-1) - 1, which for int8_t 00096 // is 127]. 00097 { 00098 fp->read( (char*)subRaw, count + 1); 00099 numberOfReadBytes += count + 1; 00100 subRaw += count + 1; 00101 numberOfOutputBytes += count + 1; 00102 } 00103 else 00104 { 00105 if ( count <= -1 && count >= -127 ) 00106 { 00107 int8_t newByte; 00108 fp->read( (char*)&newByte, 1); 00109 numberOfReadBytes += 1; 00110 for( int i = 0; i < -count + 1; i++ ) 00111 { 00112 subRaw[i] = newByte; 00113 } 00114 subRaw += -count + 1; 00115 numberOfOutputBytes += -count + 1; 00116 } 00117 } 00118 // if count = 128 output nothing 00119 00120 if ( numberOfReadBytes > fragmentSize ) 00121 { 00122 gdcmWarningMacro( "Read more bytes (" << numberOfReadBytes 00123 << " ) than the segment size. (" 00124 << fragmentSize << ")" ); 00125 return false; 00126 } 00127 } 00128 return true; 00129 }
|
|
Definition at line 53 of file gdcmRLEFrame.cxx. References Length, NumberOfFragments, Offset, and ReadAndDecompressRLEFragment(). 00056 { 00057 // Loop on the fragments 00058 for( unsigned int k = 1; k <= NumberOfFragments; k++ ) 00059 { 00060 // First thing need to reset file to proper position: 00061 fp->seekg(Offset[k], std::ios::beg); 00062 ReadAndDecompressRLEFragment(subRaw, Length[k], 00063 rawSegmentSize, fp); 00064 subRaw += rawSegmentSize; 00065 } 00066 00067 return subRaw; 00068 }
|
|
Definition at line 41 of file gdcmRLEFrame.cxx. References gdcmAssertMacro, and Length. 00042 { 00043 gdcmAssertMacro(id<15); 00044 Length[id] = length; 00045 }
|
|
Definition at line 54 of file gdcmRLEFrame.h. 00055 { NumberOfFragments = number; }
|
|
Definition at line 29 of file gdcmRLEFrame.cxx. References gdcmAssertMacro, and Offset. 00030 { 00031 gdcmAssertMacro(id<15); 00032 Offset[id] = offset; 00033 }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Definition at line 48 of file gdcmRLEFrame.h. |
|
Definition at line 49 of file gdcmRLEFrame.h. |
|
Definition at line 69 of file gdcmRLEFrame.h. Referenced by GetLength(), Print(), ReadAndDecompressRLEFrame(), and SetLength(). |
|
Definition at line 67 of file gdcmRLEFrame.h. Referenced by Print(), and ReadAndDecompressRLEFrame(). |
|
Definition at line 68 of file gdcmRLEFrame.h. Referenced by GetOffset(), Print(), ReadAndDecompressRLEFrame(), and SetOffset(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print(). |