25 #ifndef WFIBERCLUSTER_H
26 #define WFIBERCLUSTER_H
30 #include <shared_mutex>
34 #include <boost/thread.hpp>
36 #include "../../common/WColor.h"
37 #include "../../common/WTransferable.h"
38 #include "../WDataSetFiberVector.h"
51 typedef std::shared_ptr< WFiberCluster >
SPtr;
56 typedef std::shared_ptr< const WFiberCluster >
ConstSPtr;
83 WFiberCluster(
const IndexList& indices,
const WColor& color = WColor(), std::string
const& annotation = std::string() );
95 const WColor& color = WColor(), std::string
const& annotation = std::string() );
218 virtual const std::string
getName()
const;
251 WTransferable::operator=( other );
274 void setDataSetReference( std::shared_ptr< const WDataSetFiberVector > fibs );
275 std::shared_ptr< const WDataSetFiberVector > getDataSetReference()
const;
328 void unifyDirection( std::shared_ptr< WDataSetFiberVector > fibs )
const;
353 std::shared_ptr< const WDataSetFiberVector >
m_fibs;
447 return "FiberCluster";
452 return "A collection of indices for fibers representing a fiber cluster";
475 inline std::ostream& operator<<( std::ostream& os,
const WFiberCluster& c )
477 using string_utils::operator<<;
Unit test the WFiberCluster class.
Represents a cluster of indices of a WDataSetFiberVector.
bool operator==(const WFiberCluster &other) const
std::shared_ptr< WFiberCluster > SPtr
Shared pointer abbreviation.
std::shared_ptr< WFiber > m_centerLine
Average fiber for this cluster representing the main direction and curvature of this cluster.
std::shared_ptr< WFiber > m_longestLine
The longest fiber in the dataset.
IndexList m_memberIndices
All indices in this set are members of this cluster.
void elongateCenterLine() const
The centerline may be shortened due to the averaging of outliers.
WFiberCluster & operator=(const WFiberCluster &other)
Copy assignment operator which does NOT copy the mutex's!!!
virtual const std::string getName() const
The name of this transferable.
WColor m_color
Color which is used to paint the members of this cluster.
static std::shared_ptr< WPrototyped > m_prototype
Prototype for this dataset.
void clear()
Make this cluster empty.
void setMainDirection(osg::Vec3 mainDirection)
Sets the main direction of the cluster.
IndexList::const_iterator IndexListConstIterator
Const iterator on the index list.
virtual ~WFiberCluster()
Destructs.
std::shared_ptr< WFiber > getCenterLine() const
Returns the center line of this cluster.
WColor getColor() const
Gets the color of which all fibers of this clusters should be painted with.
std::list< size_t > IndexList
This is the list of indices of fibers.
osg::Vec3 getMainDirection() const
Gets the main direction of the cluster ( if set )
bool empty() const
Returns true if there are no fibers in that cluster, false otherwise.
virtual const std::string getDescription() const
The description of this transferable.
std::string const & getAnnotation() const
Get the annotation string.
void generateLongestLine() const
Makes the hard work to find the longest line.
std::shared_ptr< WFiber > getLongestLine() const
Returns the center line of this cluster.
std::shared_ptr< const WDataSetFiberVector > m_fibs
Reference to the real fibers of the brain this cluster belongs to.
static std::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
void setAnnotation(std::string const &anno)
Set the annotation for this fiber cluster.
std::string m_annotation
An annotation for the bundle, usually a name.
void setColor(WColor color)
Sets the color of which all fibers of this clusters should be painted with.
const IndexList & getIndices() const
Returns a const reference of all indices inside this cluster.
void merge(WFiberCluster &other)
Merge the fibers of the other cluster with the fibers of this cluster.
WFiberCluster()
Constructs an empty cluster.
void setIndices(const IndexList &indices)
Reset the indices belonging to that cluster.
void sort()
Sort the indices of fibers associated with this cluster in ascending order.
void unifyDirection(std::shared_ptr< WDataSetFiberVector > fibs) const
Alings all fibers within the given dataset to be in one main direction.
void generateCenterLine() const
Makes the hard work to compute the center line.
osg::Vec3 m_mainDirection
The cluster's main direction.
bool operator!=(const WFiberCluster &other) const
The opposite of the operator==.
std::shared_mutex * m_centerLineCreationLock
Lock the modification in the m_centerLine mutable.
std::shared_ptr< const WFiberCluster > ConstSPtr
Const shared pointer abbreviation.
std::shared_mutex * m_longestLineCreationLock
Lock the modification in the m_longestLine mutable.
WBoundingBox getBoundingBox() const
Recomputes on every call the axis aligned bounding box incorporating all tracts in this cluster.
Represents a neural pathway.
Class building the interface for classes that might be transferred using WModuleConnector.