Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit d5500750 authored by schultezub's avatar schultezub
Browse files

* added IVec2PropertyWidget

 * some further work on ProxyGeometryGenerator/DVRVis

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@277 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent d81408b6
......@@ -69,4 +69,51 @@ namespace TUMVis {
_spinBox->setMaximum(prop->getMaxValue());
}
}
// ================================================================================================
IVec2PropertyWidget::IVec2PropertyWidget(IVec2Property* property, QWidget* parent /*= 0*/)
: AbstractPropertyWidget(property, parent)
{
for (size_t i = 0; i < size; ++i) {
_spinBox[i] = new QSpinBox(this);
_spinBox[i]->setMinimum(property->getMinValue()[i]);
_spinBox[i]->setMaximum(property->getMaxValue()[i]);
_spinBox[i]->setValue(property->getValue()[i]);
addWidget(_spinBox[i]);
connect(_spinBox[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
property->s_minMaxChanged.connect(this, &IVec2PropertyWidget::onPropertyMinMaxChanged);
}
IVec2PropertyWidget::~IVec2PropertyWidget() {
static_cast<IVec2Property*>(_property)->s_minMaxChanged.disconnect(this);
}
void IVec2PropertyWidget::updateWidgetFromProperty() {
IVec2Property* prop = static_cast<IVec2Property*>(_property);
for (size_t i = 0; i < size; ++i) {
_spinBox[i]->blockSignals(true);
_spinBox[i]->setValue(prop->getValue()[i]);
_spinBox[i]->blockSignals(false);
}
}
void IVec2PropertyWidget::onValueChanged(int value) {
_ignorePropertyUpdates = true;
IVec2Property* prop = static_cast<IVec2Property*>(_property);
prop->setValue(tgt::ivec2(_spinBox[0]->value(), _spinBox[1]->value()));
_ignorePropertyUpdates = false;
}
void IVec2PropertyWidget::onPropertyMinMaxChanged(const AbstractProperty* property) {
if (!_ignorePropertyUpdates) {
IVec2Property* prop = static_cast<IVec2Property*>(_property);
for (size_t i = 0; i < size; ++i) {
_spinBox[i]->setMinimum(prop->getMinValue()[i]);
_spinBox[i]->setMaximum(prop->getMaxValue()[i]);
}
}
}
}
\ No newline at end of file
......@@ -70,5 +70,44 @@ namespace TUMVis {
QSpinBox* _spinBox;
};
// = TODO: Using templates would make this much more elegant... ===================================
/**
* Widget for a IVec2Property
*/
class IVec2PropertyWidget : public AbstractPropertyWidget {
enum { size = 2 };
Q_OBJECT;
public:
/**
* Creates a new IVec2PropertyWidget for the property \a property.
* \param property The property the widget shall handle
* \param parent Parent Qt widget
*/
IVec2PropertyWidget(IVec2Property* property, QWidget* parent = 0);
/**
* Destructor
*/
virtual ~IVec2PropertyWidget();
protected:
/**
* Gets called when the property has changed, so that widget can update its state.
*/
virtual void updateWidgetFromProperty();
private slots:
void onValueChanged(int value);
private:
/// Slot getting called when the property's min or max value has changed, so that the widget can be updated.
virtual void onPropertyMinMaxChanged(const AbstractProperty* property);
QSpinBox* _spinBox[2];
};
}
#endif // INTPROPERTYWIDGET_H__
......@@ -53,6 +53,10 @@ namespace TUMVis {
return new IntPropertyWidget(tester);
}
if (IVec2Property* tester = dynamic_cast<IVec2Property*>(property)) {
return new IVec2PropertyWidget(tester);
}
if (FloatProperty* tester = dynamic_cast<FloatProperty*>(property)) {
return new FloatPropertyWidget(tester);
}
......
......@@ -59,6 +59,12 @@ namespace TUMVis {
return tgt::Bounds(_mappingInformation.getOffset(), _mappingInformation.getOffset() + (tgt::vec3(_size) * _mappingInformation.getVoxelSize()));
}
tgt::Bounds ImageData::getWorldBounds(const tgt::svec3& llf, const tgt::svec3& urb) const {
return tgt::Bounds(
_mappingInformation.getOffset() + (tgt::vec3(llf) * _mappingInformation.getVoxelSize()),
_mappingInformation.getOffset() + (tgt::vec3(urb) * _mappingInformation.getVoxelSize()));
}
size_t ImageData::getNumElements() const {
return _numElements;
}
......
......@@ -79,6 +79,14 @@ namespace TUMVis {
*/
tgt::Bounds getWorldBounds() const;
/**
* Returns the image extent in world coordinates for the given voxel coordinates.
* \param llf Lower-left-front in voxel coordinates.
* \param urb Upper-right-back in voxel coordinates.
* \return The image extent in world coordinates for the given voxel coordinates.
*/
tgt::Bounds getWorldBounds(const tgt::svec3& llf, const tgt::svec3& urb) const;
/**
* Returns the subimage of this image given by \a llf and \a urb.
* TODO: Check whether it is necessary to adjust image mapping!
......
......@@ -106,6 +106,7 @@ namespace TUMVis {
_renderTargetID.setValue("drr.output");
_imageReader.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_pgGenerator.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_eepGenerator.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_drrraycater.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_simpleRaycaster.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
......
......@@ -73,10 +73,10 @@ namespace TUMVis {
_clipZ.setValue(tgt::ivec2(0, img->getSize().z));
_sourceTimestamp = img.getDataHandle()->getTimestamp();
}
// TODO: implement some kind of cool proxy geometry supporting clipping (camera in volume)...
tgt::Bounds volumeExtent = img->getWorldBounds();
tgt::Bounds volumeExtent = img->getWorldBounds(tgt::svec3(_clipX.getValue().x, _clipY.getValue().x, _clipZ.getValue().x), tgt::svec3(_clipX.getValue().y, _clipY.getValue().y, _clipZ.getValue().y));
tgt::vec3 numSlices = tgt::vec3(img->getSize());
tgt::vec3 texLLF(static_cast<float>(_clipX.getValue().x), static_cast<float>(_clipY.getValue().x), static_cast<float>(_clipZ.getValue().x));
texLLF /= numSlices;
tgt::vec3 texURB(static_cast<float>(_clipX.getValue().y), static_cast<float>(_clipY.getValue().y), static_cast<float>(_clipZ.getValue().y));
......
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