OpenWalnut
1.5.0dev
|
Reads fibers from a VTK file. More...
#include <WReaderFiberVTK.h>
Public Member Functions | |
WReaderFiberVTK (std::string fname) | |
Constructs and makes a new VTK reader for separate thread start. More... | |
virtual | ~WReaderFiberVTK () throw () |
Destroys this instance and closes the file. More... | |
virtual std::shared_ptr< WDataSetFibers > | read () |
Reads the fiber file and creates a dataset out of it. More... | |
Public Member Functions inherited from WReader | |
WReader (std::string fname) | |
Creates a read object for file reading. More... | |
OW_API_DEPRECATED void | setFileName (std::string fname) |
Reset the file name and checks if it exists. More... | |
void | setFilename (std::string fname) |
Reset the file name and checks if it exists. More... | |
Protected Member Functions | |
void | readHeader () |
Read VTK header from file. More... | |
void | readPoints () |
Read VTK POINTS field from input stream. More... | |
void | readValues () |
Read VTK VALUES field from input stream. More... | |
void | readLines () |
Read VTK LINES field from input stream. More... | |
Protected Attributes | |
std::vector< std::string > | m_header |
VTK header of the read file. More... | |
std::shared_ptr< std::vector< float > > | m_points |
Stores for every point its x,y and z float value successivley. More... | |
std::shared_ptr< std::vector< size_t > > | m_fiberStartIndices |
Stores the start indices (in the point array) for every fiber. More... | |
std::shared_ptr< std::vector< size_t > > | m_fiberLengths |
Stores the length of every fiber. More... | |
WDataSetFibers::VertexParemeterArray | m_fiberParameters |
additional colors if found in file. More... | |
std::shared_ptr< std::vector< size_t > > | m_pointFiberMapping |
Stores for every point the fiber where it belongs to. More... | |
std::shared_ptr< std::ifstream > | m_ifs |
Pointer to the input file stream reader. More... | |
Protected Attributes inherited from WReader | |
std::string | m_fname |
Absolute path of the file to read from. More... | |
Private Member Functions | |
std::string | getLine (const std::string &desc) |
Reads the next line from current position in stream of the fiber VTK file. More... | |
template<typename T > | |
T | getLexicalCast (std::string stringValue, const std::string &errMsg) const |
Try to cast from the given string to the template value T. More... | |
Friends | |
class | WReaderFiberVTKTest |
Only UnitTests may be friends. More... | |
Reads fibers from a VTK file.
For VTK just see http://www.vtk.org. Currently only a subset of the legacy format is supported: MedInria's Fib-VTK format. The byte order of the files is assumed to be big endian by default.
Definition at line 49 of file WReaderFiberVTK.h.
|
explicit |
Constructs and makes a new VTK reader for separate thread start.
fname | File name where to read data from |
WDHNoSuchFile |
Definition at line 44 of file WReaderFiberVTK.cpp.
|
virtual |
Destroys this instance and closes the file.
Definition at line 49 of file WReaderFiberVTK.cpp.
|
inlineprivate |
Try to cast from the given string to the template value T.
If the cast fails a WDHParseError is thrown.
WDHParseError |
stringValue | The string to cast from |
errMsg | Error message incase the cast fails |
Definition at line 146 of file WReaderFiberVTK.h.
References WReader::m_fname.
|
private |
Reads the next line from current position in stream of the fiber VTK file.
desc | In case of trouble while reading, this gives information in the error message about what was tried to read |
WDHIOFailure,WDHParseError |
Definition at line 220 of file WReaderFiberVTK.cpp.
References WReader::m_fname, and m_ifs.
Referenced by readHeader(), readLines(), readPoints(), and readValues().
|
virtual |
Reads the fiber file and creates a dataset out of it.
Definition at line 53 of file WReaderFiberVTK.cpp.
References m_fiberLengths, m_fiberParameters, m_fiberStartIndices, WReader::m_fname, m_ifs, m_pointFiberMapping, m_points, readHeader(), readLines(), readPoints(), and readValues().
|
protected |
Read VTK header from file.
WDHIOFailure,WDHParseError |
Definition at line 75 of file WReaderFiberVTK.cpp.
References wlog::error(), getLine(), WReader::m_fname, m_header, string_utils::toString(), and wlog::warn().
Referenced by read().
|
protected |
Read VTK LINES field from input stream.
Definition at line 138 of file WReaderFiberVTK.cpp.
References getLine(), m_fiberLengths, m_fiberStartIndices, m_ifs, m_pointFiberMapping, string_utils::tokenize(), and string_utils::toUpper().
Referenced by read().
|
protected |
Read VTK POINTS field from input stream.
Definition at line 108 of file WReaderFiberVTK.cpp.
References getLine(), m_ifs, m_pointFiberMapping, m_points, string_utils::tokenize(), and string_utils::toLower().
Referenced by read().
|
protected |
Read VTK VALUES field from input stream.
Definition at line 183 of file WReaderFiberVTK.cpp.
References wlog::debug(), getLine(), m_fiberParameters, m_ifs, string_utils::tokenize(), and string_utils::toLower().
Referenced by read().
|
friend |
Only UnitTests may be friends.
Definition at line 54 of file WReaderFiberVTK.h.
|
protected |
Stores the length of every fiber.
Definition at line 110 of file WReaderFiberVTK.h.
Referenced by read(), and readLines().
|
protected |
additional colors if found in file.
Definition at line 112 of file WReaderFiberVTK.h.
Referenced by read(), and readValues().
|
protected |
Stores the start indices (in the point array) for every fiber.
Definition at line 108 of file WReaderFiberVTK.h.
Referenced by read(), and readLines().
|
protected |
VTK header of the read file.
Definition at line 99 of file WReaderFiberVTK.h.
Referenced by readHeader().
|
protected |
Pointer to the input file stream reader.
Definition at line 121 of file WReaderFiberVTK.h.
Referenced by getLine(), read(), readLines(), readPoints(), and readValues().
|
protected |
Stores for every point the fiber where it belongs to.
Definition at line 119 of file WReaderFiberVTK.h.
Referenced by read(), readLines(), and readPoints().
|
protected |
Stores for every point its x,y and z float value successivley.
Definition at line 106 of file WReaderFiberVTK.h.
Referenced by read(), and readPoints().