25 #ifndef WDATASETFIBERS_H
26 #define WDATASETFIBERS_H
33 #include <boost/shared_ptr.hpp>
36 #include <boost/tuple/tuple.hpp>
39 #include "../common/math/linearAlgebra/WPosition.h"
40 #include "../common/WBoundingBox.h"
41 #include "../common/WProperties.h"
62 typedef boost::shared_ptr< WDataSetFibers >
SPtr;
67 typedef boost::shared_ptr< const WDataSetFibers >
ConstSPtr;
72 typedef boost::shared_ptr< std::vector< float > >
VertexArray;
77 typedef boost::shared_ptr< std::vector< size_t > >
IndexArray;
82 typedef boost::shared_ptr< std::vector< size_t > >
LengthArray;
92 typedef boost::shared_ptr< std::vector< float > >
ColorArray;
198 WDataSetFibers( boost::shared_ptr< std::vector< float > >vertices,
199 boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
200 boost::shared_ptr< std::vector< size_t > > lineLengths,
201 boost::shared_ptr< std::vector< size_t > > verticesReverse,
212 WDataSetFibers( boost::shared_ptr< std::vector< float > >vertices,
213 boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
214 boost::shared_ptr< std::vector< size_t > > lineLengths,
215 boost::shared_ptr< std::vector< size_t > > verticesReverse );
227 WDataSetFibers( boost::shared_ptr< std::vector< float > >vertices,
228 boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
229 boost::shared_ptr< std::vector< size_t > > lineLengths,
230 boost::shared_ptr< std::vector< size_t > > verticesReverse,
232 VertexParemeterArray vertexParameters );
243 WDataSetFibers( boost::shared_ptr< std::vector< float > >vertices,
244 boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
245 boost::shared_ptr< std::vector< size_t > > lineLengths,
246 boost::shared_ptr< std::vector< size_t > > verticesReverse,
247 VertexParemeterArray vertexParameters );
272 virtual const std::string
getName()
const;
359 const boost::shared_ptr< ColorScheme >
getColorScheme( std::string name )
const;
368 const boost::shared_ptr< ColorScheme >
getColorScheme(
size_t idx )
const;
425 const_iterator
begin()
const;
432 const_iterator
end()
const;
780 WColor
getColor( std::size_t idx )
const;
791 WColor
getColor( std::string name )
const;
802 WColor
getColor(
const boost::shared_ptr< WDataSetFibers::ColorScheme > scheme )
const;
829 #endif // WDATASETFIBERS_H
WFiberPointsIterator & operator--()
Decrement operator.
double getParameter(double def=0.0) const
Returns the parameter specified in the vertex parameter array of the dataset.
VertexArray m_vertices
Point vector for all fibers.
Represents a simple set of WFibers.
bool m_reverse
Whether to iterate backwards.
ColorScheme(std::string name, std::string description, const char **icon, ColorArray color, ColorMode mode=RGB)
Constructor.
virtual bool isTexture() const
Determines whether this dataset can be used as a texture.
ColorMode getMode() const
Returns the mode of the color scheme.
Represents a neural pathway.
Base class for all data set types.
WFiberPointsIterator & operator=(WFiberPointsIterator const &iter)
Copy operator.
const_iterator end() const
Returns an iterator pointing beyond the last fiber.
static boost::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
WFiberIterator & operator++()
Increment operator.
boost::shared_ptr< const WDataSetFibers > ConstSPtr
Pointer to const dataset.
virtual const std::string getName() const
Gets the name of this prototype.
ColorMode m_mode
Coloring mode.
Item used in the selection below also containing color info.
bool operator!=(WFiberIterator const &rhs) const
Compare to another fiber iterator.
std::size_t m_index
The index of the current point.
WPosition getPosition(size_t fiber, size_t vertex) const
returns the position in space for a vertex of a given fiber
WDataSetFibers const * m_fibers
The pointer to the fibers.
WFiberPointsIterator rbegin()
Creates a point iterator for backward iteration, pointing to the last point of the fiber...
~WFiberIterator()
Destructor.
std::size_t getBaseIndex() const
Calculates the index of this point in the dataset arrays.
WFiberIterator const_iterator
Const iterator to go through fibers.
This only is a 3d double vector.
VertexParemeterArray m_vertexParameters
Parameter array.
ColorArray getColor() const
Get the color.
WPropSelection m_colorProp
Property keeping track of the active color in m_colors.
WDataSetFibers const * m_fibers
The pointer to the fibers.
virtual const std::string getDescription() const
Gets the description for this prototype.
WBoundingBox getBoundingBox() const
Get the bounding box.
void replaceColorScheme(WDataSetFibers::ColorArray oldColors, WDataSetFibers::ColorArray newColors)
Replaces the specified old color scheme by the new color scheme.
void removeColorScheme(WDataSetFibers::ColorArray colors)
This method removes the specified color scheme from the list and triggers an update.
void setColor(ColorArray color, ColorMode mode=RGB)
Sets the color array for this item.
boost::shared_ptr< WDataSetFibers > SPtr
Pointer to dataset.
const boost::shared_ptr< ColorScheme > getColorScheme() const
Convenience method returning the currently selected scheme.
std::size_t m_index
The current index in the fiber data.
WPosition getTangent(size_t fiber, size_t vertex) const
calculates the tangent for a point on the fiber
LengthArray m_lineLengths
Line vector that contains the number of vertices for each line.
~WFiberPointsIterator()
Destructor.
const WPropSelection getColorSchemeProperty() const
Returns the property controlling the color scheme selection.
WFiberIterator & operator=(WFiberIterator const &iter)
Copy operator.
std::size_t numPoints() const
Returns the number of points of the current fiber.
TangentArray getTangents() const
Returns an array containing the tangents of the fibers at the vertices.
WFiberPointsIterator begin()
Creates a point iterator for forward iteration, pointing to the first point of the fiber...
WPosition getTangent() const
The tangent of the point.
const_iterator begin() const
Returns an iterator to the first fiber of the dataset.
bool operator==(WFiberIterator const &rhs) const
Compare to another fiber iterator.
WFiberIterator iterator
Iterator to go through the fibers.
std::size_t m_fiberIndex
The index of the fiber.
bool operator==(WFiberPointsIterator const &rhs) const
Compare to another point iterator.
An iterator for fibers of a fiber dataset.
WPosition operator*()
Returns the coordinates of the point currently pointed to.
bool operator!=(WFiberPointsIterator const &rhs) const
Compare to another point iterator.
boost::shared_ptr< std::vector< float > > VertexArray
List of vertex coordinates in term of components of vertices.
std::size_t getIndex() const
Get the index of the line.
IndexArray getVerticesReverse() const
Returns a reverse lookup table that allow do find out which vertex belongs to which line...
WDataSetFibers()
Constructs a new set of tracts.
WFiberPointsIterator rend()
Creates a point iterator for backward iteration, pointing beyond the first point of the fiber...
IndexArray getLineStartIndexes() const
Return the indices that indicate at which vertex ID each line begins in the vertex array...
boost::shared_ptr< std::vector< float > > ColorArray
Colors for each vertex in VertexArray.
std::size_t getLineStartIndex() const
Get the index in the point array where the points data starts for this line.
boost::shared_ptr< WItemSelection > m_colors
An array of color arrays.
boost::shared_ptr< std::vector< size_t > > LengthArray
Lengths of fibers in terms of vertices.
boost::shared_ptr< std::vector< float > > TangentArray
Tangents at each vertex in VertexArray.
ColorMode
different kinds of color arrays can be used in this class.
void init()
This does the common initialisation of the constructors.
WFiberPointsIterator()
Default contructor.
static boost::shared_ptr< WPrototyped > m_prototype
The prototype as singleton.
ColorArray m_color
The color array associated with the item.
LengthArray getLineLengths() const
Return the number of vertices for all lines.
boost::shared_ptr< std::vector< double > > VertexParemeterArray
Parameter storage for each vertex.
WFiberPointsIterator end()
Creates a point iterator for forward iteration, pointing beyond the last point of the fiber...
boost::shared_ptr< std::vector< size_t > > IndexArray
Index list indexing fibers in VertexArray in terms of vertex numbers.
void addColorScheme(WDataSetFibers::ColorArray colors, std::string name, std::string description)
This method adds a new color scheme to the list of available colors.
WColor getColor() const
Return the color of the point.
WFiberIterator & operator--()
Decrement operator.
VertexParemeterArray getVertexParameters() const
Get the parameter values for each vertex.
WFiberPointsIterator & operator++()
Increment operator.
WBoundingBox m_bb
Axis aligned bounding box for all tract-vertices of this dataset.
IndexArray m_lineStartIndexes
Line vector that contains the start index of its first point for each line.
Class for keeping a single named item in a WItemSelection.
size_t size() const
Get number of tracts in this data set.
IndexArray m_verticesReverse
Reverse lookup table for which point belongs to which fiber.
WFiberIterator()
Constructor.
VertexArray getVertices() const
Getter for the lines' vertices.
WFiber operator[](size_t numTract) const
Constructs a WFiber out of the given tract number.
TangentArray m_tangents
Point vector for tangents at each vertex, used for fake tubes.
An iterator for iterating the points of a fiber.