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
46ed98a2
Commit
46ed98a2
authored
Jan 29, 2010
by
Mathias Goldau
Browse files
[MERGE]
parents
b25b4c53
eb108974
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
251 additions
and
59 deletions
+251
-59
src/dataHandler/WDataTexture3D.cpp
src/dataHandler/WDataTexture3D.cpp
+2
-3
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+4
-4
src/gui/qt4/WMainWindow.h
src/gui/qt4/WMainWindow.h
+3
-2
src/gui/qt4/WQtToolBar.cpp
src/gui/qt4/WQtToolBar.cpp
+62
-0
src/gui/qt4/WQtToolBar.h
src/gui/qt4/WQtToolBar.h
+67
-0
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
+1
-3
src/gui/qt4/ribbonMenu/WQtRibbonMenu.cpp
src/gui/qt4/ribbonMenu/WQtRibbonMenu.cpp
+2
-2
src/gui/qt4/ribbonMenu/WQtRibbonMenu.h
src/gui/qt4/ribbonMenu/WQtRibbonMenu.h
+2
-1
src/modules/gaussFiltering/WMGaussFiltering.cpp
src/modules/gaussFiltering/WMGaussFiltering.cpp
+98
-40
src/modules/gaussFiltering/WMGaussFiltering.h
src/modules/gaussFiltering/WMGaussFiltering.h
+10
-3
src/modules/marchingCubes/WMMarchingCubes.cpp
src/modules/marchingCubes/WMMarchingCubes.cpp
+0
-1
No files found.
src/dataHandler/WDataTexture3D.cpp
View file @
46ed98a2
...
...
@@ -204,27 +204,26 @@ void WDataTexture3D::createTexture()
if
(
m_valueSet
->
getDataType
()
==
W_DT_UINT8
)
{
std
::
cout
<<
"W_DT_UINT8"
<<
std
::
endl
;
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
vs
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
m_valueSet
);
unsigned
char
*
source
=
const_cast
<
unsigned
char
*
>
(
vs
->
rawData
()
);
ima
=
createTexture3D
(
source
,
m_valueSet
->
dimension
()
);
}
else
if
(
m_valueSet
->
getDataType
()
==
W_DT_INT16
)
{
std
::
cout
<<
"W_DT_INT16"
<<
std
::
endl
;
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
vs
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int16_t
>
>
(
m_valueSet
);
int16_t
*
source
=
const_cast
<
int16_t
*
>
(
vs
->
rawData
()
);
ima
=
createTexture3D
(
source
,
m_valueSet
->
dimension
()
);
}
else
if
(
m_valueSet
->
getDataType
()
==
W_DT_FLOAT
)
{
std
::
cout
<<
"W_DT_FLOAT"
<<
std
::
endl
;
boost
::
shared_ptr
<
WValueSet
<
float
>
>
vs
=
boost
::
shared_dynamic_cast
<
WValueSet
<
float
>
>
(
m_valueSet
);
float
*
source
=
const_cast
<
float
*
>
(
vs
->
rawData
()
);
ima
=
createTexture3D
(
source
,
m_valueSet
->
dimension
()
);
}
else
{
wlog
::
error
(
"WDataTexture3D"
)
<<
"COnversion of this data type to texture not supported yet."
;
}
m_texture
=
osg
::
ref_ptr
<
osg
::
Texture3D
>
(
new
osg
::
Texture3D
);
m_texture
->
setFilter
(
osg
::
Texture3D
::
MIN_FILTER
,
osg
::
Texture3D
::
LINEAR
);
...
...
src/gui/qt4/WMainWindow.cpp
View file @
46ed98a2
...
...
@@ -131,7 +131,7 @@ void WMainWindow::setupGUI()
void
WMainWindow
::
setupRibbonMenu
()
{
m_ribbonMenu
=
new
WQtRibbonMenu
(
this
);
m_ribbonMenu
=
new
WQtRibbonMenu
(
"Main Menu"
,
this
);
m_iconManager
.
addIcon
(
std
::
string
(
"quit"
),
quit_xpm
);
m_iconManager
.
addIcon
(
std
::
string
(
"save"
),
disc_xpm
);
...
...
@@ -190,8 +190,8 @@ void WMainWindow::setupCompatiblesToolBar()
{
m_iconManager
.
addIcon
(
std
::
string
(
"o"
),
o_xpm
);
// duumy icon for modules
m_compatiblesToolBar
=
new
WQt
RibbonMenu
(
this
);
m_compatiblesToolBar
=
new
WQt
ToolBar
(
"Compatible Modules Toolbar"
,
this
);
addToolBarBreak
(
Qt
::
TopToolBarArea
);
addToolBar
(
Qt
::
TopToolBarArea
,
m_compatiblesToolBar
);
}
...
...
@@ -205,7 +205,7 @@ WQtRibbonMenu* WMainWindow::getRibbonMenu()
return
m_ribbonMenu
;
}
WQt
RibbonMenu
*
WMainWindow
::
getCompatiblesToolBar
()
WQt
ToolBar
*
WMainWindow
::
getCompatiblesToolBar
()
{
return
m_compatiblesToolBar
;
}
...
...
src/gui/qt4/WMainWindow.h
View file @
46ed98a2
...
...
@@ -43,6 +43,7 @@
#include "WQtNavGLWidget.h"
#include "ribbonMenu/WQtRibbonMenu.h"
#include "WQtCustomDockWidget.h"
#include "WQtToolBar.h"
#include "WIconManager.h"
#include "WPropertyManager.h"
...
...
@@ -86,7 +87,7 @@ public:
/**
* returns a pointer to the tool bar showing the compatible modules
*/
WQt
RibbonMenu
*
getCompatiblesToolBar
();
WQt
ToolBar
*
getCompatiblesToolBar
();
/**
...
...
@@ -184,7 +185,7 @@ private:
WQtRibbonMenu
*
m_ribbonMenu
;
//!< The ribbon menu of the main window.
WQt
RibbonMenu
*
m_compatiblesToolBar
;
//!< This toolbar shows the compatible modules if a module is selcted in the dataset browser
WQt
ToolBar
*
m_compatiblesToolBar
;
//!< This toolbar shows the compatible modules if a module is sel
e
cted in the dataset browser
WQtDatasetBrowser
*
m_datasetBrowser
;
//!< dataset browser
...
...
src/gui/qt4/WQtToolBar.cpp
0 → 100644
View file @
46ed98a2
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WQtToolBar.h"
WQtToolBar
::
WQtToolBar
(
const
QString
&
title
,
QWidget
*
parent
)
:
QToolBar
(
title
,
parent
)
{
this
->
setAllowedAreas
(
Qt
::
TopToolBarArea
|
Qt
::
BottomToolBarArea
);
// The following makes the bar having button size from the beginning.
QPushButton
*
dummyButton
=
new
QPushButton
;
dummyButton
->
setFixedWidth
(
0
);
addWidget
(
dummyButton
);
}
WQtToolBar
::~
WQtToolBar
()
{
}
WQtPushButton
*
WQtToolBar
::
addPushButton
(
QString
name
,
QIcon
icon
,
QString
label
)
{
WQtPushButton
*
button
=
new
WQtPushButton
(
icon
,
label
);
button
->
setName
(
name
);
addWidget
(
button
);
return
button
;
}
void
WQtToolBar
::
clearButtons
()
{
clear
();
// The following prevents the bar from changing size when it has no real buttons.
QPushButton
*
dummyButton
=
new
QPushButton
;
dummyButton
->
setFixedWidth
(
0
);
addWidget
(
dummyButton
);
}
src/gui/qt4/WQtToolBar.h
0 → 100644
View file @
46ed98a2
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTTOOLBAR_H
#define WQTTOOLBAR_H
#include <QtGui/QToolBar>
#include "guiElements/WQtPushButton.h"
/**
* This is a toolbar. Its main usage for now is the "compatible modules" toolbar
*/
class
WQtToolBar
:
public
QToolBar
{
public:
/**
* Constructs the toolbar.
* \param title name of the toolbar.
* \param parent the parent widget of this widget, i.e. the widget that manages it.
*/
explicit
WQtToolBar
(
const
QString
&
title
,
QWidget
*
parent
);
/**
* destructor
*/
virtual
~
WQtToolBar
();
/**
* Adds a push button to the toolbar. The button is identifiable by its name.
* \param name a name for the new button to identifie it
* \param icon and icon for the button
* \param label The optional text that is displayed besides the icon on the button.
*/
WQtPushButton
*
addPushButton
(
QString
name
,
QIcon
icon
,
QString
label
=
0
);
/**
* Removes all buttons,
*/
void
clearButtons
();
protected:
private:
};
#endif // WQTTOOLBAR_H
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
View file @
46ed98a2
...
...
@@ -242,7 +242,7 @@ void WQtDatasetBrowser::selectTreeItem()
}
boost
::
shared_ptr
<
WModule
>
module
;
m_mainWindow
->
getCompatiblesToolBar
()
->
clear
NonPersistentTab
s
();
m_mainWindow
->
getCompatiblesToolBar
()
->
clear
Button
s
();
if
(
m_treeWidget
->
selectedItems
().
at
(
0
)
->
type
()
==
1
)
{
...
...
@@ -254,12 +254,10 @@ void WQtDatasetBrowser::selectTreeItem()
}
// every module may have compatibles: create ribbon menu entry
m_mainWindow
->
getCompatiblesToolBar
()
->
addTab
(
QString
(
"Compatible Modules"
),
false
);
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
{
WQtPushButton
*
button
=
m_mainWindow
->
getCompatiblesToolBar
()
->
addPushButton
(
QString
(
(
*
iter
)
->
getName
().
c_str
()
),
QString
(
"Compatible Modules"
),
m_mainWindow
->
getIconManager
()
->
getIcon
(
"o"
),
QString
(
(
*
iter
)
->
getName
().
c_str
()
)
);
...
...
src/gui/qt4/ribbonMenu/WQtRibbonMenu.cpp
View file @
46ed98a2
...
...
@@ -30,8 +30,8 @@
#include "WQtRibbonMenu.h"
WQtRibbonMenu
::
WQtRibbonMenu
(
QWidget
*
parent
)
:
QToolBar
(
parent
)
WQtRibbonMenu
::
WQtRibbonMenu
(
const
QString
&
title
,
QWidget
*
parent
)
:
QToolBar
(
title
,
parent
)
{
this
->
setAllowedAreas
(
Qt
::
TopToolBarArea
|
Qt
::
BottomToolBarArea
);
...
...
src/gui/qt4/ribbonMenu/WQtRibbonMenu.h
View file @
46ed98a2
...
...
@@ -40,9 +40,10 @@ class WQtRibbonMenu : public QToolBar
public:
/**
* default constructor
* \param title name of the ribbon menu.
* \param parent the parent widget of this widget, i.e. the widget that manages it.
*/
explicit
WQtRibbonMenu
(
QWidget
*
parent
);
explicit
WQtRibbonMenu
(
const
QString
&
title
,
QWidget
*
parent
);
/**
* destructor
...
...
src/modules/gaussFiltering/WMGaussFiltering.cpp
View file @
46ed98a2
...
...
@@ -30,6 +30,7 @@
#include <cmath>
#include "../../common/WStringUtils.h"
#include "../../common/WProgress.h"
#include "../../dataHandler/WGridRegular3D.h"
#include "../../kernel/WKernel.h"
#include "../../math/WPosition.h"
...
...
@@ -70,35 +71,63 @@ size_t getId( size_t xDim, size_t yDim, size_t /*zDim*/, size_t x, size_t y, siz
return
z
*
xDim
*
yDim
+
y
*
xDim
+
x
;
}
double
WMGaussFiltering
::
filterSimple
(
size_t
nX
,
size_t
nY
,
size_t
nZ
,
size_t
x
,
size_t
y
,
size_t
z
)
template
<
typename
T
>
double
WMGaussFiltering
::
filterAtPosition
(
boost
::
shared_ptr
<
WValueSet
<
T
>
>
vals
,
size_t
nX
,
size_t
nY
,
size_t
nZ
,
size_t
x
,
size_t
y
,
size_t
z
)
{
double
filtered
=
0
;
filtered
+=
2
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
-
1
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
,
z
-
1
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
,
z
-
1
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
+
1
,
z
-
1
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
-
1
,
z
-
1
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
-
1
,
z
)
);
filtered
+=
2
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
-
1
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
-
1
,
z
)
);
filtered
+=
2
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
,
z
)
);
filtered
+=
4
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
)
);
filtered
+=
2
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
+
1
,
z
)
);
filtered
+=
2
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
+
1
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
+
1
,
z
)
);
filtered
+=
2
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
+
1
,
z
)
);
filtered
+=
1
*
m_
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
-
1
,
z
)
);
filtered
+=
2
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
-
1
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
,
z
-
1
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
,
z
-
1
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
+
1
,
z
-
1
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
-
1
,
z
-
1
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
-
1
,
z
)
);
filtered
+=
2
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
-
1
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
-
1
,
z
)
);
filtered
+=
2
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
,
z
)
);
filtered
+=
4
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
)
);
filtered
+=
2
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
+
1
,
z
)
);
filtered
+=
2
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
+
1
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
+
1
,
z
)
);
filtered
+=
2
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
+
1
,
y
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
-
1
,
y
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
+
1
,
z
)
);
filtered
+=
1
*
vals
->
getScalar
(
getId
(
nX
,
nY
,
nZ
,
x
,
y
-
1
,
z
)
);
filtered
/=
28.
;
return
filtered
;
}
template
<
typename
T
>
std
::
vector
<
double
>
WMGaussFiltering
::
filterField
(
boost
::
shared_ptr
<
WValueSet
<
T
>
>
vals
)
{
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
m_dataSet
->
getGrid
()
);
assert
(
grid
);
size_t
nX
=
grid
->
getNbCoordsX
();
size_t
nY
=
grid
->
getNbCoordsY
();
size_t
nZ
=
grid
->
getNbCoordsZ
();
std
::
vector
<
double
>
newVals
(
nX
*
nY
*
nZ
,
0.
);
boost
::
shared_ptr
<
WProgress
>
progress
=
boost
::
shared_ptr
<
WProgress
>
(
new
WProgress
(
"Gauss Filtering"
,
nZ
)
);
m_progress
->
addSubProgress
(
progress
);
for
(
size_t
z
=
1
;
z
<
nZ
-
1
;
z
++
)
{
++*
progress
;
for
(
size_t
y
=
1
;
y
<
nY
-
1
;
y
++
)
{
for
(
size_t
x
=
1
;
x
<
nX
-
1
;
x
++
)
{
newVals
[
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
)]
=
filterAtPosition
(
vals
,
nX
,
nY
,
nZ
,
x
,
y
,
z
);
}
}
}
progress
->
finish
();
return
newVals
;
}
void
WMGaussFiltering
::
moduleMain
()
{
// use the m_input "data changed" flag
...
...
@@ -123,29 +152,58 @@ void WMGaussFiltering::moduleMain()
}
assert
(
m_dataSet
);
m_vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
double
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
assert
(
m_vals
);
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
m_dataSet
->
getGrid
()
);
assert
(
grid
);
size_t
nX
=
grid
->
getNbCoordsX
();
size_t
nY
=
grid
->
getNbCoordsY
();
size_t
nZ
=
grid
->
getNbCoordsZ
();
std
::
vector
<
double
>
newVals
(
nX
*
nY
*
nZ
,
0.
);
for
(
size_t
z
=
1
;
z
<
nZ
-
1
;
z
++
)
std
::
vector
<
double
>
newVals
;
switch
(
(
*
m_dataSet
).
getValueSet
()
->
getDataType
()
)
{
for
(
size_t
y
=
1
;
y
<
nY
-
1
;
y
++
)
case
W_DT_UNSIGNED_CHAR
:
{
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
assert
(
vals
);
newVals
=
filterField
(
vals
);
break
;
}
case
W_DT_INT16
:
{
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int16_t
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
assert
(
vals
);
newVals
=
filterField
(
vals
);
}
case
W_DT_SIGNED_INT
:
{
for
(
size_t
x
=
1
;
x
<
nX
-
1
;
x
++
)
{
newVals
[
getId
(
nX
,
nY
,
nZ
,
x
,
y
,
z
)]
=
filterSimple
(
nX
,
nY
,
nZ
,
x
,
y
,
z
);
}
boost
::
shared_ptr
<
WValueSet
<
int32_t
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int32_t
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
assert
(
vals
);
newVals
=
filterField
(
vals
);
break
;
}
case
W_DT_FLOAT
:
{
boost
::
shared_ptr
<
WValueSet
<
float
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
float
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
assert
(
vals
);
newVals
=
filterField
(
vals
);
break
;
}
case
W_DT_DOUBLE
:
{
boost
::
shared_ptr
<
WValueSet
<
double
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
double
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
assert
(
vals
);
newVals
=
filterField
(
vals
);
break
;
}
default:
assert
(
false
&&
"Unknow data type in Gauss Filtering module"
);
}
boost
::
shared_ptr
<
WValueSet
<
double
>
>
values
;
values
=
boost
::
shared_ptr
<
WValueSet
<
double
>
>
(
new
WValueSet
<
double
>
(
0
,
1
,
newVals
,
W_DT_DOUBLE
)
);
m_dataSet
=
boost
::
shared_ptr
<
WDataSetSingle
>
(
new
WDataSetSingle
(
values
,
m_dataSet
->
getGrid
()
)
);
boost
::
shared_ptr
<
WValueSet
<
double
>
>
valueSet
;
valueSet
=
boost
::
shared_ptr
<
WValueSet
<
double
>
>
(
new
WValueSet
<
double
>
(
0
,
1
,
newVals
,
W_DT_DOUBLE
)
);
m_dataSet
=
boost
::
shared_ptr
<
WDataSetSingle
>
(
new
WDataSetSingle
(
valueSet
,
m_dataSet
->
getGrid
()
)
);
m_output
->
updateData
(
m_dataSet
);
// this waits for m_moduleState to fire. By default, this is only the m_shutdownFlag condition.
...
...
@@ -179,7 +237,7 @@ void WMGaussFiltering::connectors()
void
WMGaussFiltering
::
properties
()
{
(
m_properties
->
addInt
(
"Filter Size"
,
1
)
)
->
connect
(
boost
::
bind
(
&
WMGaussFiltering
::
slotPropertyChanged
,
this
,
_1
)
);
//
( m_properties->addInt( "Filter Size", 1 ) )->connect( boost::bind( &WMGaussFiltering::slotPropertyChanged, this, _1 ) );
}
void
WMGaussFiltering
::
slotPropertyChanged
(
std
::
string
propertyName
)
...
...
src/modules/gaussFiltering/WMGaussFiltering.h
View file @
46ed98a2
...
...
@@ -44,7 +44,7 @@ class WPickHandler;
* Gauss filtering for WDataSetSingle
*
* \problem It works only on double value sets so far.
* \reminder The boundary values will not be touched an considered to be zero.
* \reminder The boundary values will not be touched an considered to be zero.
*
* \ingroup modules
*/
...
...
@@ -107,6 +107,7 @@ private:
/**
* Simple convolution using a small gauss-like mask
* \param vals the valueset to work on
* \param nX number of positions in x direction
* \param nY number of positions in y direction
* \param nZ number of positions in z direction
...
...
@@ -114,11 +115,17 @@ private:
* \param y index for x direction
* \param z index for x direction
*/
double
filterSimple
(
size_t
nX
,
size_t
nY
,
size_t
nZ
,
size_t
x
,
size_t
y
,
size_t
z
);
template
<
typename
T
>
double
filterAtPosition
(
boost
::
shared_ptr
<
WValueSet
<
T
>
>
vals
,
size_t
nX
,
size_t
nY
,
size_t
nZ
,
size_t
x
,
size_t
y
,
size_t
z
);
/**
* Run the filter over the field.
* \param vals the valueset to work on
*/
template
<
typename
T
>
std
::
vector
<
double
>
filterField
(
boost
::
shared_ptr
<
WValueSet
<
T
>
>
vals
);
boost
::
shared_ptr
<
WModuleInputData
<
WDataSetSingle
>
>
m_input
;
//!< Input connector required by this module.
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSetSingle
>
>
m_output
;
//!< The only output of this filter module.
boost
::
shared_ptr
<
WDataSetSingle
>
m_dataSet
;
//!< Pointer providing access to the treated data set in the whole module.
boost
::
shared_ptr
<
WValueSet
<
double
>
>
m_vals
;
//!< Pointer providing access to the treated value set in the whole module.
};
#endif // WMGAUSSFILTERING_H
src/modules/marchingCubes/WMMarchingCubes.cpp
View file @
46ed98a2
...
...
@@ -200,7 +200,6 @@ void WMMarchingCubes::slotPropertyChanged( std::string propertyName )
}
else
if
(
propertyName
==
"Opacity %"
)
{
debugLog
()
<<
"Change opacity."
<<
std
::
endl
;
updateTextures
();
}
else
if
(
propertyName
==
"active"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment