2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

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

fixed MetaProperty and added usage in VolumeExplorer

parent 98203ca0
......@@ -41,26 +41,6 @@ namespace campvis {
MetaProperty::~MetaProperty() {
}
void MetaProperty::init() {
AbstractProperty::init();
initAllProperties();
}
void MetaProperty::deinit() {
deinitAllProperties();
AbstractProperty::deinit();
}
void MetaProperty::lock() {
AbstractProperty::lock();
lockAllProperties();
}
void MetaProperty::unlock() {
unlockAllProperties();
AbstractProperty::unlock();
}
void MetaProperty::onPropertyChanged(const AbstractProperty* prop) {
s_changed(prop);
}
......
......@@ -38,6 +38,11 @@ namespace campvis {
/**
* Property wrapping around a bunch of other properties.
* Useful either for grouping properties or for wrapping around entire property collections.
*
* \note ATTENTION: Even though MetaProperty derives from HasPropertyCollection, it does
* neither take ownership of its wrapped properties, nor does is (de)initialize
* or (un)lock them. This has to be done by the owners of the wrapped
* properties.
*/
class MetaProperty : public AbstractProperty, public HasPropertyCollection {
public:
......@@ -54,15 +59,6 @@ namespace campvis {
**/
virtual ~MetaProperty();
/// \see AbstractProperty::init()
virtual void init();
/// \see AbstractProperty::deinit()
virtual void deinit();
/// \see AbstractProperty::lock()
virtual void lock();
/// \see AbstractProperty::unlock()
virtual void unlock();
/// \see HasPropertyCollection::onPropertyChanged
virtual void onPropertyChanged(const AbstractProperty* prop);
......
......@@ -39,12 +39,9 @@ namespace campvis {
VolumeExplorerDemo::VolumeExplorerDemo(DataContainer* dc)
: AutoEvaluationPipeline(dc)
, _camera("camera", "Camera")
, _imageReader()
, _ve(&_canvasSize)
{
addProperty(&_camera);
addProcessor(&_imageReader);
addProcessor(&_ve);
......@@ -59,7 +56,6 @@ namespace campvis {
_imageReader.s_validated.connect(this, &VolumeExplorerDemo::onProcessorValidated);
_camera.addSharedProperty(&_ve.p_camera);
_ve.p_outputImage.setValue("combine");
_renderTargetID.setValue("combine");
......
......@@ -68,7 +68,6 @@ namespace campvis {
*/
virtual void onProcessorValidated(AbstractProcessor* processor);
CameraProperty _camera;
MhdImageReader _imageReader;
VolumeExplorer _ve;
};
......
......@@ -44,39 +44,44 @@ namespace campvis {
VolumeExplorer::VolumeExplorer(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_inputVolume("InputVolume", "Input Volume", "", DataNameProperty::READ, AbstractProcessor::INVALID_PROPERTIES)
, p_camera("Camera", "Camera")
, p_xSlice("XSlice", "Slice in YZ Plane", 0, 0, 0, 1, INVALID_RESULT | SLICES_INVALID)
, p_ySlice("YSlice", "Slice in XZ Plane", 0, 0, 0, 1, INVALID_RESULT | SLICES_INVALID)
, p_zSlice("ZSlice", "Slice in XY Plane", 0, 0, 0, 1, INVALID_RESULT | SLICES_INVALID)
, p_outputImage("OutputImage", "Output Image", "ve.output", DataNameProperty::WRITE)
, p_seProperties("SliceExtractorProperties", "Slice Extractor Properties", AbstractProcessor::VALID)
, p_vrProperties("VolumeRendererProperties", "Volume Renderer Properties", AbstractProcessor::VALID)
, _raycaster(viewportSizeProp)
, _sliceExtractor(viewportSizeProp)
, p_sliceRenderSize("SliceRenderSize", "Slice Render Size", tgt::ivec2(32), tgt::ivec2(0), tgt::ivec2(10000), tgt::ivec2(1), AbstractProcessor::VALID)
, p_volumeRenderSize("VolumeRenderSize", "Volume Render Size", tgt::ivec2(32), tgt::ivec2(0), tgt::ivec2(10000), tgt::ivec2(1), AbstractProcessor::VALID)
, _xSliceHandler(&p_xSlice)
, _ySliceHandler(&p_ySlice)
, _zSliceHandler(&p_zSlice)
, _xSliceHandler(&_sliceExtractor.p_xSliceNumber)
, _ySliceHandler(&_sliceExtractor.p_ySliceNumber)
, _zSliceHandler(&_sliceExtractor.p_zSliceNumber)
, _windowingHandler(&_sliceExtractor.p_transferFunction)
, _trackballEH(0)
, _mousePressed(false)
{
addProperty(&p_inputVolume);
addProperty(&p_camera);
addProperty(&p_xSlice);
addProperty(&p_ySlice);
addProperty(&p_zSlice);
addProperty(&p_outputImage);
p_seProperties.addPropertyCollection(_sliceExtractor);
_sliceExtractor.p_lqMode.setVisible(false);
_sliceExtractor.p_sourceImageID.setVisible(false);
_sliceExtractor.p_targetImageID.setVisible(false);
_sliceExtractor.p_sliceOrientation.setVisible(false);
_sliceExtractor.p_xSliceColor.setVisible(false);
_sliceExtractor.p_ySliceColor.setVisible(false);
_sliceExtractor.p_zSliceColor.setVisible(false);
addProperty(&p_seProperties);
p_vrProperties.addPropertyCollection(_raycaster);
_raycaster.p_lqMode.setVisible(false);
_raycaster.p_inputVolume.setVisible(false);
_raycaster.p_outputImage.setVisible(false);
addProperty(&p_vrProperties);
addProperty(&_sliceExtractor.p_transferFunction);
addProperty(_raycaster.getProperty("TransferFunction"));
p_inputVolume.addSharedProperty(&_raycaster.p_inputVolume);
p_inputVolume.addSharedProperty(&_sliceExtractor.p_sourceImageID);
p_camera.addSharedProperty(&_raycaster.p_camera);
p_xSlice.addSharedProperty(&_sliceExtractor.p_xSliceNumber);
p_ySlice.addSharedProperty(&_sliceExtractor.p_ySliceNumber);
p_zSlice.addSharedProperty(&_sliceExtractor.p_zSliceNumber);
_sliceExtractor.setViewportSizeProperty(&p_sliceRenderSize);
_raycaster.setViewportSizeProperty(&p_volumeRenderSize);
......@@ -246,17 +251,17 @@ namespace campvis {
if (img != 0) {
const tgt::svec3& imgSize = img->getSize();
if (p_xSlice.getMaxValue() != imgSize.x - 1){
p_xSlice.setMaxValue(static_cast<int>(imgSize.x) - 1);
p_xSlice.setValue(static_cast<int>(imgSize.x) / 2);
if (_sliceExtractor.p_xSliceNumber.getMaxValue() != imgSize.x - 1){
_sliceExtractor.p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1);
_sliceExtractor.p_xSliceNumber.setValue(static_cast<int>(imgSize.x) / 2);
}
if (p_ySlice.getMaxValue() != imgSize.y - 1){
p_ySlice.setMaxValue(static_cast<int>(imgSize.y) - 1);
p_ySlice.setValue(static_cast<int>(imgSize.y) / 2);
if (_sliceExtractor.p_ySliceNumber.getMaxValue() != imgSize.y - 1){
_sliceExtractor.p_ySliceNumber.setMaxValue(static_cast<int>(imgSize.y) - 1);
_sliceExtractor.p_ySliceNumber.setValue(static_cast<int>(imgSize.y) / 2);
}
if (p_zSlice.getMaxValue() != imgSize.z - 1){
p_zSlice.setMaxValue(static_cast<int>(imgSize.z) - 1);
p_zSlice.setValue(static_cast<int>(imgSize.z) / 2);
if (_sliceExtractor.p_zSliceNumber.getMaxValue() != imgSize.z - 1){
_sliceExtractor.p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
_sliceExtractor.p_zSliceNumber.setValue(static_cast<int>(imgSize.z) / 2);
}
_trackballEH->reinitializeCamera(img);
......
......@@ -39,6 +39,7 @@
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/metaproperty.h"
#include "modules/vis/processors/volumerenderer.h"
#include "modules/vis/processors/sliceextractor.h"
......@@ -86,13 +87,11 @@ namespace campvis {
virtual void process(DataContainer& data);
DataNameProperty p_inputVolume; ///< image ID for first input image
DataNameProperty p_outputImage; ///< image ID for output image
CameraProperty p_camera;
IntProperty p_xSlice;
IntProperty p_ySlice;
IntProperty p_zSlice;
MetaProperty p_seProperties; ///< MetaProperty for SliceExtractor properties
MetaProperty p_vrProperties; ///< MetaProperty for Raycaster properties
DataNameProperty p_outputImage; ///< image ID for output image
protected:
/// Additional invalidation levels for this processor.
......
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