30 #include "WMFiberFilterIndex.h"
31 #include "core/kernel/WKernel.h"
55 return "Fiber Filter Index";
61 return "This module provides fiber data filtered by fiber index.";
105 std::shared_ptr< WDataSetFibers > dataSet =
m_input->getData();
106 bool dataValid = ( dataSet != NULL );
107 bool dataChanged = dataSet !=
m_fibers;
117 debugLog() <<
"Data changed. Recalculating output.";
133 std::shared_ptr< std::vector< float > > vertices(
new std::vector< float >() );
134 std::shared_ptr< std::vector< size_t > > lineStartIndexes(
new std::vector< size_t >() );
135 std::shared_ptr< std::vector< size_t > > lineLengths(
new std::vector< size_t >() );
136 std::shared_ptr< std::vector< size_t > > verticesReverse(
new std::vector< size_t >() );
139 std::shared_ptr< WProgress > progress1(
new WProgress(
"Filtering" ) );
147 errorLog() <<
"Index invalid: " << idx <<
" - data has only " <<
m_fibers->size() <<
" lines.";
152 bool hasAttribs = (
m_fibers->getVertexParameters() != NULL );
155 size_t startIdx =
m_fibers->getStartIndex( idx );
156 size_t startIdx3 = 3 * startIdx;
157 size_t len =
m_fibers->getLengthOfLine( idx );
158 size_t len3 = 3 * len;
161 vertices->resize( len * 3 );
162 std::copy(
m_fibers->getVertices()->begin() + startIdx3,
m_fibers->getVertices()->begin() + startIdx3 + len3, vertices->begin() );
168 std::copy(
m_fibers->getVertexParameters()->begin() + startIdx,
m_fibers->getVertexParameters()->begin() + startIdx + len,
169 vertexParameter->begin() );
178 vertices->push_back( vertices->at( 3 ) );
179 vertices->push_back( vertices->at( 4 ) );
180 vertices->push_back( vertices->at( 5 ) );
184 vertexParameter->push_back( vertexParameter->at( 1 ) );
189 lineStartIndexes->push_back( 0 );
190 lineLengths->push_back( len );
191 verticesReverse->resize( len, 0 );
194 std::shared_ptr< WDataSetFibers> newOutput(
new WDataSetFibers( vertices, lineStartIndexes, lineLengths, verticesReverse, vertexParameter ) );
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.
Represents a simple set of WFibers.
std::shared_ptr< std::vector< double > > VertexParemeterArray
Parameter storage for each vertex.
This module is intended to allow the user to filter a fiber dataset using the current ROI config.
void updateOutput()
Updates the output using the ROI configuration.
std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output
The output connector for the filtered 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...
WDataSetFibers::SPtr m_fibers
Fiber data.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual const std::string getName() const
Gives back the name of this module.
std::shared_ptr< WModuleInputData< WDataSetFibers > > m_input
An input for the fiber data.
virtual void properties()
Initialize the properties for this module.
virtual void moduleMain()
Entry point after loading the module.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
virtual void connectors()
Initialize the connectors this module is using.
WMFiberFilterIndex()
Default constructor.
WPropInt m_indexProp
Trigger output update.
virtual ~WMFiberFilterIndex()
Destructor.
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.
wlog::WStreamedLogger errorLog() const
Logger instance for comfortable error logging.
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.