49 #ifndef WMHIERCHCLUSTDISPLAY_H
50 #define WMHIERCHCLUSTDISPLAY_H
59 #include <osgGA/GUIEventAdapter>
60 #include <osgGA/GUIEventHandler>
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"
80 const unsigned int MASK_2D = 0xF0000000;
81 const unsigned int MASK_3D = 0x0F000000;
103 virtual const std::string
getName()
const;
115 virtual std::shared_ptr< WModule >
factory()
const;
145 bool handle(
const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& );
196 void colorBranch(
const size_t &root,
const WColor &color );
251 void updateSelection(
const std::vector< WColor > &preloadedColors = std::vector< WColor >() );
311 std::shared_ptr< WModuleInputData< WDataSetSingle > >
m_input;
312 std::shared_ptr< WModuleOutputData< WDataSetVector > >
m_output;
313 std::shared_ptr< WModuleOutputData< WDataSetScalar > >
m_output2;
317 osgWidget::WindowManager*
m_wm;
334 std::shared_ptr< WGridRegular3D >
m_grid;
this class implements a hierarchical tree and provides functions for creation, partitioning,...
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
WMHierchClustDisplay()
Constructor.
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.
Class representing a single module of OpenWalnut.
Class creates a dendrogram from a hierarchical clustering, and allows to click and select specific no...