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

introducing AbstractProcessor::updateProperties(DataContainer&) which is...

introducing AbstractProcessor::updateProperties(DataContainer&) which is automatically called by AbstractPipeline when a processor invalidates its INVALID_PROPERTIES flag
parent 5bb124e2
...@@ -66,23 +66,23 @@ int main(int argc, char** argv) { ...@@ -66,23 +66,23 @@ int main(int argc, char** argv) {
#endif #endif
CampVisApplication app(argc, argv); CampVisApplication app(argc, argv);
//app.addVisualizationPipeline("Advanced Ultrasound Visualization", new AdvancedUsVis()); // app.addVisualizationPipeline("Advanced Ultrasound Visualization", new AdvancedUsVis());
//app.addVisualizationPipeline("Confidence Map Generation", new CmBatchGeneration()); // app.addVisualizationPipeline("Confidence Map Generation", new CmBatchGeneration());
// app.addVisualizationPipeline("IXPV", new IxpvDemo()); // app.addVisualizationPipeline("IXPV", new IxpvDemo());
//app.addVisualizationPipeline("SliceVis", new SliceVis()); app.addVisualizationPipeline("SliceVis", new SliceVis());
app.addVisualizationPipeline("DVRVis", new DVRVis()); // app.addVisualizationPipeline("DVRVis", new DVRVis());
//app.addVisualizationPipeline("VolumeRendererDemo", new VolumeRendererDemo()); // app.addVisualizationPipeline("VolumeRendererDemo", new VolumeRendererDemo());
app.addVisualizationPipeline("VolumeExplorerDemo", new VolumeExplorerDemo()); app.addVisualizationPipeline("VolumeExplorerDemo", new VolumeExplorerDemo());
#ifdef HAS_KISSCL #ifdef HAS_KISSCL
//app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline()); // app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
#endif #endif
#ifdef CAMPVIS_HAS_MODULE_SCR_MSK #ifdef CAMPVIS_HAS_MODULE_SCR_MSK
//app.addVisualizationPipeline("US Compounding", new UsCompounding()); app.addVisualizationPipeline("US Compounding", new UsCompounding());
#endif #endif
#ifdef CAMPVIS_HAS_MODULE_COLUMBIA #ifdef CAMPVIS_HAS_MODULE_COLUMBIA
//app.addVisualizationPipeline("Columbia", new Columbia1()); app.addVisualizationPipeline("Columbia", new Columbia1());
#endif #endif
......
...@@ -83,14 +83,11 @@ namespace campvis { ...@@ -83,14 +83,11 @@ namespace campvis {
void AbstractPipeline::onPropertyChanged(const AbstractProperty* prop) { void AbstractPipeline::onPropertyChanged(const AbstractProperty* prop) {
HasPropertyCollection::onPropertyChanged(prop); HasPropertyCollection::onPropertyChanged(prop);
s_PipelineInvalidated();
} }
void AbstractPipeline::onProcessorInvalidated(AbstractProcessor* processor) { void AbstractPipeline::onProcessorInvalidated(AbstractProcessor* processor) {
if (processor->getEnabled()) if (processor->getEnabled())
SimpleJobProc.enqueueJob(makeJob(this, &AbstractPipeline::executeProcessor, processor, false)); SimpleJobProc.enqueueJob(makeJob(this, &AbstractPipeline::executeProcessor, processor, false));
s_PipelineInvalidated();
} }
const DataContainer& AbstractPipeline::getDataContainer() const { const DataContainer& AbstractPipeline::getDataContainer() const {
...@@ -104,31 +101,43 @@ namespace campvis { ...@@ -104,31 +101,43 @@ namespace campvis {
void AbstractPipeline::executeProcessor(AbstractProcessor* processor, bool unlockInExtraThred) { void AbstractPipeline::executeProcessor(AbstractProcessor* processor, bool unlockInExtraThred) {
tgtAssert(processor != 0, "Processor must not be 0."); tgtAssert(processor != 0, "Processor must not be 0.");
if (processor->getEnabled() && !processor->isLocked() && processor->hasInvalidResult()) { if (processor->getEnabled() && !processor->isLocked()) {
processor->lockProcessor(); // update properties if they're invalid
clock_t startTime = clock(); if (processor->hasInvalidProperties()) {
processor->updateProperties(_data);
try { #if CAMPVIS_DEBUG
processor->process(_data); if (processor->hasInvalidProperties())
} LDEBUG("Processor " << processor->getName() << " still has INVALID_PROPERTIES level. Did you forget to validate the processor in updateProperties()?");
catch (std::exception& e) { #endif
LERROR("Caught unhandled exception while executing processor " << processor->getName() << ": " << e.what());
}
catch (...) {
LERROR("Caught unhandled exception while executing processor " << processor->getName() << ": unknown exception");
} }
if (processor->getClockExecutionTime()) { // execute processor if needed
clock_t endTime = clock(); if (processor->hasInvalidResult()) {
LDEBUG("Executed processor " << processor->getName() << " duration: " << (endTime - startTime)); processor->lockProcessor();
clock_t startTime = clock();
try {
processor->process(_data);
}
catch (std::exception& e) {
LERROR("Caught unhandled exception while executing processor " << processor->getName() << ": " << e.what());
}
catch (...) {
LERROR("Caught unhandled exception while executing processor " << processor->getName() << ": unknown exception");
}
if (processor->getClockExecutionTime()) {
clock_t endTime = clock();
LDEBUG("Executed processor " << processor->getName() << " duration: " << (endTime - startTime));
}
// Unlocking processors might be expensive, since a long chain of invalidations might be started
// -> do this in another thread...
if (unlockInExtraThred)
SimpleJobProc.enqueueJob(makeJob(processor, &AbstractProcessor::unlockProcessor));
else
processor->unlockProcessor();
} }
// Unlocking processors might be expensive, since a long chain of invalidations might be started
// -> do this in another thread...
if (unlockInExtraThred)
SimpleJobProc.enqueueJob(makeJob(processor, &AbstractProcessor::unlockProcessor));
else
processor->unlockProcessor();
} }
} }
......
...@@ -121,9 +121,6 @@ namespace campvis { ...@@ -121,9 +121,6 @@ namespace campvis {
*/ */
void setEnabled(bool enabled); void setEnabled(bool enabled);
/// Signal being emitted when this pipeline has been invalidated.
sigslot::signal0<> s_PipelineInvalidated;
protected: protected:
/** /**
* Locks all processors. * Locks all processors.
......
...@@ -127,5 +127,9 @@ namespace campvis { ...@@ -127,5 +127,9 @@ namespace campvis {
_clockExecutionTime = value; _clockExecutionTime = value;
} }
void AbstractProcessor::updateProperties(DataContainer& dc) {
validate(INVALID_PROPERTIES);
}
} }
...@@ -260,6 +260,19 @@ namespace campvis { ...@@ -260,6 +260,19 @@ namespace campvis {
validate(static_cast<int>(il)); validate(static_cast<int>(il));
} }
/**
* Gets called from the pipeline before calling process(), when this processor has an INVALID_PROPERTIES level.
* \note You may overload this method as needed. The default implementation only validates
* the INVALID_PROPERTIES level again.
* \note There is also an overloadable updateProperties() in the HasPropertyCollection super class,
* which is called from the processor itself. If you do not need access to the DataContainer
* of the parent pipeline, you can also use that method.
* \see HasPropertyCollection::updateProperties()
* \param dc DataContainer The DataContainer of the calling pipeline.
*/
virtual void updateProperties(DataContainer& dc);
/// Signal emitted when the processor has been invalidated. /// Signal emitted when the processor has been invalidated.
sigslot::signal1<AbstractProcessor*> s_invalidated; sigslot::signal1<AbstractProcessor*> s_invalidated;
......
...@@ -178,23 +178,23 @@ namespace campvis { ...@@ -178,23 +178,23 @@ namespace campvis {
AbstractPipeline::executeProcessor(processor, true); AbstractPipeline::executeProcessor(processor, true);
#ifdef CAMPVIS_DEBUG #ifdef CAMPVIS_DEBUG
// tgtAssert(getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false."); tgtAssert(getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false.");
// tgtAssert(getGlBool(GL_SCISSOR_TEST) == false, "Invalid OpenGL state after processor execution, GL_SCISSOR_TEST != false."); tgtAssert(getGlBool(GL_SCISSOR_TEST) == false, "Invalid OpenGL state after processor execution, GL_SCISSOR_TEST != false.");
//
// tgtAssert(getGlInt(GL_CULL_FACE_MODE) == GL_BACK, "Invalid OpenGL state after processor execution, GL_CULL_FACE_MODE != GL_BACk."); tgtAssert(getGlInt(GL_CULL_FACE_MODE) == GL_BACK, "Invalid OpenGL state after processor execution, GL_CULL_FACE_MODE != GL_BACk.");
// tgtAssert(getGlInt(GL_DEPTH_FUNC) == GL_LESS, "Invalid OpenGL state after processor execution, GL_DEPTH_FUNC != GL_LESS."); tgtAssert(getGlInt(GL_DEPTH_FUNC) == GL_LESS, "Invalid OpenGL state after processor execution, GL_DEPTH_FUNC != GL_LESS.");
//
// tgtAssert(getGlFloat(GL_DEPTH_CLEAR_VALUE) == 1.f, "Invalid OpenGL state after processor execution, GL_DEPTH_CLEAR_VALUE != 1.f."); tgtAssert(getGlFloat(GL_DEPTH_CLEAR_VALUE) == 1.f, "Invalid OpenGL state after processor execution, GL_DEPTH_CLEAR_VALUE != 1.f.");
//
// tgtAssert(getGlFloat(GL_RED_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_RED_SCALE != 1.f."); tgtAssert(getGlFloat(GL_RED_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_RED_SCALE != 1.f.");
// tgtAssert(getGlFloat(GL_GREEN_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_GREEN_SCALE != 1.f."); tgtAssert(getGlFloat(GL_GREEN_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_GREEN_SCALE != 1.f.");
// tgtAssert(getGlFloat(GL_BLUE_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_BLUE_SCALE != 1.f."); tgtAssert(getGlFloat(GL_BLUE_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_BLUE_SCALE != 1.f.");
// tgtAssert(getGlFloat(GL_ALPHA_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_ALPHA_SCALE != 1.f."); tgtAssert(getGlFloat(GL_ALPHA_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_ALPHA_SCALE != 1.f.");
//
// tgtAssert(getGlFloat(GL_RED_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_RED_BIAS != 0.f."); tgtAssert(getGlFloat(GL_RED_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_RED_BIAS != 0.f.");
// tgtAssert(getGlFloat(GL_GREEN_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_GREEN_BIAS != 0.f."); tgtAssert(getGlFloat(GL_GREEN_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_GREEN_BIAS != 0.f.");
// tgtAssert(getGlFloat(GL_BLUE_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_BLUE_BIAS != 0.f."); tgtAssert(getGlFloat(GL_BLUE_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_BLUE_BIAS != 0.f.");
// tgtAssert(getGlFloat(GL_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f."); tgtAssert(getGlFloat(GL_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f.");
#endif #endif
} }
......
...@@ -63,7 +63,7 @@ namespace campvis { ...@@ -63,7 +63,7 @@ namespace campvis {
AdvancedUsFusion::AdvancedUsFusion(IVec2Property* viewportSizeProp) AdvancedUsFusion::AdvancedUsFusion(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp) : VisualizationProcessor(viewportSizeProp)
, p_usImageId("UsImageId", "Ultrasound Input Image", "", DataNameProperty::READ) , p_usImageId("UsImageId", "Ultrasound Input Image", "", DataNameProperty::READ, AbstractProcessor::INVALID_PROPERTIES | AbstractProcessor::INVALID_RESULT)
, p_blurredImageId("BlurredImageId", "Blurred Ultrasound Image", "", DataNameProperty::READ) , p_blurredImageId("BlurredImageId", "Blurred Ultrasound Image", "", DataNameProperty::READ)
, p_gradientImageID("GradientImageId", "Gradient Input Image", "", DataNameProperty::READ) , p_gradientImageID("GradientImageId", "Gradient Input Image", "", DataNameProperty::READ)
, p_confidenceImageID("ConfidenceImageId", "Confidence Map Input", "", DataNameProperty::READ) , p_confidenceImageID("ConfidenceImageId", "Confidence Map Input", "", DataNameProperty::READ)
...@@ -120,15 +120,6 @@ namespace campvis { ...@@ -120,15 +120,6 @@ namespace campvis {
if (img != 0 && blurred != 0 && confidence != 0) { if (img != 0 && blurred != 0 && confidence != 0) {
if (img->getDimensionality() >= 2) { if (img->getDimensionality() >= 2) {
if (img.getDataHandle().getTimestamp() != _sourceImageTimestamp) {
// source DataHandle has changed
updateProperties(img.getDataHandle());
_sourceImageTimestamp = img.getDataHandle().getTimestamp();
//p_confidenceTF.getTF()->setImageHandle(confidence.getDataHandle());
//_shader->setHeaders(generateHeader());
//_shader->rebuild();
}
FramebufferActivationGuard fag(this); FramebufferActivationGuard fag(this);
createAndAttachColorTexture(); createAndAttachColorTexture();
createAndAttachDepthTexture(); createAndAttachDepthTexture();
...@@ -170,13 +161,17 @@ namespace campvis { ...@@ -170,13 +161,17 @@ namespace campvis {
validate(INVALID_RESULT); validate(INVALID_RESULT);
} }
void AdvancedUsFusion::updateProperties(DataHandle img) { void AdvancedUsFusion::updateProperties(DataContainer dc) {
p_transferFunction.getTF()->setImageHandle(img); DataContainer::ScopedTypedData<ImageData> img(dc, p_usImageId.getValue());
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
p_transferFunction.getTF()->setImageHandle(img.getDataHandle());
const tgt::svec3& imgSize = img->getSize();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){ if (p_sliceNumber.getMaxValue() != imgSize.z - 1){
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1); p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
} }
p_use3DTexture.setValue(static_cast<const ImageData*>(img.getData())->getDimensionality() == 3); p_use3DTexture.setValue(img->getDimensionality() == 3);
validate(AbstractProcessor::INVALID_PROPERTIES);
} }
std::string AdvancedUsFusion::generateHeader() const { std::string AdvancedUsFusion::generateHeader() const {
......
...@@ -98,16 +98,13 @@ namespace campvis { ...@@ -98,16 +98,13 @@ namespace campvis {
protected: protected:
/// adapts the range of the p_sliceNumber property to the image /// adapts the range of the p_sliceNumber property to the image
void updateProperties(DataHandle img); virtual void updateProperties(DataContainer dc);
std::string generateHeader() const; std::string generateHeader() const;
tgt::Shader* _shader; ///< Shader for slice rendering tgt::Shader* _shader; ///< Shader for slice rendering
static const std::string loggerCat_; static const std::string loggerCat_;
private:
clock_t _sourceImageTimestamp;
}; };
} }
......
...@@ -133,7 +133,7 @@ namespace campvis { ...@@ -133,7 +133,7 @@ namespace campvis {
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, 1.f)); 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))); dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.1f, .125f), tgt::col4(255, 0, 0, 32), tgt::col4(255, 0, 0, 32)));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .5f), tgt::col4(0, 255, 0, 128), tgt::col4(0, 255, 0, 128))); dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .5f), tgt::col4(0, 255, 0, 128), tgt::col4(0, 255, 0, 128)));
static_cast<TransferFunctionProperty*>(_vr.getProperty("transferFunction"))->replaceTF(dvrTF); static_cast<TransferFunctionProperty*>(_vr.getProperty("TransferFunction"))->replaceTF(dvrTF);
_vr.p_outputImage.connect(&_compositor.p_secondImageId); _vr.p_outputImage.connect(&_compositor.p_secondImageId);
_gr.p_renderTargetID.setValue("gr"); _gr.p_renderTargetID.setValue("gr");
...@@ -160,7 +160,7 @@ namespace campvis { ...@@ -160,7 +160,7 @@ namespace campvis {
// update camera // update camera
DataContainer::ScopedTypedData<ImageData> img(_data, _imageSplitter.p_outputID.getValue()); DataContainer::ScopedTypedData<ImageData> img(_data, _imageSplitter.p_outputID.getValue());
if (img != 0) { if (img != 0) {
_trackballEH->reinitializeCamera(img);
} }
} }
} }
......
...@@ -296,6 +296,8 @@ namespace campvis { ...@@ -296,6 +296,8 @@ namespace campvis {
p_timeStep.setVisible(true); p_timeStep.setVisible(true);
p_conductance.setVisible(true); p_conductance.setVisible(true);
} }
validate(AbstractProcessor::INVALID_PROPERTIES);
} }
} }
...@@ -79,7 +79,7 @@ namespace campvis { ...@@ -79,7 +79,7 @@ namespace campvis {
FloatProperty p_conductance; FloatProperty p_conductance;
protected: protected:
/// \see AbstractProcessor::updateProperties /// \see HasPropertyCollection::updateProperties
virtual void updateProperties(); virtual void updateProperties();
static const std::string loggerCat_; static const std::string loggerCat_;
......
...@@ -230,8 +230,4 @@ namespace campvis { ...@@ -230,8 +230,4 @@ namespace campvis {
validate(INVALID_RESULT); validate(INVALID_RESULT);
} }
void ItkImageFilterKernel::updateProperties() {
}
} }
...@@ -74,8 +74,6 @@ namespace campvis { ...@@ -74,8 +74,6 @@ namespace campvis {
IntProperty p_kernelSize; IntProperty p_kernelSize;
protected: protected:
/// \see AbstractProcessor::updateProperties
virtual void updateProperties();
static const std::string loggerCat_; static const std::string loggerCat_;
}; };
......
...@@ -139,10 +139,6 @@ namespace campvis { ...@@ -139,10 +139,6 @@ namespace campvis {
DataContainer::ScopedTypedData< TrackedUsFileIoData > fio(data, p_sourceImageID.getValue()); DataContainer::ScopedTypedData< TrackedUsFileIoData > fio(data, p_sourceImageID.getValue());
if (fio != 0) { if (fio != 0) {
if (hasInvalidProperties()) {
updateProperties(const_cast<TrackedUSFileIO*>(fio->getData()));
}
if (_currentSweep != 0) { if (_currentSweep != 0) {
int frameNr = p_frameNumber.getValue(); int frameNr = p_frameNumber.getValue();
const tgt::Camera& cam = p_camera.getValue(); const tgt::Camera& cam = p_camera.getValue();
...@@ -228,8 +224,10 @@ namespace campvis { ...@@ -228,8 +224,10 @@ namespace campvis {
validate(INVALID_RESULT); validate(INVALID_RESULT);
} }
void TrackedUsSweepFrameRenderer3D::updateProperties(TrackedUSFileIO* fio) { void TrackedUsSweepFrameRenderer3D::updateProperties(DataContainer& dc) {
if (fio != 0) { DataContainer::ScopedTypedData<TrackedUsFileIoData> data(dc, p_sourceImageID.getValue());
if (data != 0) {
TrackedUSFileIO* fio = const_cast<TrackedUSFileIO*>(data->getData());
const TrackedUSFileXMLHeader::TrackedUSFileStudy *study = fio->getStudyHeader(0); const TrackedUSFileXMLHeader::TrackedUSFileStudy *study = fio->getStudyHeader(0);
p_sweepNumber.setMaxValue(static_cast<int>(study->Series.size()) - 1); p_sweepNumber.setMaxValue(static_cast<int>(study->Series.size()) - 1);
......
...@@ -96,7 +96,7 @@ namespace campvis { ...@@ -96,7 +96,7 @@ namespace campvis {
TransferFunctionProperty p_transferFunction; ///< Transfer function TransferFunctionProperty p_transferFunction; ///< Transfer function
/// adapts the range of the p_frameNumber property to the image /// adapts the range of the p_frameNumber property to the image
void updateProperties(TrackedUSFileIO* fio); virtual void updateProperties(DataContainer& dc);
const TrackedUSSweep* getCurrentSweep() const; const TrackedUSSweep* getCurrentSweep() const;
......
...@@ -219,9 +219,7 @@ namespace campvis { ...@@ -219,9 +219,7 @@ namespace campvis {
ImageRepresentationLocal::ScopedRepresentation local(_data, _usReader.p_targetImageID.getValue()); ImageRepresentationLocal::ScopedRepresentation local(_data, _usReader.p_targetImageID.getValue());
if (local != 0) { if (local != 0) {
Interval<float> ii = local->getNormalizedIntensityRange(); Interval<float> ii = local->getNormalizedIntensityRange();
_usSliceRenderer.p_transferFunction.getTF()->setImageHandle(local.getDataHandle());
_usSliceRenderer.p_transferFunction.getTF()->setIntensityDomain(tgt::vec2(ii.getLeft(), ii.getRight())); _usSliceRenderer.p_transferFunction.getTF()->setIntensityDomain(tgt::vec2(ii.getLeft(), ii.getRight()));
_usSliceRenderer.updateProperties(local.getImageData());
_usSliceRenderer.p_sliceNumber.setValue(125); _usSliceRenderer.p_sliceNumber.setValue(125);
} }
} }
......
...@@ -101,12 +101,6 @@ namespace campvis { ...@@ -101,12 +101,6 @@ namespace campvis {
if (img != 0) { if (img != 0) {
if (img->getDimensionality() == 3) { if (img->getDimensionality() == 3) {
if (hasInvalidProperties()) {
// source DataHandle has changed
updateProperties(img.getDataHandle());
validate(AbstractProcessor::INVALID_PROPERTIES);
}
tgt::vec3 imgSize(img->getSize()); tgt::vec3 imgSize(img->getSize());
// current slices in texture coordinates // current slices in texture coordinates
...@@ -264,9 +258,11 @@ namespace campvis { ...@@ -264,9 +258,11 @@ namespace campvis {
validate(INVALID_RESULT); validate(INVALID_RESULT);
} }
void SliceExtractor::updateProperties(DataHandle img) { void SliceExtractor::updateProperties(DataContainer& dc) {
p_transferFunction.getTF()->setImageHandle(img); DataContainer::ScopedTypedData<ImageData> img(dc, p_sourceImageID.getValue());
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
p_transferFunction.getTF()->setImageHandle(img.getDataHandle());
const tgt::svec3& imgSize = img->getSize();
if (p_xSliceNumber.getMaxValue() != imgSize.x - 1){ if (p_xSliceNumber.getMaxValue() != imgSize.x - 1){
p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1); p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1);
} }
...@@ -276,6 +272,8 @@ namespace campvis { ...@@ -276,6 +272,8 @@ namespace campvis {
if (p_zSliceNumber.getMaxValue() != imgSize.z - 1){ if (p_zSliceNumber.getMaxValue() != imgSize.z - 1){
p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1); p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
} }
validate(AbstractProcessor::INVALID_PROPERTIES);
} }
void SliceExtractor::updateBorderGeometry() { void SliceExtractor::updateBorderGeometry() {
......
...@@ -105,7 +105,8 @@ namespace campvis { ...@@ -105,7 +105,8 @@ namespace campvis {
protected: protected:
/// adapts the range of the p_xSliceNumber property to the image /// adapts the range of the p_xSliceNumber property to the image
void updateProperties(DataHandle img); /// \see AbstractPro#::updateProperties
virtual void updateProperties(DataContainer& dc);
void updateBorderGeometry(); void updateBorderGeometry();
......
...@@ -84,7 +84,6 @@ namespace campvis { ...@@ -84,7 +84,6 @@ namespace campvis {
if (img != 0) { if (img != 0) {
if (img->getDimensionality() == 3) { if (img->getDimensionality() == 3) {
updateProperties(img->getParent());
const tgt::Camera& cam = p_camera.getValue(); const tgt::Camera& cam = p_camera.getValue();
const tgt::svec3& imgSize = img->getSize(); const tgt::svec3& imgSize = img->getSize();
...@@ -140,11 +139,14 @@ namespace campvis { ...@@ -140,11 +139,14 @@ namespace campvis {
validate(INVALID_RESULT); validate(INVALID_RESULT);
} }
void SliceRenderer3D::updateProperties(const ImageData* img) { void SliceRenderer3D::updateProperties(DataContainer& dc) {
DataContainer::ScopedTypedData<ImageData> img(dc, p_sourceImageID.getValue());
const tgt::svec3& imgSize = img->getSize(); const tgt::svec3& imgSize = img->getSize();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){ if (p_sliceNumber.getMaxValue() != imgSize.z - 1){
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1); p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
} }
validate(AbstractProcessor::INVALID_PROPERTIES);
} }
} }