OpenWalnut 1.2.5
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
WFiberCluster Class Reference

Represents a cluster of indices of a WDataSetFiberVector. More...

#include <WFiberCluster.h>

Inheritance diagram for WFiberCluster:

List of all members.

Public Member Functions

 WFiberCluster (size_t index)
 Constructs an cluster with one fiber and a reference to the fiber dataset to compute the intercluster distance.
 WFiberCluster (const WFiberCluster &other)
 Copies the specified WFiberCluster Instance.
 WFiberCluster ()
 Constructs an empty cluster.
virtual ~WFiberCluster ()
 Destructs.
bool empty () const
 Returns true if there are no fibers in that cluster, false otherwise.
void merge (WFiberCluster &other)
 Merge the fibers of the other cluster with the fibers of this cluster.
const std::list< size_t > & getIndices () const
 Returns a const reference of all indices inside this cluster.
void setIndices (const std::list< size_t > &indices)
 Reset the indices belonging to that cluster.
void sort ()
 Sort the indices of fibers associated with this cluster in ascending order.
size_t size () const
void clear ()
 Make this cluster empty.
void setColor (WColor color)
 Sets the color of which all fibers of this clusters should be painted with.
WColor getColor () const
 Gets the color of which all fibers of this clusters should be painted with.
virtual const std::string getName () const
 The only reason for implementing is here, to prevent this class from beeing abstract.
virtual const std::string getDescription () const
 The only reason for implementing is here, to prevent this class from beeing abstract.
bool operator== (const WFiberCluster &other) const
bool operator!= (const WFiberCluster &other) const
 The opposite of the operator==.
WFiberClusteroperator= (const WFiberCluster &other)
 Copy assignment operator which does NOT copy the mutex's!!!
boost::shared_ptr< WFibergetCenterLine () const
 Returns the center line of this cluster.
boost::shared_ptr< WFibergetLongestLine () const
 Returns the center line of this cluster.
void generateCenterLine () const
 Makes the hard work to compute the center line.
void generateLongestLine () const
 Makes the hard work to find the longest line.
WBoundingBox getBoundingBox () const
 Recomputes on every call the axis aligned bounding box incorporating all tracts in this cluster.

Protected Member Functions

void unifyDirection (boost::shared_ptr< WDataSetFiberVector > fibs) const
 Alings all fibers within the given dataset to be in one main direction.

Private Member Functions

void elongateCenterLine () const
 The centerline may be shortened due to the averaging of outliers.

Private Attributes

std::list< size_t > m_memberIndices
 All indices in this set are members of this cluster.
boost::shared_ptr< const
WDataSetFiberVector
m_fibs
 Reference to the real fibers of the brain this cluster belongs to.
WColor m_color
 Color which is used to paint the members of this cluster.
boost::shared_mutex * m_centerLineCreationLock
 Lock the modification in the m_centerLine mutable.
boost::shared_mutex * m_longestLineCreationLock
 Lock the modification in the m_longestLine mutable.
boost::shared_ptr< WFiberm_centerLine
 Average fiber for this cluster representing the main direction and curvature of this cluster.
boost::shared_ptr< WFiberm_longestLine
 The longest fiber in the dataset.

Friends

class WFiberClusterTest

Detailed Description

Represents a cluster of indices of a WDataSetFiberVector.

Definition at line 43 of file WFiberCluster.h.


Constructor & Destructor Documentation

WFiberCluster::WFiberCluster ( size_t  index) [explicit]

Constructs an cluster with one fiber and a reference to the fiber dataset to compute the intercluster distance.

Parameters:
indexThe index of the first fiber belonging to this cluster

Definition at line 53 of file WFiberCluster.cpp.

References m_memberIndices.

WFiberCluster::WFiberCluster ( const WFiberCluster other)

Copies the specified WFiberCluster Instance.

The copy does not contain a valid centerline or longest line.

Parameters:
otherthe other instance to clone.

Definition at line 61 of file WFiberCluster.cpp.

References m_centerLine, and m_longestLine.

WFiberCluster::WFiberCluster ( )

Constructs an empty cluster.

Definition at line 46 of file WFiberCluster.cpp.

WFiberCluster::~WFiberCluster ( ) [virtual]

Destructs.

Frees used locks/mutex.

Definition at line 83 of file WFiberCluster.cpp.

References m_centerLineCreationLock, and m_longestLineCreationLock.


Member Function Documentation

void WFiberCluster::clear ( ) [inline]

Make this cluster empty.

Note: The real fibers from fiber dataset are not deleted.

Definition at line 319 of file WFiberCluster.h.

References m_memberIndices.

Referenced by merge().

void WFiberCluster::elongateCenterLine ( ) const [private]

The centerline may be shortened due to the averaging of outliers.

To nevertheless color almost the whole bundle surface we need a surface parameterization (given via the centerline) upto the endings of the bundle. Therefore the centerline is stepwise elongated with the last known direction, until no perpendicular plane intersects any of the tracts inside of the bundle.

Definition at line 211 of file WFiberCluster.cpp.

References WPlane::getPosition(), m_centerLine, m_fibs, m_memberIndices, and WPlane::resetPosition().

Referenced by generateCenterLine().

bool WFiberCluster::empty ( ) const [inline]

Returns true if there are no fibers in that cluster, false otherwise.

Returns:
true if empty

Definition at line 304 of file WFiberCluster.h.

References m_memberIndices.

Referenced by WFiberClusterTest::testMerge().

void WFiberCluster::generateCenterLine ( ) const

Makes the hard work to compute the center line.

Definition at line 128 of file WFiberCluster.cpp.

References elongateCenterLine(), m_centerLine, m_fibs, m_memberIndices, and unifyDirection().

Referenced by getCenterLine().

void WFiberCluster::generateLongestLine ( ) const

Makes the hard work to find the longest line.

Definition at line 173 of file WFiberCluster.cpp.

References m_fibs, and m_longestLine.

Referenced by getLongestLine().

WBoundingBox WFiberCluster::getBoundingBox ( ) const

Recomputes on every call the axis aligned bounding box incorporating all tracts in this cluster.

Returns:
AABB as WBoundingBox.

Definition at line 379 of file WFiberCluster.cpp.

References WBoundingBoxImpl< VT >::expandBy(), m_fibs, and m_memberIndices.

boost::shared_ptr< WFiber > WFiberCluster::getCenterLine ( ) const

Returns the center line of this cluster.

The centerline gets calculated during the first call of this method.

Returns:
Reference to the center line

Definition at line 361 of file WFiberCluster.cpp.

References generateCenterLine(), and m_centerLine.

WColor WFiberCluster::getColor ( ) const [inline]

Gets the color of which all fibers of this clusters should be painted with.

Returns:
cluster color.

Definition at line 329 of file WFiberCluster.h.

References m_color.

const std::string WFiberCluster::getDescription ( ) const [inline, virtual]

The only reason for implementing is here, to prevent this class from beeing abstract.

Returns:
A name.

Implements WPrototyped.

Definition at line 339 of file WFiberCluster.h.

const std::list< size_t > & WFiberCluster::getIndices ( ) const [inline]

Returns a const reference of all indices inside this cluster.

Returns:
the index list

Definition at line 354 of file WFiberCluster.h.

References m_memberIndices.

boost::shared_ptr< WFiber > WFiberCluster::getLongestLine ( ) const

Returns the center line of this cluster.

The longest line gets calculated during the first call if this method.

Returns:
Reference to the longest line

Definition at line 370 of file WFiberCluster.cpp.

References generateLongestLine(), and m_longestLine.

const std::string WFiberCluster::getName ( ) const [inline, virtual]

The only reason for implementing is here, to prevent this class from beeing abstract.

Returns:
A name.

Implements WPrototyped.

Definition at line 334 of file WFiberCluster.h.

void WFiberCluster::merge ( WFiberCluster other)

Merge the fibers of the other cluster with the fibers of this cluster.

Afterwards the other cluster is empty.

Parameters:
otherThe other WFiberCluster which should merged into this one

Definition at line 89 of file WFiberCluster.cpp.

References clear(), m_centerLine, m_longestLine, and m_memberIndices.

Referenced by WFiberClusterTest::testMerge().

bool WFiberCluster::operator!= ( const WFiberCluster other) const [inline]

The opposite of the operator==.

Parameters:
otherThe other fiber which should be compared
Returns:
false If both clusters having same fibers IN SAME ORDER!

Definition at line 349 of file WFiberCluster.h.

References m_memberIndices.

WFiberCluster& WFiberCluster::operator= ( const WFiberCluster other) [inline]

Copy assignment operator which does NOT copy the mutex's!!!

Parameters:
otherThe instance to copy.
Returns:
itself

Definition at line 171 of file WFiberCluster.h.

References m_centerLine, m_color, m_fibs, m_longestLine, and m_memberIndices.

bool WFiberCluster::operator== ( const WFiberCluster other) const [inline]
Parameters:
otherThe other fiber which should be compared
Returns:
true If both clusters having same fibers IN SAME ORDER!

Definition at line 344 of file WFiberCluster.h.

References m_memberIndices.

void WFiberCluster::setColor ( WColor  color) [inline]

Sets the color of which all fibers of this clusters should be painted with.

Parameters:
colorThe color for all fibers of this cluster.

Definition at line 324 of file WFiberCluster.h.

References m_color.

void WFiberCluster::setIndices ( const std::list< size_t > &  indices) [inline]

Reset the indices belonging to that cluster.

Parameters:
indiceslist of indices

Definition at line 359 of file WFiberCluster.h.

References m_memberIndices.

size_t WFiberCluster::size ( ) const [inline]
Returns:
Number of fibers associated with this cluster.

Definition at line 314 of file WFiberCluster.h.

References m_memberIndices.

void WFiberCluster::sort ( ) [inline]

Sort the indices of fibers associated with this cluster in ascending order.

Definition at line 309 of file WFiberCluster.h.

References m_memberIndices.

void WFiberCluster::unifyDirection ( boost::shared_ptr< WDataSetFiberVector fibs) const [protected]

Alings all fibers within the given dataset to be in one main direction.

But Alignment only may swap the ordering of the fibers but not the positions or something similar. We need this only for the centerline generation.

Parameters:
fibsThe dataset

Definition at line 325 of file WFiberCluster.cpp.

References WMixinVector< ValueT >::at(), WMixinVector< ValueT >::back(), WMixinVector< ValueT >::front(), and WMixinVector< ValueT >::size().

Referenced by generateCenterLine().


Member Data Documentation

boost::shared_ptr< WFiber > WFiberCluster::m_centerLine [mutable, private]

Average fiber for this cluster representing the main direction and curvature of this cluster.

Notes:
This member is mutable as it needs to be modified during a const getter.

Definition at line 294 of file WFiberCluster.h.

Referenced by elongateCenterLine(), generateCenterLine(), getCenterLine(), merge(), operator=(), and WFiberCluster().

boost::shared_mutex* WFiberCluster::m_centerLineCreationLock [private]

Lock the modification in the m_centerLine mutable.

The lock is stored as pointer to avoid copy construction problems.

Definition at line 282 of file WFiberCluster.h.

Referenced by ~WFiberCluster().

WColor WFiberCluster::m_color [private]

Color which is used to paint the members of this cluster.

Definition at line 277 of file WFiberCluster.h.

Referenced by getColor(), operator=(), and setColor().

boost::shared_ptr< const WDataSetFiberVector > WFiberCluster::m_fibs [private]

Reference to the real fibers of the brain this cluster belongs to.

Definition at line 272 of file WFiberCluster.h.

Referenced by elongateCenterLine(), generateCenterLine(), generateLongestLine(), getBoundingBox(), and operator=().

boost::shared_ptr< WFiber > WFiberCluster::m_longestLine [mutable, private]

The longest fiber in the dataset.

Notes:
This member is mutable as it needs to be modified during a const getter.

Definition at line 301 of file WFiberCluster.h.

Referenced by generateLongestLine(), getLongestLine(), merge(), operator=(), and WFiberCluster().

boost::shared_mutex* WFiberCluster::m_longestLineCreationLock [private]

Lock the modification in the m_longestLine mutable.

The lock is stored as pointer to avoid copy construction problems.

Definition at line 287 of file WFiberCluster.h.

Referenced by ~WFiberCluster().

std::list< size_t > WFiberCluster::m_memberIndices [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends