Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
140d95e0
Commit
140d95e0
authored
Feb 17, 2011
by
Sebastian Eichelbaum
Browse files
[MERGE] - merged default into gridChanges
parents
5407b175
d356fd65
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
593 additions
and
281 deletions
+593
-281
src/common/WHierarchicalTree.cpp
src/common/WHierarchicalTree.cpp
+0
-90
src/common/WHierarchicalTree.h
src/common/WHierarchicalTree.h
+0
-8
src/dataHandler/datastructures/WValueSetHistogram.cpp
src/dataHandler/datastructures/WValueSetHistogram.cpp
+4
-2
src/dataHandler/datastructures/WValueSetHistogram.h
src/dataHandler/datastructures/WValueSetHistogram.h
+2
-2
src/graphicsEngine/algorithms/WMarchingLegoAlgorithm.cpp
src/graphicsEngine/algorithms/WMarchingLegoAlgorithm.cpp
+3
-3
src/graphicsEngine/algorithms/WMarchingLegoAlgorithm.h
src/graphicsEngine/algorithms/WMarchingLegoAlgorithm.h
+3
-3
src/gui/qt4/controlPanel/WPropertyWidget.cpp
src/gui/qt4/controlPanel/WPropertyWidget.cpp
+4
-0
src/gui/qt4/controlPanel/WQtControlPanel.cpp
src/gui/qt4/controlPanel/WQtControlPanel.cpp
+38
-42
src/gui/qt4/controlPanel/WQtPropertyGroupWidget.cpp
src/gui/qt4/controlPanel/WQtPropertyGroupWidget.cpp
+54
-3
src/gui/qt4/controlPanel/WQtPropertyGroupWidget.h
src/gui/qt4/controlPanel/WQtPropertyGroupWidget.h
+44
-1
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
+305
-85
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.h
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.h
+48
-6
src/modules/histogramEqualization/WMHistogramEqualization.cpp
...modules/histogramEqualization/WMHistogramEqualization.cpp
+24
-17
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.cpp
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.cpp
+11
-0
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.h
src/modules/isosurfaceRaytracer/WMIsosurfaceRaytracer.h
+10
-0
src/modules/isosurfaceRaytracer/shaders/WMIsosurfaceRaytracer-fragment.glsl
...faceRaytracer/shaders/WMIsosurfaceRaytracer-fragment.glsl
+21
-12
src/modules/isosurfaceRaytracer/shaders/WMIsosurfaceRaytracer-vertex.glsl
...urfaceRaytracer/shaders/WMIsosurfaceRaytracer-vertex.glsl
+2
-3
src/modules/template/WMTemplate.cpp
src/modules/template/WMTemplate.cpp
+10
-4
src/modules/template/WMTemplate.h
src/modules/template/WMTemplate.h
+10
-0
No files found.
src/common/WHierarchicalTree.cpp
View file @
140d95e0
...
...
@@ -119,96 +119,6 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
return
returnVector
;
}
std
::
vector
<
size_t
>
WHierarchicalTree
::
findXBiggestClusters2
(
size_t
cluster
,
size_t
number
)
{
//std::cout << number << " largest clusters for cluster: " << cluster << std::endl;
if
(
number
>
m_containsLeafes
[
cluster
].
size
()
)
{
number
=
m_containsLeafes
[
cluster
].
size
();
}
// init
std
::
list
<
size_t
>
worklist
;
worklist
.
push_back
(
cluster
);
while
(
worklist
.
size
()
<
number
)
{
size_t
current
=
worklist
.
front
();
worklist
.
pop_front
();
if
(
m_containsLeafes
[
current
].
size
()
>
1
)
{
size_t
left
=
m_children
[
current
].
first
;
size_t
right
=
m_children
[
current
].
second
;
worklist
.
push_back
(
left
);
worklist
.
push_back
(
right
);
}
else
{
worklist
.
push_back
(
current
);
}
}
worklist
.
sort
(
compSize
(
this
)
);
bool
newSplit
=
true
;
while
(
newSplit
)
{
newSplit
=
false
;
size_t
current
=
worklist
.
front
();
if
(
m_containsLeafes
[
current
].
size
()
>
1
)
{
size_t
left
=
m_children
[
current
].
first
;
size_t
right
=
m_children
[
current
].
second
;
size_t
last
=
worklist
.
back
();
if
(
(
m_containsLeafes
[
left
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
&&
(
m_containsLeafes
[
right
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
)
{
if
(
m_containsLeafes
[
left
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
{
worklist
.
pop_front
();
worklist
.
push_back
(
left
);
worklist
.
sort
(
compSize
(
this
)
);
newSplit
=
true
;
}
last
=
worklist
.
back
();
if
(
m_containsLeafes
[
right
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
{
if
(
!
newSplit
)
{
worklist
.
pop_front
();
}
if
(
worklist
.
size
()
==
number
)
{
worklist
.
pop_back
();
}
worklist
.
push_back
(
right
);
worklist
.
sort
(
compSize
(
this
)
);
newSplit
=
true
;
}
}
}
}
std
::
vector
<
size_t
>
returnVector
;
std
::
list
<
size_t
>::
iterator
it
;
for
(
it
=
worklist
.
begin
();
it
!=
worklist
.
end
();
++
it
)
{
size_t
current
=
*
it
;
//std::cout << "cluster:" << current << " size:" << m_containsLeafes[current].size() << std::endl;
returnVector
.
push_back
(
current
);
}
return
returnVector
;
}
std
::
vector
<
size_t
>
WHierarchicalTree
::
downXLevelsFromTop
(
size_t
level
,
bool
hideOutliers
)
{
if
(
level
>
m_maxLevel
)
...
...
src/common/WHierarchicalTree.h
View file @
140d95e0
...
...
@@ -153,14 +153,6 @@ public:
*/
std
::
vector
<
size_t
>
findXBiggestClusters
(
size_t
cluster
,
size_t
number
=
10
);
// TODO(schurade): merge these two function
/**
* finds the X biggest clusters for a given cluster
* \param cluster
* \param number of sub clusters
*/
std
::
vector
<
size_t
>
findXBiggestClusters2
(
size_t
cluster
,
size_t
number
=
10
);
/**
* sets the color for a selected cluster and all sub clusters
* \param cluster
...
...
src/dataHandler/datastructures/WValueSetHistogram.cpp
View file @
140d95e0
...
...
@@ -254,10 +254,12 @@ std::ostream& operator<<( std::ostream& out, const WValueSetHistogram& h )
{
std
::
pair
<
double
,
double
>
interval
=
h
.
getIntervalForIndex
(
i
);
// NOTE: the notation for open intervals is [a,b) or alternatively [a,b[.
out
<<
i
<<
" = ["
<<
interval
.
first
<<
", "
<<
interval
.
second
<<
") = "
<<
h
[
i
]
<<
std
::
endl
;
//out << i << " = [" << interval.first << ", " << interval.second << ") = " << h[ i ] << std::endl;
out
<<
interval
.
first
<<
" "
<<
interval
.
second
<<
" "
<<
std
::
min
(
h
[
i
],
size_t
(
3000
)
)
<<
std
::
endl
;
}
// the last interval is handled special
out
<<
h
.
size
()
-
1
<<
" = ["
<<
h
.
getIntervalForIndex
(
h
.
size
()
-
1
).
first
<<
", inf) = "
<<
h
[
h
.
size
()
-
1
]
<<
std
::
endl
;
//out << h.size() - 1 << " = [" << h.getIntervalForIndex( h.size() - 1 ).first << ", inf) = " << h[ h.size() - 1 ] << std::endl;
out
<<
h
.
getIntervalForIndex
(
h
.
size
()
-
1
).
first
<<
" inf "
<<
std
::
min
(
h
[
h
.
size
()
-
1
],
size_t
(
3000
)
)
<<
std
::
endl
;
return
out
;
}
...
...
src/dataHandler/datastructures/WValueSetHistogram.h
View file @
140d95e0
...
...
@@ -270,12 +270,12 @@ inline size_t WValueSetHistogram::getIndexForValue( double value ) const
// the position on the scala
double
pos
=
(
value
-
m_minimum
)
/
static_cast
<
double
>
(
m_mappedBucketSize
);
// the index is the floor( position )
size_t
idx
=
static_cast
<
size_t
>
(
pos
);
size_t
idx
=
static_cast
<
size_t
>
(
std
::
floor
(
pos
)
);
// is the index larger than the size?
bool
inU
=
(
idx
<
m_nMappedBuckets
);
// is the index smaller than the size?
bool
inL
=
(
pos
>
0.0
);
bool
inL
=
(
pos
>
=
0.0
);
// the trick done here is to clamp value into [m_minimum,m_maximum] without using if statements. The C++ Standard says that booleans are
// always 1 if true.
...
...
src/graphicsEngine/algorithms/WMarchingLegoAlgorithm.cpp
View file @
140d95e0
...
...
@@ -399,9 +399,9 @@ boost::shared_ptr<WTriangleMesh> WMarchingLegoAlgorithm::genSurfaceOneValue( siz
resultPos4D
[
3
]
=
m_matrix
(
3
,
0
)
*
pos
[
0
]
+
m_matrix
(
3
,
1
)
*
pos
[
1
]
+
m_matrix
(
3
,
2
)
*
pos
[
2
]
+
m_matrix
(
3
,
3
)
*
1
;
(
*
mapIterator
).
second
.
newID
=
nextID
;
triMesh
->
addVertex
(
resultPos4D
[
0
]
/
resultPos4D
[
3
]
-
0.5
,
resultPos4D
[
1
]
/
resultPos4D
[
3
]
-
0.5
,
resultPos4D
[
2
]
/
resultPos4D
[
3
]
-
0.5
);
triMesh
->
addVertex
(
resultPos4D
[
0
]
/
resultPos4D
[
3
],
resultPos4D
[
1
]
/
resultPos4D
[
3
],
resultPos4D
[
2
]
/
resultPos4D
[
3
]
);
triMesh
->
addTextureCoordinate
(
texCoord
);
nextID
++
;
mapIterator
++
;
...
...
src/graphicsEngine/algorithms/WMarchingLegoAlgorithm.h
View file @
140d95e0
...
...
@@ -253,9 +253,9 @@ template<typename T> boost::shared_ptr<WTriangleMesh> WMarchingLegoAlgorithm::ge
resultPos4D
[
3
]
=
m_matrix
(
3
,
0
)
*
pos
[
0
]
+
m_matrix
(
3
,
1
)
*
pos
[
1
]
+
m_matrix
(
3
,
2
)
*
pos
[
2
]
+
m_matrix
(
3
,
3
)
*
1
;
(
*
mapIterator
).
second
.
newID
=
nextID
;
triMesh
->
addVertex
(
resultPos4D
[
0
]
/
resultPos4D
[
3
]
-
0.5
,
resultPos4D
[
1
]
/
resultPos4D
[
3
]
-
0.5
,
resultPos4D
[
2
]
/
resultPos4D
[
3
]
-
0.5
);
triMesh
->
addVertex
(
resultPos4D
[
0
]
/
resultPos4D
[
3
],
resultPos4D
[
1
]
/
resultPos4D
[
3
],
resultPos4D
[
2
]
/
resultPos4D
[
3
]
);
triMesh
->
addTextureCoordinate
(
texCoord
);
nextID
++
;
mapIterator
++
;
...
...
src/gui/qt4/controlPanel/WPropertyWidget.cpp
View file @
140d95e0
...
...
@@ -65,6 +65,10 @@ WPropertyWidget::WPropertyWidget( boost::shared_ptr< WPropertyBase > property,
setCurrentIndex
(
1
);
}
// if the property is hidden initially, hide widget too
setHidden
(
m_property
->
isHidden
()
);
m_label
.
setHidden
(
m_property
->
isHidden
()
);
// setup the update callback
m_connection
=
m_property
->
getUpdateCondition
()
->
subscribeSignal
(
boost
::
bind
(
&
WPropertyWidget
::
propertyChangeNotifier
,
this
)
);
}
...
...
src/gui/qt4/controlPanel/WQtControlPanel.cpp
View file @
140d95e0
...
...
@@ -804,8 +804,7 @@ void WQtControlPanel::selectDataModule( boost::shared_ptr< WDataSet > dataSet )
WQtPropertyGroupWidget
*
WQtControlPanel
::
buildPropWidget
(
boost
::
shared_ptr
<
WProperties
>
props
)
{
WQtPropertyGroupWidget
*
tab
=
new
WQtPropertyGroupWidget
(
props
->
getName
()
);
WQtPropertyGroupWidget
*
tab
=
new
WQtPropertyGroupWidget
(
props
);
if
(
props
.
get
()
)
{
// read lock, gets unlocked upon destruction (out of scope)
...
...
@@ -816,47 +815,44 @@ WQtPropertyGroupWidget* WQtControlPanel::buildPropWidget( boost::shared_ptr< WP
// iterate all properties.
for
(
WProperties
::
PropertyConstIterator
iter
=
propAccess
->
get
().
begin
();
iter
!=
propAccess
->
get
().
end
();
++
iter
)
{
if
(
!
(
*
iter
)
->
isHidden
()
)
switch
(
(
*
iter
)
->
getType
()
)
{
switch
(
(
*
iter
)
->
getType
()
)
{
case
PV_BOOL
:
tab
->
addProp
(
(
*
iter
)
->
toPropBool
()
);
break
;
case
PV_INT
:
tab
->
addProp
(
(
*
iter
)
->
toPropInt
()
);
break
;
case
PV_DOUBLE
:
tab
->
addProp
(
(
*
iter
)
->
toPropDouble
()
);
break
;
case
PV_STRING
:
tab
->
addProp
(
(
*
iter
)
->
toPropString
()
);
break
;
case
PV_PATH
:
tab
->
addProp
(
(
*
iter
)
->
toPropFilename
()
);
break
;
case
PV_SELECTION
:
tab
->
addProp
(
(
*
iter
)
->
toPropSelection
()
);
break
;
case
PV_COLOR
:
tab
->
addProp
(
(
*
iter
)
->
toPropColor
()
);
break
;
case
PV_POSITION
:
tab
->
addProp
(
(
*
iter
)
->
toPropPosition
()
);
break
;
case
PV_TRIGGER
:
tab
->
addProp
(
(
*
iter
)
->
toPropTrigger
()
);
break
;
case
PV_GROUP
:
tab
->
addGroup
(
buildPropWidget
(
(
*
iter
)
->
toPropGroup
()
)
);
break
;
case
PV_MATRIX4X4
:
tab
->
addProp
(
(
*
iter
)
->
toPropMatrix4X4
()
);
break
;
default:
WLogger
::
getLogger
()
->
addLogMessage
(
"This property type is not yet supported."
,
"ControlPanel"
,
LL_WARNING
);
break
;
}
case
PV_BOOL
:
tab
->
addProp
(
(
*
iter
)
->
toPropBool
()
);
break
;
case
PV_INT
:
tab
->
addProp
(
(
*
iter
)
->
toPropInt
()
);
break
;
case
PV_DOUBLE
:
tab
->
addProp
(
(
*
iter
)
->
toPropDouble
()
);
break
;
case
PV_STRING
:
tab
->
addProp
(
(
*
iter
)
->
toPropString
()
);
break
;
case
PV_PATH
:
tab
->
addProp
(
(
*
iter
)
->
toPropFilename
()
);
break
;
case
PV_SELECTION
:
tab
->
addProp
(
(
*
iter
)
->
toPropSelection
()
);
break
;
case
PV_COLOR
:
tab
->
addProp
(
(
*
iter
)
->
toPropColor
()
);
break
;
case
PV_POSITION
:
tab
->
addProp
(
(
*
iter
)
->
toPropPosition
()
);
break
;
case
PV_TRIGGER
:
tab
->
addProp
(
(
*
iter
)
->
toPropTrigger
()
);
break
;
case
PV_GROUP
:
tab
->
addGroup
(
buildPropWidget
(
(
*
iter
)
->
toPropGroup
()
)
);
break
;
case
PV_MATRIX4X4
:
tab
->
addProp
(
(
*
iter
)
->
toPropMatrix4X4
()
);
break
;
default:
WLogger
::
getLogger
()
->
addLogMessage
(
"This property type is not yet supported."
,
"ControlPanel"
,
LL_WARNING
);
break
;
}
}
}
...
...
src/gui/qt4/controlPanel/WQtPropertyGroupWidget.cpp
View file @
140d95e0
...
...
@@ -24,18 +24,45 @@
#include <string>
#include <QtGui/QApplication>
#include <QtGui/QGroupBox>
#include <QtGui/QPushButton>
#include <QtGui/QScrollArea>
#include "../events/WEventTypes.h"
#include "../events/WPropertyChangedEvent.h"
#include "../../../common/WProperties.h"
#include "WQtPropertyGroupWidget.h"
WQtPropertyGroupWidget
::
WQtPropertyGroupWidget
(
WPropGroup
group
,
QWidget
*
parent
)
:
QWidget
(
parent
),
m_name
(
group
->
getName
().
c_str
()
),
m_numberOfWidgets
(
0
),
m_group
(
group
)
{
// note: never do layouts as none pointers
// on destruction of a widget it will try to delete them which will cause crashes
m_pageLayout
=
new
QVBoxLayout
();
m_controlLayout
=
new
QGridLayout
();
m_pageLayout
->
addLayout
(
m_controlLayout
);
// NOTE: a simple setHidden( group->isHidden() ) causes the QWidgets to popup if hidden is false. This is why we set hidden only if it really
// is needed
if
(
group
->
isHidden
()
)
{
setHidden
(
true
);
}
// setup the update callback
m_connection
=
m_group
->
getUpdateCondition
()
->
subscribeSignal
(
boost
::
bind
(
&
WQtPropertyGroupWidget
::
propertyChangeNotifier
,
this
)
);
}
WQtPropertyGroupWidget
::
WQtPropertyGroupWidget
(
std
::
string
name
,
QWidget
*
parent
)
:
QWidget
(
parent
),
m_name
(
name
.
c_str
()
),
// m_controlLayout(),
// m_pageLayout(),
m_numberOfWidgets
(
0
)
m_numberOfWidgets
(
0
),
m_group
()
{
// note: never do layouts as none pointers
// on destruction of a widget it will try to delete them which will cause crashes
...
...
@@ -46,6 +73,26 @@ WQtPropertyGroupWidget::WQtPropertyGroupWidget( std::string name, QWidget* paren
WQtPropertyGroupWidget
::~
WQtPropertyGroupWidget
()
{
// cleanup
m_connection
.
disconnect
();
}
void
WQtPropertyGroupWidget
::
propertyChangeNotifier
()
{
QCoreApplication
::
postEvent
(
this
,
new
WPropertyChangedEvent
()
);
}
bool
WQtPropertyGroupWidget
::
event
(
QEvent
*
event
)
{
// a property changed
if
(
event
->
type
()
==
WQT_PROPERTY_CHANGED_EVENT
)
{
setHidden
(
m_group
->
isHidden
()
);
emit
hideSignal
(
m_group
->
isHidden
()
);
return
true
;
}
return
QWidget
::
event
(
event
);
}
WPropertyBoolWidget
*
WQtPropertyGroupWidget
::
addProp
(
WPropBool
property
)
...
...
@@ -177,6 +224,10 @@ void WQtPropertyGroupWidget::addGroup( WQtPropertyGroupWidget* widget, bool asSc
// insert into layout
int
row
=
m_controlLayout
->
rowCount
();
m_controlLayout
->
addWidget
(
box
,
row
,
0
,
1
,
2
);
// hide the box too if the property gets hidden
box
->
setHidden
(
widget
->
isHidden
()
);
connect
(
widget
,
SIGNAL
(
hideSignal
(
bool
)
),
box
,
SLOT
(
setHidden
(
bool
)
)
);
}
void
WQtPropertyGroupWidget
::
addSpacer
()
...
...
src/gui/qt4/controlPanel/WQtPropertyGroupWidget.h
View file @
140d95e0
...
...
@@ -51,12 +51,19 @@ class WQtPropertyGroupWidget : public QWidget
Q_OBJECT
public:
/**
* Creates new widget for a property group. Use this constructor to provide automatic hidden-flag management.
* \param group The group
* \param parent The widget managing this widget
*/
WQtPropertyGroupWidget
(
WPropGroup
group
,
QWidget
*
parent
=
0
);
/**
* Creates new widget for a property group
* \param name Name of the widget
* \param parent The widget managing this widget
*/
explicit
WQtPropertyGroupWidget
(
std
::
string
name
,
QWidget
*
parent
=
0
);
WQtPropertyGroupWidget
(
std
::
string
name
,
QWidget
*
parent
=
0
);
/**
* destructor
...
...
@@ -191,7 +198,33 @@ public:
*/
void
setName
(
QString
name
);
signals:
/**
* A Signal which gets emitted whenever the widget should be hidden. This is a useful signal for containers which embed this group.
*
* \param hide if true, the widget should be hidden.
*/
void
hideSignal
(
bool
hide
);
protected:
/**
* Callback for WPropertyBase::getChangeCondition. It emits an event to ensure all updates are done in gui thread.
*/
virtual
void
propertyChangeNotifier
();
/**
* Custom event dispatcher. Gets called by QT's Event system every time an event got sent to this widget. This event handler
* processes property change events.
*
* \note QT Doc says: use event() for custom events.
* \param event the event that got transmitted.
*
* \return true if the event got handled properly.
*/
virtual
bool
event
(
QEvent
*
event
);
private:
/**
...
...
@@ -213,6 +246,16 @@ private:
* The number of widgets inside this one.
*/
unsigned
int
m_numberOfWidgets
;
/**
* The property group handled here.
*/
WPropGroup
m_group
;
/**
* The connection for propertyChangeNotifier().
*/
boost
::
signals2
::
connection
m_connection
;
};
#endif // WQTPROPERTYGROUPWIDGET_H
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
View file @
140d95e0
This diff is collapsed.
Click to expand it.
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.h
View file @
140d95e0
...
...
@@ -35,6 +35,7 @@
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../dataHandler/WDataTexture3D.h"
#include "../../graphicsEngine/WGETexture.h"
#include "../../dataHandler/WSubject.h"
#include "../../dataHandler/WValueSet.h"
#include "../../graphicsEngine/geodes/WDendrogramGeode.h"
...
...
@@ -186,6 +187,17 @@ private:
*/
void
dendrogramClick
(
WPickInfo
pickInfo
);
/**
* update the output connector on demand, for performance reasons this is not done every time
* a change to the cluster selection is applied
*/
void
updateOutDataset
();
/**
* helper function to set the label on the in scene buttons depending on which labeling scheme is selected
*/
void
setButtonLabels
();
/**
* An input connector that accepts order 1 datasets.
...
...
@@ -217,6 +229,12 @@ private:
*/
osg
::
ref_ptr
<
osg
::
Texture3D
>
m_texture
;
/**
* stores a pointer to the texture we paint in
*/
// osg::ref_ptr< WGETexture3D > m_texture;
/**
* label vector for texture creation
*/
...
...
@@ -316,12 +334,6 @@ private:
*/
WPropGroup
m_groupTriangulation
;
/**
* grouping the properties controlling cluster selection for minimum branch length
*/
WPropGroup
m_groupMinBranchLength
;
/**
* controls the display of the dendrogram overlay
*/
...
...
@@ -394,6 +406,36 @@ private:
WPropInt
m_infoMaxLevel
;
//!< info property
std
::
vector
<
std
::
vector
<
size_t
>
>
m_loadedPartitions
;
//!< set partitions loaded from file
/**
* updates the output connector on demand, as we don't want to do this every paint command
*/
WPropTrigger
m_buttonUpdateOutput
;
/**
* A list of cluster selection methods
*/
boost
::
shared_ptr
<
WItemSelection
>
m_clusterSelectionsList
;
/**
* Selection property for clusters
*/
WPropSelection
m_clusterSelection
;
/**
* triggers the cluster selection update
*/
WPropTrigger
m_buttonExecuteSelection
;
/**
* A list of button labels
*/
boost
::
shared_ptr
<
WItemSelection
>
m_buttonLabelList
;
/**
* Selection property for button labels
*/
WPropSelection
m_buttonLabelSelection
;
};
#endif // WMCLUSTERDISPLAYVOXELS_H
src/modules/histogramEqualization/WMHistogramEqualization.cpp
View file @
140d95e0
...
...
@@ -23,6 +23,7 @@
//---------------------------------------------------------------------------
#include <vector>
#include <fstream>
#include <string>
#include "../../kernel/WKernel.h"
...
...
@@ -211,16 +212,21 @@ void WMHistogramEqualization::moduleMain()
curI
++
;
}
debugLog
()
<<
"Clamped "
<<
perc
<<
"% resulting in new interval ["
<<
lower
<<
", "
<<
upper
<<
")."
;
debugLog
()
<<
"Clamped "
<<
perc
<<
"% of ["
<<
hist
->
getMinimum
()
<<
", "
<<
hist
->
getMaximum
()
<<
"]"
<<
" resulting in new interval ["
<<
lower
<<
", "
<<
upper
<<
")."
;
// with this new interval, extract a new histogram and use it for equalization
hist
=
boost
::
shared_ptr
<
const
WValueSetHistogram
>
(
new
WValueSetHistogram
(
valueSet
,
lower
,
upper
,
cdfHistRes
)
);
}
// the new data
std
::
vector
<
unsigned
char
>
newData
;
std
::
vector
<
double
>
newData
;
newData
.
resize
(
hist
->
getTotalElementCount
(),
0
);
// these values are needed to rescale the data to the original interval
double
valueMin
=
hist
->
getMinimum
();
double
valueScaler
=
hist
->
getMaximum
()
-
valueMin
;
// equalize?
++*
progress
;
if
(
m_equalize
->
get
(
true
)
)
...
...
@@ -232,24 +238,23 @@ void WMHistogramEqualization::moduleMain()
// go through each CDF item and fill it, which is the sum of all previous items in hist
size_t
accum
=
0
;
double
cdfMin
=
(
*
hist
)[
0
];
double
cdfScaler
=
static_cast
<
double
>
(
valueSet
->
rawSize
()
)
-
cdfMin
;
for
(
size_t
i
=
0
;
i
<
hist
->
size
();
++
i
)
{
// the CDF at i is the summed up histogram from 0 to i
// we additionally require the histogram to be normalized so divide by the total count
accum
+=
(
*
hist
)[
i
];
cdf
[
i
]
=
accum
;
cdf
[
i
]
=
accum
-
cdfMin
;
}
// finally, build the new dataset
debugLog
()
<<
"Calculating equalized value-set"
;
double
cdfMin
=
cdf
[
0
];
for
(
size_t
vi
=
0
;
vi
<
valueSet
->
rawSize
();
++
vi
)
{
double
cdfVI
=
cdf
[
hist
->
getIndexForValue
(
valueSet
->
getScalarDouble
(
vi
)
)
];
newData
[
vi
]
=
static_cast
<
unsigned
char
>
(
255.0
*
(
cdfVI
-
cdfMin
)
/
(
static_cast
<
double
>
(
valueSet
->
rawSize
()
)
-
cdfMin
)
);
size_t
idx
=
hist
->
getIndexForValue
(
valueSet
->
getScalarDouble
(
vi
)
);
double
cdfVI
=
cdf
[
idx
];
newData
[
vi
]
=
valueMin
+
(
valueScaler
*
cdfVI
/
cdfScaler
);
}
}
else
...
...
@@ -260,7 +265,8 @@ void WMHistogramEqualization::moduleMain()
for
(
size_t
vi
=
0
;
vi
<
valueSet
->
rawSize
();
++
vi
)
{