Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

Commit aee5eb16 authored by Jakob Weiss's avatar Jakob Weiss

Extended Params of glImageResampler and MedianFilter

parent dc64895d
......@@ -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", .5f, .01f, 10.f)
, p_relativeScale("RelativeScaling", "Relative Scaling", true)
, p_resampleScale("ResampleScale", "Resampling Scale", cgt::vec3(.5f), cgt::vec3(.01f), 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) + .5f/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());
}
}
......
......@@ -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:
......
......@@ -47,7 +47,7 @@ namespace campvis {
MedianFilter::MedianFilter()
: AbstractProcessor()
, p_inputImage("InputImage", "Input Image", "", DataNameProperty::READ)
, p_outputImage("OutputImage", "Output Image", "GlGaussianFilter.out", DataNameProperty::WRITE)
, p_outputImage("OutputImage", "Output Image", "MedianFilter.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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment