Access to fields in a binary file header. More...
#include <cmtkFileHeader.h>
Public Member Functions | |
FileHeader (void *const header, const bool isBigEndian=true) | |
Constructor. | |
template<class T > | |
T | GetField (const size_t offset) |
Retrieve field of arbitrary type from header. | |
template<class T > | |
void | StoreField (const size_t offset, T value) |
Store field of arbitrary type to header. | |
void | StoreFieldString (const size_t offset, const char *value, const size_t maxlen=0) |
Store null-terminated string to header. | |
bool | CompareFieldStringN (const size_t offset, const char *value, const size_t len) const |
Compare n-character string. | |
template<class T > | |
void | GetArray (T *const target, const size_t offset, const size_t length=1) |
Retrieve array of arbitrary type from header. | |
Private Attributes | |
char * | Header |
Pointer to the binary header. | |
bool | IsBigEndian |
Flag for endianness. |
Access to fields in a binary file header.
Definition at line 49 of file cmtkFileHeader.h.
cmtk::FileHeader::FileHeader | ( | void *const | header, |
const bool | isBigEndian = true |
||
) | [inline] |
Constructor.
Definition at line 53 of file cmtkFileHeader.h.
bool cmtk::FileHeader::CompareFieldStringN | ( | const size_t | offset, |
const char * | value, | ||
const size_t | len | ||
) | const [inline] |
Compare n-character string.
Definition at line 96 of file cmtkFileHeader.h.
Referenced by cmtk::VolumeFromFile::ReadAnalyzeHdr().
void cmtk::FileHeader::GetArray | ( | T *const | target, |
const size_t | offset, | ||
const size_t | length = 1 |
||
) | [inline] |
Retrieve array of arbitrary type from header.
Definition at line 103 of file cmtkFileHeader.h.
References cmtk::Memory::ByteSwap().
Referenced by cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().
T cmtk::FileHeader::GetField | ( | const size_t | offset ) | [inline] |
Retrieve field of arbitrary type from header.
Definition at line 60 of file cmtkFileHeader.h.
References cmtk::Memory::ByteSwap().
Referenced by cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().
void cmtk::FileHeader::StoreField | ( | const size_t | offset, |
T | value | ||
) | [inline] |
Store field of arbitrary type to header.
Definition at line 73 of file cmtkFileHeader.h.
References cmtk::Memory::ByteSwap().
Referenced by cmtk::ScalarImageIO::WriteAnalyze(), and cmtk::VolumeFromFile::WriteAnalyzeHdr().
void cmtk::FileHeader::StoreFieldString | ( | const size_t | offset, |
const char * | value, | ||
const size_t | maxlen = 0 |
||
) | [inline] |
Store null-terminated string to header.
Definition at line 84 of file cmtkFileHeader.h.
Referenced by cmtk::VolumeFromFile::WriteAnalyzeHdr().
char* cmtk::FileHeader::Header [private] |
Pointer to the binary header.
Definition at line 123 of file cmtkFileHeader.h.
bool cmtk::FileHeader::IsBigEndian [private] |
Flag for endianness.
Definition at line 126 of file cmtkFileHeader.h.