The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 535a3f34 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

* Split up ProcessorDecoratorShading in ProcessorDecoratorShading inheriting...

* Split up ProcessorDecoratorShading in ProcessorDecoratorShading inheriting from ProcessorDecoratorGradient
* Introducing GlGradientVolumeGenerator processor in preprocessing module
parent ef39dee4
......@@ -99,16 +99,39 @@ namespace campvis {
virtual ~HasProcessorDecorators();
protected:
/**
* Adds \a decorator to the list of processor decorators.
* \param decorator Processor decorator to add
*/
void addDecorator(AbstractProcessorDecorator* decorator);
/**
* Decorates \a propCollection with the properties of all held decorators.
* \param propCollection PropertyCollection to decorate (usually your processor)
*/
void decoratePropertyCollection(HasPropertyCollection* propCollection) const;
/**
* Calls renderProlog() on each held decorator.
* To be called before rendering to decorate \a shader.
* \param dataContainer DataContainer to work on
* \param shader Shader to decorate
*/
void decorateRenderProlog(const DataContainer& dataContainer, tgt::Shader* shader) const;
/**
* Calls renderProlog() on each held decorator.
* To be called after rendering to decorate \a shader.
* \param shader Shader to decorate
*/
void decorateRenderEpilog(tgt::Shader* shader) const;
/**
* Concatenates and returns the GLSL headers of all held decorators.
*/
std::string getDecoratedHeader() const;
std::vector<AbstractProcessorDecorator*> _decorators; ///< List of all processor decorators
};
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#include "processordecoratorgradient.h"
#include "tgt/shadermanager.h"
#include "core/properties/propertycollection.h"
namespace campvis {
static const GenericOption<ProcessorDecoratorGradient::GradientMethod> gradientOptions[4] = {
GenericOption<ProcessorDecoratorGradient::GradientMethod>("Forward", "Forward Differences", ProcessorDecoratorGradient::ForwardDifferences),
GenericOption<ProcessorDecoratorGradient::GradientMethod>("Central", "Central Differences", ProcessorDecoratorGradient::CentralDifferences),
GenericOption<ProcessorDecoratorGradient::GradientMethod>("Sobel", "Sobel Filter", ProcessorDecoratorGradient::SobelFilter),
GenericOption<ProcessorDecoratorGradient::GradientMethod>("FilteredCentral", "Filtered Central Differences", ProcessorDecoratorGradient::FilteredCentralDifferences)
};
ProcessorDecoratorGradient::ProcessorDecoratorGradient()
: AbstractProcessorDecorator()
, _gradientMethod("GradientMethod", "Gradient Computation Method", gradientOptions, 4, AbstractProcessor::INVALID_SHADER | AbstractProcessor::INVALID_RESULT)
{
_gradientMethod.setValue(1);
}
ProcessorDecoratorGradient::~ProcessorDecoratorGradient() {
}
void ProcessorDecoratorGradient::addProperties(HasPropertyCollection* propCollection) {
propCollection->addProperty(&_gradientMethod);
}
std::string ProcessorDecoratorGradient::generateHeader() const {
std::string toReturn;
switch (_gradientMethod.getOptionValue()) {
case ForwardDifferences:
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientForwardDifferences(tex, texParams, texCoords)\n");
break;
case CentralDifferences:
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientCentralDifferences(tex, texParams, texCoords)\n");
break;
case FilteredCentralDifferences:
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientFilteredCentralDifferences(tex, texParams, texCoords)\n");
break;
case SobelFilter:
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientSobel(tex, texCoords)\n");
break;
default:
tgtAssert(false, "Invalid enum!");
break;
}
return toReturn;
}
}
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#ifndef PROCESSORDECORATORGRADIENT_H__
#define PROCESSORDECORATORGRADIENT_H__
#include "tgt/textureunit.h"
#include "core/pipeline/abstractprocessordecorator.h"
#include "core/properties/floatingpointproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/optionproperty.h"
namespace campvis {
/**
* Processor decorator to decorate for all gradient computation methods supported in glsl/tools/gradient.frag.
* Holds a single option property to select the gradient computation method and implements
* generateHeader() to define computeGradient(tex, texParams, texCoords) in GLSL calling
* the selected function.
*/
class ProcessorDecoratorGradient : public AbstractProcessorDecorator {
public:
/// Method for online-calculating gradients
enum GradientMethod {
ForwardDifferences,
CentralDifferences,
FilteredCentralDifferences,
SobelFilter
};
/// Constructor
ProcessorDecoratorGradient();
/// Virtual Destructor
virtual ~ProcessorDecoratorGradient();
protected:
/// \see AbstractProcessorDecorator::addProperties()
void addProperties(HasPropertyCollection* propCollection);
/// \see AbstractProcessorDecorator::generateHeader()
std::string generateHeader() const;
GenericOptionProperty<GradientMethod> _gradientMethod; ///< Method for calculating the gradients
};
}
#endif // PROCESSORDECORATORGRADIENT_H__
......@@ -33,17 +33,9 @@
#include "core/properties/propertycollection.h"
namespace campvis {
static const GenericOption<ProcessorDecoratorShading::GradientMethod> gradientOptions[4] = {
GenericOption<ProcessorDecoratorShading::GradientMethod>("Forward", "Forward Differences", ProcessorDecoratorShading::ForwardDifferences),
GenericOption<ProcessorDecoratorShading::GradientMethod>("Central", "Central Differences", ProcessorDecoratorShading::CentralDifferences),
GenericOption<ProcessorDecoratorShading::GradientMethod>("Sobel", "Sobel Filter", ProcessorDecoratorShading::SobelFilter),
GenericOption<ProcessorDecoratorShading::GradientMethod>("FilteredCentral", "Filtered Central Differences", ProcessorDecoratorShading::FilteredCentralDifferences)
};
ProcessorDecoratorShading::ProcessorDecoratorShading(const std::string& lightUniformName /*= "_lightSource"*/)
: AbstractProcessorDecorator()
: ProcessorDecoratorGradient()
, _enableShading("EnableShading", "Enable Shading", true, AbstractProcessor::INVALID_SHADER | AbstractProcessor::INVALID_RESULT)
, _gradientMethod("GradientMethod", "Gradient Computation Method", gradientOptions, 4, AbstractProcessor::INVALID_SHADER | AbstractProcessor::INVALID_RESULT)
, _lightPosition("LightPosition", "Light Position", tgt::vec3(-100.f), tgt::vec3(-500.f), tgt::vec3(500.f), tgt::vec3(1.f))
, _ambientColor("AmbientColor", "Ambient Light Color", tgt::vec3(0.4f), tgt::vec3(0.f), tgt::vec3(1.f))
, _diffuseColor("DiffuseColor", "Diffuse Light Color", tgt::vec3(0.75f), tgt::vec3(0.f), tgt::vec3(1.f))
......@@ -52,7 +44,6 @@ namespace campvis {
, _attenuation("Attenuation", "Attenuation Factors", tgt::vec3(0.f), tgt::vec3(0.f), tgt::vec3(1.f))
, _lightUniformName(lightUniformName)
{
_gradientMethod.setValue(1);
}
ProcessorDecoratorShading::~ProcessorDecoratorShading() {
......@@ -60,7 +51,8 @@ namespace campvis {
void ProcessorDecoratorShading::addProperties(HasPropertyCollection* propCollection) {
propCollection->addProperty(&_enableShading);
propCollection->addProperty(&_gradientMethod);
ProcessorDecoratorGradient::addProperties(propCollection);
propCollection->addProperty(&_lightPosition);
propCollection->addProperty(&_ambientColor);
propCollection->addProperty(&_diffuseColor);
......@@ -70,6 +62,8 @@ namespace campvis {
}
void ProcessorDecoratorShading::renderProlog(const DataContainer& dataContainer, tgt::Shader* shader) {
ProcessorDecoratorGradient::renderProlog(dataContainer, shader);
shader->setUniform(_lightUniformName + "._position", _lightPosition.getValue());
shader->setUniform(_lightUniformName + "._ambientColor", _ambientColor.getValue());
shader->setUniform(_lightUniformName + "._diffuseColor", _diffuseColor.getValue());
......@@ -80,28 +74,10 @@ namespace campvis {
std::string ProcessorDecoratorShading::generateHeader() const {
std::string toReturn;
std::string toReturn = ProcessorDecoratorGradient::generateHeader();
if (_enableShading.getValue())
toReturn.append("#define ENABLE_SHADING\n");
switch (_gradientMethod.getOptionValue()) {
case ForwardDifferences :
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientForwardDifferences(tex, texParams, texCoords)\n");
break;
case CentralDifferences :
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientCentralDifferences(tex, texParams, texCoords)\n");
break;
case FilteredCentralDifferences :
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientFilteredCentralDifferences(tex, texParams, texCoords)\n");
break;
case SobelFilter :
toReturn.append("#define computeGradient(tex, texParams, texCoords) computeGradientSobel(tex, texCoords)\n");
break;
default:
tgtAssert(false, "Invalid enum!");
break;
}
return toReturn;
}
......
......@@ -31,24 +31,17 @@
#define PROCESSORDECORATORSHADING_H__
#include "tgt/textureunit.h"
#include "core/pipeline/abstractprocessordecorator.h"
#include "core/pipeline/processordecoratorgradient.h"
#include "core/properties/floatingpointproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/optionproperty.h"
namespace campvis {
class ProcessorDecoratorShading : public AbstractProcessorDecorator {
class ProcessorDecoratorShading : public ProcessorDecoratorGradient {
public:
/// Method for online-calculating gradients
enum GradientMethod {
ForwardDifferences,
CentralDifferences,
FilteredCentralDifferences,
SobelFilter
};
explicit ProcessorDecoratorShading(const std::string& lightUniformName = "_lightSource");
virtual ~ProcessorDecoratorShading();
protected:
......@@ -58,8 +51,8 @@ namespace campvis {
std::string generateHeader() const;
BoolProperty _enableShading; ///< Flag whether to enable shading;
GenericOptionProperty<GradientMethod> _gradientMethod; ///< Method for calculating the gradients
Vec3Property _lightPosition; ///< Light position
Vec3Property _ambientColor; ///< Ambient light color
Vec3Property _diffuseColor; ///< Diffuse light color
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
in vec3 ex_TexCoord;
out vec3 out_Color;
#include "tools/gradient.frag"
#include "tools/texture3d.frag"
uniform sampler3D _texture;
uniform TextureParameters3D _textureParams;
uniform float _zTexCoord;
void main() {
out_Color = computeGradient(_texture, _textureParams, vec3(ex_TexCoord.xy, _zTexCoord));
}
......@@ -8,6 +8,9 @@ FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
# Header files
FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
modules/preprocessing/glsl/*.frag
modules/preprocessing/processors/*.h
modules/preprocessing/tools/*.h
)
SET(ThisModShaderDirectories "modules/preprocessing/glsl")
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#include "glgradientvolumegenerator.h"
#include "tgt/logmanager.h"
#include "tgt/shadermanager.h"
#include "tgt/textureunit.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/datastructures/renderdata.h"
#include "core/pipeline/processordecoratorgradient.h"
#include "core/classification/simpletransferfunction.h"
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
#include "core/tools/quadrenderer.h"
namespace campvis {
const std::string GlGradientVolumeGenerator::loggerCat_ = "CAMPVis.modules.classification.GlGradientVolumeGenerator";
GlGradientVolumeGenerator::GlGradientVolumeGenerator(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_inputImage("InputImage", "Input Image", "", DataNameProperty::READ, AbstractProcessor::INVALID_PROPERTIES | AbstractProcessor::INVALID_RESULT)
, p_outputImage("OutputImage", "Output Image", "GlGradientVolumeGenerator.out", DataNameProperty::WRITE)
, _shader(0)
{
addDecorator(new ProcessorDecoratorGradient());
addProperty(&p_inputImage);
addProperty(&p_outputImage);
decoratePropertyCollection(this);
}
GlGradientVolumeGenerator::~GlGradientVolumeGenerator() {
}
void GlGradientVolumeGenerator::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "modules/preprocessing/glsl/glgradientvolumegenerator.frag", generateHeader(), false);
_shader->setAttributeLocation(0, "in_Position");
_shader->setAttributeLocation(1, "in_TexCoord");
}
void GlGradientVolumeGenerator::deinit() {
ShdrMgr.dispose(_shader);
VisualizationProcessor::deinit();
}
void GlGradientVolumeGenerator::process(DataContainer& data) {
ImageRepresentationGL::ScopedRepresentation img(data, p_inputImage.getValue());
if (img != 0) {
if (hasInvalidShader()) {
_shader->setHeaders(generateHeader());
_shader->rebuild();
validate(INVALID_SHADER);
}
const tgt::svec3& size = img->getSize();
tgt::ivec2 viewportSize = size.xy();
tgt::TextureUnit inputUnit;
inputUnit.activate();
// create texture for result
tgt::Texture* resultTexture = new tgt::Texture(0, tgt::ivec3(size), GL_RGB, GL_RGB32F, GL_FLOAT, tgt::Texture::LINEAR);
resultTexture->uploadTexture();
// activate shader and bind textures
_shader->activate();
img->bind(_shader, inputUnit);
// activate FBO and attach texture
_fbo->activate();
glViewport(0, 0, static_cast<GLsizei>(viewportSize.x), static_cast<GLsizei>(viewportSize.y));
// render quad to compute difference measure by shader
for (int z = 0; z < size.z; ++z) {
float zTexCoord = static_cast<float>(z)/static_cast<float>(size.z) + .5f/static_cast<float>(size.z);
_shader->setUniform("_zTexCoord", zTexCoord);
_fbo->attachTexture(resultTexture, GL_COLOR_ATTACHMENT0, 0, z);
QuadRdr.renderQuad();
}
_fbo->detachAll();
_fbo->deactivate();
_shader->deactivate();
// put resulting image into DataContainer
ImageData* id = new ImageData(3, size, 1);
ImageRepresentationGL::create(id, resultTexture);
id->setMappingInformation(img->getParent()->getMappingInformation());
data.addData(p_outputImage.getValue(), id);
tgt::TextureUnit::setZeroUnit();
LGL_ERROR;
}
else {
LERROR("No suitable input image found.");
}
validate(INVALID_RESULT);
}
std::string GlGradientVolumeGenerator::generateHeader() const {
return getDecoratedHeader();
}
}
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#ifndef GLGRADIENTVOLUMEGENERATOR_H__
#define GLGRADIENTVOLUMEGENERATOR_H__
#include <string>
#include "core/pipeline/abstractprocessordecorator.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
namespace tgt {
class Shader;
}
namespace campvis {
/**
* Creates the gradient volume for the given intensity volume using OpenGL.
*/
class GlGradientVolumeGenerator : public VisualizationProcessor, public HasProcessorDecorators {
public:
/**
* Constructs a new GlGradientVolumeGenerator Processor
**/
GlGradientVolumeGenerator(IVec2Property* viewportSizeProp);
/**
* Destructor
**/
virtual ~GlGradientVolumeGenerator();
/// \see AbstractProcessor::init
virtual void init();
/// \see AbstractProcessor::deinit
virtual void deinit();
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "GlGradientVolumeGenerator"; };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Creates the gradient volume for the given intensity volume using OpenGL."; };
/// \see AbstractProcessor::getAuthor()
virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::process()
virtual void process(DataContainer& data);
DataNameProperty p_inputImage; ///< ID for input volume
DataNameProperty p_outputImage; ///< ID for output gradient volume
protected:
std::string generateHeader() const;
tgt::Shader* _shader; ///< Shader for gradient volume generation
static const std::string loggerCat_;
};
}
#endif // GLGRADIENTVOLUMEGENERATOR_H__
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