25 #ifndef WDATASETFIBERS_H
26 #define WDATASETFIBERS_H
33 #include <boost/tuple/tuple.hpp>
35 #include "../common/WBoundingBox.h"
36 #include "../common/WDefines.h"
37 #include "../common/WProperties.h"
38 #include "../common/math/linearAlgebra/WPosition.h"
40 #include "WIteratorRange.h"
61 typedef std::shared_ptr< WDataSetFibers >
SPtr;
66 typedef std::shared_ptr< const WDataSetFibers >
ConstSPtr;
76 typedef std::shared_ptr< std::vector< size_t > >
IndexArray;
91 typedef std::shared_ptr< std::vector< float > >
ColorArray;
203 std::shared_ptr< std::vector< size_t > > lineStartIndexes,
204 std::shared_ptr< std::vector< size_t > > lineLengths,
205 std::shared_ptr< std::vector< size_t > > verticesReverse,
217 std::shared_ptr< std::vector< size_t > > lineStartIndexes,
218 std::shared_ptr< std::vector< size_t > > lineLengths,
219 std::shared_ptr< std::vector< size_t > > verticesReverse );
232 std::shared_ptr< std::vector< size_t > > lineStartIndexes,
233 std::shared_ptr< std::vector< size_t > > lineLengths,
234 std::shared_ptr< std::vector< size_t > > verticesReverse,
248 std::shared_ptr< std::vector< size_t > > lineStartIndexes,
249 std::shared_ptr< std::vector< size_t > > lineLengths,
250 std::shared_ptr< std::vector< size_t > > verticesReverse,
276 virtual const std::string
getName()
const;
394 const std::shared_ptr< ColorScheme >
getColorScheme( std::string name )
const;
403 const std::shared_ptr< ColorScheme >
getColorScheme(
size_t idx )
const;
719 operator bool()
const;
1023 operator bool()
const;
1041 double getParameter(
double def = 0.0,
size_t parameterIndex = 0 )
const;
1066 WColor
getColor( std::size_t idx )
const;
1077 WColor
getColor( std::string name )
const;
1088 WColor
getColor(
const std::shared_ptr< WDataSetFibers::ColorScheme > scheme )
const;
1252 operator bool()
const;
Item used in the selection below also containing color info.
ColorMode m_mode
Coloring mode.
void setColor(ColorArray color, ColorMode mode=RGB)
Sets the color array for this item.
ColorArray m_color
The color array associated with the item.
ColorScheme(std::string name, std::string description, const char **icon, ColorArray color, ColorMode mode=RGB)
Constructor.
ColorMode
different kinds of color arrays can be used in this class.
@ GRAY
gray value per vertex
ColorArray getColor() const
Get the color.
ColorMode getMode() const
Returns the mode of the color scheme.
Represents a simple set of WFibers.
std::size_t getStartIndex(std::size_t fiber) const
Get the index of the first vertex of a given fiber.
void addColorScheme(WDataSetFibers::ColorArray colors, std::string name, std::string description)
This method adds a new color scheme to the list of available colors.
WPosition getTangent(size_t fiber, size_t vertex) const
calculates the tangent for a point on the fiber
std::shared_ptr< std::vector< size_t > > IndexArray
Index list indexing fibers in VertexArray in terms of vertex numbers.
std::shared_ptr< std::vector< float > > ColorArray
Colors for each vertex in VertexArray.
void replaceColorScheme(WDataSetFibers::ColorArray oldColors, WDataSetFibers::ColorArray newColors)
Replaces the specified old color scheme by the new color scheme.
WPosition getPosition(size_t fiber, size_t vertex) const
returns the position in space for a vertex of a given fiber
void removeColorScheme(WDataSetFibers::ColorArray colors)
This method removes the specified color scheme from the list and triggers an update.
void setLineParameters(std::vector< LineParemeterArray > parameters)
Set an array to be the list of line parameters.
LineParemeterArray getLineParameters(size_t parameterIndex=0) const
Get the parameter values for each line.
TangentArray getTangents() const
Returns an array containing the tangents of the fibers at the vertices.
VertexParemeterArray getVertexParameters(size_t parameterIndex=0) const
Get the parameter values for each vertex.
VertexArray getVertices() const
Getter for the lines' vertices.
void init()
This does the common initialisation of the constructors.
WFiberIterator const_iterator
Const iterator to go through fibers.
std::shared_ptr< std::vector< float > > TangentArray
Tangents at each vertex in VertexArray.
size_t size() const
Get number of tracts in this data set.
std::shared_ptr< std::vector< size_t > > LengthArray
Lengths of fibers in terms of vertices.
std::shared_ptr< const WDataSetFibers > ConstSPtr
Pointer to const dataset.
LengthArray getLineLengths() const
Return the number of vertices for all lines.
std::shared_ptr< WDataSetFibers > SPtr
Pointer to dataset.
std::shared_ptr< std::vector< double > > VertexParemeterArray
Parameter storage for each vertex.
std::vector< LineParemeterArray > m_lineParameters
Parameter array.
WFiber operator[](size_t numTract) const
Constructs a WFiber out of the given tract number.
const WPropSelection getColorSchemeProperty() const
Returns the property controlling the color scheme selection.
std::shared_ptr< std::vector< float > > VertexArray
List of vertex coordinates in term of components of vertices.
static std::shared_ptr< WPrototyped > m_prototype
The prototype as singleton.
IndexArray getLineStartIndexes() const
Return the indices that indicate at which vertex ID each line begins in the vertex array.
OW_API_DEPRECATED const_iterator end() const
Returns an iterator pointing beyond the last fiber.
std::vector< VertexParemeterArray > m_vertexParameters
Parameter array.
LengthArray m_lineLengths
Line vector that contains the number of vertices for each line.
IndexArray getVerticesReverse() const
Returns a reverse lookup table that allow do find out which vertex belongs to which line.
const std::shared_ptr< ColorScheme > getColorScheme() const
Convenience method returning the currently selected scheme.
WBoundingBox getBoundingBox() const
Get the bounding box.
IndexArray m_verticesReverse
Reverse lookup table for which point belongs to which fiber.
TangentArray m_tangents
Point vector for tangents at each vertex, used for fake tubes.
void setSelectedColorScheme(size_t idx)
Sets the selected color scheme.
WBoundingBox m_bb
Axis aligned bounding box for all tract-vertices of this dataset.
std::size_t getLengthOfLine(std::size_t fiber) const
Returns the number of points for a given fiber.
WDataSetFibers()
Constructs a new set of tracts.
WIteratorRange< WFiberIterator > fibers() const
Creates a range of iterators that allows for forward iteration of the fibers in this dataset.
virtual const std::string getName() const
Gets the name of this prototype.
size_t getNbVertices() const
Getter for the total number of vertices over all lines.
void setVertexParameters(std::vector< VertexParemeterArray > parameters)
Set the given array of parameters to be the vertex parameters of this fiber dataset.
virtual const std::string getDescription() const
Gets the description for this prototype.
std::shared_ptr< WItemSelection > m_colors
An array of color arrays.
static std::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
std::shared_ptr< std::vector< double > > LineParemeterArray
Parameter storage for each line.
OW_API_DEPRECATED const_iterator begin() const
Returns an iterator to the first fiber of the dataset.
IndexArray m_lineStartIndexes
Line vector that contains the start index of its first point for each line.
WFiberIterator iterator
Iterator to go through the fibers.
VertexArray m_vertices
Point vector for all fibers.
WPropSelection m_colorProp
Property keeping track of the active color in m_colors.
virtual bool isTexture() const
Determines whether this dataset can be used as a texture.
Base class for all data set types.
An iterator for fibers of a fiber dataset.
WFiberIterator operator-(size_t n) const
Minus operator.
OW_API_DEPRECATED WFiberPointsIterator begin()
Creates a point iterator for forward iteration, pointing to the first point of the fiber.
OW_API_DEPRECATED WFiberPointsIterator end()
Creates a point iterator for forward iteration, pointing beyond the last point of the fiber.
bool operator==(WFiberIterator const &rhs) const
Compare to another fiber iterator.
~WFiberIterator()
Destructor.
std::size_t numPoints() const
Returns the number of points of the current fiber.
OW_API_DEPRECATED WFiberSegmentsIterator srend()
Returns a backward iterator to the invalid segment before the first (i.e.
WIteratorRange< WFiberPointsIterator > pointsReverse() const
Creates a range of iterators that allows for reverse iteration of the points of the fiber this iterat...
WFiberIterator & operator=(WFiberIterator const &iter)
Copy operator.
std::size_t m_index
The current index in the fiber data.
OW_API_DEPRECATED WFiberPointsIterator rend()
Creates a point iterator for backward iteration, pointing beyond the first point of the fiber.
WIteratorRange< WFiberSegmentsIterator > segmentsReverse() const
Creates a range of iterators that allows for reverse iteration of the segments of the fiber this iter...
WIteratorRange< WFiberSegmentsIterator > segments() const
Creates a range of iterators that allows for forward iteration of the segments of the fiber this iter...
WIteratorRange< WFiberPointsIterator > points() const
Creates a range of iterators that allows for forward iteration of the points of the fiber this iterat...
std::size_t getLineStartIndex() const
Get the index in the point array where the points data starts for this line.
OW_API_DEPRECATED WFiberSegmentsIterator sbegin()
Returns a forward iterator to the first segment.
bool operator!=(WFiberIterator const &rhs) const
Compare to another fiber iterator.
WIteratorRangeUnpacker< WFiberIterator > operator,(WFiberIterator &other)
Creates a temporary object that is used to unpack an iterator range to two iterators.
OW_API_DEPRECATED WFiberSegmentsIterator send()
Returns a forward iterator to the invalid segment after the last (i.e.
double getFiberLength() const
The length of the line.
WDataSetFibers const * m_fibers
The pointer to the fibers.
WFiberIterator()
Constructor.
OW_API_DEPRECATED WFiberPointsIterator rbegin()
Creates a point iterator for backward iteration, pointing to the last point of the fiber.
WFiberIterator & operator++()
Increment operator.
WFiberIterator operator+(size_t n) const
Plus operator.
OW_API_DEPRECATED WFiberSegmentsIterator srbegin()
Returns a backward iterator to the last segment.
std::size_t getIndex() const
Get the index of the line.
WFiberIterator & operator--()
Decrement operator.
An iterator for iterating the points of a fiber.
bool m_reverse
Whether to iterate backwards.
WFiberPointsIterator operator+(size_t n)
Plus operator.
bool operator==(WFiberPointsIterator const &rhs) const
Compare to another point iterator.
std::size_t m_index
The index of the current point.
WPosition getTangent() const
The tangent of the point.
WFiberPointsIterator operator-(size_t n)
Minus operator.
WIteratorRangeUnpacker< WFiberPointsIterator > operator,(WFiberPointsIterator &other)
Creates a temporary object that is used to unpack an iterator range to two iterators.
WColor getColor() const
Return the color of the point.
WPosition operator*() const
Returns the coordinates of the point currently pointed to.
WFiberPointsIterator & operator=(WFiberPointsIterator const &iter)
Copy operator.
std::size_t m_fiberIndex
The index of the fiber.
bool operator!=(WFiberPointsIterator const &rhs) const
Compare to another point iterator.
std::size_t getBaseIndex() const
Calculates the index of this point in the dataset arrays.
WFiberPointsIterator & operator--()
Decrement operator.
WFiberPointsIterator & operator++()
Increment operator.
WFiberPointsIterator()
Default contructor.
double getParameter(double def=0.0, size_t parameterIndex=0) const
Returns the parameter specified in the vertex parameter array of the dataset.
~WFiberPointsIterator()
Destructor.
WDataSetFibers const * m_fibers
The pointer to the fibers.
An iterator for iterating the segments of a fiber.
WFiberPointsIterator start() const
Returns an iterator to the starting point of the segment.
WFiberSegmentsIterator & operator++()
Increment operator.
bool m_reverse
Whether to iterate backwards.
osg::Vec3 direction() const
Returns the vector from the starting point position to the end point position.
std::size_t m_index
The index of the current point.
WFiberSegmentsIterator()
Default contructor.
WFiberSegmentsIterator & operator--()
Decrement operator.
WIteratorRangeUnpacker< WFiberSegmentsIterator > operator,(WFiberSegmentsIterator &other)
Creates a temporary object that is used to unpack an iterator range to two iterators.
std::size_t m_fiberIndex
The index of the fiber.
double length() const
Returns the length of the segment.
~WFiberSegmentsIterator()
Destructor.
WFiberPointsIterator end() const
Returns an iterator to the end point of the segment.
bool operator!=(WFiberSegmentsIterator const &rhs) const
Compare to another segment iterator.
WFiberSegmentsIterator & operator=(WFiberSegmentsIterator const &iter)
Copy operator.
bool operator==(WFiberSegmentsIterator const &rhs) const
Compare to another segment iterator.
WDataSetFibers const * m_fibers
The pointer to the fibers.
Represents a neural pathway.
Class for keeping a single named item in a WItemSelection.
A temporary used to unpack an iterator range into two iterators.
This only is a 3d double vector.
#define OW_API_DEPRECATED
In order to mark functions for the compiler as deprecated we need to put this before each deprecated ...