Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
aee5eb16
Commit
aee5eb16
authored
Mar 30, 2017
by
Jakob Weiss
Browse files
Extended Params of glImageResampler and MedianFilter
parent
dc64895d
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/preprocessing/processors/glimageresampler.cpp
View file @
aee5eb16
...
...
@@ -43,13 +43,15 @@ namespace campvis {
:
VisualizationProcessor
(
viewportSizeProp
)
,
p_inputImage
(
"InputImage"
,
"Input Image"
,
""
,
DataNameProperty
::
READ
)
,
p_outputImage
(
"OutputImage"
,
"Output Image"
,
"GlImageResampler.out"
,
DataNameProperty
::
WRITE
)
,
p_resampleScale
(
"ResampleScale"
,
"Resampling Scale"
,
.5
f
,
.01
f
,
10.
f
)
,
p_relativeScale
(
"RelativeScaling"
,
"Relative Scaling"
,
true
)
,
p_resampleScale
(
"ResampleScale"
,
"Resampling Scale"
,
cgt
::
vec3
(
.5
f
),
cgt
::
vec3
(
.01
f
),
cgt
::
vec3
(
10.
f
))
,
p_targetSize
(
"TargetSize"
,
"Size of Resampled Image"
,
cgt
::
ivec3
(
128
),
cgt
::
ivec3
(
1
),
cgt
::
ivec3
(
1024
))
,
_shader2D
(
0
)
,
_shader3D
(
0
)
{
addProperty
(
p_inputImage
,
INVALID_RESULT
|
INVALID_PROPERTIES
);
addProperty
(
p_outputImage
);
addProperty
(
p_relativeScale
,
INVALID_RESULT
|
INVALID_PROPERTIES
);
addProperty
(
p_resampleScale
,
INVALID_RESULT
|
INVALID_PROPERTIES
);
addProperty
(
p_targetSize
);
}
...
...
@@ -77,6 +79,9 @@ namespace campvis {
if
(
img
!=
0
)
{
cgt
::
vec3
originalSize
(
img
->
getSize
());
cgt
::
ivec3
resampledSize
=
p_targetSize
.
getValue
();
if
(
p_relativeScale
.
getValue
())
resampledSize
=
cgt
::
ivec3
(
p_resampleScale
.
getValue
()
*
cgt
::
vec3
(
img
->
getSize
()));
bool
isTexture2D
=
img
->
getParent
()
->
getDimensionality
()
==
2
;
// 2D textures should not be scaled along the z axis
...
...
@@ -96,14 +101,14 @@ namespace campvis {
// activate shader and bind textures
shader
->
activate
();
img
->
bind
(
shader
,
inputUnit
);
// activate FBO and attach texture
_fbo
->
activate
();
glViewport
(
0
,
0
,
static_cast
<
GLsizei
>
(
resampledSize
.
x
),
static_cast
<
GLsizei
>
(
resampledSize
.
y
));
// render quad to compute difference measure by shader
for
(
int
z
=
0
;
z
<
resampledSize
.
z
;
++
z
)
{
if
(
!
isTexture2D
)
{
if
(
!
isTexture2D
)
{
float
zTexCoord
=
static_cast
<
float
>
(
z
)
/
static_cast
<
float
>
(
resampledSize
.
z
)
+
.5
f
/
static_cast
<
float
>
(
resampledSize
.
z
);
shader
->
setUniform
(
"_zTexCoord"
,
zTexCoord
);
}
...
...
@@ -134,9 +139,12 @@ namespace campvis {
ImageRepresentationGL
::
ScopedRepresentation
img
(
dataContainer
,
p_inputImage
.
getValue
());
if
(
img
!=
0
)
{
p_targetSize
.
setMaxValue
(
cgt
::
ivec3
(
img
->
getSize
())
*
int
(
p_resampleScale
.
getMaxValue
()));
p_targetSize
.
setValue
(
cgt
::
ivec3
(
cgt
::
vec3
(
img
->
getSize
())
*
p_resampleScale
.
getValue
()));
p_targetSize
.
setMaxValue
(
cgt
::
ivec3
(
img
->
getSize
())
*
cgt
::
ivec3
(
p_resampleScale
.
getMaxValue
()));
if
(
p_relativeScale
.
getValue
())
p_targetSize
.
setValue
(
cgt
::
ivec3
(
cgt
::
vec3
(
img
->
getSize
())
*
p_resampleScale
.
getValue
()));
}
p_resampleScale
.
setVisible
(
p_relativeScale
.
getValue
());
p_targetSize
.
setVisible
(
!
p_relativeScale
.
getValue
());
}
}
...
...
modules/preprocessing/processors/glimageresampler.h
View file @
aee5eb16
...
...
@@ -75,7 +75,9 @@ namespace campvis {
DataNameProperty
p_inputImage
;
///< ID for input volume
DataNameProperty
p_outputImage
;
///< ID for output gradient volume
FloatProperty
p_resampleScale
;
///< Resampling Scale
BoolProperty
p_relativeScale
;
///< relative or absolute scaling
Vec3Property
p_resampleScale
;
///< Resampling Scale
IVec3Property
p_targetSize
;
///< Size of resampled image
protected:
...
...
modules/preprocessing/processors/medianfilter.cpp
View file @
aee5eb16
...
...
@@ -47,7 +47,7 @@ namespace campvis {
MedianFilter
::
MedianFilter
()
:
AbstractProcessor
()
,
p_inputImage
(
"InputImage"
,
"Input Image"
,
""
,
DataNameProperty
::
READ
)
,
p_outputImage
(
"OutputImage"
,
"Output Image"
,
"
GlGauss
ianFilter.out"
,
DataNameProperty
::
WRITE
)
,
p_outputImage
(
"OutputImage"
,
"Output Image"
,
"
Med
ianFilter.out"
,
DataNameProperty
::
WRITE
)
,
p_windowSize
(
"WindowSize"
,
"Window Size"
,
cgt
::
ivec3
(
1
,
1
,
0
),
cgt
::
ivec3
(
0
),
cgt
::
ivec3
(
30
))
,
p_workgroupSize
(
"WorkgroupSize"
,
"Workgroup Size"
,
cgt
::
ivec3
(
4
),
cgt
::
ivec3
(
1
),
cgt
::
ivec3
(
16
))
,
_shader
(
0
)
...
...
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