Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing 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 d91e1c95 authored by schultezub's avatar schultezub
Browse files

introducing IxpvCompositor processor

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@378 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 314cb695
/**********************************************************************
* *
* Voreen - The Volume Rendering Engine *
* *
* Copyright (C) 2005-2012 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the Voreen software package. Voreen is free *
* software: you can redistribute it and/or modify it under the terms *
* of the GNU General Public License version 2 as published by the *
* Free Software Foundation. *
* *
* Voreen 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* in the file "LICENSE.txt" along with this program. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
* The authors reserve all rights not expressly granted herein. For *
* non-commercial academic use see the license exception specified in *
* the file "LICENSE-academic.txt". To get information about *
* commercial licensing please contact the authors. *
* *
**********************************************************************/
#include "modules/mod_sampler2d.frag"
uniform SAMPLER2D_TYPE colorTex0_;
uniform SAMPLER2D_TYPE depthTex0_;
uniform TEXTURE_PARAMETERS textureParameters0_;
uniform SAMPLER2D_TYPE colorTex1_;
uniform SAMPLER2D_TYPE depthTex1_;
uniform TEXTURE_PARAMETERS textureParameters1_;
uniform SAMPLER2D_TYPE colorTexDRRMax_;
uniform TEXTURE_PARAMETERS textureParametersDRRMax_;
uniform SAMPLER2D_TYPE colorTexDRRClipped_;
uniform TEXTURE_PARAMETERS textureParametersDRRClipped_;
/***
* The main method.
***/
void main() {
vec2 fragCoord = gl_FragCoord.xy;
// fetch input textures
vec4 color0 = textureLookup2Dscreen(colorTex0_, textureParameters0_, fragCoord);
float depth0 = textureLookup2Dscreen(depthTex0_, textureParameters0_, fragCoord).z;
vec4 color1 = textureLookup2Dscreen(colorTex1_, textureParameters1_, fragCoord);
float depth1 = textureLookup2Dscreen(depthTex1_, textureParameters1_, fragCoord).z;
float drrMax = textureLookup2Dscreen(colorTexDRRMax_, textureParametersDRRMax_, fragCoord).r;
float drrClipped = textureLookup2Dscreen(colorTexDRRClipped_, textureParametersDRRClipped_, fragCoord).r;
float weightingFactor = 0.0;
if (drrClipped > 0)
weightingFactor = clamp(drrClipped / drrMax, 0.0, 1.0);
vec4 fragColor = vec4(0.0, 0.0, 0.0, 1.0);
float fragDepth = weightingFactor;
if (weightingFactor == 0.0)
fragDepth = depth1;
else if (weightingFactor == 1.0)
fragDepth = depth0;
else
fragDepth = min(depth0, depth1);
fragColor = weightingFactor*color0 + (1.0-weightingFactor)*color1;
FragData0 = fragColor;
gl_FragDepth = fragDepth;
}
// ================================================================================================
//
// 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 Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, 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 "ixpvcompositor.h"
#include "tgt/logmanager.h"
#include "tgt/shadermanager.h"
#include "tgt/textureunit.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagedatagl.h"
#include "core/datastructures/imagedatarendertarget.h"
#include "core/datastructures/imagedataconverter.h"
#include "core/classification/simpletransferfunction.h"
#include "core/tools/quadrenderer.h"
namespace campvis {
const std::string IxpvCompositor::loggerCat_ = "CAMPVis.modules.vis.IxpvCompositor";
IxpvCompositor::IxpvCompositor(GenericProperty<tgt::ivec2>& canvasSize)
: VisualizationProcessor(canvasSize)
, p_xRayImageId("XRayImageId", "X-Ray input image", "", DataNameProperty::READ)
, p_3dSliceImageId("3DSliceImageId", "Slice input image rendered in 3D world space", "", DataNameProperty::READ)
, p_drrFullImageId("DrrFullImageId", "Full DRR input image", "", DataNameProperty::READ)
, p_drrClippedImageId("DrrClippedImageId", "Clipped DRR input image", "", DataNameProperty::READ)
, p_targetImageId("TargetImageId", "Output Image", "", DataNameProperty::WRITE)
, _shader(0)
{
addProperty(&p_xRayImageId);
addProperty(&p_3dSliceImageId);
addProperty(&p_drrFullImageId);
addProperty(&p_drrFullImageId);
addProperty(&p_targetImageId);
addDecorator(new ProcessorDecoratorBackground());
decoratePropertyCollection(this);
}
IxpvCompositor::~IxpvCompositor() {
}
void IxpvCompositor::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "modules/vis/glsl/ixpvcompositor.frag", "", false);
_shader->setAttributeLocation(0, "in_Position");
_shader->setAttributeLocation(1, "in_TexCoord");
}
void IxpvCompositor::deinit() {
VisualizationProcessor::deinit();
ShdrMgr.dispose(_shader);
}
void IxpvCompositor::process(DataContainer& data) {
DataContainer::ScopedTypedData<ImageDataRenderTarget> xRayImage(data, p_xRayImageId.getValue());
DataContainer::ScopedTypedData<ImageDataRenderTarget> sliceImage(data, p_3dSliceImageId.getValue());
DataContainer::ScopedTypedData<ImageDataRenderTarget> drrFullImage(data, p_drrFullImageId.getValue());
DataContainer::ScopedTypedData<ImageDataRenderTarget> drrClippedImage(data, p_drrClippedImageId.getValue());
if (xRayImage != 0 && sliceImage != 0 && drrFullImage != 0 && drrClippedImage != 0) {
ImageDataRenderTarget* rt = new ImageDataRenderTarget(tgt::svec3(_renderTargetSize.getValue(), 1));
glPushAttrib(GL_ALL_ATTRIB_BITS);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);
_shader->activate();
tgt::TextureUnit xRayColorUnit, xRayDepthUnit, sliceColorUnit, sliceDepthUnit, drrFullUnit, drrClippedUnit;
xRayImage->bind(_shader, &xRayColorUnit, &xRayDepthUnit, "_xRayColor", "_xRayDepth");
sliceImage->bind(_shader, &sliceColorUnit, &sliceDepthUnit, "_sliceColor", "_sliceDepth");
drrFullImage->bind(_shader, &drrFullUnit, 0, "_drrFullColor", "");
drrClippedImage->bind(_shader, &drrClippedUnit, 0, "_drrClippedColor", "");
decorateRenderProlog(data, _shader);
rt->activate();
LGL_ERROR;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QuadRdr.renderQuad();
rt->deactivate();
_shader->deactivate();
tgt::TextureUnit::setZeroUnit();
glPopAttrib();
LGL_ERROR;
data.addData(p_targetImageId.getValue(), rt);
p_targetImageId.issueWrite();
}
else {
LERROR("No suitable input images found.");
}
_invalidationLevel.setValid();
}
}
// ================================================================================================
//
// 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 Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, 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 IXPVCOMPOSITOR_H__
#define IXPVCOMPOSITOR_H__
#include <string>
#include "core/pipeline/abstractprocessordecorator.h"
#include "core/pipeline/processordecoratorbackground.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
namespace tgt {
class Shader;
}
namespace campvis {
class ImageData;
/**
* Performs IXPV composition of a 3D slice rendering and a X-Ray image.
*/
class IxpvCompositor : public VisualizationProcessor, public HasProcessorDecorators {
public:
/**
* Constructs a new IxpvCompositor Processor
**/
IxpvCompositor(GenericProperty<tgt::ivec2>& canvasSize);
/**
* Destructor
**/
virtual ~IxpvCompositor();
/// \see AbstractProcessor::init
virtual void init();
/// \see AbstractProcessor::deinit
virtual void deinit();
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "IxpvCompositor"; };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Performs IXPV composition of a 3D volume rendering and a X-Ray image."; };
virtual void process(DataContainer& data);
DataNameProperty p_xRayImageId; ///< image ID for X-Ray input image
DataNameProperty p_3dSliceImageId; ///< image ID for the slice input image rendered in 3D world space
DataNameProperty p_drrFullImageId; ///< image ID full DRR input image
DataNameProperty p_drrClippedImageId; ///< image ID clipped DRR input image
DataNameProperty p_targetImageId; ///< image ID for output image
protected:
tgt::Shader* _shader; ///< Shader for slice rendering
static const std::string loggerCat_;
};
}
#endif // IXPVCOMPOSITOR_H__
......@@ -45,7 +45,7 @@ namespace campvis {
class ImageData;
/**
* Extracts a slice from a 3D image and renders it into a rendertarget.
* Performs the composition of a rendering, a virtual mirror rendering and the corresponding mirror.
*/
class VirtualMirrorCombine : public VisualizationProcessor, public HasProcessorDecorators {
public:
......
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