29 #include "WMFibersToPoints.h"
30 #include "core/common/WPropertyHelper.h"
31 #include "core/common/math/WMath.h"
32 #include "core/dataHandler/WDataHandler.h"
33 #include "core/kernel/WKernel.h"
60 return "Fibers To Points";
65 return "This module converts fiber data to points by using the fiber vertex points and colors.";
71 m_fiberInput = std::shared_ptr< WModuleInputData < WDataSetFibers > >(
79 m_pointsOutput = std::shared_ptr< WModuleOutputData < WDataSetPoints > >(
96 std::string(
"Your data cannot be filtered due to missing parameters." ) );
132 std::shared_ptr< WDataSetFibers > dataSet =
m_fiberInput->getData();
133 bool dataValid = ( dataSet != NULL );
146 if( dataValid && dataUpdated )
148 if( dataSet->getVertexParameters() )
152 for( WDataSetFibers::VertexParemeterArray::element_type::const_iterator it = dataSet->getVertexParameters()->begin();
153 it != dataSet->getVertexParameters()->end(); ++it )
173 if( dataValid && !dataUpdated && !propsChanged )
182 debugLog() <<
"Creating point data. Num Points = " << dataSet->getVertices()->size() / 3 <<
".";
199 for(
size_t idx = 0; idx < fibVerts->size() / 3; ++idx )
201 if( isInClosed( interval, fibParams->operator[]( idx ) ) )
203 filteredBB.
expandBy( fibVerts->operator[]( idx * 3 + 0 ),
204 fibVerts->operator[]( idx * 3 + 1 ),
205 fibVerts->operator[]( idx * 3 + 2 ) );
207 filteredVerts->push_back( fibVerts->operator[]( idx * 3 + 0 ) );
208 filteredVerts->push_back( fibVerts->operator[]( idx * 3 + 1 ) );
209 filteredVerts->push_back( fibVerts->operator[]( idx * 3 + 2 ) );
211 filteredColors->push_back(
m_color->get().x() );
212 filteredColors->push_back(
m_color->get().y() );
213 filteredColors->push_back(
m_color->get().z() );
214 filteredColors->push_back(
m_color->get().w() );
222 filteredVerts = fibVerts;
223 filteredColors = fibColors;
224 filteredBB = dataSet->getBoundingBox();
228 debugLog() <<
"Done filtering. Result are " << filteredVerts->size() / 3 <<
" points.";
void expandBy(const WBoundingBoxImpl< VT > &bb)
Expands this bounding box to include the given bounding box.
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.
std::shared_ptr< std::vector< float > > ColorArray
Colors for each vertex in VertexArray.
std::shared_ptr< std::vector< double > > VertexParemeterArray
Parameter storage for each vertex.
std::shared_ptr< std::vector< float > > VertexArray
List of vertex coordinates in term of components of vertices.
Dataset to store a bunch of points without order or topology.
std::shared_ptr< WDataSetPoints > SPtr
Pointer to dataset.
This modules takes a fiber dataset and extracts its vertices to build a point dataset.
double m_parameterMax
fiber parameter max
virtual ~WMFibersToPoints()
Destructor.
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...
WPropDouble m_parametersFilterValue
Filter fib point according to its parameter value and this value.
WPropString m_paramHint
A string which informs the user whether filtering is possible.
std::shared_ptr< WModuleOutputData< WDataSetPoints > > m_pointsOutput
The output connector used to provide the calculated point data to other modules.
double m_parameterMin
fiber parameter min
virtual void moduleMain()
Entry point after loading the module.
virtual const std::string getDescription() const
Gives back a description of this module.
WPropDouble m_parametersFilterWidth
Filter width.
virtual const std::string getName() const
Gives back the name of this module.
virtual void properties()
Initialize the properties for this module.
WMFibersToPoints()
Default constructor.
WPropGroup m_filterGroup
Group contains the filtering options.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void connectors()
Initialize the connectors this module is using.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
std::shared_ptr< WModuleInputData< WDataSetFibers > > m_fiberInput
The fiber dataset which is going to be used.
WPropColor m_color
The color to use for the resulting points.
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.
void addConnector(std::shared_ptr< WModuleInputConnector > con)
Adds the specified connector to the list of inputs.
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.
Class managing progress inside of modules.
std::shared_ptr< WProgress > SPtr
Shared pointer on a WProgress.
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.