31 #include "../../common/WStringUtils.h"
32 #include "../../common/WTransferable.h"
33 #include "../../common/datastructures/WUnionFind.h"
34 #include "../../common/exceptions/WNotImplemented.h"
35 #include "../WValueSet.h"
36 #include "WJoinContourTree.h"
45 m_elementIndices( dataset->getValueSet()->size() ),
46 m_joinTree( dataset->getValueSet()->size() ),
47 m_lowestVoxel( dataset->getValueSet()->size() )
49 if( dataset->getValueSet()->order() != 0 || dataset->getValueSet()->dimension() != 1 )
51 throw WNotImplemented( std::string(
"ATM there is only support for scalar fields" ) );
53 m_valueSet = std::dynamic_pointer_cast< WValueSet< double > >( dataset->getValueSet() );
56 throw WNotImplemented( std::string(
"ATM there is only support for scalar fields with doubles as scalars" ) );
58 m_grid = std::dynamic_pointer_cast< WGridRegular3D >( dataset->getGrid() );
61 throw WNotImplemented( std::string(
"Only WGridRegular3D is supported, despite that its not a simplicial mesh!" ) );
81 for(
size_t i = 0; i <
m_joinTree.size(); ++i )
85 std::vector< size_t >::const_iterator n = neighbours.begin();
86 for( ; n != neighbours.end(); ++n )
104 std::shared_ptr< std::vector< size_t > > result(
new std::vector< size_t >(
m_elementIndices ) );
122 if(
m_valueSet->getScalar( target ) >= isoValue )
132 : m_valueSet( valueSet )
Comperator for indirect sort so the value set is not modified.
bool operator()(size_t i, size_t j)
Compares the isovalue of the elments with index i and j.
IndirectCompare(std::shared_ptr< WValueSet< double > > valueSet)
Since we must have access to the value set we need a reference to it.
Processes a dataset for join tree computation.
std::vector< size_t > m_elementIndices
Stores the component number for the i'th vertex in the value set.
std::vector< size_t > m_lowestVoxel
Stores the index of lowest element for the i'th component.
std::vector< size_t > m_joinTree
For each index stores which node it is connected to.
std::shared_ptr< WGridRegular3D > m_grid
Stores the reference to the grid of the given dataset to get the neighbours of a voxel.
void buildJoinTree()
Build the join tree.
WJoinContourTree(std::shared_ptr< WDataSetSingle > dataset)
Initialize this with a data set for which the join tree should be computed.
static std::shared_ptr< WPrototyped > m_prototype
The prototype as singleton.
static std::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
void sortIndexArray()
Sort the indices on their element value of the value set in descending order.
std::shared_ptr< std::set< size_t > > getVolumeVoxelsEnclosedByIsoSurface(const double isoValue) const
For a given isovalue all the voxel which are enclosed by the biggest isosurface are computed.
std::shared_ptr< WValueSet< double > > m_valueSet
Stores reference to the isovalues, so we may sort them indirect on their value.
Indicates invalid element access of a container.
Class building the interface for classes that might be transferred using WModuleConnector.
Implements a very simple union-find datastructure aka disjoint_sets.
std::shared_ptr< std::set< size_t > > getMaxSet()
Computes the set with maximum number of elements.
void merge(size_t i, size_t j)
Merges two components (iow: makes a union) where the given elements are members of.
size_t find(size_t x)
Find the canonical element of the given element and do path compression.
Base Class for all value set types.