Commit 146082b0 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Cleaned up AdvancedUsVis pipeline and added sample data to enable capability to run standalone.

parent d94ecdba
......@@ -31,102 +31,52 @@
#include "core/tools/simplejobprocessor.h"
#include "core/tools/job.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
namespace campvis {
AdvancedUsVis::AdvancedUsVis(DataContainer* dc)
: AutoEvaluationPipeline(dc)
, _camera("camera", "Camera")
, _usReader()
, _confidenceReader()
, _confidenceGenerator()
, _gvg()
, _lhh()
, _usFusion1(&_canvasSize)
, _usFusion2(&_canvasSize)
, _usFusion3(&_canvasSize)
, _usFusion4(&_canvasSize)
, _usBlurFilter()
, _usBlurFilter(&_canvasSize)
, _quadView(&_canvasSize)
, _usDenoiseilter()
, _usProxy()
, _usEEP(&_canvasSize)
, _usDVR(&_canvasSize)
, _wheelHandler(&_usFusion1.p_sliceNumber)
, _tfWindowingHandler(&_usFusion1.p_transferFunction)
, _trackballEH(0)
{
addProcessor(&_usReader);
addProcessor(&_confidenceReader);
//addProcessor(&_confidenceGenerator);
//addProcessor(&_gvg);
//addProcessor(&_lhh);
addProcessor(&_usBlurFilter);
addProcessor(&_usFusion1);
addProcessor(&_usFusion2);
addProcessor(&_usFusion3);
addProcessor(&_usFusion4);
addProcessor(&_quadView);
//addProcessor(&_usDenoiseilter);
//addProcessor(&_usProxy);
//addProcessor(&_usEEP);
//addProcessor(&_usDVR);
addEventListenerToBack(&_wheelHandler);
//addEventHandler(&_tfWindowingHandler);
_trackballEH = new TrackballNavigationEventListener(&_camera, &_canvasSize);
addEventListenerToBack(_trackballEH);
}
AdvancedUsVis::~AdvancedUsVis() {
delete _trackballEH;
}
void AdvancedUsVis::init() {
AutoEvaluationPipeline::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\\CurefabCS\\Stent_Patient_ B-Mode_2013-02-11T14.56.46z\\01_us.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");
//_usReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\transcranial\\us.png");
_usReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/us.mhd");
_usReader.p_targetImageID.setValue("us.image");
_usReader.p_targetImageID.addSharedProperty(&_confidenceGenerator.p_sourceImageID);
_usReader.p_targetImageID.addSharedProperty(&_usFusion1.p_usImageId);
_usReader.p_targetImageID.addSharedProperty(&_usFusion2.p_usImageId);
_usReader.p_targetImageID.addSharedProperty(&_usFusion3.p_usImageId);
_usReader.p_targetImageID.addSharedProperty(&_usFusion4.p_usImageId);
_usReader.p_targetImageID.addSharedProperty(&_gvg.p_sourceImageID);
_usReader.p_targetImageID.addSharedProperty(&_lhh.p_intensitiesId);
_usReader.p_targetImageID.addSharedProperty(&_usBlurFilter.p_sourceImageID);
_usReader.p_targetImageID.addSharedProperty(&_usDenoiseilter.p_sourceImageID);
_confidenceReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\CurefabCS\\Stent_Patient_ B-Mode_2013-02-11T14.56.46z\\01_cm.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");
//_confidenceReader.p_url.setValue("D:\\Medical Data\\US Confidence Vis\\transcranial\\cm.png");
_usReader.p_targetImageID.addSharedProperty(&_usBlurFilter.p_inputImage);
_confidenceReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/cm.mhd");
_confidenceReader.p_targetImageID.setValue("confidence.image.read");
_confidenceReader.p_targetImageID.addSharedProperty(&_usFusion1.p_confidenceImageID);
_confidenceReader.p_targetImageID.addSharedProperty(&_usFusion2.p_confidenceImageID);
_confidenceReader.p_targetImageID.addSharedProperty(&_usFusion3.p_confidenceImageID);
_confidenceReader.p_targetImageID.addSharedProperty(&_usFusion4.p_confidenceImageID);
_confidenceGenerator.p_targetImageID.setValue("confidence.image.generated");
//_confidenceGenerator.p_targetImageID.addSharedProperty(&_usFusion1.p_confidenceImageID);
//_confidenceGenerator.p_targetImageID.addSharedProperty(&_usFusion2.p_confidenceImageID);
//_confidenceGenerator.p_targetImageID.addSharedProperty(&_usFusion3.p_confidenceImageID);
//_confidenceGenerator.p_targetImageID.addSharedProperty(&_usFusion4.p_confidenceImageID);
_gvg.p_targetImageID.addSharedProperty(&_lhh.p_gradientsId);
_gvg.p_targetImageID.addSharedProperty(&_usFusion1.p_gradientImageID);
_gvg.p_targetImageID.addSharedProperty(&_usFusion2.p_gradientImageID);
_gvg.p_targetImageID.addSharedProperty(&_usFusion3.p_gradientImageID);
_gvg.p_targetImageID.addSharedProperty(&_usFusion4.p_gradientImageID);
_usFusion1.p_targetImageID.setValue("us.fused1");
_usFusion1.p_targetImageID.addSharedProperty(&_quadView.p_inputImage1);
_usFusion1.p_view.selectById("us");
......@@ -148,31 +98,15 @@ namespace campvis {
_usFusion4.p_targetImageID.addSharedProperty(&_quadView.p_inputImage4);
_usFusion4.p_view.selectById("mappingSharpness");
_usBlurFilter.p_targetImageID.setValue("us.blurred");
_usBlurFilter.p_targetImageID.addSharedProperty(&_usFusion1.p_blurredImageId);
_usBlurFilter.p_targetImageID.addSharedProperty(&_usFusion2.p_blurredImageId);
_usBlurFilter.p_targetImageID.addSharedProperty(&_usFusion3.p_blurredImageId);
_usBlurFilter.p_targetImageID.addSharedProperty(&_usFusion4.p_blurredImageId);
_usBlurFilter.p_filterMode.selectById("gauss");
_usBlurFilter.p_outputImage.setValue("us.blurred");
_usBlurFilter.p_outputImage.addSharedProperty(&_usFusion1.p_blurredImageId);
_usBlurFilter.p_outputImage.addSharedProperty(&_usFusion2.p_blurredImageId);
_usBlurFilter.p_outputImage.addSharedProperty(&_usFusion3.p_blurredImageId);
_usBlurFilter.p_outputImage.addSharedProperty(&_usFusion4.p_blurredImageId);
_usBlurFilter.p_sigma.setValue(4.f);
_quadView.p_outputImage.setValue("quadview.output");
_usDenoiseilter.p_targetImageID.setValue("us.denoised");
_usDenoiseilter.p_targetImageID.addSharedProperty(&_usProxy.p_sourceImageID);
_usDenoiseilter.p_targetImageID.addSharedProperty(&_usEEP.p_sourceImageID);
_usDenoiseilter.p_targetImageID.addSharedProperty(&_usDVR.p_sourceImageID);
_usDenoiseilter.p_filterMode.selectById("gradientDiffusion");
_usDenoiseilter.p_numberOfSteps.setValue(3);
_usProxy.p_geometryID.setValue("us.proxy");
_usProxy.p_geometryID.addSharedProperty(&_usEEP.p_geometryID);
_usEEP.p_entryImageID.setValue("us.entry");
_usEEP.p_entryImageID.addSharedProperty(&_usDVR.p_entryImageID);
_usEEP.p_exitImageID.setValue("us.exit");
_usEEP.p_exitImageID.addSharedProperty(&_usDVR.p_exitImageID);
// TODO: replace this hardcoded domain by automatically determined from image min/max values
Geometry1DTransferFunction* tf = new Geometry1DTransferFunction(128, tgt::vec2(0.f, 1.f));
tf->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, 1.f), tgt::col4(0, 0, 0, 255), tgt::col4(255, 255, 255, 255)));
......@@ -181,39 +115,13 @@ namespace campvis {
_usFusion3.p_transferFunction.replaceTF(tf->clone());
_usFusion4.p_transferFunction.replaceTF(tf->clone());
// TODO: replace this hardcoded domain by automatically determined from image min/max values
Geometry1DTransferFunction* tf2 = new Geometry1DTransferFunction(256, tgt::vec2(0.f, 1.f));
tf2->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, 1.f), tgt::col4(0, 0, 0, 255), tgt::col4(255, 255, 255, 255)));
_usDVR.p_transferFunction.replaceTF(tf2);
_usDVR.p_targetImageID.setValue("us.dvr");
_renderTargetID.setValue("quadview.output");
}
void AdvancedUsVis::deinit() {
_canvasSize.s_changed.disconnect(this);
AutoEvaluationPipeline::deinit();
}
void AdvancedUsVis::execute() {
/*
if (!_usReader.getInvalidationLevel().isValid()) {
SimpleJobProc.enqueueJob(makeJob(this, &AdvancedUsVis::foobar));
}
if (!_usDenoiseilter.getInvalidationLevel().isValid()) {
SimpleJobProc.enqueueJob(makeJob<AdvancedUsVis, AbstractProcessor*>(this, &AdvancedUsVis::executeProcessor, &_usDenoiseilter));
}
if (!_confidenceGenerator.getInvalidationLevel().isValid()) {
SimpleJobProc.enqueueJob(makeJob<AdvancedUsVis, AbstractProcessor*>(this, &AdvancedUsVis::executeProcessor, &_confidenceGenerator));
}
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
if (! (*it)->getInvalidationLevel().isValid())
lockGLContextAndExecuteProcessor(*it);
}*/
}
void AdvancedUsVis::keyEvent(tgt::KeyEvent* e) {
if (e->pressed()) {
switch (e->keyCode()) {
......@@ -229,14 +137,4 @@ namespace campvis {
}
}
void AdvancedUsVis::onProcessorValidated(AbstractProcessor* processor) {
if (processor == &_usReader) {
// convert data
ScopedTypedData<ImageData> img(*_data, _usReader.p_targetImageID.getValue());
if (img != 0) {
_trackballEH->reinitializeCamera(img);
}
}
}
}
......@@ -25,23 +25,12 @@
#ifndef ADVANCEDUSVIS_H__
#define ADVANCEDUSVIS_H__
#include "core/datastructures/imagerepresentationlocal.h"
#include "core/eventhandlers/mwheeltonumericpropertyeventlistener.h"
#include "core/eventhandlers/transfuncwindowingeventlistener.h"
#include "core/eventhandlers/trackballnavigationeventlistener.h"
#include "core/pipeline/autoevaluationpipeline.h"
#include "modules/devil/processors/devilimagereader.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"
#include "modules/itk/processors/itkimagefilter.h"
#include "modules/vis/processors/proxygeometrygenerator.h"
#include "modules/vis/processors/eepgenerator.h"
#include "modules/vis/processors/simpleraycaster.h"
#include "modules/preprocessing/processors/glgaussianfilter.h"
#include "modules/vis/processors/quadview.h"
#include "modules/randomwalk/processors/confidencemapgenerator.h"
namespace campvis {
class AdvancedUsVis : public AutoEvaluationPipeline {
......@@ -64,49 +53,22 @@ namespace campvis {
/// \see AbstractPipeline::getName()
virtual const std::string getName() const { return getId(); };
/// \see AbstractPipeline::getId()
static const std::string getId() { return "AdvancedUsVis"; };
/**
* Execute this pipeline.
**/
virtual void execute();
virtual void keyEvent(tgt::KeyEvent* e);
protected:
/**
* 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;
ConfidenceMapGenerator _confidenceGenerator;
GradientVolumeGenerator _gvg;
LHHistogram _lhh;
AdvancedUsFusion _usFusion1;
AdvancedUsFusion _usFusion2;
AdvancedUsFusion _usFusion3;
AdvancedUsFusion _usFusion4;
ItkImageFilter _usBlurFilter;
GlGaussianFilter _usBlurFilter;
QuadView _quadView;
ItkImageFilter _usDenoiseilter;
ProxyGeometryGenerator _usProxy;
EEPGenerator _usEEP;
SimpleRaycaster _usDVR;
MWheelToNumericPropertyEventListener _wheelHandler;
TransFuncWindowingEventListener _tfWindowingHandler;
TrackballNavigationEventListener* _trackballEH;
};
}
......
ObjectType = Image
NDims = 2
DimSize = 720 500
ElementSpacing = 1 1
Position = 0 0
ElementType = MET_UCHAR
ElementNumberOfChannels = 1
ElementByteOrderMSB = False
ElementDataFile = cm.raw
ObjectType = Image
NDims = 2
DimSize = 720 500
ElementSpacing = 1 1
Position = 0 0
ElementType = MET_UCHAR
ElementNumberOfChannels = 1
ElementByteOrderMSB = False
ElementDataFile = us.raw
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