elsa io

EDF

class elsa::EDF

class to read and write EDF files.

Class to handle reading

EDF files into DataContainers and writing of DataContainers to EDF files.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

EDF files are non-standard files that include a 1024 Byte header containing textual meta data about the following raw data. It allows storing images of arbitrary dimensions in a low-overhead manner.

Please note: we assume little endian byte order.

Public Static Functions

template<typename data_t = real_t>
DataContainer<data_t> read(std::string filename)

read from filename into a DataContainer

template<typename data_t = real_t>
void write(const DataContainer<data_t> &data, std::string filename)

write the DataContainer to the file named filename

Private Static Functions

std::map<std::string, std::string> readHeader(std::ifstream &file)

read the EDF header into a property map

std::pair<std::unique_ptr<DataDescriptor>, DataUtils::DataType> parseHeader(const std::map<std::string, std::string> &properties)

parse the EDF header property map into a DataDescriptor and DataType

template<typename data_t>
void writeHeader(std::ofstream &file, const DataContainer<data_t> &data)

write the EDF header to file

template<typename data_t>
std::string getDataTypeName(const DataContainer<data_t> &data)

return the EDF string for data type of DataContainer

MHD

class elsa::MHD

class to read and write MHD files. MHD files are compatible with ITK/VTK based applications.

Class to handle reading

MHD files into DataContainers and writing of DataContainers to MHD files.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

MHD files consist of two parts, a text file (ending in .mhd) containing meta data, and a raw file containing the image data (filename is referenced in meta data). It allows storing images of arbitrary dimensions in a low-overhead manner.

Please note: we assume little endian byte order.

Public Static Functions

template<typename data_t = real_t>
DataContainer<data_t> read(std::string filename)

read from filename into a DataContainer

template<typename data_t = real_t>
void write(const DataContainer<data_t> &data, std::string metaFilename, std::string rawFilename)

write the DataContainer to the file named filename

Private Static Functions

std::map<std::string, std::string> readHeader(std::ifstream &metaFile)

read the MHD header into a property map

std::tuple<std::unique_ptr<DataDescriptor>, std::string, DataUtils::DataType> parseHeader(const std::map<std::string, std::string> &properties)

parse the MHD header property map into a DataDescriptor and DataType

template<typename data_t>
void writeHeader(std::ofstream &metaFile, const DataContainer<data_t> &data, std::string rawFilename)

write the MHD header to file

template<typename data_t>
std::string getDataTypeName(const DataContainer<data_t> &data)

return the MHD string for data type of DataContainer

IO Utilities

StringUtils

struct elsa::StringUtils

class providing string handling utility functions.

Author

Maximilian Hornung - initial code

Author

Tobias Lasser - rewrite

Public Static Functions

void trim(std::string &str)

trim whitespace from beginning/end of string

void toLower(std::string &str)

convert string to lower case

void toUpper(std::string &str)

convert string to upper case

DataUtils

struct elsa::DataUtils

class providing utility functions for reading/writing data

Author

Matthias Wieczorek - first version of code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - rewrite

Public Types

enum ByteOrder

byte order

Values:

enumerator LOW_BYTE_FIRST
enumerator HIGH_BYTE_FIRST
enum DataType

data types

Values:

enumerator INT8
enumerator UINT8
enumerator INT16
enumerator UINT16
enumerator INT32
enumerator UINT32
enumerator FLOAT32
enumerator FLOAT64

Public Static Functions

index_t getSizeOfDataType(DataType type)

return the size in bytes for the respective DataType

template<typename data_t>
data_t parse(const std::string &str)

parse a data_t value from a string

template<typename data_t>
std::vector<data_t> parseVector(const std::string &str)

parse a vector of data_t values from a string

template<typename raw_data_t, typename data_t>
void parseRawData(std::ifstream &file, DataContainer<data_t> &data)

read in raw data (of type raw_data_t) into a data container (of type data_t)

Public Static Attributes

const ByteOrder DEFAULT_BYTE_ORDER = ByteOrder::LOW_BYTE_FIRST

our default byte order is little endian (low byte first)

FileSystemUtils

struct elsa::FileSystemUtils

class providing utility functions for the filesystem

Author

Maximilian Hornung - initial code

Author

Tobias Lasser - rewrite

Public Static Functions

std::string getAbsolutePath(std::string path, std::string base)

return the absolute path of path with respect to base