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 063db290 authored by schultezub's avatar schultezub
Browse files

* first test implementation for new pipeline evaluation concept implemented...

* first test implementation for new pipeline evaluation concept implemented into DiGraphVisualizationPipeline / AdvancedUsVis pipeline
* introducing AbstractProcessor::s_validated signal


git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@458 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 892dfe81
......@@ -27,6 +27,7 @@
//
// ================================================================================================
#include "tbb/compat/thread"
#include "tgt/assert.h"
#include "abstractprocessor.h"
......@@ -57,6 +58,9 @@ namespace campvis {
if (! _invalidationLevel.isValid()) {
s_invalidated(this);
}
else {
s_validated(this);
}
}
void AbstractProcessor::init() {
......@@ -69,7 +73,8 @@ namespace campvis {
void AbstractProcessor::lockProcessor() {
while (_locked.compare_and_swap(true, false) == true); // TODO: busy waiting us fu**ing ugly...
while (_locked.compare_and_swap(true, false) == true) // TODO: busy waiting us fu**ing ugly...
std::this_thread::yield();
_locked = true;
lockAllProperties();
}
......
......@@ -161,6 +161,9 @@ namespace campvis {
/// Signal emitted when the processor has been invalidated.
sigslot::signal1<AbstractProcessor*> s_invalidated;
/// Signal emitted when the processor has been validated.
sigslot::signal1<AbstractProcessor*> s_validated;
/**
* Slot getting called when one of the observed properties changed and notifies its observers.
* \param prop Property that emitted the signal
......
......@@ -35,6 +35,7 @@
#include "core/pipeline/visualizationprocessor.h"
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/simplejobprocessor.h"
#include <stack>
......@@ -127,7 +128,26 @@ namespace campvis {
}
void DigraphVisualizationPipeline::onProcessorInvalidated(AbstractProcessor* processor) {
// TODO: implement
// dirty hack - implement proper initialization...
if (_canvas == 0)
return;
// TODO: think about a more elaborate implementation, this one doesn't care about the processor graph
std::map<AbstractProcessor*, DependencyNode*>::iterator node = _processorNodeMap.find(processor);
if (node != _processorNodeMap.end()) {
if (node->second->_isVisualizationProcessor) {
GLJobProc.enqueueJob(
_canvas,
makeJobOnHeap<DigraphVisualizationPipeline, AbstractProcessor*>(this, &DigraphVisualizationPipeline::executeProcessor, processor),
OpenGLJobProcessor::SerialJob);
}
else {
SimpleJobProc.enqueueJob(makeJob<DigraphVisualizationPipeline, AbstractProcessor*>(this, &DigraphVisualizationPipeline::executeProcessor, processor));
}
}
else {
LWARNING("Caught invalidation of a processor that is not in the processor graph!");
}
}
}
......@@ -47,7 +47,7 @@ namespace campvis {
* Specialization of the VisualizationPipeline that performs automatic evaluation based on
* an acyclic directed dependency graph.
*
* \todo Think about thread-safety. The current graph implementation is \b not thread-safe.
* \todo Implement thread-safety. The current graph implementation is \b not thread-safe.
*/
class DigraphVisualizationPipeline : public VisualizationPipeline {
public:
......
......@@ -39,7 +39,7 @@
namespace campvis {
AdvancedUsVis::AdvancedUsVis()
: VisualizationPipeline()
: DigraphVisualizationPipeline()
, _camera("camera", "Camera")
, _usReader()
, _confidenceReader()
......@@ -90,10 +90,13 @@ namespace campvis {
void AdvancedUsVis::init() {
VisualizationPipeline::init();
_usReader.s_validated.connect(this, &AdvancedUsVis::onProcessorValidated);
_camera.addSharedProperty(&_usEEP.p_camera);
_camera.addSharedProperty(&_usDVR.p_camera);
_usReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\01\\BMode_01.mhd");
//_usReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\01\\BMode_01.mhd");
_usReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\UltrasoundBoneData\\SynthesEvaluationUnterschenkel\\Athanasios\\US.csvd");
_usReader.p_targetImageID.setValue("us.image");
_usReader.p_targetImageID.connect(&_confidenceGenerator.p_sourceImageID);
_usReader.p_targetImageID.connect(&_usFusion1.p_usImageId);
......@@ -105,7 +108,8 @@ namespace campvis {
_usReader.p_targetImageID.connect(&_usBlurFilter.p_sourceImageID);
_usReader.p_targetImageID.connect(&_usDenoiseilter.p_sourceImageID);
_confidenceReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\01\\Confidence_01.mhd");
//_confidenceReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\01\\Confidence_01.mhd");
_confidenceReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\UltrasoundBoneData\\SynthesEvaluationUnterschenkel\\Athanasios\\Map.csvd");
_confidenceReader.p_targetImageID.setValue("confidence.image.read");
_confidenceGenerator.p_targetImageID.setValue("confidence.image.generated");
......@@ -193,7 +197,7 @@ namespace campvis {
_invalidationLevel.setValid();
// TODO: think whether we want to lock all processors already here.
}
/*
if (!_usReader.getInvalidationLevel().isValid()) {
SimpleJobProc.enqueueJob(makeJob(this, &AdvancedUsVis::foobar));
}
......@@ -208,7 +212,7 @@ namespace campvis {
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
if (! (*it)->getInvalidationLevel().isValid())
lockGLContextAndExecuteProcessor(*it);
}
}*/
}
void AdvancedUsVis::keyEvent(tgt::KeyEvent* e) {
......@@ -234,18 +238,19 @@ namespace campvis {
_camera.setWindowRatio(ratio);
}
void AdvancedUsVis::foobar() {
executeProcessor(&_usReader);
// convert data
DataContainer::ScopedTypedData<ImageData> img(_data, _usReader.p_targetImageID.getValue());
if (img != 0) {
tgt::Bounds volumeExtent = img->getWorldBounds();
tgt::vec3 pos = volumeExtent.center() - tgt::vec3(0, 0, tgt::length(volumeExtent.diagonal()));
void AdvancedUsVis::onProcessorValidated(AbstractProcessor* processor) {
if (processor = &_usReader) {
// convert data
DataContainer::ScopedTypedData<ImageData> img(_data, _usReader.p_targetImageID.getValue());
if (img != 0) {
tgt::Bounds volumeExtent = img->getWorldBounds();
tgt::vec3 pos = volumeExtent.center() - tgt::vec3(0, 0, tgt::length(volumeExtent.diagonal()));
_trackballEH->setSceneBounds(volumeExtent);
_trackballEH->setCenter(volumeExtent.center());
_trackballEH->reinitializeCamera(pos, volumeExtent.center(), _camera.getValue().getUpVector());
}
_trackballEH->setSceneBounds(volumeExtent);
_trackballEH->setCenter(volumeExtent.center());
_trackballEH->reinitializeCamera(pos, volumeExtent.center(), _camera.getValue().getUpVector());
}
}
......
......@@ -34,8 +34,9 @@
#include "core/eventhandlers/mwheeltonumericpropertyeventhandler.h"
#include "core/eventhandlers/transfuncwindowingeventhandler.h"
#include "core/eventhandlers/trackballnavigationeventhandler.h"
#include "core/pipeline/visualizationpipeline.h"
#include "core/pipeline/digraphvisualizationpipeline.h"
#include "modules/io/processors/mhdimagereader.h"
#include "modules/io/processors/csvdimagereader.h"
#include "modules/advancedusvis/processors/advancedusfusion.h"
#include "modules/preprocessing/processors/gradientvolumegenerator.h"
#include "modules/preprocessing/processors/lhhistogram.h"
......@@ -47,10 +48,10 @@
#include "modules/randomwalk/processors/confidencemapgenerator.h"
namespace campvis {
class AdvancedUsVis : public VisualizationPipeline {
class AdvancedUsVis : public DigraphVisualizationPipeline {
public:
/**
* Creates a VisualizationPipeline.
* Creates a VisualizationPipeline.
*/
AdvancedUsVis();
......@@ -77,12 +78,18 @@ namespace campvis {
void onRenderTargetSizeChanged(const AbstractProperty* prop);
protected:
void foobar();
/**
* Slot getting called when one of the observed processors got validated.
* Updates the camera properties, when the input image has changed.
* \param processor The processor that emitted the signal
*/
virtual void onProcessorValidated(AbstractProcessor* processor);
CameraProperty _camera;
MhdImageReader _usReader;
MhdImageReader _confidenceReader;
CsvdImageReader _usReader;
CsvdImageReader _confidenceReader;
ConfidenceMapGenerator _confidenceGenerator;
GradientVolumeGenerator _gvg;
......
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