OpenWalnut  1.4.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes
WDataSetFibers Class Reference

Represents a simple set of WFibers. More...

#include <WDataSetFibers.h>

+ Inheritance diagram for WDataSetFibers:

List of all members.

Classes

class  ColorScheme
 Item used in the selection below also containing color info. More...

Public Types

typedef boost::shared_ptr
< WDataSetFibers
SPtr
 Pointer to dataset.
typedef boost::shared_ptr
< const WDataSetFibers
ConstSPtr
 Pointer to const dataset.
typedef boost::shared_ptr
< std::vector< float > > 
VertexArray
 List of vertex coordinates in term of components of vertices.
typedef boost::shared_ptr
< std::vector< size_t > > 
IndexArray
 Index list indexing fibers in VertexArray in terms of vertex numbers.
typedef boost::shared_ptr
< std::vector< size_t > > 
LengthArray
 Lengths of fibers in terms of vertices.
typedef boost::shared_ptr
< std::vector< float > > 
TangentArray
 Tangents at each vertex in VertexArray.
typedef boost::shared_ptr
< std::vector< float > > 
ColorArray
 Colors for each vertex in VertexArray.
typedef boost::shared_ptr
< std::vector< double > > 
VertexParemeterArray
 Parameter storage for each vertex.
typedef WFiberIterator iterator
 Iterator to go through the fibers.
typedef WFiberIterator const_iterator
 Const iterator to go through fibers.

Public Member Functions

 WDataSetFibers (boost::shared_ptr< std::vector< float > >vertices, boost::shared_ptr< std::vector< size_t > > lineStartIndexes, boost::shared_ptr< std::vector< size_t > > lineLengths, boost::shared_ptr< std::vector< size_t > > verticesReverse, WBoundingBox boundingBox)
 Constructs a new set of fibers.
 WDataSetFibers (boost::shared_ptr< std::vector< float > >vertices, boost::shared_ptr< std::vector< size_t > > lineStartIndexes, boost::shared_ptr< std::vector< size_t > > lineLengths, boost::shared_ptr< std::vector< size_t > > verticesReverse)
 Constructs a new set of fibers.
 WDataSetFibers (boost::shared_ptr< std::vector< float > >vertices, boost::shared_ptr< std::vector< size_t > > lineStartIndexes, boost::shared_ptr< std::vector< size_t > > lineLengths, boost::shared_ptr< std::vector< size_t > > verticesReverse, WBoundingBox boundingBox, VertexParemeterArray vertexParameters)
 Constructs a new set of fibers.
 WDataSetFibers (boost::shared_ptr< std::vector< float > >vertices, boost::shared_ptr< std::vector< size_t > > lineStartIndexes, boost::shared_ptr< std::vector< size_t > > lineLengths, boost::shared_ptr< std::vector< size_t > > verticesReverse, VertexParemeterArray vertexParameters)
 Constructs a new set of fibers.
 WDataSetFibers ()
 Constructs a new set of tracts.
size_t size () const
 Get number of tracts in this data set.
virtual bool isTexture () const
 Determines whether this dataset can be used as a texture.
virtual const std::string getName () const
 Gets the name of this prototype.
virtual const std::string getDescription () const
 Gets the description for this prototype.
VertexArray getVertices () const
 Getter for the lines' vertices.
IndexArray getLineStartIndexes () const
 Return the indices that indicate at which vertex ID each line begins in the vertex array.
LengthArray getLineLengths () const
 Return the number of vertices for all lines.
IndexArray getVerticesReverse () const
 Returns a reverse lookup table that allow do find out which vertex belongs to which line.
TangentArray getTangents () const
 Returns an array containing the tangents of the fibers at the vertices.
VertexParemeterArray getVertexParameters () const
 Get the parameter values for each vertex.
void addColorScheme (WDataSetFibers::ColorArray colors, std::string name, std::string description)
 This method adds a new color scheme to the list of available colors.
void removeColorScheme (WDataSetFibers::ColorArray colors)
 This method removes the specified color scheme from the list and triggers an update.
void replaceColorScheme (WDataSetFibers::ColorArray oldColors, WDataSetFibers::ColorArray newColors)
 Replaces the specified old color scheme by the new color scheme.
const boost::shared_ptr
< ColorScheme
getColorScheme (std::string name) const
 Get the color scheme with the specified name.
const boost::shared_ptr
< ColorScheme
getColorScheme (size_t idx) const
 Get the color scheme with the specified ID.
const boost::shared_ptr
< ColorScheme
getColorScheme () const
 Convenience method returning the currently selected scheme.
const WPropSelection getColorSchemeProperty () const
 Returns the property controlling the color scheme selection.
WPosition getPosition (size_t fiber, size_t vertex) const
 returns the position in space for a vertex of a given fiber
WPosition getTangent (size_t fiber, size_t vertex) const
 calculates the tangent for a point on the fiber
WBoundingBox getBoundingBox () const
 Get the bounding box.
WFiber operator[] (size_t numTract) const
 Constructs a WFiber out of the given tract number.
const_iterator begin () const
 Returns an iterator to the first fiber of the dataset.
const_iterator end () const
 Returns an iterator pointing beyond the last fiber.

Static Public Member Functions

static boost::shared_ptr
< WPrototyped
getPrototype ()
 Returns a prototype instantiated with the true type of the deriving class.

Static Protected Attributes

static boost::shared_ptr
< WPrototyped
m_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton.

Private Member Functions

void init ()
 This does the common initialisation of the constructors.

Private Attributes

VertexArray m_vertices
 Point vector for all fibers.
TangentArray m_tangents
 Point vector for tangents at each vertex, used for fake tubes.
boost::shared_ptr< WItemSelectionm_colors
 An array of color arrays.
WPropSelection m_colorProp
 Property keeping track of the active color in m_colors.
IndexArray m_lineStartIndexes
 Line vector that contains the start index of its first point for each line.
LengthArray m_lineLengths
 Line vector that contains the number of vertices for each line.
IndexArray m_verticesReverse
 Reverse lookup table for which point belongs to which fiber.
WBoundingBox m_bb
 Axis aligned bounding box for all tract-vertices of this dataset.
VertexParemeterArray m_vertexParameters
 Parameter array.

Detailed Description

Represents a simple set of WFibers.

Definition at line 51 of file WDataSetFibers.h.


Member Typedef Documentation

typedef boost::shared_ptr< std::vector< float > > WDataSetFibers::ColorArray

Colors for each vertex in VertexArray.

Definition at line 88 of file WDataSetFibers.h.

Const iterator to go through fibers.

As the WFiberIterators does not allow any modifications per-se, the const iterator and the standard iterator are the same.

Definition at line 104 of file WDataSetFibers.h.

typedef boost::shared_ptr< const WDataSetFibers > WDataSetFibers::ConstSPtr

Pointer to const dataset.

Reimplemented from WDataSet.

Definition at line 63 of file WDataSetFibers.h.

typedef boost::shared_ptr< std::vector< size_t > > WDataSetFibers::IndexArray

Index list indexing fibers in VertexArray in terms of vertex numbers.

Definition at line 73 of file WDataSetFibers.h.

Iterator to go through the fibers.

Definition at line 98 of file WDataSetFibers.h.

typedef boost::shared_ptr< std::vector< size_t > > WDataSetFibers::LengthArray

Lengths of fibers in terms of vertices.

Definition at line 78 of file WDataSetFibers.h.

typedef boost::shared_ptr< WDataSetFibers > WDataSetFibers::SPtr

Pointer to dataset.

Reimplemented from WDataSet.

Definition at line 58 of file WDataSetFibers.h.

typedef boost::shared_ptr< std::vector< float > > WDataSetFibers::TangentArray

Tangents at each vertex in VertexArray.

Definition at line 83 of file WDataSetFibers.h.

typedef boost::shared_ptr< std::vector< float > > WDataSetFibers::VertexArray

List of vertex coordinates in term of components of vertices.

Definition at line 68 of file WDataSetFibers.h.

typedef boost::shared_ptr< std::vector< double > > WDataSetFibers::VertexParemeterArray

Parameter storage for each vertex.

Definition at line 93 of file WDataSetFibers.h.


Constructor & Destructor Documentation

WDataSetFibers::WDataSetFibers ( boost::shared_ptr< std::vector< float > >  vertices,
boost::shared_ptr< std::vector< size_t > >  lineStartIndexes,
boost::shared_ptr< std::vector< size_t > >  lineLengths,
boost::shared_ptr< std::vector< size_t > >  verticesReverse,
WBoundingBox  boundingBox 
)

Constructs a new set of fibers.

Parameters:
verticesthe vertices of the fibers, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
lineStartIndexesthe index in which the fiber start (index of the 3D-vertex, not the index of the float in the vertices vector)
lineLengthshow many vertices belong to a fiber
verticesReversestores for each vertex the index of the corresponding fiber
boundingBoxThe bounding box of the fibers (first minimum, second maximum).

Definition at line 51 of file WDataSetFibers.cpp.

References init(), and m_vertices.

WDataSetFibers::WDataSetFibers ( boost::shared_ptr< std::vector< float > >  vertices,
boost::shared_ptr< std::vector< size_t > >  lineStartIndexes,
boost::shared_ptr< std::vector< size_t > >  lineLengths,
boost::shared_ptr< std::vector< size_t > >  verticesReverse 
)

Constructs a new set of fibers.

This constructor determines the bounding box by using the coordinates of the vertices.

Parameters:
verticesthe vertices of the fibers, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
lineStartIndexesthe index in which the fiber start (index of the 3D-vertex, not the index of the float in the vertices vector)
lineLengthshow many vertices belong to a fiber
verticesReversestores for each vertex the index of the corresponding fiber

Definition at line 67 of file WDataSetFibers.cpp.

References WBoundingBoxImpl< VT >::expandBy(), init(), m_bb, and m_vertices.

WDataSetFibers::WDataSetFibers ( boost::shared_ptr< std::vector< float > >  vertices,
boost::shared_ptr< std::vector< size_t > >  lineStartIndexes,
boost::shared_ptr< std::vector< size_t > >  lineLengths,
boost::shared_ptr< std::vector< size_t > >  verticesReverse,
WBoundingBox  boundingBox,
WDataSetFibers::VertexParemeterArray  vertexParameters 
)

Constructs a new set of fibers.

Parameters:
verticesthe vertices of the fibers, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
lineStartIndexesthe index in which the fiber start (index of the 3D-vertex, not the index of the float in the vertices vector)
lineLengthshow many vertices belong to a fiber
verticesReversestores for each vertex the index of the corresponding fiber
boundingBoxThe bounding box of the fibers (first minimum, second maximum).
vertexParametersoptional per-vertex scalar.

Definition at line 87 of file WDataSetFibers.cpp.

References init(), and m_vertices.

WDataSetFibers::WDataSetFibers ( boost::shared_ptr< std::vector< float > >  vertices,
boost::shared_ptr< std::vector< size_t > >  lineStartIndexes,
boost::shared_ptr< std::vector< size_t > >  lineLengths,
boost::shared_ptr< std::vector< size_t > >  verticesReverse,
WDataSetFibers::VertexParemeterArray  vertexParameters 
)

Constructs a new set of fibers.

This constructor determines the bounding box by using the coordinates of the vertices.

Parameters:
verticesthe vertices of the fibers, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
lineStartIndexesthe index in which the fiber start (index of the 3D-vertex, not the index of the float in the vertices vector)
lineLengthshow many vertices belong to a fiber
verticesReversestores for each vertex the index of the corresponding fiber
vertexParametersoptional per-vertex scalar.

Definition at line 105 of file WDataSetFibers.cpp.

References WBoundingBoxImpl< VT >::expandBy(), init(), m_bb, and m_vertices.

Constructs a new set of tracts.

The constructed instance is not usable but needed for prototype mechanism.

Definition at line 45 of file WDataSetFibers.cpp.

Referenced by getPrototype().


Member Function Documentation

void WDataSetFibers::addColorScheme ( WDataSetFibers::ColorArray  colors,
std::string  name,
std::string  description 
)

This method adds a new color scheme to the list of available colors.

The color scheme needs to have a name and description to allow the user to identify which color has which meaning. If the specified color array already exists, only an update is triggered and the name and description is ignored. It detects the type of colors by its size.

Parameters:
colorsthe color array. Needs to have exactly getVertices()->size() items.
namename of the color scheme. Should be a telling name.
descriptiondescription. How calculated and so on.

Definition at line 244 of file WDataSetFibers.cpp.

References WDataSetFibers::ColorScheme::GRAY, m_colors, m_vertices, WDataSetFibers::ColorScheme::RGB, and WDataSetFibers::ColorScheme::RGBA.

Returns an iterator to the first fiber of the dataset.

The iterator does not allow any modification of the data.

Returns:
An iterator to the first fiber.

Definition at line 385 of file WDataSetFibers.cpp.

Returns an iterator pointing beyond the last fiber.

The iterator does not allow any modification of the data.

Returns:
An iterator pointing beyond the last fiber.

Definition at line 390 of file WDataSetFibers.cpp.

References m_lineLengths.

Get the bounding box.

Returns:
The bounding box of all lines.

Definition at line 366 of file WDataSetFibers.cpp.

References m_bb.

const boost::shared_ptr< WDataSetFibers::ColorScheme > WDataSetFibers::getColorScheme ( std::string  name) const

Get the color scheme with the specified name.

If it is not found, an exception gets thrown.

Parameters:
namethe name of the color scheme
Returns:
the color scheme
Exceptions:
WDHNoSuchDataSetif the name could not be found.

Definition at line 299 of file WDataSetFibers.cpp.

References m_colors.

Referenced by WFiberPointsIterator::getColor().

const boost::shared_ptr< WDataSetFibers::ColorScheme > WDataSetFibers::getColorScheme ( size_t  idx) const

Get the color scheme with the specified ID.

If the index is invalid, an exception gets thrown.

Parameters:
idxthe index
Returns:
the color scheme

Definition at line 313 of file WDataSetFibers.cpp.

References m_colors.

const boost::shared_ptr< WDataSetFibers::ColorScheme > WDataSetFibers::getColorScheme ( ) const

Convenience method returning the currently selected scheme.

This is a comfortable alternative to using the color scheme selection property.

Returns:
the current active color scheme

Definition at line 319 of file WDataSetFibers.cpp.

References m_colorProp.

const WPropSelection WDataSetFibers::getColorSchemeProperty ( ) const

Returns the property controlling the color scheme selection.

Returns:
the property.

Definition at line 324 of file WDataSetFibers.cpp.

References m_colorProp.

const std::string WDataSetFibers::getDescription ( ) const [virtual]

Gets the description for this prototype.

Returns:
the description

Reimplemented from WDataSet.

Definition at line 204 of file WDataSetFibers.cpp.

Return the number of vertices for all lines.

Returns:
The numbers of all lines' vertices

Definition at line 229 of file WDataSetFibers.cpp.

References m_lineLengths.

Referenced by WFiberPointsIterator::getBaseIndex(), and WFiberIterator::numPoints().

Return the indices that indicate at which vertex ID each line begins in the vertex array.

Returns:
The start indices of the lines

Definition at line 224 of file WDataSetFibers.cpp.

References m_lineStartIndexes.

Referenced by WFiberPointsIterator::getBaseIndex(), and WFiberIterator::getLineStartIndex().

const std::string WDataSetFibers::getName ( ) const [virtual]

Gets the name of this prototype.

Returns:
the name.

Reimplemented from WDataSet.

Definition at line 199 of file WDataSetFibers.cpp.

WPosition WDataSetFibers::getPosition ( size_t  fiber,
size_t  vertex 
) const

returns the position in space for a vertex of a given fiber

Parameters:
fiberIndex of fiber
vertexIndex of vertex in fiber.
Returns:
Position of the given vertex of the also given fiber

Definition at line 334 of file WDataSetFibers.cpp.

References m_lineStartIndexes, and m_vertices.

Referenced by getTangent().

boost::shared_ptr< WPrototyped > WDataSetFibers::getPrototype ( ) [static]

Returns a prototype instantiated with the true type of the deriving class.

Returns:
the prototype.

Reimplemented from WDataSet.

Definition at line 209 of file WDataSetFibers.cpp.

References m_prototype, and WDataSetFibers().

WPosition WDataSetFibers::getTangent ( size_t  fiber,
size_t  vertex 
) const

calculates the tangent for a point on the fiber

Parameters:
fiberIndex of fiber
vertexIndex of vertex in fiber
Returns:
Tangent of the given vertex of the also given fiber

Definition at line 341 of file WDataSetFibers.cpp.

References getPosition(), and m_lineLengths.

Returns an array containing the tangents of the fibers at the vertices.

Returns:
The tangents of the fibers.

Definition at line 239 of file WDataSetFibers.cpp.

References m_tangents.

Referenced by WFiberPointsIterator::getTangent().

Get the parameter values for each vertex.

Same indexing as vertices. Used to store additional scalar values for each vertex.

Returns:
the array. Can be NULL.

Definition at line 329 of file WDataSetFibers.cpp.

References m_vertexParameters.

Referenced by WFiberPointsIterator::getParameter().

Getter for the lines' vertices.

Returns:
The vertices of the lines

Definition at line 219 of file WDataSetFibers.cpp.

References m_vertices.

Referenced by WFiberPointsIterator::operator*().

Returns a reverse lookup table that allow do find out which vertex belongs to which line.

Returns:
Lookup table from vertices to lines.

Definition at line 234 of file WDataSetFibers.cpp.

References m_verticesReverse.

void WDataSetFibers::init ( ) [private]
bool WDataSetFibers::isTexture ( ) const [virtual]

Determines whether this dataset can be used as a texture.

Returns:
true if usable as texture.

Reimplemented from WDataSet.

Definition at line 189 of file WDataSetFibers.cpp.

WFiber WDataSetFibers::operator[] ( size_t  numTract) const

Constructs a WFiber out of the given tract number.

Parameters:
numTractNumber of the tract to generate a WFiber object for
Returns:
The WFiber object. Attention: copy by value!

Definition at line 371 of file WDataSetFibers.cpp.

References m_lineLengths, m_vertices, WMixinVector< ValueT >::push_back(), WMixinVector< ValueT >::reserve(), and size().

This method removes the specified color scheme from the list and triggers an update.

Parameters:
colorsthe color array.

Definition at line 266 of file WDataSetFibers.cpp.

References m_colors.

Replaces the specified old color scheme by the new color scheme.

If the old color scheme did not exist, nothing happens.

Parameters:
oldColorsold colors to remove
newColorsnew colors to set

Definition at line 285 of file WDataSetFibers.cpp.

References m_colors, and WDataSetFibers::ColorScheme::setColor().

Get number of tracts in this data set.

Returns:
number of fibers

Definition at line 194 of file WDataSetFibers.cpp.

References m_lineStartIndexes.

Referenced by init(), and operator[]().


Member Data Documentation

Axis aligned bounding box for all tract-vertices of this dataset.

Definition at line 482 of file WDataSetFibers.h.

Referenced by getBoundingBox(), and WDataSetFibers().

WPropSelection WDataSetFibers::m_colorProp [private]

Property keeping track of the active color in m_colors.

Definition at line 460 of file WDataSetFibers.h.

Referenced by getColorScheme(), getColorSchemeProperty(), and init().

boost::shared_ptr< WItemSelection > WDataSetFibers::m_colors [private]

An array of color arrays.

The first two elements are: 0: global color, 1: local color

Definition at line 455 of file WDataSetFibers.h.

Referenced by addColorScheme(), getColorScheme(), init(), removeColorScheme(), and replaceColorScheme().

Line vector that contains the number of vertices for each line.

Definition at line 472 of file WDataSetFibers.h.

Referenced by end(), getLineLengths(), getTangent(), init(), and operator[]().

Line vector that contains the start index of its first point for each line.

Warning:
The index returned cannot be used in the vertices array until the number of components for each point is multiplied.

Definition at line 467 of file WDataSetFibers.h.

Referenced by getLineStartIndexes(), getPosition(), and size().

boost::shared_ptr< WPrototyped > WDataSetFibers::m_prototype = boost::shared_ptr< WPrototyped >() [static, protected]

The prototype as singleton.

Reimplemented from WDataSet.

Definition at line 434 of file WDataSetFibers.h.

Referenced by getPrototype().

Point vector for tangents at each vertex, used for fake tubes.

Definition at line 450 of file WDataSetFibers.h.

Referenced by getTangents(), and init().

Parameter array.

Used to store additional scalar values for each vertex.

Definition at line 487 of file WDataSetFibers.h.

Referenced by getVertexParameters().

Point vector for all fibers.

Definition at line 445 of file WDataSetFibers.h.

Referenced by addColorScheme(), getPosition(), getVertices(), init(), operator[](), and WDataSetFibers().

Reverse lookup table for which point belongs to which fiber.

Definition at line 477 of file WDataSetFibers.h.

Referenced by getVerticesReverse().


The documentation for this class was generated from the following files: