25 #ifndef WREADERFIBERVTK_H
26 #define WREADERFIBERVTK_H
34 #include "core/common/WStringUtils.h"
35 #include "core/dataHandler/WDataSetFibers.h"
36 #include "core/dataHandler/exceptions/WDHIOFailure.h"
37 #include "core/dataHandler/exceptions/WDHNoSuchFile.h"
38 #include "core/dataHandler/exceptions/WDHParseError.h"
39 #include "core/dataHandler/io/WReader.h"
121 std::shared_ptr< std::ifstream >
m_ifs;
132 std::
string getLine( const std::
string& desc );
143 template< typename T > T
getLexicalCast( std::
string stringValue, const std::
string& errMsg ) const;
151 result = string_utils::fromString< T >( stringValue );
153 catch(
const std::exception &e )
155 throw WDHParseError( std::string(
"Cast error in VTK fiber file: " +
m_fname +
": " + errMsg +
": " + stringValue ) );
Use this for IO error handling.
Represents a simple set of WFibers.
Reads fibers from a VTK file.
std::string getLine(const std::string &desc)
Reads the next line from current position in stream of the fiber VTK file.
std::vector< std::string > m_header
VTK header of the read file.
virtual ~WReaderFiberVTK()
Destroys this instance and closes the file.
T getLexicalCast(std::string stringValue, const std::string &errMsg) const
Try to cast from the given string to the template value T.
WDataSetFibers::VertexParemeterArray m_fiberParameters
additional colors if found in file.
friend class WReaderFiberVTKTest
Only UnitTests may be friends.
void readValues()
Read VTK VALUES field from input stream.
std::shared_ptr< std::ifstream > m_ifs
Pointer to the input file stream reader.
std::shared_ptr< std::vector< float > > m_points
Stores for every point its x,y and z float value successivley.
std::shared_ptr< std::vector< size_t > > m_fiberStartIndices
Stores the start indices (in the point array) for every fiber.
std::shared_ptr< std::vector< size_t > > m_fiberLengths
Stores the length of every fiber.
void readPoints()
Read VTK POINTS field from input stream.
WReaderFiberVTK(std::string fname)
Constructs and makes a new VTK reader for separate thread start.
virtual std::shared_ptr< WDataSetFibers > read()
Reads the fiber file and creates a dataset out of it.
void readHeader()
Read VTK header from file.
std::shared_ptr< std::vector< size_t > > m_pointFiberMapping
Stores for every point the fiber where it belongs to.
void readLines()
Read VTK LINES field from input stream.
Read some data from a given file.
std::string m_fname
Absolute path of the file to read from.