Commit 4e2b4077 authored by schurade's avatar schurade

[CHANGE] mode for thinning out the dendrogram

parent 529b9096
......@@ -30,10 +30,11 @@
/**
* Class implements a dendrogram as an osg geode
*/
WDendrogram::WDendrogram( WHierarchicalTree* tree, size_t cluster, float xSize, float ySize, float xOffset, float yOffset ) :
WDendrogram::WDendrogram( WHierarchicalTree* tree, size_t cluster, size_t minClusterSize, float xSize, float ySize, float xOffset, float yOffset ) :
osg::Geode(),
m_tree( tree ),
m_rootCluster( cluster ),
m_minClusterSize( minClusterSize ),
m_xSize( xSize ),
m_ySize( ySize ),
m_xOff( xOffset ),
......@@ -99,7 +100,7 @@ void WDendrogram::layout( size_t cluster, float left, float right )
float rightHeight = m_tree->getLevel( rightCluster );
float rightSize = static_cast<float>( m_tree->size( rightCluster ) );
if ( ( leftSize / rightSize ) > 100. )
if ( ( leftSize >= m_minClusterSize ) && ( rightSize < m_minClusterSize ) )
//if ( rightSize < 2 )
{
// left cluster is much bigger, draw only left
......@@ -114,7 +115,7 @@ void WDendrogram::layout( size_t cluster, float left, float right )
layout( leftCluster, left, right );
}
else if ( ( rightSize / leftSize ) > 100. )
else if ( ( rightSize >= m_minClusterSize ) && ( leftSize < m_minClusterSize ) )
//else if ( leftSize < 2 )
{
// right cluster is much bigger, draw only right
......
......@@ -44,13 +44,14 @@ public:
*
* \param tree reference to the tree object to work on
* \param cluster root cluster for the dendrogram
* \param minClusterSize minimum for cluster to be drawn, when i the whole tree is drawn
* \param xSize number of pixel to scale the tree on along the x axis
* \param ySize number of pixel to scale the tree on along the y axis
* \param xOffset translation alogn the x axis
* \param yOffset translation alogn the y axis
*
*/
WDendrogram( WHierarchicalTree* tree, size_t cluster, float xSize = 1000.f, float ySize = 500.f, float xOffset = 0.0f, float yOffset = 0.0f );
WDendrogram( WHierarchicalTree* tree, size_t cluster, size_t minClusterSize = 1, float xSize = 1000.f, float ySize = 500.f, float xOffset = 0.0f, float yOffset = 0.0f );
/**
* destructor
......@@ -83,6 +84,8 @@ private:
osg::DrawElementsUInt* m_lineArray; //!< line array
size_t m_minClusterSize; //!< minimum cluster size to be considered while laying out the dendrogram
float m_xSize; //!< x size in pixel of the final dendrogram
float m_ySize; //!< y size in pixel of the final dendrogram
float m_xOff; //!< x offset
......
......@@ -395,11 +395,16 @@ void WMClusterDisplay::moduleMain()
handleBiggestClustersChanged();
}
if ( m_propSubLevelsToColor->changed() || m_propMinSizeToColor->changed() )
if ( m_propSubLevelsToColor->changed() )
{
handleColoringChanged();
}
if ( m_propMinSizeToColor->changed() )
{
handleMinSizeChanged();
}
if ( m_propBoxClusterRatio->changed() || m_propMaxSubClusters->changed() )
{
handleRoiChanged();
......@@ -434,7 +439,7 @@ void WMClusterDisplay::handleSelectedClusterChanged()
WKernel::getRunningKernel()->getRoiManager()->setExternalBitfield( m_tree.getOutputBitfield( m_rootCluster ) );
m_propSubLevelsToColor->setMax( m_tree.getLevel( m_rootCluster ) );
colorClusters( m_propSelectedCluster->get( true ) );
m_dendrogramDirty = true;
}
......@@ -516,6 +521,11 @@ void WMClusterDisplay::handleColoringChanged()
m_dendrogramDirty = true;
}
void WMClusterDisplay::handleMinSizeChanged()
{
m_dendrogramDirty = true;
}
void WMClusterDisplay::handleRoiChanged()
{
if ( m_active->get() )
......@@ -642,7 +652,7 @@ void WMClusterDisplay::updateWidgets()
if ( m_propShowDendrogram->get( true ) )
{
m_dendrogramGeode = new WDendrogram( &m_tree, m_rootCluster, width - 120, height / 2 , 100 );
m_dendrogramGeode = new WDendrogram( &m_tree, m_rootCluster, m_propMinSizeToColor->get(), width - 120, height / 2 , 100 );
m_camera->addChild( m_dendrogramGeode );
}
m_dendrogramDirty = false;
......
......@@ -174,6 +174,12 @@ private:
*/
void handleColoringChanged();
/**
* function to handle user input
*/
void handleMinSizeChanged();
/**
* function to handle user input
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment