34 #include "core/common/WStringUtils.h"
35 #include "core/dataHandler/WDataSet.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"
147 std::shared_ptr<
WValueSetBase >
readHARDI( std::
size_t nbPoints, std::
size_t nbGradients, const std::
string& );
164 std::shared_ptr< std::ifstream >
m_ifs;
207 std::string
getLine(
const std::string& desc );
216 void readCoords( std::string
const& name, std::size_t dim, std::vector< float >& coords );
242 template<
typename T > T
getLexicalCast( std::string stringValue,
const std::string& errMsg )
const;
271 result = string_utils::fromString< T >( stringValue );
273 catch(
const std::exception &e )
275 throw WDHParseError( std::string(
"Cast error in VTK file: " +
m_fname +
": " + errMsg +
": " + stringValue ) );
Use this for IO error handling.
Base class for all data set types.
A grid that has parallelepiped cells which all have the same proportion.
std::shared_ptr< WValueSetBase > readVectors(size_t nbVectors, const std::string &name)
Read VTK SCALARS field.
AttributeType
The types of attributes supported so far.
@ UNSUPPORTED_ATTRIBUTE
anything else
std::shared_ptr< std::ifstream > m_ifs
Pointer to the input file stream reader.
WReaderVTK(std::string fname)
Constructs and makes a new VTK reader for separate thread start.
void readCoords(std::string const &name, std::size_t dim, std::vector< float > &coords)
Read the coordinates of the dataset's domain.
std::shared_ptr< WGridRegular3D > readStructuredPoints()
Read VTK Domain specification and create a matching grid.
std::shared_ptr< WDataSet > m_newDataSet
reference to the currently loading data set
bool readHeader()
Read VTK header from file.
std::shared_ptr< WValueSetBase > readTensors(size_t nbTensors, const std::string &name)
Read VTK TENSORS field.
DomainType
The types of domains supported so far.
@ RECTILINEAR_GRID
rectilinear grid
@ STRUCTURED_POINTS
structured points
@ UNSUPPORTED_DOMAIN
anything else
std::shared_ptr< WGridRegular3D > readRectilinearGrid()
Read VTK Domain specification and create a matching grid.
T getLexicalCast(std::string stringValue, const std::string &errMsg) const
Try to cast from the given string to the template value T.
void readValuesFromFile(std::vector< float > &values, std::size_t numValues)
Read values from the file.
AttributeType m_attributeType
The type of the attributes first read from the file.
bool m_isASCII
internal flag whether we read ascii or binary
std::shared_ptr< WValueSetBase > readHARDI(std::size_t nbPoints, std::size_t nbGradients, const std::string &)
Read HARDI data from the file.
std::shared_ptr< std::vector< WVector3d > > readGradients()
Read gradients from a gradients file which has the same basename as the data file and ends in ....
std::shared_ptr< WValueSetBase > readScalars(size_t nbScalars, const std::string &name)
Read VTK SCALARS field.
DomainType m_domainType
The type of domain specified in the file.
virtual std::shared_ptr< WDataSet > read()
Reads the data file and creates a dataset out of it.
virtual ~WReaderVTK()
Destroys this instance and closes the file.
std::shared_ptr< WValueSetBase > readData(std::shared_ptr< WGridRegular3D > const &grid)
Read domain information for structured points.
std::shared_ptr< WGridRegular3D > m_newGrid
reference to the currently loading grid
std::string getLine(const std::string &desc)
Reads the next line from current position in stream of the fiber VTK file.
friend class WReaderVTKTest
allow member access by the test class
std::vector< std::string > m_header
VTK header of the read file.
Read some data from a given file.
std::string m_fname
Absolute path of the file to read from.
Abstract base class to all WValueSets.