OpenWalnut
1.3.1
|
Represents a simple set of WFibers. More...
#include <WDataSetFibers.h>
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 verties. | |
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. |
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 () | |
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. | |
ColorArray | getGlobalColors () const |
Reference to the vector storing the global colors. | |
ColorArray | getLocalColors () const |
Reference to the vector storing the local colors. | |
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. | |
![]() | |
WDataSet () | |
This constructor should be used if a dataSet does not stem from a file. | |
virtual | ~WDataSet () |
Since WDataSet is a base class and thus should be polymorphic we add virtual destructor. | |
void | setFilename (const std::string filename) |
Set the name of the file that this data set stems from. | |
std::string | getFilename () const |
Get the name of the file that this data set stems from. | |
OW_API_DEPRECATED void | setFileName (const std::string filename) |
Set the name of the file that this data set stems from. | |
OW_API_DEPRECATED std::string | getFileName () const |
Get the name of the file that this data set stems from. | |
virtual boost::shared_ptr < WDataSetVector > | isVectorDataSet () |
Checks if this dataset is a vector dataset. | |
virtual osg::ref_ptr < WDataTexture3D > | getTexture () const |
Returns the texture- representation of the dataset. | |
boost::shared_ptr< WProperties > | getProperties () const |
Return a pointer to the properties object of the dataset. | |
boost::shared_ptr< WProperties > | getInformationProperties () const |
Return a pointer to the information properties object of the dataset. | |
![]() | |
WTransferable () | |
Default constructor. | |
virtual | ~WTransferable () |
Destructor. | |
![]() | |
WPrototyped () | |
Default constructor. | |
virtual | ~WPrototyped () |
Destructor. | |
template<typename T > | |
bool | isA () |
Checks whether the actual prototype has the specified runtime type. |
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. | |
![]() | |
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< WItemSelection > | m_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. |
Additional Inherited Members | |
![]() | |
boost::shared_ptr< WProperties > | m_properties |
The property object for the dataset. | |
boost::shared_ptr< WProperties > | m_infoProperties |
The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". |
Represents a simple set of WFibers.
Definition at line 47 of file WDataSetFibers.h.
typedef boost::shared_ptr< std::vector< float > > WDataSetFibers::ColorArray |
Colors for each vertex in VertexArray.
Definition at line 84 of file WDataSetFibers.h.
typedef boost::shared_ptr< const WDataSetFibers > WDataSetFibers::ConstSPtr |
Pointer to const dataset.
Definition at line 59 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 69 of file WDataSetFibers.h.
typedef boost::shared_ptr< std::vector< size_t > > WDataSetFibers::LengthArray |
Lengths of fibers in terms of verties.
Definition at line 74 of file WDataSetFibers.h.
typedef boost::shared_ptr< WDataSetFibers > WDataSetFibers::SPtr |
Pointer to dataset.
Definition at line 54 of file WDataSetFibers.h.
typedef boost::shared_ptr< std::vector< float > > WDataSetFibers::TangentArray |
Tangents at each vertex in VertexArray.
Definition at line 79 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 64 of file WDataSetFibers.h.
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.
vertices | the vertices of the fibers, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme |
lineStartIndexes | the index in which the fiber start (index of the 3D-vertex, not the index of the float in the vertices vector) |
lineLengths | how many vertices belong to a fiber |
verticesReverse | stores for each vertex the index of the corresponding fiber |
boundingBox | The bounding box of the fibers (first minimum, second maximum). |
Definition at line 54 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.
vertices | the vertices of the fibers, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme |
lineStartIndexes | the index in which the fiber start (index of the 3D-vertex, not the index of the float in the vertices vector) |
lineLengths | how many vertices belong to a fiber |
verticesReverse | stores for each vertex the index of the corresponding fiber |
Definition at line 70 of file WDataSetFibers.cpp.
References WBoundingBoxImpl< VT >::expandBy(), init(), m_bb, and m_vertices.
WDataSetFibers::WDataSetFibers | ( | ) |
Constructs a new set of tracts.
The constructed instance is not usable but needed for prototype mechanism.
Definition at line 48 of file WDataSetFibers.cpp.
Referenced by getPrototype(), and WDataSetFiberVector::toWDataSetFibers().
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.
colors | the color array. Needs to have exactly getVertices()->size() items. |
name | name of the color scheme. Should be a telling name. |
description | description. How calculated and so on. |
Definition at line 216 of file WDataSetFibers.cpp.
References WDataSetFibers::ColorScheme::GRAY, m_colors, m_vertices, WDataSetFibers::ColorScheme::RGB, and WDataSetFibers::ColorScheme::RGBA.
WBoundingBox WDataSetFibers::getBoundingBox | ( | ) | const |
Get the bounding box.
Definition at line 333 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.
name | the name of the color scheme |
WDHNoSuchDataSet | if the name could not be found. |
Definition at line 271 of file WDataSetFibers.cpp.
References m_colors.
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.
idx | the index |
Definition at line 285 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.
Definition at line 291 of file WDataSetFibers.cpp.
References m_colorProp.
const WPropSelection WDataSetFibers::getColorSchemeProperty | ( | ) | const |
Returns the property controlling the color scheme selection.
Definition at line 296 of file WDataSetFibers.cpp.
References m_colorProp.
|
virtual |
Gets the description for this prototype.
Reimplemented from WDataSet.
Definition at line 166 of file WDataSetFibers.cpp.
WDataSetFibers::ColorArray WDataSetFibers::getGlobalColors | ( | ) | const |
Reference to the vector storing the global colors.
Definition at line 206 of file WDataSetFibers.cpp.
WDataSetFibers::LengthArray WDataSetFibers::getLineLengths | ( | ) | const |
Return the number of vertices for all lines.
Definition at line 191 of file WDataSetFibers.cpp.
References m_lineLengths.
WDataSetFibers::IndexArray WDataSetFibers::getLineStartIndexes | ( | ) | const |
Return the indices that indicate at which vertex ID each line begins in the vertex array.
Definition at line 186 of file WDataSetFibers.cpp.
References m_lineStartIndexes.
WDataSetFibers::ColorArray WDataSetFibers::getLocalColors | ( | ) | const |
Reference to the vector storing the local colors.
Definition at line 211 of file WDataSetFibers.cpp.
|
virtual |
Gets the name of this prototype.
Reimplemented from WDataSet.
Definition at line 161 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
fiber | Index of fiber |
vertex | Index of vertex in fiber. |
Definition at line 301 of file WDataSetFibers.cpp.
References m_lineStartIndexes, and m_vertices.
Referenced by getTangent().
|
static |
Returns a prototype instantiated with the true type of the deriving class.
Reimplemented from WDataSet.
Definition at line 171 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
fiber | Index of fiber |
vertex | Index of vertex in fiber |
Definition at line 308 of file WDataSetFibers.cpp.
References getPosition(), and m_lineLengths.
WDataSetFibers::TangentArray WDataSetFibers::getTangents | ( | ) | const |
Returns an array containing the tangents of the fibers at the vertices.
Definition at line 201 of file WDataSetFibers.cpp.
References m_tangents.
WDataSetFibers::VertexArray WDataSetFibers::getVertices | ( | ) | const |
Getter for the lines' vertices.
Definition at line 181 of file WDataSetFibers.cpp.
References m_vertices.
WDataSetFibers::IndexArray WDataSetFibers::getVerticesReverse | ( | ) | const |
Returns a reverse lookup table that allow do find out which vertex belongs to which line.
Definition at line 196 of file WDataSetFibers.cpp.
References m_verticesReverse.
|
private |
This does the common initialisation of the constructors.
Definition at line 90 of file WDataSetFibers.cpp.
References WPropertyHelper::PC_SELECTONLYONE::addTo(), WPropertyHelper::PC_NOTEMPTY::addTo(), m_colorProp, m_colors, m_lineLengths, m_lineStartIndexes, WDataSet::m_properties, m_tangents, m_vertices, WDataSetFibers::ColorScheme::RGB, WThreadedRunner::run(), size(), and WThreadedRunner::wait().
Referenced by WDataSetFibers().
|
virtual |
Determines whether this dataset can be used as a texture.
Reimplemented from WDataSet.
Definition at line 151 of file WDataSetFibers.cpp.
WFiber WDataSetFibers::operator[] | ( | size_t | numTract | ) | const |
Constructs a WFiber out of the given tract number.
numTract | Number of the tract to generate a WFiber object for |
Definition at line 338 of file WDataSetFibers.cpp.
References m_lineLengths, m_vertices, WMixinVector< ValueT >::push_back(), WMixinVector< ValueT >::reserve(), and size().
void WDataSetFibers::removeColorScheme | ( | WDataSetFibers::ColorArray | colors | ) |
This method removes the specified color scheme from the list and triggers an update.
colors | the color array. |
Definition at line 238 of file WDataSetFibers.cpp.
References m_colors.
void WDataSetFibers::replaceColorScheme | ( | WDataSetFibers::ColorArray | oldColors, |
WDataSetFibers::ColorArray | newColors | ||
) |
Replaces the specified old color scheme by the new color scheme.
If the old color scheme did not exist, nothing happens.
oldColors | old colors to remove |
newColors | new colors to set |
Definition at line 257 of file WDataSetFibers.cpp.
References m_colors, and WDataSetFibers::ColorScheme::setColor().
size_t WDataSetFibers::size | ( | ) | const |
Get number of tracts in this data set.
Definition at line 156 of file WDataSetFibers.cpp.
References m_lineStartIndexes.
Referenced by init(), and operator[]().
|
private |
Axis aligned bounding box for all tract-vertices of this dataset.
Definition at line 425 of file WDataSetFibers.h.
Referenced by getBoundingBox(), and WDataSetFibers().
|
private |
Property keeping track of the active color in m_colors.
Definition at line 403 of file WDataSetFibers.h.
Referenced by getColorScheme(), getColorSchemeProperty(), and init().
|
private |
An array of color arrays.
The first two elements are: 0: global color, 1: local color
Definition at line 398 of file WDataSetFibers.h.
Referenced by addColorScheme(), getColorScheme(), init(), removeColorScheme(), and replaceColorScheme().
|
private |
Line vector that contains the number of vertices for each line.
Definition at line 415 of file WDataSetFibers.h.
Referenced by getLineLengths(), getTangent(), init(), and operator[]().
|
private |
Line vector that contains the start index of its first point for each line.
Definition at line 410 of file WDataSetFibers.h.
Referenced by getLineStartIndexes(), getPosition(), init(), and size().
|
staticprotected |
The prototype as singleton.
Definition at line 375 of file WDataSetFibers.h.
Referenced by getPrototype().
|
private |
Point vector for tangents at each vertex, used for fake tubes.
Definition at line 391 of file WDataSetFibers.h.
Referenced by getTangents(), and init().
|
private |
Point vector for all fibers.
Definition at line 386 of file WDataSetFibers.h.
Referenced by addColorScheme(), getPosition(), getVertices(), init(), operator[](), and WDataSetFibers().
|
private |
Reverse lookup table for which point belongs to which fiber.
Definition at line 420 of file WDataSetFibers.h.
Referenced by getVerticesReverse().