Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
b7b1f6a3
Commit
b7b1f6a3
authored
Feb 07, 2015
by
Declara Denis
Committed by
Christian Schulte zu Berge
Feb 18, 2015
Browse files
Added ability to change presets with F keys
You can now use the F keys (F1 - F5) to change presets in ConfidenceMapsDemo.
parent
945dc85e
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/cudaconfidencemaps/cudaconfidencemaps.cmake
View file @
b7b1f6a3
...
...
@@ -46,9 +46,14 @@ IF(ModuleEnabled)
SET
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
;-O3
)
ENDIF
()
SET
(
CUSPLIBRARY_VERSION
"0.4.0"
)
IF
(
CUSPLIBRARY_VERSION STREQUAL
"0.4.0-git"
)
SET
(
CUDA_NVCC_FLAGS -DGIT_CUSP_VERSION
)
ENDIF
()
# CUSP Include directory
CUDA_INCLUDE_DIRECTORIES
(
${
ThisModDir
}
/ext/cusplibrary-
0.4.0
${
ThisModDir
}
/ext/cusplibrary-
${
CUSPLIBRARY_VERSION
}
${
TBB_INCLUDE_DIR
}
)
...
...
modules/cudaconfidencemaps/pipelines/cudaconfidencemapsdemo.cpp
View file @
b7b1f6a3
...
...
@@ -38,6 +38,7 @@
#include
"core/datastructures/imagerepresentationgl.h"
#include
"core/classification/geometry1dtransferfunction.h"
#include
"core/classification/tfgeometry1d.h"
#include
"cgt/event/keyevent.h"
namespace
campvis
{
...
...
@@ -53,7 +54,7 @@ namespace campvis {
,
p_millisecondBudget
(
"MillisecondBudget"
,
"Milliseconds per frame"
,
24.0
f
,
10.0
f
,
60.0
f
)
,
p_connectDisconnectButton
(
"ConnectToIGTLink"
,
"Connect/Disconnect"
)
,
p_resamplingScale
(
"ResampleScale"
,
"Resample Scale"
,
0.25
f
,
0.01
f
,
1.0
f
)
,
p_beta
(
"Beta"
,
"Beta"
,
2
0.0
f
,
1.0
f
,
200.0
f
)
,
p_beta
(
"Beta"
,
"Beta"
,
6
0.0
f
,
1.0
f
,
200.0
f
)
,
p_showAdvancedOptions
(
"ShowAdvancedOptions"
,
"Advanced options..."
,
false
)
,
p_useAlphaBetaFilter
(
"UseAlphaBetaFilter"
,
"Alpha-Beta-Filter"
,
true
)
,
p_gaussianFilterSize
(
"GaussianSigma"
,
"Blur amount"
,
2.5
f
,
1.0
f
,
10.0
f
)
...
...
@@ -96,6 +97,8 @@ namespace campvis {
addProperty
(
p_recordingDirectory
);
addProperty
(
p_enableRecording
);
addProperty
(
p_useSpacingEncodedFanGeometry
);
setAdvancedPropertiesVisibility
(
false
);
}
...
...
@@ -211,6 +214,7 @@ namespace campvis {
auto
ms
=
(
endTime
-
startTime
).
seconds
()
*
1000.0
f
;
auto
solverMs
=
(
solverEndTime
-
solverStartTime
).
seconds
()
*
1000.0
f
;
std
::
stringstream
string
;
string
<<
"Mode: "
<<
_usFusion
.
p_view
.
getOptionValue
()
<<
std
::
endl
;
string
<<
"Execution time: "
<<
static_cast
<
int
>
(
ms
)
<<
"ms"
<<
std
::
endl
;
string
<<
"Solver time: "
<<
static_cast
<
int
>
(
solverMs
)
<<
"ms"
<<
std
::
endl
;
string
<<
"CG Iterations: "
<<
_usMapsSolver
.
getActualConjugentGradientIterations
()
<<
std
::
endl
;
...
...
@@ -259,6 +263,64 @@ namespace campvis {
}
}
void
CudaConfidenceMapsDemo
::
onEvent
(
cgt
::
Event
*
e
)
{
// Allow for rapid switching between different visualizations
// F1: Ultrasound only
// F2: Sharpness
// F3: LAB
// F4: Color overlay
// F5: CM only
if
(
typeid
(
*
e
)
==
typeid
(
cgt
::
KeyEvent
))
{
cgt
::
KeyEvent
*
keyEvent
=
reinterpret_cast
<
cgt
::
KeyEvent
*>
(
e
);
if
(
keyEvent
==
nullptr
)
return
;
if
(
keyEvent
->
pressed
())
{
bool
eventHandled
=
true
;
switch
(
keyEvent
->
keyCode
())
{
case
cgt
::
KeyEvent
::
K_F1
:
_usFusion
.
p_view
.
setValue
(
0
);
// US only
break
;
case
cgt
::
KeyEvent
::
K_F2
:
_usFusion
.
p_view
.
setValue
(
10
);
// Sharpness
{
Geometry1DTransferFunction
*
tf
=
new
Geometry1DTransferFunction
(
256
);
tf
->
addGeometry
(
TFGeometry1D
::
createQuad
(
cgt
::
vec2
(
0.0
f
,
1.0
f
),
cgt
::
col4
(
0
,
0
,
0
,
255
),
cgt
::
col4
(
0
,
0
,
0
,
0
)));
_usFusion
.
p_confidenceTF
.
replaceTF
(
tf
);
}
break
;
case
cgt
::
KeyEvent
::
K_F3
:
_usFusion
.
p_view
.
setValue
(
8
);
// LAB
{
Geometry1DTransferFunction
*
tf
=
new
Geometry1DTransferFunction
(
256
);
tf
->
addGeometry
(
TFGeometry1D
::
createQuad
(
cgt
::
vec2
(
0.0
f
,
0.5
f
),
cgt
::
col4
(
0
,
0
,
0
,
255
),
cgt
::
col4
(
0
,
0
,
0
,
0
)));
_usFusion
.
p_confidenceTF
.
replaceTF
(
tf
);
_usFusion
.
p_hue
.
setValue
(
0.23
f
);
}
break
;
case
cgt
::
KeyEvent
::
K_F4
:
_usFusion
.
p_view
.
setValue
(
12
);
// Color overlay
{
Geometry1DTransferFunction
*
tf
=
new
Geometry1DTransferFunction
(
256
);
tf
->
addGeometry
(
TFGeometry1D
::
createQuad
(
cgt
::
vec2
(
0.0
f
,
0.5
f
),
cgt
::
col4
(
0
,
0
,
0
,
255
),
cgt
::
col4
(
0
,
0
,
0
,
0
)));
_usFusion
.
p_confidenceTF
.
replaceTF
(
tf
);
_usFusion
.
p_hue
.
setValue
(
0.15
f
);
}
break
;
case
cgt
::
KeyEvent
::
K_F5
:
_usFusion
.
p_view
.
setValue
(
2
);
// CM Only
break
;
default:
eventHandled
=
false
;
};
if
(
eventHandled
)
{
e
->
accept
();
// Force HUD statistics to be updated
_statisticsLastUpdateTime
=
tbb
::
tick_count
();
}
}
}
}
void
CudaConfidenceMapsDemo
::
onPropertyChanged
(
const
AbstractProperty
*
prop
)
{
if
(
prop
==
&
p_showAdvancedOptions
)
{
setAdvancedPropertiesVisibility
(
p_showAdvancedOptions
.
getValue
());
...
...
modules/cudaconfidencemaps/pipelines/cudaconfidencemapsdemo.h
View file @
b7b1f6a3
...
...
@@ -41,6 +41,7 @@
namespace
campvis
{
class
CudaConfidenceMapsDemo
:
public
AutoEvaluationPipeline
{
public:
/**
...
...
@@ -62,6 +63,9 @@ namespace campvis {
/// \see AbstractPipeline::executePipeline()
virtual
void
executePipeline
();
/// \see AbstractPipeline::onEvent()
virtual
void
onEvent
(
cgt
::
Event
*
e
);
/// \see AbstractPipeline::getName()
virtual
const
std
::
string
getName
()
const
{
return
getId
();
};
static
const
std
::
string
getId
()
{
return
"CudaConfidenceMapsDemo"
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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