OpenWalnut  1.5.0dev
WMHierchClustDisplay.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 //---------------------------------------------------------------------------
26 //
27 // Project: hClustering
28 //
29 // Whole-Brain Connectivity-Based Hierarchical Parcellation Project
30 // David Moreno-Dominguez
31 // d.mor.dom@gmail.com
32 // moreno@cbs.mpg.de
33 // www.cbs.mpg.de/~moreno//
34 // This file is also part of OpenWalnut ( http://www.openwalnut.org ).
35 //
36 // hClustering is free software: you can redistribute it and/or modify
37 // it under the terms of the GNU Lesser General Public License as published by
38 // the Free Software Foundation, either version 3 of the License, or
39 // (at your option) any later version.
40 // http://creativecommons.org/licenses/by-nc/3.0
41 //
42 // hClustering is distributed in the hope that it will be useful,
43 // but WITHOUT ANY WARRANTY; without even the implied warranty of
44 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 // GNU Lesser General Public License for more details.
46 //
47 //---------------------------------------------------------------------------
48 
49 #ifndef WMHIERCHCLUSTDISPLAY_H
50 #define WMHIERCHCLUSTDISPLAY_H
51 
52 #include <map>
53 #include <memory>
54 #include <queue>
55 #include <string>
56 #include <vector>
57 
58 #include <osg/Geode>
59 #include <osgGA/GUIEventAdapter>
60 #include <osgGA/GUIEventHandler>
61 
62 #include "WHtree.h"
63 #include "WHtreePartition.h"
64 #include "WHtreeProcesser.h"
65 #include "WNonBinDendroGeode.h"
66 #include "core/dataHandler/WDataHandler.h"
67 #include "core/dataHandler/WDataSetScalar.h"
68 #include "core/dataHandler/WDataSetVector.h"
69 #include "core/dataHandler/WSubject.h"
70 #include "core/dataHandler/WValueSet.h"
71 #include "core/graphicsEngine/WGEGeodeUtils.h"
72 #include "core/graphicsEngine/WGEManagedGroupNode.h"
73 #include "core/graphicsEngine/WGETexture.h"
74 #include "core/graphicsEngine/shaders/WGEShader.h"
75 #include "core/graphicsEngine/widgets/WOSGButton.h"
76 #include "core/kernel/WModule.h"
77 #include "core/kernel/WModuleInputData.h"
78 #include "core/kernel/WModuleOutputData.h"
79 
80 const unsigned int MASK_2D = 0xF0000000; //!< used for osgWidget processes
81 const unsigned int MASK_3D = 0x0F000000; //!< used for osgWidget processes
82 
83 
84 /**
85  * Module to explore hierarchical parcellations of brain data
86  * The module loads a tree file from disk, and allows tree processing, visualization of seed voxel locations onto anatomy image
87  * exploration of the hierarchical tree, partition selection, and along with partition2Mesh module the projection of partitions
88  * back to the brain surface
89  *
90  * \ingroup modules
91  */
93 {
94 public:
95  //! Constructor
97 
98  //! Destructor
99  virtual ~WMHierchClustDisplay();
100 
101  //! Gives back the name of this module.
102  //! \return the module's name.
103  virtual const std::string getName() const;
104 
105  //! Gives back a description of this module.
106  //! \return module description.
107  virtual const std::string getDescription() const;
108 
109  /**
110  * new instance of this module
111  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
112  * should never be initialized or modified in some other way. A simple new instance is required.
113  * \return the prototype used to create every module in OpenWalnut.
114  */
115  virtual std::shared_ptr< WModule > factory() const;
116 
117 protected:
118  //! Entry point after loading the module. Runs in separate thread.
119  virtual void moduleMain();
120 
121  //! Initialize the connectors this module is using.
122  virtual void connectors();
123 
124  //! Initialize the properties for this module.
125  virtual void properties();
126 
127 private:
128  // === PRIVATE MEMBER FUNCTIONS ===
129  /**
130  * Small event handler class to catch left mouse buttons clicks in the main view.
131  */
132  class MainViewEventHandler : public osgGA::GUIEventHandler
133  {
134  public:
135  //! signal from a mouse button being clicked
136  typedef boost::signals2::signal< bool ( WVector2f ) > mouseClickSignalType;
137 
138  /**
139  * The OSG calls this function whenever a new event has occured.
140  *
141  * \param ea Event class for storing GUI events such as mouse or keyboard interation etc.
142  *
143  * \return true if the event was handled.
144  */
145  bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& /* aa */ );
146 
147  /**
148  * Registers a function slot to LEFT BUTTON PUSH events. Whenever the event occurs, the slot is called with current parameters.
149  *
150  * \param slot Function object having the appropriate signature according to the used SignalType.
151  */
152  void subscribeLeftButtonPush( mouseClickSignalType::slot_type slot );
153 
154  /**
155  * Registers a function slot to RIGHT BUTTON PUSH events. Whenever the event occurs, the slot is called with current parameters.
156  *
157  * \param slot Function object having the appropriate signature according to the used SignalType.
158  */
159  void subscribeRightButtonPush( mouseClickSignalType::slot_type slot );
160 
161  private:
162  /**
163  * Signal used for notification of the LEFT BUTTON PUSH event.
164  */
166  /**
167  * Signal used for notification of the RIGHT BUTTON PUSH event.
168  */
170  };
171 
172 
173 
174  /**
175  * updates property min/max values after loading a clustering file
176  */
177  void initProperties();
178 
179  /**
180  * loads the tree file into the tree object
181  * \param treeFile the tree file path
182  * \return true if the tree was successfully loaded, false otherwise
183  */
184  bool loadTree( boost::filesystem::path treeFile );
185 
186  /**
187  * initializes properties depending on the specific tree structure loaded
188  */
189  void initTreeData();
190 
191  /**
192  * recursive function that fills the display colors for a whole branch with a selected color
193  * \param root cluster to work on
194  * \param color color to paint
195  */
196  void colorBranch( const size_t &root, const WColor &color );
197 
198  /**
199  * recursive function that fills the display colors for a whole branch with a custom color from a scheme previously generated
200  * \param root cluster to work on
201  * \param color color to paint
202  */
203  void colorBranchCustom( const size_t &root, const WColor &color );
204 
205  /**
206  * creates a texture, assigning the colouring of the current partition to the respective seed voxels in the
207  * displayed anatomy texture. (makes the partitioning visivle in the slide view (usually T1 )
208  */
209  void initTexture();
210 
211  /**
212  * renders the triangulated seed voxels
213  */
214  void renderCubeMesh();
215 
216  /**
217  * inits the graphical widgets in the 3d scene
218  */
219  void initWidgets();
220 
221  /**
222  * updates the graphical widgets in the 3d scene
223  */
224  void updateWidgets();
225 
226  /**
227  * handles mouse clicks into the dendrogram
228  * \return true if handled
229  */
231 
232  /**
233  * handles clicks into the dendrogram
234  * \param pos the mouse position during the click
235  * \return true if it handled the click
236  */
237  bool dendrogramClick( const WVector2f& pos );
238  //DEPRECATED void dendrogramClick( WPickInfo pickInfo );
239 
240  /**
241  * handles right clicks into the dendrogram
242  * \param pos the mouse position during the click
243  * \return true if it handled the click
244  */
245  bool dendrogramClickRight( const WVector2f& pos );
246 
247  /**
248  * after the active cluster list has changed this function updates the texture, cubeMesh, dendrogram and output
249  * \param preloadedColors a vector with cluster colors preloaded form the tree file
250  */
251  void updateSelection( const std::vector< WColor > &preloadedColors = std::vector< WColor >() );
252 
253  /**
254  * updates the selection colors
255  */
256  void updateColors();
257 
258  /**
259  * updates the voxels coordinate output
260  */
261  void updateOutput2();
262 
263  /**
264  * writes partition selection(s) in an ascii file
265  */
266  void writePartition();
267 
268  /**
269  * Assigns a default color to each node travelling the tree top-down based on dividing first the biggest cluster
270  * where the biggest children keeps the color of the parent basing the algorithm on cluster size
271  */
272  void initializeColorsSize();
273 
274  /**
275  * Assigns a default color to each node travelling the tree top-down based on hierarchy
276  * where the biggest children keeps the color of the parent basing the algorithm on cluster size
277  */
278  void initializeColorsHdist();
279 
280  /**
281  * Uses the provided node Id and color to update the current tree default coloring using hierarchical information
282  * up: each parent node will be recolored to this color as long as it is the biggest of the children
283  * down: the biggest child at each division will be also recolored to this
284  * \param thisID ID of the reference node
285  * \param thisColor color of the reference node
286  */
287  void assignColorHierch( const size_t thisID, const WColor thisColor );
288 
289  /**
290  * manages cluster selection action response
291  */
292  void clusterSelection();
293 
294  /**
295  * manages action after the trigger of the color section has been pressed
296  */
297  void colorAction();
298 
299  /**
300  * Adds partitions form current selections into the tree object
301  */
302  void addPartitions();
303 
304  /**
305  * recolors added partitions from the tree object with current selection set of colors
306  */
307  void recolorPartitions();
308 
309  // === PRIVATE MEMBER DATA ===
310 
311  std::shared_ptr< WModuleInputData< WDataSetSingle > > m_input; //!< An input connector that accepts order 1 datasets.
312  std::shared_ptr< WModuleOutputData< WDataSetVector > > m_output; //!< An output connector for the output scalar dsataset
313  std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output2; //!< An output connector for the output coordinate vector.
314  std::shared_ptr< WDataSetVector > m_outData; //!< This is a pointer to the current output1.
315  std::shared_ptr< WDataSetScalar > m_outData2; //!< This is a pointer to the current output2.
316 
317  osgWidget::WindowManager* m_wm; //!< stores a pointer to the window manager used for osg wdgets and overlay stuff
318  osg::Camera* m_camera; //!< stores the camera object
319  int m_oldViewHeight; //!< stores the old viewport resolution height to check whether a resize happened
320  int m_oldViewWidth; //!< stores the old viewport resolution width to check whether a resize happened
321 
322  osg::ref_ptr< WGEGroupNode > m_moduleNode; //!< Pointer to the modules group node.
323  osg::ref_ptr< WGEGroupNode > m_dendrogramNode; //!< Pointer to the dendrogram group node.
324  osg::ref_ptr< WGEGroupNode > m_meshNode; //!< Pointer to the cube mesh group node.
325 
326  /**
327  * The shader
328  */
329  osg::ref_ptr< WGEShader > m_shader;
330 
331  std::shared_ptr< WDataSetSingle > m_anatomy; //!< This is a pointer to the anatomy dataset the module is currently working on.
332  osg::ref_ptr<osg::Texture3D> m_texture; //!< stores a pointer to the texture we paint in (to overlay to anatomy)
333  std::vector< size_t >m_textureLabels; //!< label vector for texture creation
334  std::shared_ptr< WGridRegular3D > m_grid; //!< stores a pointer to the grid we use;
335 
336  WHtree m_tree; //!< stores the tree object as loaded from file;
337  bool m_treeDirty; //!< true if the dendrogram needs redrawing
338  bool m_labelsDirty; //!< true if the labels need redrawing
339  size_t m_treeZoomRoot; //!< control variable for tree zoom mode
340 
341  WNonBinDendroGeode* m_dendrogramGeode; //!< stores the dendrogram geode
342  float m_horizontalLine; //!< to draw a horizontal line when theres distance partition cutting
343 
344  std::vector< WColor >m_nodeColorsCustom; //!< stores preset color for every tree node, so clusters keep same color through different selection
345  std::vector< WColor >m_treeDisplayColors; //!< stores a the current colors each tree node should be displayed, given the current selection
346  std::map< size_t, WColor >m_selectionColors; //!< stores a the current colors each cluster should be displayed, given the current selection
347  std::map< size_t, WColor >m_selectionColorsBackup; //!< stores a backup of m_selectionColors
348 
349  std::vector<std::vector<size_t> > m_clusterVoxels; //!< stores the contained seed voxel IDs for each cluster, increases speed for texture drawing
350  std::vector<size_t> m_discardedVoxels; //!< stores the contained seed voxel IDs for discarded elements
351 
352  std::vector<size_t>m_selectionClusters; //!< stores the currently activated clusters
353  std::vector<size_t>m_selectionLeaves; //!< stores the leaves output by the selection
354 
355  std::shared_ptr< WTriangleMesh > m_cubeMesh; //!< Cube-like triangulation of the seed voxels
356  std::shared_ptr< WTriangleMesh > m_discardedMesh; //!< Cube-like triangulation of the discarded voxels
357 
358  std::vector< osg::ref_ptr<WOSGButton> >m_selectionLabels; //!< list of buttons for the active cluster selection
359 
360  // === MODULE PROPERTIES ===
361 
362  std::shared_ptr< WCondition > m_propTriggerChange; //!< A condition used to notify about changes in several properties.
363 
364  WPropGroup m_groupInfoSelected; //!< grouping the selected info
365  WPropInt m_infoSelectedID; //!< Info property: clusters in current partition
366  WPropInt m_infoSelectedSize; //!< Info property: clusters in current partition
367  WPropInt m_infoSelectedDistance; //!< Info property: clusters in current partition
368 
369  WPropGroup m_groupInfoPartition; //!< grouping the partition info
370  WPropInt m_infoPartNumber; //!< Info property: clusters in current partition
371  WPropInt m_infoPartActive; //!< Info property: active clusters in current partition
372  WPropInt m_infoPartLeaves; //!< Info property: leaf clusters in current partition
373  WPropDouble m_infoCutValue; //!< Info property: cut value for current partition
374 
375  WPropGroup m_groupInfoTree; //!< grouping the tree info
376  WPropString m_infoTreeName; //!< Info property: current tree name
377  WPropInt m_infoCountLeaves; //!< Info property: number of leaves
378  WPropInt m_infoCountNodes; //!< Info property: number of nodes
379  WPropInt m_infoCountDiscarded; //!< Info property: number of discarded voxels
380  WPropInt m_infoMaxLevel; //!< Info property: maximum hierarchical level
381  WPropDouble m_infoCpcc; //!< Info property: cpcc value
382 
383  WPropGroup m_groupInfoMessage; //!< grouping the message info
384  WPropString m_infoPartMessage; //!< Info property: partition output message
385 
386  WPropGroup m_groupRead; //!< grouping the tree loading
387  WPropFilename m_propReadFilename; //!< The tree file will be loaded form this directory
388  WPropTrigger m_propReadTreeTrigger; //!< This property triggers the actual reading of the tree file
389 
390  WPropGroup m_groupDendrogram; //!< grouping the dendrogram manipulation properties
391  WPropBool m_propShowDendrogram; //!< controls the display of the dendrogram overlay
392  WPropBool m_propDendroPlotByLevel; //!< controls plotting the height of a join (1 plots the tree by hierarchical level, 0 by cluster distance)
393  WPropBool m_propTriangleLeaves; //!< specifies a minimum size for a cluster so that too small cluster won't get an own color
394  WPropTrigger m_propDendroZoomIn; //!< zoom into tree, sets m_treeZoom true and m_zoomRoot to the currently selected cluster
395  WPropTrigger m_propDendroZoomOut; //!< zooms out, m_treeZoom = false, dendrogram shows the whole tree
396  std::shared_ptr< WItemSelection > m_propDendroSideList; //!< A list of dendrogram positions
397  WPropSelection m_propDendroSideSelector; //!< Selection property for dendrogram positions
398  WPropGroup m_groupDendroManual; //!< grouping the dendrogram manual resizing properties
399  WPropInt m_propDendroSizeX; //!< controls the width of the dendrogram
400  WPropInt m_propDendroSizeY; //!< controls the height of the dendrogram
401  WPropInt m_propDendroOffsetX; //!< controls the horizontal origin of the dendrogram
402  WPropInt m_propDendroOffsetY; //!< controls the vertical origin of the dendrogram
403 
404  WPropGroup m_groupPartition; //!< grouping the different selection methods
405  WPropTrigger m_propPartRoot; //!< triggers the selection of root cluster
406  WPropInt m_propSourceCluster; //!< the current subtree root cluster
407  WPropSelection m_propPartitionSelector; //!< Selection property for clusters
408  std::shared_ptr< WItemSelection > m_propPartitionSelectionList; //!< A list of cluster selection methods
409  WPropSelection m_propConditionSelector; //!< Selection condition for clusters
410  std::shared_ptr< WItemSelection > m_propConditionSelectionsList; //!< A list of condition selection methods
411  WPropInt m_propPartNumClusters; //!< number of clusters of the desired partition
412  WPropInt m_propPartSizeValue; //!< size cut value for the desired partition
413  WPropInt m_propPartSearchDepthValue; //!< depth of search for optimized partitioning
414  WPropDouble m_propPartRelativeValue; //!< Relative size cut value for the desired partition
415  WPropDouble m_propPartDistanceValue; //!< distance cut value for the desired partition
416  WPropInt m_propPartHlevelValue; //!< hierarchical level cut value for the desired partition
417  WPropInt m_propPreloadPartitionNr; //!< predefined partition to load
418  WPropBool m_propPartExcludeLeaves; //!< defines if base nodes will be subdivided or not
419  WPropTrigger m_propDoPartition; //!< triggers the cluster selection update
420 
421  WPropGroup m_groupVisualization; //!< grouping the different visualization options
422  WPropInt m_propSubselectedCluster; //!< the currently selected cluster
423  WPropColor m_propSubselectedcolor; //!< color for subselected cluster
424  std::shared_ptr< WItemSelection > m_propColorSchemeList; //!< List of color schemes
425  WPropSelection m_propColorSchemeSelector; //!< selection of color schemes
426  std::shared_ptr< WItemSelection > m_propColorActionList; //!< List of color schemes
427  WPropSelection m_propColorActionSelector; //!< selection of color schemes
428  WPropTrigger m_propColorActionTrigger; //!< shuffle current colors
429  WPropBool m_propShowLabels; //!< show info labels for selected clusters
430  std::shared_ptr< WItemSelection > m_propLabelList; //!< List of label contents
431  WPropSelection m_propLabelInfoSelector; //!< selection of info on button labels
432  WPropBool m_propShowDiscarded; //!< visualize also discarded voxels
433  WPropBool m_propShowCubeMesh; //!< visualize voxel cube triangulation
434  WPropBool m_propBoundaries; //!< visualize only parcel boundaries
435  WPropColor m_propDiscardedColor; //!< color for discarded voxels
436  WPropColor m_propBoundaryColor; //!< color for cluster boundaries
437  WPropColor m_propInactiveColor; //!< color for inactive mesh voxels
438 
439  WPropGroup m_groupTreeProcess; //!< grouping the different tree processing methods
440  WPropSelection m_propProcessSelector; //!< Selection property for processing
441  std::shared_ptr< WItemSelection > m_propProcessSelectionsList; //!< A list of cluster selection methods
442  WPropInt m_propSafeSize; //!< maximum size to be pruned
443  WPropInt m_propPruneJoinSize; //!< join size for pruning process
444  WPropDouble m_propPruneSizeRatio; //!< size ratio for pruning process
445  WPropDouble m_propDistanceGap; //!< distance gap for prunin process
446  WPropDouble m_propFlatLimit; //!< distance gap for prunin process
447  WPropBool m_propKeepBases; //!< dont debinarize basenodes
448  WPropInt m_propSmoothSize; //!< desired cluster size fro smoothing
449  WPropInt m_propPrunedNumber; //!< number of leaves to be pruned by random pruning
450  WPropInt m_propPrunedSeed; //!< rng seed for random pruning
451  WPropInt m_propCoarseRatio; //!< ratio of decimation
452  WPropTrigger m_propDoProcessing; //!< triggers the tree processing
453 
454  WPropGroup m_groupSavedPartition; //!< grouping the partition options
455  WPropTrigger m_propAddPartTrigger; //!< This property triggers the inclusion in the tree of the current partition
456  WPropTrigger m_propRecolorPartTrigger; //!< This property triggers the recoloring partition of the current partitions
457  WPropTrigger m_propClearPartsTrigger; //!< This property triggers the clearing of current partitions in the tree
458 
459  WPropGroup m_groupWrite; //!< grouping the tree writing
460  WPropFilename m_propWriteTreeFilename; //!< The tree file will be written to this location
461  WPropTrigger m_propWriteTreeTrigger; //!< This property triggers the actual writing of the tree file
462  WPropFilename m_propPartitionFile; //!< The partition file will be written to this location
463  WPropTrigger m_propPartitionsTrigger; //!< This property triggers the actual writing of the partition file
464 };
465 
466 #endif // WMHIERCHCLUSTDISPLAY_H
467 
468 
this class implements a hierarchical tree and provides functions for creation, partitioning,...
Definition: WHtree.h:81
Small event handler class to catch left mouse buttons clicks in the main view.
void subscribeLeftButtonPush(mouseClickSignalType::slot_type slot)
Registers a function slot to LEFT BUTTON PUSH events.
boost::signals2::signal< bool(WVector2f) > mouseClickSignalType
signal from a mouse button being clicked
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &)
The OSG calls this function whenever a new event has occured.
mouseClickSignalType m_signalLeftButtonPush
Signal used for notification of the LEFT BUTTON PUSH event.
mouseClickSignalType m_signalRightButtonPush
Signal used for notification of the RIGHT BUTTON PUSH event.
void subscribeRightButtonPush(mouseClickSignalType::slot_type slot)
Registers a function slot to RIGHT BUTTON PUSH events.
Module to explore hierarchical parcellations of brain data The module loads a tree file from disk,...
WPropInt m_infoCountLeaves
Info property: number of leaves.
WPropTrigger m_propPartitionsTrigger
This property triggers the actual writing of the partition file.
osg::ref_ptr< WGEGroupNode > m_dendrogramNode
Pointer to the dendrogram group node.
void initializeColorsSize()
Assigns a default color to each node travelling the tree top-down based on dividing first the biggest...
WPropGroup m_groupSavedPartition
grouping the partition options
WPropGroup m_groupTreeProcess
grouping the different tree processing methods
std::vector< std::vector< size_t > > m_clusterVoxels
stores the contained seed voxel IDs for each cluster, increases speed for texture drawing
std::shared_ptr< WItemSelection > m_propProcessSelectionsList
A list of cluster selection methods.
WPropDouble m_propFlatLimit
distance gap for prunin process
virtual std::shared_ptr< WModule > factory() const
new instance of this module Due to the prototype design pattern used to build modules,...
WPropInt m_propPrunedSeed
rng seed for random pruning
void colorBranchCustom(const size_t &root, const WColor &color)
recursive function that fills the display colors for a whole branch with a custom color from a scheme...
int m_oldViewWidth
stores the old viewport resolution width to check whether a resize happened
WPropBool m_propBoundaries
visualize only parcel boundaries
WPropGroup m_groupInfoPartition
grouping the partition info
void renderCubeMesh()
renders the triangulated seed voxels
std::shared_ptr< WModuleInputData< WDataSetSingle > > m_input
An input connector that accepts order 1 datasets.
std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output2
An output connector for the output coordinate vector.
WPropInt m_infoMaxLevel
Info property: maximum hierarchical level.
WNonBinDendroGeode * m_dendrogramGeode
stores the dendrogram geode
WPropInt m_propDendroOffsetY
controls the vertical origin of the dendrogram
WPropGroup m_groupWrite
grouping the tree writing
void updateSelection(const std::vector< WColor > &preloadedColors=std::vector< WColor >())
after the active cluster list has changed this function updates the texture, cubeMesh,...
void clusterSelection()
manages cluster selection action response
WPropGroup m_groupDendroManual
grouping the dendrogram manual resizing properties
WPropDouble m_propPartDistanceValue
distance cut value for the desired partition
osg::Camera * m_camera
stores the camera object
WPropColor m_propInactiveColor
color for inactive mesh voxels
std::shared_ptr< WDataSetVector > m_outData
This is a pointer to the current output1.
osgWidget::WindowManager * m_wm
stores a pointer to the window manager used for osg wdgets and overlay stuff
float m_horizontalLine
to draw a horizontal line when theres distance partition cutting
void updateColors()
updates the selection colors
std::vector< size_t > m_textureLabels
label vector for texture creation
WPropTrigger m_propRecolorPartTrigger
This property triggers the recoloring partition of the current partitions.
WPropSelection m_propColorActionSelector
selection of color schemes
WPropInt m_propDendroOffsetX
controls the horizontal origin of the dendrogram
WPropDouble m_infoCpcc
Info property: cpcc value.
std::map< size_t, WColor > m_selectionColorsBackup
stores a backup of m_selectionColors
WPropSelection m_propPartitionSelector
Selection property for clusters.
WPropGroup m_groupRead
grouping the tree loading
WPropBool m_propShowDiscarded
visualize also discarded voxels
bool dendrogramClickRight(const WVector2f &pos)
handles right clicks into the dendrogram
WPropGroup m_groupInfoMessage
grouping the message info
std::shared_ptr< WGridRegular3D > m_grid
stores a pointer to the grid we use;
WPropDouble m_propPruneSizeRatio
size ratio for pruning process
std::shared_ptr< WItemSelection > m_propColorActionList
List of color schemes.
WPropTrigger m_propClearPartsTrigger
This property triggers the clearing of current partitions in the tree.
bool dendrogramClick(const WVector2f &pos)
handles clicks into the dendrogram
int m_oldViewHeight
stores the old viewport resolution height to check whether a resize happened
WPropDouble m_propDistanceGap
distance gap for prunin process
WPropInt m_infoCountDiscarded
Info property: number of discarded voxels.
virtual void connectors()
Initialize the connectors this module is using.
bool loadTree(boost::filesystem::path treeFile)
loads the tree file into the tree object
virtual void moduleMain()
Entry point after loading the module. Runs in separate thread.
WPropTrigger m_propPartRoot
triggers the selection of root cluster
std::shared_ptr< WCondition > m_propTriggerChange
A condition used to notify about changes in several properties.
WPropTrigger m_propWriteTreeTrigger
This property triggers the actual writing of the tree file.
void addPartitions()
Adds partitions form current selections into the tree object.
void updateWidgets()
updates the graphical widgets in the 3d scene
std::shared_ptr< WItemSelection > m_propColorSchemeList
List of color schemes.
WPropBool m_propShowDendrogram
controls the display of the dendrogram overlay
void initWidgets()
inits the graphical widgets in the 3d scene
virtual const std::string getName() const
Gives back the name of this module.
WPropBool m_propShowLabels
show info labels for selected clusters
osg::ref_ptr< WGEShader > m_shader
The shader.
std::shared_ptr< WItemSelection > m_propPartitionSelectionList
A list of cluster selection methods.
std::shared_ptr< WModuleOutputData< WDataSetVector > > m_output
An output connector for the output scalar dsataset.
void assignColorHierch(const size_t thisID, const WColor thisColor)
Uses the provided node Id and color to update the current tree default coloring using hierarchical in...
size_t m_treeZoomRoot
control variable for tree zoom mode
std::vector< size_t > m_discardedVoxels
stores the contained seed voxel IDs for discarded elements
WPropGroup m_groupVisualization
grouping the different visualization options
std::shared_ptr< WDataSetSingle > m_anatomy
This is a pointer to the anatomy dataset the module is currently working on.
std::shared_ptr< WTriangleMesh > m_cubeMesh
Cube-like triangulation of the seed voxels.
WPropSelection m_propConditionSelector
Selection condition for clusters.
WPropInt m_propPrunedNumber
number of leaves to be pruned by random pruning
WPropFilename m_propWriteTreeFilename
The tree file will be written to this location.
bool m_treeDirty
true if the dendrogram needs redrawing
virtual void properties()
Initialize the properties for this module.
WPropDouble m_infoCutValue
Info property: cut value for current partition.
WPropColor m_propSubselectedcolor
color for subselected cluster
WPropFilename m_propPartitionFile
The partition file will be written to this location.
WPropSelection m_propColorSchemeSelector
selection of color schemes
WPropInt m_propSafeSize
maximum size to be pruned
void writePartition()
writes partition selection(s) in an ascii file
WPropInt m_propSourceCluster
the current subtree root cluster
void colorAction()
manages action after the trigger of the color section has been pressed
bool m_labelsDirty
true if the labels need redrawing
WPropTrigger m_propDendroZoomOut
zooms out, m_treeZoom = false, dendrogram shows the whole tree
void initProperties()
updates property min/max values after loading a clustering file
WPropInt m_infoSelectedID
Info property: clusters in current partition.
WPropTrigger m_propDoProcessing
triggers the tree processing
WPropGroup m_groupInfoSelected
grouping the selected info
std::shared_ptr< WItemSelection > m_propDendroSideList
A list of dendrogram positions.
WPropInt m_propPartSearchDepthValue
depth of search for optimized partitioning
std::shared_ptr< WTriangleMesh > m_discardedMesh
Cube-like triangulation of the discarded voxels.
WPropSelection m_propDendroSideSelector
Selection property for dendrogram positions.
WPropInt m_propPartNumClusters
number of clusters of the desired partition
WPropInt m_infoPartNumber
Info property: clusters in current partition.
void initializeColorsHdist()
Assigns a default color to each node travelling the tree top-down based on hierarchy where the bigges...
WPropBool m_propShowCubeMesh
visualize voxel cube triangulation
void initTexture()
creates a texture, assigning the colouring of the current partition to the respective seed voxels in ...
WPropGroup m_groupInfoTree
grouping the tree info
WPropTrigger m_propColorActionTrigger
shuffle current colors
WHtree m_tree
stores the tree object as loaded from file;
WPropTrigger m_propAddPartTrigger
This property triggers the inclusion in the tree of the current partition.
WPropString m_infoPartMessage
Info property: partition output message.
std::vector< WColor > m_treeDisplayColors
stores a the current colors each tree node should be displayed, given the current selection
WPropTrigger m_propReadTreeTrigger
This property triggers the actual reading of the tree file.
WPropInt m_propPruneJoinSize
join size for pruning process
WPropInt m_infoSelectedDistance
Info property: clusters in current partition.
WPropBool m_propTriangleLeaves
specifies a minimum size for a cluster so that too small cluster won't get an own color
std::vector< osg::ref_ptr< WOSGButton > > m_selectionLabels
list of buttons for the active cluster selection
WPropInt m_propDendroSizeY
controls the height of the dendrogram
WPropBool m_propDendroPlotByLevel
controls plotting the height of a join (1 plots the tree by hierarchical level, 0 by cluster distance...
WPropInt m_propPartHlevelValue
hierarchical level cut value for the desired partition
WPropDouble m_propPartRelativeValue
Relative size cut value for the desired partition.
WPropInt m_propCoarseRatio
ratio of decimation
std::shared_ptr< WItemSelection > m_propConditionSelectionsList
A list of condition selection methods.
osg::ref_ptr< WGEGroupNode > m_meshNode
Pointer to the cube mesh group node.
WPropGroup m_groupDendrogram
grouping the dendrogram manipulation properties
WPropTrigger m_propDendroZoomIn
zoom into tree, sets m_treeZoom true and m_zoomRoot to the currently selected cluster
WPropInt m_propPartSizeValue
size cut value for the desired partition
void recolorPartitions()
recolors added partitions from the tree object with current selection set of colors
WPropString m_infoTreeName
Info property: current tree name.
WPropColor m_propBoundaryColor
color for cluster boundaries
osg::ref_ptr< WGEGroupNode > m_moduleNode
Pointer to the modules group node.
std::shared_ptr< WItemSelection > m_propLabelList
List of label contents.
WPropInt m_infoPartActive
Info property: active clusters in current partition.
WPropColor m_propDiscardedColor
color for discarded voxels
std::shared_ptr< WDataSetScalar > m_outData2
This is a pointer to the current output2.
WPropInt m_propSmoothSize
desired cluster size fro smoothing
WPropTrigger m_propDoPartition
triggers the cluster selection update
WPropInt m_propSubselectedCluster
the currently selected cluster
osg::ref_ptr< osg::Texture3D > m_texture
stores a pointer to the texture we paint in (to overlay to anatomy)
std::map< size_t, WColor > m_selectionColors
stores a the current colors each cluster should be displayed, given the current selection
void updateOutput2()
updates the voxels coordinate output
WPropInt m_infoSelectedSize
Info property: clusters in current partition.
void initTreeData()
initializes properties depending on the specific tree structure loaded
virtual ~WMHierchClustDisplay()
Destructor.
void colorBranch(const size_t &root, const WColor &color)
recursive function that fills the display colors for a whole branch with a selected color
WPropSelection m_propProcessSelector
Selection property for processing.
WPropInt m_propPreloadPartitionNr
predefined partition to load
std::vector< size_t > m_selectionClusters
stores the currently activated clusters
virtual const std::string getDescription() const
Gives back a description of this module.
WPropGroup m_groupPartition
grouping the different selection methods
WPropBool m_propKeepBases
dont debinarize basenodes
std::vector< size_t > m_selectionLeaves
stores the leaves output by the selection
WPropFilename m_propReadFilename
The tree file will be loaded form this directory.
WPropBool m_propPartExcludeLeaves
defines if base nodes will be subdivided or not
bool widgetClicked()
handles mouse clicks into the dendrogram
std::vector< WColor > m_nodeColorsCustom
stores preset color for every tree node, so clusters keep same color through different selection
WPropSelection m_propLabelInfoSelector
selection of info on button labels
WPropInt m_propDendroSizeX
controls the width of the dendrogram
WPropInt m_infoPartLeaves
Info property: leaf clusters in current partition.
WPropInt m_infoCountNodes
Info property: number of nodes.
A fixed size matrix class.
Definition: WMatrixFixed.h:150
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
Class creates a dendrogram from a hierarchical clustering, and allows to click and select specific no...