Commit af58935c authored by schultezub's avatar schultezub

* Introducing DataNamePropertyWidget offering a combo box with all DataHandles...

* Introducing DataNamePropertyWidget offering a combo box with all DataHandles in current DataContainer
* added slice rendering to Columbia1 pipeline

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@516 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 03f2dc07
......@@ -33,6 +33,7 @@ SET(CampvisApplicationToBeMocced
gui/properties/boolpropertywidget.h
gui/properties/buttonpropertywidget.h
gui/properties/camerapropertywidget.h
gui/properties/datanamepropertywidget.h
gui/properties/intpropertywidget.h
gui/properties/floatpropertywidget.h
gui/properties/geometry1dtransferfunctioneditor.h
......
......@@ -136,7 +136,7 @@ namespace campvis {
_infoWidgetLayout->addWidget(_canvas, 1);
_pcWidget = new PropertyCollectionWidget(_infoWidget);
_pcWidget->updatePropCollection(_canvas);
_pcWidget->updatePropCollection(_canvas, _dataContainer);
_infoWidgetLayout->addWidget(_pcWidget);
_mainLayout->addWidget(_infoWidget, 1);
......@@ -228,7 +228,7 @@ namespace campvis {
if (_canvas != 0)
_canvas->deinit();
_pcWidget->updatePropCollection(0);
_pcWidget->updatePropCollection(0, 0);
if (_dataContainer != 0) {
_dataContainer->s_dataAdded.disconnect(this);
......
......@@ -99,8 +99,8 @@ namespace campvis {
_pipelineWidget, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(onPipelineWidgetItemClicked(const QModelIndex&)));
connect(
this, SIGNAL(updatePropCollectionWidget(HasPropertyCollection*)),
_propCollectionWidget, SLOT(updatePropCollection(HasPropertyCollection*)));
this, SIGNAL(updatePropCollectionWidget(HasPropertyCollection*, DataContainer*)),
_propCollectionWidget, SLOT(updatePropCollection(HasPropertyCollection*, DataContainer*)));
connect(
_btnExecute, SIGNAL(clicked()),
this, SLOT(onBtnExecuteClicked()));
......@@ -119,7 +119,6 @@ namespace campvis {
// Yak, this is so ugly - another reason why GUI programming sucks...
QVariant item = index.data(Qt::UserRole);
HasPropertyCollection* ptr = static_cast<HasPropertyCollection*>(item.value<void*>());
emit updatePropCollectionWidget(ptr);
if (AbstractPipeline* pipeline = dynamic_cast<AbstractPipeline*>(ptr)) {
_selectedPipeline = pipeline;
......@@ -129,10 +128,18 @@ namespace campvis {
}
else if (AbstractProcessor* processor = dynamic_cast<AbstractProcessor*>(ptr)) {
_selectedProcessor = processor;
QVariant parentItem = index.parent().data(Qt::UserRole);
HasPropertyCollection* pptr = static_cast<HasPropertyCollection*>(parentItem.value<void*>());
if (AbstractPipeline* pipeline = dynamic_cast<AbstractPipeline*>(pptr)) {
_selectedPipeline = pipeline;
}
}
emit updatePropCollectionWidget(ptr, &_selectedPipeline->getDataContainer());
}
else {
emit updatePropCollectionWidget(0);
emit updatePropCollectionWidget(0, 0);
}
}
......
......@@ -90,7 +90,7 @@ namespace campvis {
/// Qt signal for updating the PipelineWidget.
void updatePipelineWidget(const std::vector<AbstractPipeline*>&);
/// Qt signal for updating the PropertyCollectionWidget
void updatePropCollectionWidget(HasPropertyCollection*);
void updatePropCollectionWidget(HasPropertyCollection*, DataContainer*);
private slots:
/**
......
// ================================================================================================
//
// 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 "datanamepropertywidget.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/datanameproperty.h"
#include <QComboBox>
#include <QLineEdit>
namespace campvis {
DataNamePropertyWidget::DataNamePropertyWidget(DataNameProperty* property, DataContainer* dc, QWidget* parent /*= 0*/)
: AbstractPropertyWidget(property, parent)
, _lineEdit(0)
, _combobox(0)
, _dc(dc)
{
if (property->getAccessInfo() == DataNameProperty::READ) {
_combobox = new QComboBox(this);
_combobox->setEditable(true);
if (dc != 0) {
std::vector< std::pair<std::string, DataHandle> > tmp = dc->getDataHandlesCopy();
QStringList sl;
for (size_t i = 0; i < tmp.size(); ++i)
sl.append(QString::fromStdString(tmp[i].first));
_combobox->addItems(sl);
dc->s_dataAdded.connect(this, &DataNamePropertyWidget::onDataAdded);
int idx = _combobox->findText(QString::fromStdString(property->getValue()));
if (idx != -1)
_combobox->setCurrentIndex(idx);
else
_combobox->setEditText(QString::fromStdString(property->getValue()));
}
addWidget(_combobox);
connect(_combobox, SIGNAL(editTextChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
}
else {
_lineEdit = new QLineEdit(this);
_lineEdit->setText(QString::fromStdString(property->getValue()));
addWidget(_lineEdit);
connect(_lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
}
}
DataNamePropertyWidget::~DataNamePropertyWidget() {
if (_dc != 0 && static_cast<DataNameProperty*>(_property)->getAccessInfo() == DataNameProperty::READ)
_dc->s_dataAdded.disconnect(this);
}
void DataNamePropertyWidget::updateWidgetFromProperty() {
DataNameProperty* prop = static_cast<DataNameProperty*>(_property);
QString qs = QString::fromStdString(prop->getValue());
if (_lineEdit->text() != qs) {
_lineEdit->blockSignals(true);
_lineEdit->setText(qs);
_lineEdit->blockSignals(false);
}
}
void DataNamePropertyWidget::onTextChanged(const QString& text) {
DataNameProperty* prop = static_cast<DataNameProperty*>(_property);
++_ignorePropertyUpdates;
prop->setValue(text.toStdString());
--_ignorePropertyUpdates;
}
void DataNamePropertyWidget::onDataAdded(const std::string& key, const DataHandle& /*dh*/) {
if (_combobox->findText(QString::fromStdString(key)) == -1) {
_combobox->addItem(QString::fromStdString(key));
}
}
}
\ No newline at end of file
// ================================================================================================
//
// 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.
//
// ================================================================================================
#ifndef DATANAMEPROPERTYWIDGET_H__
#define DATANAMEPROPERTYWIDGET_H__
#include "sigslot/sigslot.h"
#include "application/gui/properties/abstractpropertywidget.h"
class QComboBox;
class QLineEdit;
namespace campvis {
class DataNameProperty;
class DataContainer;
class DataHandle;
/**
* Widget for a DataNameProperty
*/
class DataNamePropertyWidget : public AbstractPropertyWidget {
Q_OBJECT;
public:
/**
* Creates a new PropertyWidget for the property \a property.
* \param property The property the widget shall handle
* \param parent Parent Qt widget
*/
DataNamePropertyWidget(DataNameProperty* property, DataContainer* dc, QWidget* parent = 0);
/**
* Destructor
*/
virtual ~DataNamePropertyWidget();
protected:
/**
* Gets called when the property has changed, so that widget can update its state.
*/
virtual void updateWidgetFromProperty();
void onDataAdded(const std::string& key, const DataHandle& dh);
private slots:
void onTextChanged(const QString& text);
private:
QLineEdit* _lineEdit;
QComboBox* _combobox;
DataContainer* _dc;
};
}
#endif // DATANAMEPROPERTYWIDGET_H__
......@@ -31,6 +31,7 @@
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/abstractproperty.h"
#include "core/properties/propertycollection.h"
......@@ -51,14 +52,14 @@ namespace campvis {
clearWidgetMap();
}
void PropertyCollectionWidget::updatePropCollection(HasPropertyCollection* propertyCollection) {
void PropertyCollectionWidget::updatePropCollection(HasPropertyCollection* propertyCollection, DataContainer* dc) {
// remove and delete all widgets of the previous PropertyCollection
clearWidgetMap();
// create widgets for the new PropertyCollection
if (propertyCollection != 0) {
for (std::vector<AbstractProperty*>::const_iterator it = propertyCollection->getProperties().begin(); it != propertyCollection->getProperties().end(); ++it) {
QWidget* propWidget = PropertyWidgetFactory::createWidget(*it);
QWidget* propWidget = PropertyWidgetFactory::createWidget(*it, dc);
if (propWidget == 0)
propWidget = new QPushButton(QString::fromStdString((*it)->getTitle()));
......
......@@ -38,6 +38,7 @@
namespace campvis {
class AbstractProperty;
class DataContainer;
class HasPropertyCollection;
/**
......@@ -64,7 +65,7 @@ namespace campvis {
* Updates the property collection this widget works on.
* \param propertyCollection New HasPropertyCollection instance for this widget, may be 0.
*/
void updatePropCollection(HasPropertyCollection* propertyCollection);
void updatePropCollection(HasPropertyCollection* propertyCollection, DataContainer* dc);
/**
* Slot to be called when one of the propertie's visibility has changed.
......
......@@ -33,14 +33,17 @@
#include "application/gui/properties/buttonpropertywidget.h"
#include "application/gui/properties/boolpropertywidget.h"
#include "application/gui/properties/camerapropertywidget.h"
#include "application/gui/properties/datanamepropertywidget.h"
#include "application/gui/properties/intpropertywidget.h"
#include "application/gui/properties/floatpropertywidget.h"
#include "application/gui/properties/optionpropertywidget.h"
#include "application/gui/properties/stringpropertywidget.h"
#include "application/gui/properties/transferfunctionpropertywidget.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/abstractproperty.h"
#include "core/properties/cameraproperty.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/optionproperty.h"
#include "core/properties/transferfunctionproperty.h"
......@@ -48,7 +51,7 @@
namespace campvis {
AbstractPropertyWidget* PropertyWidgetFactory::createWidget(AbstractProperty* property) {
AbstractPropertyWidget* PropertyWidgetFactory::createWidget(AbstractProperty* property, DataContainer* dc) {
tgtAssert(property != 0, "Property must not be 0.");
if (BoolProperty* tester = dynamic_cast<BoolProperty*>(property)) {
......@@ -89,6 +92,10 @@ namespace campvis {
return new Vec4PropertyWidget(tester);
}
// DataNameProperty must test before StringProperty
if (DataNameProperty* tester = dynamic_cast<DataNameProperty*>(property)) {
return new DataNamePropertyWidget(tester, dc);
}
if (StringProperty* tester = dynamic_cast<StringProperty*>(property)) {
return new StringPropertyWidget(tester);
}
......
......@@ -33,6 +33,7 @@
namespace campvis {
class AbstractPropertyWidget;
class AbstractProperty;
class DataContainer;
/**
* Factory class offering the static method createWidget to create property widgets for a given
......@@ -44,9 +45,10 @@ namespace campvis {
* Creates the corresponding property widget for the given property \a property.
* \note The callee has to take the ownership of the returned pointer.
* \param property Property to generate the widget for.
* \param dc Pointer to the DataContainer the property shall use - defaults to 0.
* \return A new property widget for the given property (depending on its type).
*/
static AbstractPropertyWidget* createWidget(AbstractProperty* property);
static AbstractPropertyWidget* createWidget(AbstractProperty* property, DataContainer* dc = 0);
};
}
#endif // PROPERTYWIDGETFACTORY_H__
......@@ -67,7 +67,7 @@ namespace campvis {
, _ignoreCanvasSizeUpdate(false)
, _canvasSize("CanvasSize", "Canvas Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))
, _effectiveRenderTargetSize("EffectiveRenderTargetSize", "Render Target Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))
, _renderTargetID("renderTargetID", "Render Target ID", "VisualizationPipeline.renderTarget")
, _renderTargetID("renderTargetID", "Render Target ID", "VisualizationPipeline.renderTarget", DataNameProperty::READ)
, _canvas(0)
{
_data.s_dataAdded.connect(this, &VisualizationPipeline::onDataContainerDataAdded);
......
......@@ -36,6 +36,7 @@
#include "tgt/event/eventlistener.h"
#include "core/eventhandlers/abstracteventhandler.h"
#include "core/pipeline/abstractpipeline.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/numericproperty.h"
#include <vector>
......@@ -186,12 +187,12 @@ namespace campvis {
tbb::concurrent_hash_map<AbstractProcessor*, bool> _isVisProcessorMap;
IVec2Property _canvasSize; ///< original canvas size
bool _lqMode; ///< Flag whether low quality mode is enables
IVec2Property _canvasSize; ///< original canvas size
bool _lqMode; ///< Flag whether low quality mode is enables
bool _ignoreCanvasSizeUpdate;
IVec2Property _effectiveRenderTargetSize; ///< actual size of the render targets (considering LQ mode)
StringProperty _renderTargetID; ///< ID of the render target image to be rendered to the canvas
IVec2Property _effectiveRenderTargetSize; ///< actual size of the render targets (considering LQ mode)
DataNameProperty _renderTargetID; ///< ID of the render target image to be rendered to the canvas
std::vector<AbstractEventHandler*> _eventHandlers; ///< List of registered event handlers for the pipeline
......
......@@ -75,4 +75,8 @@ namespace campvis {
s_changed(this);
}
DataNameProperty::DataAccessInfo DataNameProperty::getAccessInfo() const {
return _accessInfo;
}
}
......@@ -76,6 +76,12 @@ namespace campvis {
*/
void disconnect(DataNameProperty* reader);
/**
* Returns the access info of this property defining whether processor will read or write.
* \return _accessInfo
*/
DataAccessInfo getAccessInfo() const;
void issueWrite();
protected:
......
......@@ -78,7 +78,7 @@ namespace campvis {
case 4:
return GL_RGBA;
default:
tgtAssert(false, "Should not reach hier, wrong number of channels!");
tgtAssert(false, "Should not reach this, wrong number of channels!");
return GL_ALPHA;
}
}
......
......@@ -50,21 +50,21 @@ namespace tgt {
// delete textures
if (! _texturesToDelete[backIndex].empty()) {
glDeleteTextures(_texturesToDelete[backIndex].size(), &(_texturesToDelete[backIndex].front()));
glDeleteTextures(static_cast<GLsizei>(_texturesToDelete[backIndex].size()), &(_texturesToDelete[backIndex].front()));
//LDEBUGC("tgt.OpenGLGarbageCollector", "Deleted " << _texturesToDelete[backIndex].size() << " Textures.");
_texturesToDelete[backIndex].clear();
}
// delete FBOs
if (! _fbosToDelete[backIndex].empty()) {
glDeleteFramebuffers(_fbosToDelete[backIndex].size(), &(_fbosToDelete[backIndex].front()));
glDeleteFramebuffers(static_cast<GLsizei>(_fbosToDelete[backIndex].size()), &(_fbosToDelete[backIndex].front()));
//LDEBUGC("tgt.OpenGLGarbageCollector", "Deleted " << _fbosToDelete[backIndex].size() << " FBOs.");
_fbosToDelete[backIndex].clear();
}
// delete buffers
if (! _buffersToDelete[backIndex].empty()) {
glDeleteBuffers(_buffersToDelete[backIndex].size(), &(_buffersToDelete[backIndex].front()));
glDeleteBuffers(static_cast<GLsizei>(_buffersToDelete[backIndex].size()), &(_buffersToDelete[backIndex].front()));
// LDEBUGC("tgt.OpenGLGarbageCollector", "Deleted " << _buffersToDelete[backIndex].size() << " Buffers.");
_buffersToDelete[backIndex].clear();
}
......
......@@ -44,6 +44,7 @@ namespace campvis {
, _camera("camera", "Camera")
, _imageReader()
, _vr(_effectiveRenderTargetSize)
, _sr(_effectiveRenderTargetSize)
, _trackballEH(0)
{
addProperty(&_camera);
......@@ -54,6 +55,7 @@ namespace campvis {
addProcessor(&_imageReader);
addProcessor(&_splitter);
addProcessor(&_vr);
addProcessor(&_sr);
}
Columbia1::~Columbia1() {
......@@ -67,6 +69,7 @@ namespace campvis {
_camera.addSharedProperty(&_vr.p_camera);
_vr.p_outputImage.setValue("vr");
_sr.p_targetImageID.setValue("sr");
_renderTargetID.setValue("vr");
_imageReader.p_url.setValue("D:/Medical Data/Columbia/inputs/FullVolumeLV_3D_25Hz_[IM_0004]_NIF_diffused_crop_00.ltf");
......@@ -75,6 +78,7 @@ namespace campvis {
_imageReader.p_targetImageID.connect(&_splitter.p_inputID);
_splitter.p_outputID.connect(&_vr.p_inputVolume);
_splitter.p_outputID.connect(&_sr.p_sourceImageID);
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, 1.f));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.1f, .125f), tgt::col4(255, 0, 0, 32), tgt::col4(255, 0, 0, 32)));
......
......@@ -37,6 +37,7 @@
#include "modules/io/processors/ltfimagereader.h"
#include "modules/columbia/processors/imageseriessplitter.h"
#include "modules/vis/processors/sliceextractor.h"
#include "modules/vis/processors/volumerenderer.h"
namespace campvis {
......@@ -77,6 +78,7 @@ namespace campvis {
LtfImageReader _imageReader;
ImageSeriesSplitter _splitter;
VolumeRenderer _vr;
SliceExtractor _sr;
TrackballNavigationEventHandler* _trackballEH;
......
......@@ -53,7 +53,7 @@ namespace campvis {
SliceExtractor::SliceExtractor(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ, AbstractProcessor::INVALID_PROPERTIES)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ, AbstractProcessor::INVALID_RESULT | AbstractProcessor::INVALID_PROPERTIES)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_sliceOrientation("SliceOrientation", "Slice Orientation", compositingOptions, 3)
, p_xSliceNumber("XSliceNumber", "X Slice Number", 0, 0, 0)
......
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