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

* Fixed wrong model matrix in SliceRenderer3D

* Updated TensorDemo pipeline to show fused visualization of slice and glyph rendering
parent 1777c82f
...@@ -36,13 +36,15 @@ namespace campvis { ...@@ -36,13 +36,15 @@ namespace campvis {
, _imageReader() , _imageReader()
, _ta() , _ta()
, _glyphRenderer(&_canvasSize) , _glyphRenderer(&_canvasSize)
, _sliceExtractor(&_canvasSize) , _sliceRenderer(&_canvasSize)
, _wheelHandler(&_sliceExtractor.p_zSliceNumber) , _rtc(&_canvasSize)
, p_camera("Camera", "Camera", tgt::Camera()) , p_camera("Camera", "Camera", tgt::Camera())
, p_sliceNumber("SliceNuber", "Slice Number", 0, 0, 256)
, _trackballEH(0) , _trackballEH(0)
{ {
addProperty(&p_camera); addProperty(&p_camera);
addProperty(&p_sliceNumber);
_trackballEH = new TrackballNavigationEventListener(&p_camera, &_canvasSize); _trackballEH = new TrackballNavigationEventListener(&p_camera, &_canvasSize);
addEventListenerToBack(_trackballEH); addEventListenerToBack(_trackballEH);
...@@ -50,8 +52,8 @@ namespace campvis { ...@@ -50,8 +52,8 @@ namespace campvis {
addProcessor(&_imageReader); addProcessor(&_imageReader);
addProcessor(&_ta); addProcessor(&_ta);
addProcessor(&_glyphRenderer); addProcessor(&_glyphRenderer);
addProcessor(&_sliceExtractor); addProcessor(&_sliceRenderer);
addEventListenerToBack(&_wheelHandler); addProcessor(&_rtc);
} }
TensorDemo::~TensorDemo() { TensorDemo::~TensorDemo() {
...@@ -61,26 +63,35 @@ namespace campvis { ...@@ -61,26 +63,35 @@ namespace campvis {
AutoEvaluationPipeline::init(); AutoEvaluationPipeline::init();
p_camera.addSharedProperty(&_glyphRenderer.p_camera); p_camera.addSharedProperty(&_glyphRenderer.p_camera);
p_camera.addSharedProperty(&_sliceRenderer.p_camera);
p_sliceNumber.addSharedProperty(&_glyphRenderer.p_sliceNumber);
p_sliceNumber.addSharedProperty(&_sliceRenderer.p_sliceNumber);
_imageReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/tensor/sampledata/planar_tensor.mhd"); _imageReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/tensor/sampledata/planar_tensor.mhd");
_imageReader.p_targetImageID.setValue("reader.output"); _imageReader.p_targetImageID.setValue("reader.output");
_imageReader.p_targetImageID.addSharedProperty(&_ta.p_inputImage); _imageReader.p_targetImageID.addSharedProperty(&_ta.p_inputImage);
_ta.p_outputProperties[0]->_imageId.addSharedProperty(&_sliceExtractor.p_sourceImageID); _ta.p_outputProperties[0]->_imageId.addSharedProperty(&_sliceRenderer.p_sourceImageID);
_ta.p_outputProperties[0]->_imageType.selectById("MainEigenvector"); _ta.p_outputProperties[0]->_imageType.selectById("Trace");
_ta.p_evalsImage.addSharedProperty(&_glyphRenderer.p_inputEigenvalues); _ta.p_evalsImage.addSharedProperty(&_glyphRenderer.p_inputEigenvalues);
_ta.p_evecsImage.addSharedProperty(&_glyphRenderer.p_inputEigenvectors); _ta.p_evecsImage.addSharedProperty(&_glyphRenderer.p_inputEigenvectors);
_ta.s_validated.connect(this, &TensorDemo::onProcessorValidated); _ta.s_validated.connect(this, &TensorDemo::onProcessorValidated);
_glyphRenderer.p_renderOutput.setValue("glyphs"); _glyphRenderer.p_renderOutput.setValue("glyphs");
_glyphRenderer.p_renderOutput.addSharedProperty(&_rtc.p_firstImageId);
Geometry1DTransferFunction* tf = new Geometry1DTransferFunction(128, tgt::vec2(0.f, 1.f)); 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))); tf->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, 1.f), tgt::col4(0, 0, 0, 0), tgt::col4(255, 255, 255, 255)));
_sliceExtractor.p_transferFunction.replaceTF(tf); _sliceRenderer.p_transferFunction.replaceTF(tf);
_sliceExtractor.p_targetImageID.setValue("slice"); _sliceRenderer.p_targetImageID.setValue("slice");
_sliceRenderer.p_targetImageID.addSharedProperty(&_rtc.p_secondImageId);
_rtc.p_compositingMethod.selectById("depth");
_rtc.p_targetImageId.setValue("composed");
_renderTargetID.setValue("glyphs"); _renderTargetID.setValue("composed");
//_renderTargetID.addSharedProperty(&(_sliceExtractor.p_targetImageID));
} }
void TensorDemo::onProcessorValidated(AbstractProcessor* processor) { void TensorDemo::onProcessorValidated(AbstractProcessor* processor) {
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
#include "modules/io/processors/mhdimagereader.h" #include "modules/io/processors/mhdimagereader.h"
#include "modules/tensor/processors/tensoranalyzer.h" #include "modules/tensor/processors/tensoranalyzer.h"
#include "modules/tensor/processors/tensorglyphrenderer.h" #include "modules/tensor/processors/tensorglyphrenderer.h"
#include "modules/vis/processors/sliceextractor.h" #include "modules/vis/processors/slicerenderer3d.h"
#include "modules/vis/processors/rendertargetcompositor.h"
namespace campvis { namespace campvis {
class TensorDemo : public AutoEvaluationPipeline { class TensorDemo : public AutoEvaluationPipeline {
...@@ -67,12 +68,12 @@ namespace campvis { ...@@ -67,12 +68,12 @@ namespace campvis {
MhdImageReader _imageReader; MhdImageReader _imageReader;
TensorAnalyzer _ta; TensorAnalyzer _ta;
TensorGlyphRenderer _glyphRenderer; TensorGlyphRenderer _glyphRenderer;
SliceExtractor _sliceExtractor; SliceRenderer3D _sliceRenderer;
RenderTargetCompositor _rtc;
CameraProperty p_camera; CameraProperty p_camera;
IntProperty p_sliceNumber;
TrackballNavigationEventListener* _trackballEH; TrackballNavigationEventListener* _trackballEH;
MWheelToNumericPropertyEventListener _wheelHandler;
}; };
} }
......
...@@ -81,6 +81,11 @@ namespace campvis { ...@@ -81,6 +81,11 @@ namespace campvis {
/// \see AbstractProcessor::deinit() /// \see AbstractProcessor::deinit()
virtual void deinit(); virtual void deinit();
/**
* Adds another output for this processor (i.e. adds another OutputPropertyPair).
*/
void addOutput();
DataNameProperty p_inputImage; ///< ID for input volume DataNameProperty p_inputImage; ///< ID for input volume
DataNameProperty p_evalsImage; ///< ID for output eigenvalue volume DataNameProperty p_evalsImage; ///< ID for output eigenvalue volume
DataNameProperty p_evecsImage; ///< ID for output eigenvector volume DataNameProperty p_evecsImage; ///< ID for output eigenvector volume
...@@ -109,11 +114,6 @@ namespace campvis { ...@@ -109,11 +114,6 @@ namespace campvis {
*/ */
void computeOutput(DataContainer& data, size_t index); void computeOutput(DataContainer& data, size_t index);
/**
* Adds another output for this processor (i.e. adds another OutputPropertyPair).
*/
void addOutput();
DataHandle _eigenvalues; ///< Current eigenvalues cached DataHandle _eigenvalues; ///< Current eigenvalues cached
DataHandle _eigenvectors; ///< Current eigenvectors cached DataHandle _eigenvectors; ///< Current eigenvectors cached
......
...@@ -104,9 +104,6 @@ namespace campvis { ...@@ -104,9 +104,6 @@ namespace campvis {
_shader->setUniform("_projectionMatrix", cam.getProjectionMatrix()); _shader->setUniform("_projectionMatrix", cam.getProjectionMatrix());
_shader->setUniform("_viewMatrix", cam.getViewMatrix()); _shader->setUniform("_viewMatrix", cam.getViewMatrix());
tgt::mat4 trafoMatrix = tgt::mat4::createScale(tgt::vec3(-1.f, 1.f, -1.f));
_shader->setUniform("_modelMatrix", trafoMatrix);
tgt::TextureUnit inputUnit, tfUnit; tgt::TextureUnit inputUnit, tfUnit;
img->bind(_shader, inputUnit); img->bind(_shader, inputUnit);
p_transferFunction.getTF()->bind(_shader, tfUnit); p_transferFunction.getTF()->bind(_shader, tfUnit);
......
Supports Markdown
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