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

Merge branch 'various-fixes' into 'development'

Various fixes

See merge request !91
parents 44e9af20 6ede8210
......@@ -115,7 +115,7 @@ namespace campvis {
return _dataContainer;
}
void DataContainerInspectorWidget::onDataContainerDataAdded(const std::string& key, DataHandle dh) {
void DataContainerInspectorWidget::onDataContainerDataAdded(std::string key, DataHandle dh) {
// copy QtDataHandle because signal will be handled by a different thread an indefinite amount of time later:
emit dataContainerChanged(QString::fromStdString(key), QtDataHandle(dh));
}
......
......@@ -87,7 +87,7 @@ namespace campvis {
/**
* Slot called when _dataContainer has changed and emitted the s_dataAdded signal.
*/
void onDataContainerDataAdded(const std::string&, DataHandle);
void onDataContainerDataAdded(std::string, DataHandle);
/**
* Size hint for the default window size
......
......@@ -99,7 +99,7 @@ namespace campvis {
--_ignorePropertyUpdates;
}
void DataNamePropertyWidget::onDataAdded(const std::string& key, DataHandle dh) {
void DataNamePropertyWidget::onDataAdded(std::string key, DataHandle dh) {
emit s_dataAddedQt(QString::fromStdString(key), dh);
}
......
......@@ -65,7 +65,7 @@ namespace campvis {
*/
virtual void updateWidgetFromProperty();
void onDataAdded(const std::string& key, DataHandle dh);
void onDataAdded(std::string key, DataHandle dh);
private slots:
void onTextChanged(const QString& text);
......
......@@ -146,7 +146,7 @@ namespace campvis {
* Signal emitted when data has been added to this DataContainer (this includes also data being replaced).
* First parameter is the name of the added data, second parameter contains a DataHandle to the new data.
*/
sigslot::signal2<const std::string&, DataHandle> s_dataAdded;
sigslot::signal2<std::string, DataHandle> s_dataAdded;
/// Signal emitted when list of DataHandles has changed.
sigslot::signal0 s_changed;
......
......@@ -82,6 +82,7 @@ namespace campvis {
void TrackballNavigationEventListener::onEvent(tgt::Event* e) {
if (typeid(*e) == typeid(tgt::MouseEvent)) {
tgt::MouseEvent* me = static_cast<tgt::MouseEvent*>(e);
_trackball->setViewprtSize(me->viewport());
if (me->action() == tgt::MouseEvent::PRESSED) {
for (std::vector<VisualizationProcessor*>::iterator it = _lqModeProcessors.begin(); it != _lqModeProcessors.end(); ++it)
(*it)->p_lqMode.setValue(true);
......@@ -167,4 +168,13 @@ namespace campvis {
}
}
void TrackballNavigationEventListener::setViewportSizeProperty(IVec2Property* viewportSizeProp) {
_viewportSizeProp->s_changed.disconnect(this);
tgtAssert(viewportSizeProp != nullptr, "The property must not be 0.");
_viewportSizeProp = viewportSizeProp;
onViewportSizePropChanged(_viewportSizeProp);
_viewportSizeProp->s_changed.connect(this, &TrackballNavigationEventListener::onViewportSizePropChanged);
}
}
......@@ -100,6 +100,11 @@ namespace campvis {
virtual void onEvent(tgt::Event* e);
/**
* Sets the property defining the viewport size.
* \param viewportSizeProp The new property defining the viewport size, must not be 0.
*/
void setViewportSizeProperty(IVec2Property* viewportSizeProp);
/**
* Reinitializes the camera using the data in \a hwb.
......
......@@ -35,11 +35,10 @@ namespace campvis {
TransFuncWindowingEventListener::TransFuncWindowingEventListener(TransferFunctionProperty* property)
: tgt::EventListener()
, _prop(property)
, _mousePressed(false)
, _mouseDownPosition(0, 0)
, _originalIntensityDomain(0.f, 1.f)
, _mousePressed(false)
, _mouseDownPosition(0, 0)
, _originalIntensityDomain(0.f, 1.f)
{
tgtAssert(_prop != 0, "Assigned property must not be 0.");
}
TransFuncWindowingEventListener::~TransFuncWindowingEventListener() {
......@@ -47,6 +46,8 @@ namespace campvis {
}
void TransFuncWindowingEventListener::onEvent(tgt::Event* e) {
if (_prop == nullptr)
return;
if (typeid(*e) != typeid(tgt::MouseEvent))
return;
......@@ -89,4 +90,8 @@ namespace campvis {
}
}
void TransFuncWindowingEventListener::setTransferFunctionProperty(TransferFunctionProperty* prop) {
_prop = prop;
}
}
......@@ -42,6 +42,7 @@ namespace campvis {
public:
/**
* Creates a TransFuncWindowingEventListener.
* \param property The target transfer function property, may be 0.
*/
explicit TransFuncWindowingEventListener(TransferFunctionProperty* property);
......@@ -53,8 +54,14 @@ namespace campvis {
/// \see tgt::EventListener::onEvent()
virtual void onEvent(tgt::Event* e);
/**
* Sets the target transfer function property.
* \param prop The new target transfer function property, may be 0.
*/
void setTransferFunctionProperty(TransferFunctionProperty* prop);
protected:
TransferFunctionProperty* _prop;
TransferFunctionProperty* _prop; ///< The target transfer function property, may be 0
bool _mousePressed; ///< Flag whether the mouse is currently pressed
tgt::ivec2 _mouseDownPosition; ///< Viewport coordinates where mouse button has been pressed
......
......@@ -252,7 +252,7 @@ namespace campvis {
#endif
}
void AbstractPipeline::onDataContainerDataAdded(const std::string& name, DataHandle dh) {
void AbstractPipeline::onDataContainerDataAdded(std::string name, DataHandle dh) {
if (name == _renderTargetID.getValue()) {
s_renderTargetChanged.emitSignal();
}
......
......@@ -207,7 +207,7 @@ namespace campvis {
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
virtual void onDataContainerDataAdded(const std::string& name, DataHandle dh);
virtual void onDataContainerDataAdded(std::string name, DataHandle dh);
/// Pointer to the DataContainer containing local working set of data for this Pipeline, must not be 0.
DataContainer* _data;
......
......@@ -127,7 +127,7 @@ namespace campvis {
}
}
void AutoEvaluationPipeline::onDataContainerDataAdded(const std::string& name, DataHandle dh) {
void AutoEvaluationPipeline::onDataContainerDataAdded(std::string name, DataHandle dh) {
{
// acquire read lock
tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false);
......
......@@ -86,7 +86,7 @@ namespace campvis {
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
virtual void onDataContainerDataAdded(const std::string& name, DataHandle dh);
virtual void onDataContainerDataAdded(std::string name, DataHandle dh);
/**
* Recursively looks for all DataNameProperties in \a pc and adds them to the port map.
......
......@@ -169,7 +169,7 @@ namespace campvis {
}
}
else {
LERROR("No suitable input image found.");
LDEBUG("No suitable input image found.");
}
}
......
This diff is collapsed.
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#ifndef SLICERENDERPROCESSOR_H__
#define SLICERENDERPROCESSOR_H__
#include <string>
#include "tgt/event/eventlistener.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/allproperties.h"
namespace tgt {
class Shader;
}
namespace campvis {
class FaceGeometry;
class ImageData;
/**
* Base class for rendering an axis-aligned slice of a 3D image into a 2D viewport.
* Provides necessary properties, coordinate transforms, interaction handlers, as well as a
* callback for a scribbling feature.
*
* The single thing to be implemented by subclasses is the way the actual image is rendered.
*/
class CAMPVIS_CORE_API SliceRenderProcessor : public VisualizationProcessor, public tgt::EventListener {
public:
/// Slice Orientation to render
enum SliceOrientation {
XY_PLANE = 0,
XZ_PLANE = 1,
YZ_PLANE = 2
};
/**
* Constructs a new SliceRenderProcessor Processor
*
* \param viewportSizeProp Pointer to the parent pipeline's render target size property.
* \param fragmentShaderFileName Filename for the fragment shader being automatically loaded.
* \param customGlslVersion Custom GLSL version to pass to shader (Optional).
**/
SliceRenderProcessor(IVec2Property* viewportSizeProp, const std::string& fragmentShaderFileName, const std::string& customGlslVersion = "");
/**
* Destructor
**/
virtual ~SliceRenderProcessor();
/// \see AbstractProcessor::init
virtual void init();
/// \see AbstractProcessor::deinit
virtual void deinit();
/// \see tgt::EventListener::onEvent()
virtual void onEvent(tgt::Event* e);
/// Signal emitted when a scribble was painted, parameter gives the position in image coordinates.
sigslot::signal1<tgt::vec3> s_scribblePainted;
DataNameProperty p_sourceImageID; ///< image ID for input image
DataNameProperty p_geometryID; ///< ID for input geometry
DataNameProperty p_targetImageID; ///< image ID for output image
/// orientation of the slice to extract
GenericOptionProperty<SliceOrientation> p_sliceOrientation;
IntProperty p_xSliceNumber; ///< number of the slice in X direction
Vec4Property p_xSliceColor; ///< color for x marker
IntProperty p_ySliceNumber; ///< number of the slice in Y direction
Vec4Property p_ySliceColor; ///< color for y marker
IntProperty p_zSliceNumber; ///< number of the slice in Z direction
Vec4Property p_zSliceColor; ///< color for z marker
BoolProperty p_renderCrosshair; ///< Flag whether to render the crosshair or not
BoolProperty p_fitToWindow; ///< Flag whether fit image to window or use scaling and offset
FloatProperty p_scalingFactor; ///< Image scaling factor
IVec2Property p_offset; ///< Image offset
GenericOptionProperty<GLenum> p_geometryRenderMode; ///< Render mode for the geometry
FloatProperty p_geometryRenderSize; ///< Size of rendered elements
protected:
/**
* Pure virtual method to be implemented by subclasses.
* This method is supposed to implement the actual rendering of the slice, e.g. setup
* and apply transfer function. You may want to call renderCrosshair() or renderGeometry()
* yourself, if needed.
* \param dataContainer DataContainer of calling pipeline
* \param img Image to render (to avoid multiple redundant DataContainer queries), is guarantueed to not be 0)
*/
virtual void renderImageImpl(DataContainer& dataContainer, const ImageRepresentationGL::ScopedRepresentation& img) = 0;
/// \see AbstractProcessor::updateResult
virtual void updateResult(DataContainer& dataContainer);
/// \see AbstractProcessor::updateProperties
virtual void updateProperties(DataContainer& dataContainer);
/// \see AbstractProcessor::updateShader
virtual void updateShader();
/**
* Renders the crosshair indicating the slice positions into the current OpenGl context.
* \param img Image to render (to avoid multiple redundant DataContainer queries), is guarantueed to not be 0)
*/
virtual void renderCrosshair(const ImageRepresentationGL::ScopedRepresentation& img);
/**
* Renders integrated geometry into the current OpenGL context.
* \param dataContainer DataContainer of calling pipeline
* \param img Image to render (to avoid multiple redundant DataContainer queries), is guarantueed to not be 0)
*/
virtual void renderGeometry(DataContainer& dataContainer, const ImageRepresentationGL::ScopedRepresentation& img);
/**
* Setup all the transformation matrices (local members) needed for rendering.
* Gets called automatically from default updateResult() implementation prior to calling renderImageImpl().
* \param img Image to render (to avoid multiple redundant DataContainer queries), is guarantueed to not be 0)
*/
virtual void setupMatrices(const ImageRepresentationGL::ScopedRepresentation& img);
virtual std::string getGlslHeader();
tgt::Shader* _shader; ///< Shader for slice rendering
DataHandle _currentImage; ///< cached DataHandle to shown image (needed for scribbles)
bool _inScribbleMode; ///< Flag whether processor is in scribble mode (i.e. mouse is pressed)
const std::string _fragmentShaderFilename; ///< Filename for the fragment shader being automatically loaded.
const std::string _customGlslVersion; ///< Custom GLSL version to pass to shader
tgt::mat4 _texCoordMatrix; ///< Transformation matrix applied to texture coordinates
tgt::mat4 _geometryModelMatrix; ///< Transformation to apply to geometry to transform into slice space
tgt::mat4 _geometryProjectionMatrix; ///< Projection matrix to apply to geometry rendering
tgt::mat4 _viewMatrix; ///< View matrix applied to rendering (aspect ratio, zoom, shift)
static const std::string loggerCat_;
};
}
#endif // SLICERENDERPROCESSOR_H__
......@@ -149,7 +149,7 @@ namespace campvis {
}
}
else {
LERROR("No suitable input image found.");
LDEBUG("No suitable input image found.");
}
}
......
......@@ -153,7 +153,7 @@ namespace campvis {
LGL_ERROR;
}
else {
LERROR("No suitable input image found.");
LDEBUG("No suitable input image found.");
}
}
......
......@@ -138,7 +138,7 @@ namespace campvis {
}
}
else {
LERROR("Could not load Voxel Predicate Mask Image.");
LDEBUG("Could not load Voxel Predicate Mask Image.");
}
}
......
......@@ -43,7 +43,7 @@ namespace campvis {
const std::string PredicateVolumeExplorer::loggerCat_ = "CAMPVis.modules.vis.PredicateVolumeExplorer";
PredicateVolumeExplorer::PredicateVolumeExplorer(IVec2Property* viewportSizeProp)
: VolumeExplorer(viewportSizeProp, new PointPredicateRaycaster(0))
: VolumeExplorer(viewportSizeProp, new SliceExtractor(0), new PointPredicateRaycaster(0))
, p_inputLabels("InputLabels", "Input Label Image", "", DataNameProperty::READ)
, p_inputSnr("InputSnr", "Input SNR", "", DataNameProperty::READ)
, p_inputVesselness("InputVesselness", "Input Vesselness", "", DataNameProperty::READ)
......
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