12.8.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

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

Some work on AdvancedUsVis module:

* Introducing PredicateDemoSmallHeart pipeline draft.
* Fixed double signal callback registration in predicate-based rendering demo pipelines.
* Fixed PredicateVolumeExplorer not re-rendering when predicate histogram property changed.
* Disabled hiding of Add Predicate buttons in pointpredicatehistogrampropertywidget.cpp
parent 2393c045
......@@ -64,8 +64,6 @@ namespace campvis {
void PredicateDemoAchilles::init() {
AutoEvaluationPipeline::init();
_imageReader.s_validated.connect(this, &PredicateDemoAchilles::onProcessorValidated);
_ve.p_outputImage.setValue("ve");
_renderTargetID.setValue("ve");
......@@ -105,8 +103,6 @@ namespace campvis {
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor1"))->setValue(cgt::vec4(1.f));
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor2"))->setValue(cgt::vec4(1.f));
_canvasSize.s_changed.connect<PredicateDemoAchilles>(this, &PredicateDemoAchilles::onRenderTargetSizeChanged);
_canvasSize.setVisible(false);
_renderTargetID.setVisible(false);
......
......@@ -77,7 +77,6 @@ namespace campvis {
_imageReader.p_targetImageID.addSharedProperty(&_gaussian.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_snrFilter.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
_imageReader.s_validated.connect(this, &PredicateDemoCarotid::onProcessorValidated);
_labelReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/carotid_layers.mhd");
//_labelReader.p_url.setValue("D:/Medical Data/us_carotid_2014-02/christian/christian_bmode_2D_compounded_cropped_layers.mhd");
......
......@@ -77,7 +77,6 @@ namespace campvis {
_imageReader.p_targetImageID.addSharedProperty(&_gaussian.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_snrFilter.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
_imageReader.s_validated.connect(this, &PredicateDemoCarotid2::onProcessorValidated);
_labelReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/christian_bmode_2D_compounded_cropped_layers.mhd");
//_labelReader.p_url.setValue("D:/Medical Data/us_carotid_2014-02/christian/christian_bmode_2D_compounded_cropped_layers.mhd");
......@@ -115,8 +114,6 @@ namespace campvis {
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor1"))->setValue(cgt::vec4(1.f));
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor2"))->setValue(cgt::vec4(1.f));
_canvasSize.s_changed.connect<PredicateDemoCarotid2>(this, &PredicateDemoCarotid2::onRenderTargetSizeChanged);
_canvasSize.setVisible(false);
_renderTargetID.setVisible(false);
......
......@@ -75,7 +75,6 @@ namespace campvis {
//_imageReader.p_targetImageID.addSharedProperty(&_gaussian.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_snrFilter.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
_imageReader.s_validated.connect(this, &PredicateDemoShoulder::onProcessorValidated);
_labelReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/layers_0_small_cropped.mhd");
//_labelReader.p_url.setValue("D:/Medical Data/us_carotid_2014-02/christian/christian_bmode_2D_compounded_cropped_layers.mhd");
......@@ -106,8 +105,6 @@ namespace campvis {
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor1"))->setValue(cgt::vec4(1.f));
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor2"))->setValue(cgt::vec4(1.f));
_canvasSize.s_changed.connect<PredicateDemoShoulder>(this, &PredicateDemoShoulder::onRenderTargetSizeChanged);
_canvasSize.setVisible(false);
_renderTargetID.setVisible(false);
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#include "predicatedemosmallheart.h"
#include "cgt/event/keyevent.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
#include "core/datastructures/imagedata.h"
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
#include "modules/advancedusvis/processors/pointpredicateraycaster.h"
namespace campvis {
PredicateDemoSmallHeart::PredicateDemoSmallHeart(DataContainer* dc)
: AutoEvaluationPipeline(dc)
, _lsp()
, _imageReader()
, _labelReader()
, _confidenceReader()
, _gaussian(&_canvasSize)
, _vesselnesFilter(&_canvasSize)
, _morphology(&_canvasSize)
, _snrFilter(&_canvasSize)
, _ve(&_canvasSize)
{
addProcessor(&_lsp);
addProcessor(&_imageReader);
addProcessor(&_labelReader);
addProcessor(&_confidenceReader);
addProcessor(&_gaussian);
addProcessor(&_vesselnesFilter);
addProcessor(&_morphology);
addProcessor(&_snrFilter);
addProcessor(&_ve);
addEventListenerToBack(&_ve);
}
PredicateDemoSmallHeart::~PredicateDemoSmallHeart() {
}
void PredicateDemoSmallHeart::init() {
AutoEvaluationPipeline::init();
_imageReader.s_validated.connect(this, &PredicateDemoSmallHeart::onProcessorValidated);
_ve.p_outputImage.setValue("ve");
_renderTargetID.setValue("ve");
_imageReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/vis/sampledata/smallHeart.mhd");
//_imageReader.p_url.setValue("D:/Medical Data/us_carotid_2014-02/christian/christian_bmode_2D_compounded_cropped.mhd");
_imageReader.p_targetImageID.setValue("reader.output");
_imageReader.p_targetImageID.addSharedProperty(&_gaussian.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_snrFilter.p_inputImage);
_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
_labelReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/christian_bmode_2D_compounded_cropped_layers.mhd");
//_labelReader.p_url.setValue("D:/Medical Data/us_carotid_2014-02/christian/christian_bmode_2D_compounded_cropped_layers.mhd");
_labelReader.p_targetImageID.setValue("labels");
_labelReader.p_targetImageID.addSharedProperty(&_ve.p_inputLabels);
_confidenceReader.p_url.setValue(CAMPVIS_SOURCE_DIR "/modules/advancedusvis/sampledata/christian_bmode_2D_compounded_cropped.mhd");
_confidenceReader.p_targetImageID.setValue("confidence");
_confidenceReader.p_targetImageID.addSharedProperty(&_ve.p_inputConfidence);
_snrFilter.p_outputImage.setValue("snr");
_snrFilter.p_outputImage.addSharedProperty(&_ve.p_inputSnr);
_gaussian.p_sigma.setValue(6.2f);
_gaussian.p_outputImage.addSharedProperty(&_vesselnesFilter.p_inputImage);
_vesselnesFilter.p_outputImage.setValue("vesselness");
_vesselnesFilter.p_lod.setValue(cgt::vec2(3.f, 4.f));
_vesselnesFilter.p_alpha.setValue(0.2f);
_vesselnesFilter.p_beta.setValue(0.8f);
_vesselnesFilter.p_gamma.setValue(.0018f);
_vesselnesFilter.p_theta.setValue(0.3f);
_vesselnesFilter.p_outputImage.addSharedProperty(&_morphology.p_inputImage);
_morphology.p_filterOperation.setValue("de");
_morphology.p_structuringElement.setValue(1);
_morphology.p_outputImage.addSharedProperty(&_ve.p_inputVesselness);
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, cgt::vec2(0.00f, .06f));
dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(0.f, 1.f), cgt::col4(0, 0, 0, 0), cgt::col4(255, 255, 255, 255)));
static_cast<TransferFunctionProperty*>(_ve.getNestedProperty("VolumeRendererProperties::RaycasterProps::TransferFunction"))->replaceTF(dvrTF);
static_cast<FloatProperty*>(_ve.getNestedProperty("VolumeRendererProperties::RaycasterProps::GradientLod"))->setValue(0.5f);
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor1"))->setValue(cgt::vec4(1.f));
// static_cast<Vec4Property*>(_ve.getNestedProperty("backgroundColor2"))->setValue(cgt::vec4(1.f));
_canvasSize.setVisible(false);
_renderTargetID.setVisible(false);
// initialize predicates with default config
PointPredicateHistogramProperty* php = &_ve.p_histogram;
if (php != nullptr) {
PointPredicateHistogram* histogram = php->getPredicateHistogram();
AbstractPointPredicate* vpToAdd = 0;
vpToAdd = new RangePointPredicate("intensity", "Intensity", "Intensity Range");
static_cast<RangePointPredicate*>(vpToAdd)->p_range.setValue(cgt::vec2(.02f, .05f));
static_cast<RangePointPredicate*>(vpToAdd)->p_range.setMaxValue(cgt::vec2(1.f));
histogram->addPredicate(vpToAdd);
vpToAdd = new RangePointPredicate("gradientMagnitude", "Gradient", "Gradient Magnitude Range");
static_cast<RangePointPredicate*>(vpToAdd)->p_range.setValue(cgt::vec2(.1f, 1.f));
histogram->addPredicate(vpToAdd);
histogram->resetPredicates();
addProperty(*php);
}
}
void PredicateDemoSmallHeart::deinit() {
AutoEvaluationPipeline::deinit();
}
void PredicateDemoSmallHeart::onRenderTargetSizeChanged(const AbstractProperty* prop) {
}
void PredicateDemoSmallHeart::onProcessorValidated(AbstractProcessor* processor) {
if (processor == &_imageReader) {
if (IVec2Property* tester = dynamic_cast<IVec2Property*>(_ve.getNestedProperty("VolumeRendererProperties::PGGProps::clipX"))) {
tester->setValue(cgt::ivec2(42, 210));
}
}
}
}
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#ifndef PREDICATEDEMOSMALLHEART_H__
#define PREDICATEDEMOSMALLHEART_H__
#include "core/pipeline/autoevaluationpipeline.h"
#include "modules/base/processors/lightsourceprovider.h"
#include "modules/io/processors/mhdimagereader.h"
#include "modules/advancedusvis/processors/pointpredicateevaluator.h"
#include "modules/advancedusvis/processors/predicatevolumeexplorer.h"
#include "modules/vis/processors/volumeexplorer.h"
#include "modules/preprocessing/processors/glimageresampler.h"
#include "modules/preprocessing/processors/glintensityquantizer.h"
#include "modules/preprocessing/processors/glgaussianfilter.h"
#include "modules/preprocessing/processors/glgradientvolumegenerator.h"
#include "modules/preprocessing/processors/glmorphologyfilter.h"
#include "modules/preprocessing/processors/glsignaltonoiseratiofilter.h"
#include "modules/preprocessing/processors/glvesselnessfilter.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
namespace campvis {
class PredicateDemoSmallHeart : public AutoEvaluationPipeline {
public:
/**
* Creates a AutoEvaluationPipeline.
*/
PredicateDemoSmallHeart(DataContainer* dc);
/**
* Virtual Destructor
**/
virtual ~PredicateDemoSmallHeart();
/// \see AutoEvaluationPipeline::init()
virtual void init();
/// \see AutoEvaluationPipeline::deinit()
virtual void deinit();
/// \see AbstractPipeline::getName()
virtual const std::string getName() const { return getId(); };
static const std::string getId() { return "PredicateDemoSmallHeart"; };
void onRenderTargetSizeChanged(const AbstractProperty* prop);
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);
LightSourceProvider _lsp;
MhdImageReader _imageReader;
MhdImageReader _labelReader;
MhdImageReader _confidenceReader;
GlGaussianFilter _gaussian;
GlVesselnessFilter _vesselnesFilter;
GlMorphologyFilter _morphology;
GlSignalToNoiseRatioFilter _snrFilter;
PredicateVolumeExplorer _ve;
};
}
#endif // PREDICATEDEMOSMALLHEART_H__
......@@ -112,7 +112,7 @@ namespace campvis {
void PredicateVolumeExplorer::onPropertyChanged(const AbstractProperty* prop) {
if (prop == &p_inputVolume || prop == &p_histogram) {
invalidate(BITSET_INVALID);
invalidate(BITSET_INVALID | VR_INVALID);
}
VolumeExplorer::onPropertyChanged(prop);
......
......@@ -48,7 +48,7 @@ namespace campvis {
predicateList.push_back(tr("Intensity Range"));
predicateList.push_back(tr("Gradient Magnitude Range"));
predicateList.push_back(tr("Gradient Orientation"));
//predicateList.push_back(tr("Silhouette View"));
predicateList.push_back(tr("Silhouette View"));
predicateList.push_back(tr("SNR Range"));
predicateList.push_back(tr("Vesselness Range"));
//predicateList.push_back(tr("Ultrasound Confidence Range"));
......@@ -74,8 +74,8 @@ namespace campvis {
layout->addWidget(narf, 1, 0, 1, 3);
_lwPredicates->setVisible(false);
narf->setVisible(false);
//_lwPredicates->setVisible(false);
//narf->setVisible(false);
_slHue = new QSlider(Qt::Vertical, mainWidget);
_slHue->setMinimum(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