Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit bf0a6d1b authored by schultezub's avatar schultezub
Browse files

Introducing QuadView processor

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@442 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 632545e9
......@@ -43,22 +43,30 @@ namespace campvis {
, _confidenceReader()
, _gvg()
, _lhh()
, _usFusion(_effectiveRenderTargetSize)
, _usFusion1(_effectiveRenderTargetSize)
, _usFusion2(_effectiveRenderTargetSize)
, _usFusion3(_effectiveRenderTargetSize)
, _usFusion4(_effectiveRenderTargetSize)
, _usBlurFilter()
, _quadView(_effectiveRenderTargetSize)
, _usDenoiseilter()
, _usProxy()
, _usEEP(_effectiveRenderTargetSize)
, _usDVR(_effectiveRenderTargetSize)
, _wheelHandler(&_usFusion.p_sliceNumber)
, _tfWindowingHandler(&_usFusion.p_transferFunction)
, _wheelHandler(&_usFusion1.p_sliceNumber)
, _tfWindowingHandler(&_usFusion1.p_transferFunction)
, _trackballEH(0)
{
addProcessor(&_usReader);
addProcessor(&_confidenceReader);
addProcessor(&_gvg);
//addProcessor(&_lhh);
addProcessor(&_usFusion);
addProcessor(&_usBlurFilter);
addProcessor(&_usFusion1);
addProcessor(&_usFusion2);
addProcessor(&_usFusion3);
addProcessor(&_usFusion4);
addProcessor(&_quadView);
addProcessor(&_usDenoiseilter);
addProcessor(&_usProxy);
addProcessor(&_usEEP);
......@@ -83,7 +91,10 @@ namespace campvis {
_usReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\01\\BMode_01.mhd");
_usReader.p_targetImageID.setValue("us.image");
_usReader.p_targetImageID.connect(&_usFusion.p_usImageId);
_usReader.p_targetImageID.connect(&_usFusion1.p_usImageId);
_usReader.p_targetImageID.connect(&_usFusion2.p_usImageId);
_usReader.p_targetImageID.connect(&_usFusion3.p_usImageId);
_usReader.p_targetImageID.connect(&_usFusion4.p_usImageId);
_usReader.p_targetImageID.connect(&_gvg.p_sourceImageID);
_usReader.p_targetImageID.connect(&_lhh.p_intensitiesId);
_usReader.p_targetImageID.connect(&_usBlurFilter.p_sourceImageID);
......@@ -91,25 +102,53 @@ namespace campvis {
_confidenceReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\01\\Confidence_01.mhd");
_confidenceReader.p_targetImageID.setValue("confidence.image");
_confidenceReader.p_targetImageID.connect(&_usFusion.p_confidenceImageID);
_confidenceReader.p_targetImageID.connect(&_usFusion1.p_confidenceImageID);
_confidenceReader.p_targetImageID.connect(&_usFusion2.p_confidenceImageID);
_confidenceReader.p_targetImageID.connect(&_usFusion3.p_confidenceImageID);
_confidenceReader.p_targetImageID.connect(&_usFusion4.p_confidenceImageID);
_gvg.p_targetImageID.connect(&_lhh.p_gradientsId);
_gvg.p_targetImageID.connect(&_usFusion.p_gradientImageID);
_usFusion.p_targetImageID.setValue("us.fused");
_usFusion.p_sliceNumber.setValue(0);
_usFusion.p_view.setValue(0);
_gvg.p_targetImageID.connect(&_usFusion1.p_gradientImageID);
_gvg.p_targetImageID.connect(&_usFusion2.p_gradientImageID);
_gvg.p_targetImageID.connect(&_usFusion3.p_gradientImageID);
_gvg.p_targetImageID.connect(&_usFusion4.p_gradientImageID);
_usFusion1.p_targetImageID.setValue("us.fused1");
_usFusion1.p_targetImageID.connect(&_quadView.p_inputImage1);
_usFusion1.p_view.selectById("us");
_usFusion1.p_sliceNumber.setValue(0);
_usFusion1.p_sliceNumber.addSharedProperty(&_usFusion2.p_sliceNumber);
_usFusion1.p_sliceNumber.addSharedProperty(&_usFusion3.p_sliceNumber);
_usFusion1.p_sliceNumber.addSharedProperty(&_usFusion4.p_sliceNumber);
_usFusion2.p_targetImageID.setValue("us.fused2");
_usFusion2.p_targetImageID.connect(&_quadView.p_inputImage2);
_usFusion2.p_view.selectById("mappingSaturationHSV");
_usFusion3.p_targetImageID.setValue("us.fused3");
_usFusion3.p_targetImageID.connect(&_quadView.p_inputImage3);
_usFusion3.p_view.selectById("mappingChromacity");
_usFusion4.p_targetImageID.setValue("us.fused4");
_usFusion4.p_targetImageID.connect(&_quadView.p_inputImage4);
_usFusion4.p_view.selectById("mappingSharpness");
_usBlurFilter.p_targetImageID.setValue("us.blurred");
_usBlurFilter.p_targetImageID.connect(&_usFusion.p_blurredImageId);
_usBlurFilter.p_targetImageID.connect(&_usFusion1.p_blurredImageId);
_usBlurFilter.p_targetImageID.connect(&_usFusion2.p_blurredImageId);
_usBlurFilter.p_targetImageID.connect(&_usFusion3.p_blurredImageId);
_usBlurFilter.p_targetImageID.connect(&_usFusion4.p_blurredImageId);
_usBlurFilter.p_filterMode.selectById("gauss");
_usBlurFilter.p_sigma.setValue(4.f);
_quadView.p_outputImage.setValue("quadview.output");
_usDenoiseilter.p_targetImageID.setValue("us.denoised");
_usDenoiseilter.p_targetImageID.connect(&_usProxy.p_sourceImageID);
_usDenoiseilter.p_targetImageID.connect(&_usEEP.p_sourceImageID);
_usDenoiseilter.p_targetImageID.connect(&_usDVR.p_sourceImageID);
_usDenoiseilter.p_filterMode.selectById("gradientDiffusion");
_usDenoiseilter.p_numberOfSteps.setValue(3);
_usProxy.p_geometryID.setValue("us.proxy");
_usProxy.p_geometryID.connect(&_usEEP.p_geometryID);
......@@ -122,7 +161,7 @@ namespace campvis {
// TODO: replace this hardcoded domain by automatically determined from image min/max values
Geometry1DTransferFunction* tf = new Geometry1DTransferFunction(128, tgt::vec2(0.f, 1.f));
tf->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, 1.f), tgt::col4(0, 0, 0, 0), tgt::col4(255, 255, 255, 255)));
_usFusion.p_transferFunction.replaceTF(tf);
_usFusion1.p_transferFunction.replaceTF(tf);
// TODO: replace this hardcoded domain by automatically determined from image min/max values
Geometry1DTransferFunction* tf2 = new Geometry1DTransferFunction(256, tgt::vec2(0.f, 1.f));
......@@ -130,7 +169,7 @@ namespace campvis {
_usDVR.p_transferFunction.replaceTF(tf2);
_usDVR.p_targetImageID.setValue("us.dvr");
_usFusion.p_targetImageID.addSharedProperty(&(_renderTargetID));
_renderTargetID.setValue("quadview.output");
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<AdvancedUsVis>(this, &AdvancedUsVis::onRenderTargetSizeChanged);
......@@ -167,10 +206,10 @@ namespace campvis {
if (e->pressed()) {
switch (e->keyCode()) {
case tgt::KeyEvent::K_UP:
_usFusion.p_sliceNumber.increment();
_usFusion1.p_sliceNumber.increment();
break;
case tgt::KeyEvent::K_DOWN:
_usFusion.p_sliceNumber.decrement();
_usFusion1.p_sliceNumber.decrement();
break;
}
}
......
......@@ -43,6 +43,7 @@
#include "modules/vis/processors/proxygeometrygenerator.h"
#include "modules/vis/processors/eepgenerator.h"
#include "modules/vis/processors/simpleraycaster.h"
#include "modules/vis/processors/quadview.h"
namespace campvis {
class AdvancedUsVis : public VisualizationPipeline {
......@@ -78,9 +79,14 @@ namespace campvis {
MhdImageReader _confidenceReader;
GradientVolumeGenerator _gvg;
LHHistogram _lhh;
AdvancedUsFusion _usFusion;
AdvancedUsFusion _usFusion1;
AdvancedUsFusion _usFusion2;
AdvancedUsFusion _usFusion3;
AdvancedUsFusion _usFusion4;
ItkImageFilter _usBlurFilter;
QuadView _quadView;
ItkImageFilter _usDenoiseilter;
ProxyGeometryGenerator _usProxy;
EEPGenerator _usEEP;
......
// ================================================================================================
//
// 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.
//
// ================================================================================================
#version 330
in vec3 ex_TexCoord;
out vec4 out_Color;
#include "tools/texture2d.frag"
uniform Texture2D _colorTexture;
uniform Texture2D _depthTexture;
void main() {
out_Color = getElement2DNormalized(_colorTexture, ex_TexCoord.xy);
gl_FragDepth = getElement2DNormalized(_depthTexture, ex_TexCoord.xy).z;
}
// ================================================================================================
//
// 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 "quadview.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/imagerepresentationrendertarget.h"
#include "core/classification/simpletransferfunction.h"
#include "core/tools/quadrenderer.h"
namespace campvis {
const std::string QuadView::loggerCat_ = "CAMPVis.modules.vis.QuadView";
QuadView::QuadView(GenericProperty<tgt::ivec2>& canvasSize)
: VisualizationProcessor(canvasSize)
, p_inputImage1("InputImage1", "First Input Image", "", DataNameProperty::READ)
, p_inputImage2("InputImage2", "Second Input Image", "", DataNameProperty::READ)
, p_inputImage3("InputImage3", "Third Input Image", "", DataNameProperty::READ)
, p_inputImage4("InputImage4", "Fourth Input Image", "", DataNameProperty::READ)
, p_outputImage("OutputImage", "Output Image", "dd.output", DataNameProperty::WRITE)
, _shader(0)
{
addProperty(&p_inputImage1);
addProperty(&p_inputImage2);
addProperty(&p_inputImage3);
addProperty(&p_inputImage4);
addProperty(&p_outputImage);
}
QuadView::~QuadView() {
}
void QuadView::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "modules/vis/glsl/quadview.frag", "", false);
_shader->setAttributeLocation(0, "in_Position");
_shader->setAttributeLocation(1, "in_TexCoord");
}
void QuadView::deinit() {
VisualizationProcessor::deinit();
ShdrMgr.dispose(_shader);
}
void QuadView::process(DataContainer& data) {
ImageRepresentationRenderTarget::ScopedRepresentation inputImage1(data, p_inputImage1.getValue());
ImageRepresentationRenderTarget::ScopedRepresentation inputImage2(data, p_inputImage2.getValue());
ImageRepresentationRenderTarget::ScopedRepresentation inputImage3(data, p_inputImage3.getValue());
ImageRepresentationRenderTarget::ScopedRepresentation inputImage4(data, p_inputImage4.getValue());
if (inputImage1 == 0 && inputImage2 == 0 && inputImage3 == 0 && inputImage4 == 0)
return;
std::pair<ImageData*, ImageRepresentationRenderTarget*> outputTarget = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue());
tgt::TextureUnit colorUnit, depthUnit;
_shader->activate();
_shader->setUniform("_modelMatrix", tgt::mat4::createScale(tgt::vec3(.5f, .5f, .5f)));
outputTarget.second->activate();
LGL_ERROR;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (inputImage1 != 0) {
inputImage1->bind(_shader, &colorUnit, &depthUnit);
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(-.5f, .5f, 0.f)));
QuadRdr.renderQuad();
}
if (inputImage2 != 0) {
inputImage2->bind(_shader, &colorUnit, &depthUnit);
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(.5f, .5f, 0.f)));
QuadRdr.renderQuad();
}
if (inputImage3 != 0) {
inputImage3->bind(_shader, &colorUnit, &depthUnit);
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(-.5f, -.5f, 0.f)));
QuadRdr.renderQuad();
}
if (inputImage4 != 0) {
inputImage4->bind(_shader, &colorUnit, &depthUnit);
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(.5f, -.5f, 0.f)));
QuadRdr.renderQuad();
}
outputTarget.second->deactivate();
_shader->deactivate();
tgt::TextureUnit::setZeroUnit();
LGL_ERROR;
data.addData(p_outputImage.getValue(), outputTarget.first);
p_outputImage.issueWrite();
_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 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 QUADVIEW_H__
#define QUADVIEW_H__
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/numericproperty.h"
namespace tgt {
class Shader;
}
namespace campvis {
/**
* Combines up to four render targets into a single one.
*/
class QuadView : public VisualizationProcessor {
public:
/**
* Constructs a new QuadView Processor
**/
QuadView(GenericProperty<tgt::ivec2>& canvasSize);
/**
* Destructor
**/
virtual ~QuadView();
/// \see AbstractProcessor::init
virtual void init();
/// \see AbstractProcessor::deinit
virtual void deinit();
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "QuadView"; };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Combines up to four render targets into a single one."; };
virtual void process(DataContainer& data);
DataNameProperty p_inputImage1; ///< image ID for first input image
DataNameProperty p_inputImage2; ///< image ID for second input image
DataNameProperty p_inputImage3; ///< image ID for third input image
DataNameProperty p_inputImage4; ///< image ID for fourth input image
DataNameProperty p_outputImage; ///< image ID for output image
protected:
tgt::Shader* _shader; ///< Shader for slice rendering
static const std::string loggerCat_;
};
}
#endif // QUADVIEW_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