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

Fixed GenericGeometryTransferFunction not setting the clear color correctly...

Fixed GenericGeometryTransferFunction not setting the clear color correctly before rendering into TF texture.
This also fixes the broken IXPV pipeline (Issue #62) that got also cleaned with this commit.

closes #62
parent 2ce14bc2
......@@ -238,6 +238,7 @@ namespace campvis {
// render TF geometries into texture
glViewport(0, 0, _texture->getWidth(), _texture->getHeight());
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
_shader->activate();
......
......@@ -36,16 +36,11 @@ namespace campvis {
: AutoEvaluationPipeline(dc)
, _xrayReader(&_canvasSize)
, _ctReader()
, _ctProxy()
, _ctFullEEP(&_canvasSize)
, _ctClippedEEP(&_canvasSize)
, _ctDVR(&_canvasSize)
, _ctFullDRR(&_canvasSize)
, _ctClippedDRR(&_canvasSize)
, _vrFull(&_canvasSize, new DRRRaycaster(&_canvasSize))
, _vrClipped(&_canvasSize, new DRRRaycaster(&_canvasSize))
, _usReader()
, _usSliceRenderer(&_canvasSize)
, _compositor(&_canvasSize)
, _compositor2(&_canvasSize)
, _ixpvCompositor(&_canvasSize)
, _camera("camera", "Camera")
, _trackballHandler(0)
......@@ -57,25 +52,19 @@ namespace campvis {
addProcessor(&_usSliceRenderer);
addProcessor(&_ctReader);
addProcessor(&_ctProxy);
addProcessor(&_ctFullEEP);
addProcessor(&_ctClippedEEP);
addProcessor(&_ctDVR);
addProcessor(&_ctFullDRR);
addProcessor(&_ctClippedDRR);
addProcessor(&_vrFull);
addProcessor(&_vrClipped);
addProcessor(&_compositor);
addProcessor(&_compositor2);
addProcessor(&_ixpvCompositor);
addProperty(_camera);
_trackballHandler = new TrackballNavigationEventListener(&_camera, &_canvasSize);
_trackballHandler->addLqModeProcessor(&_ctDVR);
_trackballHandler->addLqModeProcessor(&_ctFullDRR);
_trackballHandler->addLqModeProcessor(&_ctClippedDRR);
_trackballHandler->addLqModeProcessor(&_vrFull);
_trackballHandler->addLqModeProcessor(&_vrClipped);
addEventListenerToBack(&_wheelHandler);
addEventListenerToBack(_trackballHandler);
// addEventListenerToBack(_trackballHandler);
}
IxpvDemo::~IxpvDemo() {
......@@ -86,11 +75,8 @@ namespace campvis {
AutoEvaluationPipeline::init();
// = Camera Setup =================================================================================
_camera.addSharedProperty(&_ctFullEEP.p_camera);
_camera.addSharedProperty(&_ctClippedEEP.p_camera);
_camera.addSharedProperty(&_ctDVR.p_camera);
_camera.addSharedProperty(&_ctFullDRR.p_camera);
_camera.addSharedProperty(&_ctClippedDRR.p_camera);
_camera.addSharedProperty(&_vrFull.p_camera);
_camera.addSharedProperty(&_vrClipped.p_camera);
_camera.addSharedProperty(&_usSliceRenderer.p_camera);
// = X-Ray Setup ==================================================================================
......@@ -99,52 +85,25 @@ namespace campvis {
// = CT Setup =====================================================================================
_ctReader.p_targetImageID.addSharedProperty(&_ctProxy.p_sourceImageID);
_ctReader.p_targetImageID.addSharedProperty(&_ctFullEEP.p_sourceImageID);
_ctReader.p_targetImageID.addSharedProperty(&_ctClippedEEP.p_sourceImageID);
_ctReader.p_targetImageID.addSharedProperty(&_ctDVR.p_sourceImageID);
_ctReader.p_targetImageID.addSharedProperty(&_ctFullDRR.p_sourceImageID);
_ctReader.p_targetImageID.addSharedProperty(&_ctClippedDRR.p_sourceImageID);
_ctReader.p_targetImageID.addSharedProperty(&_vrFull.p_inputVolume);
_ctReader.p_targetImageID.addSharedProperty(&_vrClipped.p_inputVolume);
_ctReader.p_url.setValue("D:/Medical Data/XrayDepthPerception/DataCowLeg/Cowleg_CT_8007_003_5mm_STD_20110224/phantom.mhd");
_ctReader.p_targetImageID.setValue("ct.image");
_ctReader.s_validated.connect(this, &IxpvDemo::onProcessorValidated);
_ctProxy.p_geometryID.setValue("ct.proxy");
_ctProxy.p_geometryID.addSharedProperty(&_ctFullEEP.p_geometryID);
_ctProxy.p_geometryID.addSharedProperty(&_ctClippedEEP.p_geometryID);
_ctFullEEP.p_entryImageID.setValue("ct.entry.full");
_ctFullEEP.p_entryImageID.addSharedProperty(&_ctFullDRR.p_entryImageID);
_ctFullEEP.p_entryImageID.addSharedProperty(&_ctDVR.p_entryImageID);
_ctFullEEP.p_exitImageID.setValue("ct.exit.full");
_ctFullEEP.p_exitImageID.addSharedProperty(&_ctFullDRR.p_exitImageID);
_ctFullEEP.p_exitImageID.addSharedProperty(&_ctDVR.p_exitImageID);
_ctClippedEEP.p_entryImageID.setValue("ct.entry.clipped");
_ctClippedEEP.p_entryImageID.addSharedProperty(&_ctClippedDRR.p_entryImageID);
_ctClippedEEP.p_exitImageID.setValue("ct.exit.clipped");
_ctClippedEEP.p_exitImageID.addSharedProperty(&_ctClippedDRR.p_exitImageID);
Geometry1DTransferFunction* tfDvr = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .08f));
// tf->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(0, 0, 0, 0), tgt::col4(0, 0, 0, 180)));
tfDvr->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .6f), tgt::col4(255, 192, 0, 255), tgt::col4(255, 192, 0, 255)));
_ctDVR.p_transferFunction.replaceTF(tfDvr);
_ctDVR.p_targetImageID.setValue("ct.dvr");
_ctDVR.p_samplingRate.setValue(1.f);
Geometry1DTransferFunction* tf = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .08f));
tf->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(0, 0, 0, 0), tgt::col4(0, 0, 0, 180)));
_ctFullDRR.p_transferFunction.replaceTF(tf);
_ctFullDRR.p_targetImageID.setValue("ct.drr.full");
_ctFullDRR.p_samplingRate.setValue(1.f);
_ctFullDRR.p_invertMapping.setValue(true);
static_cast<TransferFunctionProperty*>(_vrFull.getNestedProperty("RaycasterProps::TransferFunction"))->replaceTF(tf);
_vrFull.p_outputImage.setValue("ct.drr.full");
static_cast<FloatProperty*>(_vrFull.getNestedProperty("RaycasterProps::SamplingRate"))->setValue(1.f);
static_cast<BoolProperty*>(_vrFull.getNestedProperty("RaycasterProps::InvertMapping"))->setValue(true);
Geometry1DTransferFunction* tf2 = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .08f));
tf2->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.5f, 1.f), tgt::col4(0, 0, 0, 0), tgt::col4(0, 0, 0, 180)));
_ctClippedDRR.p_transferFunction.replaceTF(tf2);
_ctClippedDRR.p_targetImageID.setValue("ct.drr.clipped");
_ctClippedDRR.p_samplingRate.setValue(1.f);
_ctClippedDRR.p_invertMapping.setValue(true);
static_cast<TransferFunctionProperty*>(_vrClipped.getNestedProperty("RaycasterProps::TransferFunction"))->replaceTF(tf2);
_vrClipped.p_outputImage.setValue("ct.drr.clipped");
static_cast<FloatProperty*>(_vrClipped.getNestedProperty("RaycasterProps::SamplingRate"))->setValue(1.f);
static_cast<BoolProperty*>(_vrClipped.getNestedProperty("RaycasterProps::InvertMapping"))->setValue(true);
// = US Setup =====================================================================================
......@@ -156,7 +115,7 @@ namespace campvis {
_usReader.p_voxelSize.setValue(tgt::vec3(1.f, 1.f, 1.3f));
_usSliceRenderer.p_targetImageID.setValue("us.slice");
_usSliceRenderer.p_targetImageID.addSharedProperty(&_ctClippedEEP.p_geometryImageId);
_usSliceRenderer.p_targetImageID.addSharedProperty(_vrClipped.getNestedProperty("EEPProps::GeometryImageId"));
_usSliceRenderer.p_sliceNumber.setValue(0);
......@@ -164,19 +123,14 @@ namespace campvis {
// = Compositing Setup ============================================================================
_xrayReader.p_targetImageID.addSharedProperty(&_compositor.p_firstImageId);
_ctFullDRR.p_targetImageID.addSharedProperty(&_compositor.p_secondImageId);
_vrFull.p_outputImage.addSharedProperty(&_compositor.p_secondImageId);
_compositor.p_targetImageId.setValue("composed");
_compositor.p_compositingMethod.selectById("diff");
_ctDVR.p_targetImageID.addSharedProperty(&_compositor2.p_firstImageId);
_usSliceRenderer.p_targetImageID.addSharedProperty(&_compositor2.p_secondImageId);
_compositor2.p_targetImageId.setValue("composed2");
_compositor2.p_compositingMethod.selectById("depth");
_xrayReader.p_targetImageID.addSharedProperty(&_ixpvCompositor.p_xRayImageId);
_usSliceRenderer.p_targetImageID.addSharedProperty(&_ixpvCompositor.p_3dSliceImageId);
_ctFullDRR.p_targetImageID.addSharedProperty(&_ixpvCompositor.p_drrFullImageId);
_ctClippedDRR.p_targetImageID.addSharedProperty(&_ixpvCompositor.p_drrClippedImageId);
_vrFull.p_outputImage.addSharedProperty(&_ixpvCompositor.p_drrFullImageId);
_vrClipped.p_outputImage.addSharedProperty(&_ixpvCompositor.p_drrClippedImageId);
_ixpvCompositor.p_targetImageId.setValue("ixpv");
_renderTargetID.setValue("ixpv");
......@@ -186,15 +140,6 @@ namespace campvis {
if (processor == &_ctReader) {
ImageRepresentationLocal::ScopedRepresentation local(*_data, _ctReader.p_targetImageID.getValue());
if (local != 0) {
// set TF handles
Interval<float> ii = local->getNormalizedIntensityRange();
_ctDVR.p_transferFunction.setImageHandle(local.getDataHandle());
_ctDVR.p_transferFunction.getTF()->setIntensityDomain(tgt::vec2(ii.getLeft(), ii.getRight()));
_ctFullDRR.p_transferFunction.setImageHandle(local.getDataHandle());
_ctFullDRR.p_transferFunction.getTF()->setIntensityDomain(tgt::vec2(.3f, .73f));
_ctClippedDRR.p_transferFunction.setImageHandle(local.getDataHandle());
_ctClippedDRR.p_transferFunction.getTF()->setIntensityDomain(tgt::vec2(.3f, .73f));
// update camera
tgt::Bounds volumeExtent = local->getParent()->getWorldBounds();
......
......@@ -42,6 +42,8 @@
#include "modules/vis/processors/rendertargetcompositor.h"
#include "modules/vis/processors/slicerenderer3d.h"
#include "modules/ixpv/processors/ixpvcompositor.h"
#include "modules/vis/processors/volumerenderer.h"
namespace campvis {
......@@ -76,18 +78,14 @@ namespace campvis {
DevilImageReader _xrayReader;
MhdImageReader _ctReader;
ProxyGeometryGenerator _ctProxy;
EEPGenerator _ctFullEEP;
EEPGenerator _ctClippedEEP;
SimpleRaycaster _ctDVR;
DRRRaycaster _ctFullDRR;
DRRRaycaster _ctClippedDRR;
VolumeRenderer _vrFull;
VolumeRenderer _vrClipped;
MhdImageReader _usReader;
SliceRenderer3D _usSliceRenderer;
RenderTargetCompositor _compositor;
RenderTargetCompositor _compositor2;
IxpvCompositor _ixpvCompositor;
CameraProperty _camera;
......
......@@ -35,7 +35,7 @@ namespace campvis {
: RaycastingProcessor(viewportSizeProp, "modules/vis/glsl/drrraycaster.frag", false)
, p_shift("shift", "Normalization Shift", 0.f, -10.f, 10.f, 0.1f)
, p_scale("scale", "Normalization Scale", 1.f, 0.f, 1000.f, 0.1f)
, p_invertMapping("invertMapping", "Invert Mapping", false)
, p_invertMapping("InvertMapping", "Invert Mapping", false)
{
addProperty(p_shift);
addProperty(p_scale);
......
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