29 #include "WMFiberFilterROI.h"
30 #include "core/kernel/WKernel.h"
54 return "Fiber Filter ROI";
60 return "This module provides fiber data filtered by the current ROI configuration.";
69 "A cluster dataset splitting the input data into two clusters: the selected fibers and the rest." );
106 std::shared_ptr< WDataSetFibers > dataSet =
m_input->getData();
107 bool dataValid = ( dataSet != NULL );
108 bool dataChanged = dataSet !=
m_fibers;
118 debugLog() <<
"Received new data. Creating new selector.";
121 debugLog() <<
"Data changed. Recalculating output.";
141 std::shared_ptr< std::vector< bool > > active =
m_fiberSelector->getBitfield();
142 std::shared_ptr< std::vector< float > > vertices(
new std::vector< float >() );
143 std::shared_ptr< std::vector< size_t > > lineStartIndexes(
new std::vector< size_t >() );
144 std::shared_ptr< std::vector< size_t > > lineLengths(
new std::vector< size_t >() );
145 std::shared_ptr< std::vector< size_t > > verticesReverse(
new std::vector< size_t >() );
147 std::shared_ptr< WProgress > progress1(
new WProgress(
"Filtering", active->size() ) );
150 size_t countLines = 0;
151 for(
size_t l = 0; l < active->size(); ++l )
155 size_t pc =
m_fibers->getLineStartIndexes()->at( l ) * 3;
157 lineStartIndexes->push_back( vertices->size() / 3 );
158 lineLengths->push_back(
m_fibers->getLineLengths()->at( l ) );
160 for(
size_t j = 0; j <
m_fibers->getLineLengths()->at( l ); ++j )
162 vertices->push_back(
m_fibers->getVertices()->at( pc ) );
164 vertices->push_back(
m_fibers->getVertices()->at( pc ) );
166 vertices->push_back(
m_fibers->getVertices()->at( pc ) );
168 verticesReverse->push_back( countLines );
174 std::shared_ptr< WDataSetFibers> newOutput(
new WDataSetFibers( vertices, lineStartIndexes, lineLengths, verticesReverse,
179 progress1 = std::shared_ptr< WProgress >(
new WProgress(
"Create Clustering", active->size() ) );
186 for(
size_t l = 0; l < active->size(); ++l )
200 if( cl0->size() > 0 )
201 clustering->setCluster( 0, cl0 );
202 if( cl1->size() > 0 )
203 clustering->setCluster( 1, cl1 );
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
Class to encapsulate boost::condition_variable_any.
This is a dataset which represent a clustering of fibers.
Represents a simple set of WFibers.
Represents a cluster of indices of a WDataSetFiberVector.
Adaptor class between the roi manager and the fiber display.
std::shared_ptr< WFiberSelector > SPtr
Fiber selector pointer.
This module is intended to allow the user to filter a fiber dataset using the current ROI config.
std::shared_ptr< WModuleOutputData< WDataSetFiberClustering > > m_clusterOutput
The output connector for the resulting clustering.
WFiberSelector::SPtr m_fiberSelector
Selector for the current fiber data or NULL of none.
virtual const std::string getName() const
Gives back the name of this module.
virtual void properties()
Initialize the properties for this module.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual ~WMFiberFilterROI()
Destructor.
virtual void connectors()
Initialize the connectors this module is using.
void updateOutput()
Updates the output using the ROI configuration.
WMFiberFilterROI()
Default constructor.
std::shared_ptr< WModuleInputData< WDataSetFibers > > m_input
An input for the fiber data.
std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_fiberOutput
The output connector for the filtered data.
WPropTrigger m_aTrigger
Trigger output update.
WDataSetFibers::SPtr m_fibers
Fiber data.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
virtual void moduleMain()
Entry point after loading the module.
Class offering an instantiate-able data connection between modules.
Class representing a single module of OpenWalnut.
virtual void properties()
Initialize properties in this function.
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
std::shared_ptr< WProperties > m_properties
The property object for the module.
void ready()
Call this whenever your module is ready and can react on property changes.
WConditionSet m_moduleState
The internal state of the module.
std::shared_ptr< WProgressCombiner > m_progress
Progress indicator used as parent for all progress' of this module.
virtual void connectors()
Initialize connectors in this function.
void waitRestored()
This method waits for the module to be restored completely.
Class managing progress inside of modules.
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
@ PV_TRIGGER_TRIGGERED
Trigger property: got triggered.
@ PV_TRIGGER_READY
Trigger property: is ready to be triggered (again)