Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

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) {
#endif
CampVisApplication app(argc, argv);
//app.addVisualizationPipeline("Advanced Ultrasound Visualization", new AdvancedUsVis());
//app.addVisualizationPipeline("Confidence Map Generation", new CmBatchGeneration());
// app.addVisualizationPipeline("IXPV", new IxpvDemo());
//app.addVisualizationPipeline("SliceVis", new SliceVis());
app.addVisualizationPipeline("DVRVis", new DVRVis());
//app.addVisualizationPipeline("VolumeRendererDemo", new VolumeRendererDemo());
// app.addVisualizationPipeline("Advanced Ultrasound Visualization", new AdvancedUsVis());
// app.addVisualizationPipeline("Confidence Map Generation", new CmBatchGeneration());
// app.addVisualizationPipeline("IXPV", new IxpvDemo());
app.addVisualizationPipeline("SliceVis", new SliceVis());
// app.addVisualizationPipeline("DVRVis", new DVRVis());
// app.addVisualizationPipeline("VolumeRendererDemo", new VolumeRendererDemo());
app.addVisualizationPipeline("VolumeExplorerDemo", new VolumeExplorerDemo());
#ifdef HAS_KISSCL
//app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
// app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
#endif
#ifdef CAMPVIS_HAS_MODULE_SCR_MSK
//app.addVisualizationPipeline("US Compounding", new UsCompounding());
app.addVisualizationPipeline("US Compounding", new UsCompounding());
#endif
#ifdef CAMPVIS_HAS_MODULE_COLUMBIA
//app.addVisualizationPipeline("Columbia", new Columbia1());
app.addVisualizationPipeline("Columbia", new Columbia1());
#endif
......
......@@ -83,14 +83,11 @@ namespace campvis {
void AbstractPipeline::onPropertyChanged(const AbstractProperty* prop) {
HasPropertyCollection::onPropertyChanged(prop);
s_PipelineInvalidated();
}
void AbstractPipeline::onProcessorInvalidated(AbstractProcessor* processor) {
if (processor->getEnabled())
SimpleJobProc.enqueueJob(makeJob(this, &AbstractPipeline::executeProcessor, processor, false));
s_PipelineInvalidated();
}
const DataContainer& AbstractPipeline::getDataContainer() const {
......@@ -104,31 +101,43 @@ namespace campvis {
void AbstractPipeline::executeProcessor(AbstractProcessor* processor, bool unlockInExtraThred) {
tgtAssert(processor != 0, "Processor must not be 0.");
if (processor->getEnabled() && !processor->isLocked() && processor->hasInvalidResult()) {
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->getEnabled() && !processor->isLocked()) {
// update properties if they're invalid
if (processor->hasInvalidProperties()) {
processor->updateProperties(_data);
#if CAMPVIS_DEBUG
if (processor->hasInvalidProperties())
LDEBUG("Processor " << processor->getName() << " still has INVALID_PROPERTIES level. Did you forget to validate the processor in updateProperties()?");
#endif
}
if (processor->getClockExecutionTime()) {
clock_t endTime = clock();
LDEBUG("Executed processor " << processor->getName() << " duration: " << (endTime - startTime));
// execute processor if needed
if (processor->hasInvalidResult()) {
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 {
*/
void setEnabled(bool enabled);
/// Signal being emitted when this pipeline has been invalidated.
sigslot::signal0<> s_PipelineInvalidated;
protected:
/**
* Locks all processors.
......
......@@ -127,5 +127,9 @@ namespace campvis {
_clockExecutionTime = value;
}
void AbstractProcessor::updateProperties(DataContainer& dc) {
validate(INVALID_PROPERTIES);
}
}
......@@ -260,6 +260,19 @@ namespace campvis {
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.
sigslot::signal1<AbstractProcessor*> s_invalidated;
......
......@@ -178,23 +178,23 @@ namespace campvis {
AbstractPipeline::executeProcessor(processor, true);
#ifdef CAMPVIS_DEBUG
// 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(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(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_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_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_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_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f.");
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(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(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_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_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_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_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f.");
#endif
}
......
......@@ -63,7 +63,7 @@ namespace campvis {
AdvancedUsFusion::AdvancedUsFusion(IVec2Property* 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_gradientImageID("GradientImageId", "Gradient Input Image", "", DataNameProperty::READ)
, p_confidenceImageID("ConfidenceImageId", "Confidence Map Input", "", DataNameProperty::READ)
......@@ -120,15 +120,6 @@ namespace campvis {
if (img != 0 && blurred != 0 && confidence != 0) {
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);
createAndAttachColorTexture();
createAndAttachDepthTexture();
......@@ -170,13 +161,17 @@ namespace campvis {
validate(INVALID_RESULT);
}
void AdvancedUsFusion::updateProperties(DataHandle img) {
p_transferFunction.getTF()->setImageHandle(img);
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
void AdvancedUsFusion::updateProperties(DataContainer dc) {
DataContainer::ScopedTypedData<ImageData> img(dc, p_usImageId.getValue());
p_transferFunction.getTF()->setImageHandle(img.getDataHandle());
const tgt::svec3& imgSize = img->getSize();
if (p_sliceNumber.getMaxValue() != 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 {
......
......@@ -98,16 +98,13 @@ namespace campvis {
protected:
/// adapts the range of the p_sliceNumber property to the image
void updateProperties(DataHandle img);
virtual void updateProperties(DataContainer dc);
std::string generateHeader() const;
tgt::Shader* _shader; ///< Shader for slice rendering
static const std::string loggerCat_;
private:
clock_t _sourceImageTimestamp;
};
}
......
......@@ -133,7 +133,7 @@ namespace campvis {
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(.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);
_gr.p_renderTargetID.setValue("gr");
......@@ -160,7 +160,7 @@ namespace campvis {
// update camera
DataContainer::ScopedTypedData<ImageData> img(_data, _imageSplitter.p_outputID.getValue());
if (img != 0) {
_trackballEH->reinitializeCamera(img);
}
}
}
......
......@@ -296,6 +296,8 @@ namespace campvis {
p_timeStep.setVisible(true);
p_conductance.setVisible(true);
}
validate(AbstractProcessor::INVALID_PROPERTIES);
}
}
......@@ -79,7 +79,7 @@ namespace campvis {
FloatProperty p_conductance;
protected:
/// \see AbstractProcessor::updateProperties
/// \see HasPropertyCollection::updateProperties
virtual void updateProperties();
static const std::string loggerCat_;
......
......@@ -230,8 +230,4 @@ namespace campvis {
validate(INVALID_RESULT);
}
void ItkImageFilterKernel::updateProperties() {
}
}
......@@ -74,8 +74,6 @@ namespace campvis {
IntProperty p_kernelSize;
protected:
/// \see AbstractProcessor::updateProperties
virtual void updateProperties();
static const std::string loggerCat_;
};
......
......@@ -139,10 +139,6 @@ namespace campvis {
DataContainer::ScopedTypedData< TrackedUsFileIoData > fio(data, p_sourceImageID.getValue());
if (fio != 0) {
if (hasInvalidProperties()) {
updateProperties(const_cast<TrackedUSFileIO*>(fio->getData()));
}
if (_currentSweep != 0) {
int frameNr = p_frameNumber.getValue();
const tgt::Camera& cam = p_camera.getValue();
......@@ -228,8 +224,10 @@ namespace campvis {
validate(INVALID_RESULT);
}
void TrackedUsSweepFrameRenderer3D::updateProperties(TrackedUSFileIO* fio) {
if (fio != 0) {
void TrackedUsSweepFrameRenderer3D::updateProperties(DataContainer& dc) {
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);
p_sweepNumber.setMaxValue(static_cast<int>(study->Series.size()) - 1);
......
......@@ -96,7 +96,7 @@ namespace campvis {
TransferFunctionProperty p_transferFunction; ///< Transfer function
/// adapts the range of the p_frameNumber property to the image
void updateProperties(TrackedUSFileIO* fio);
virtual void updateProperties(DataContainer& dc);
const TrackedUSSweep* getCurrentSweep() const;
......
......@@ -219,9 +219,7 @@ namespace campvis {
ImageRepresentationLocal::ScopedRepresentation local(_data, _usReader.p_targetImageID.getValue());
if (local != 0) {
Interval<float> ii = local->getNormalizedIntensityRange();
_usSliceRenderer.p_transferFunction.getTF()->setImageHandle(local.getDataHandle());
_usSliceRenderer.p_transferFunction.getTF()->setIntensityDomain(tgt::vec2(ii.getLeft(), ii.getRight()));
_usSliceRenderer.updateProperties(local.getImageData());
_usSliceRenderer.p_sliceNumber.setValue(125);
}
}
......
......@@ -101,12 +101,6 @@ namespace campvis {
if (img != 0) {
if (img->getDimensionality() == 3) {
if (hasInvalidProperties()) {
// source DataHandle has changed
updateProperties(img.getDataHandle());
validate(AbstractProcessor::INVALID_PROPERTIES);
}
tgt::vec3 imgSize(img->getSize());
// current slices in texture coordinates
......@@ -264,9 +258,11 @@ namespace campvis {
validate(INVALID_RESULT);
}
void SliceExtractor::updateProperties(DataHandle img) {
p_transferFunction.getTF()->setImageHandle(img);
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
void SliceExtractor::updateProperties(DataContainer& dc) {
DataContainer::ScopedTypedData<ImageData> img(dc, p_sourceImageID.getValue());
p_transferFunction.getTF()->setImageHandle(img.getDataHandle());
const tgt::svec3& imgSize = img->getSize();
if (p_xSliceNumber.getMaxValue() != imgSize.x - 1){
p_xSliceNumber.setMaxValue(static_cast<int>(imgSize.x) - 1);
}
......@@ -276,6 +272,8 @@ namespace campvis {
if (p_zSliceNumber.getMaxValue() != imgSize.z - 1){
p_zSliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
}
validate(AbstractProcessor::INVALID_PROPERTIES);
}
void SliceExtractor::updateBorderGeometry() {
......
......@@ -105,7 +105,8 @@ namespace campvis {
protected:
/// 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();
......
......@@ -84,7 +84,6 @@ namespace campvis {
if (img != 0) {
if (img->getDimensionality() == 3) {
updateProperties(img->getParent());
const tgt::Camera& cam = p_camera.getValue();
const tgt::svec3& imgSize = img->getSize();
......@@ -140,11 +139,14 @@ namespace campvis {
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();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
}
validate(AbstractProcessor::INVALID_PROPERTIES);
}
}
......@@ -87,7 +87,8 @@ namespace campvis {
TransferFunctionProperty p_transferFunction; ///< Transfer function
/// adapts the range of the p_sliceNumber property to the image
void updateProperties(const ImageData* img);
/// \see AbstractProcessor::updateProperties
virtual void updateProperties(DataContainer& dc);
protected:
tgt::Shader* _shader; ///< Shader for slice rendering
......
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