Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

Fixed various issues:

* Fixed deadlock in VolumeRenderer when changing the RaycastingProcessor
* Fixed compile error in ITK module
* Fixed some gcc warnings
* Fixed usage of deprecated ScopedSynchronousGlJobExecution in mainwindow.cpp
parent 6a9c4ca7
......@@ -460,8 +460,9 @@ namespace campvis {
void MainWindow::onLuaCommandExecuted(const QString& cmd) {
#ifdef CAMPVIS_HAS_SCRIPTING
if (_application->getLuaVmState() != nullptr) {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
_application->getLuaVmState()->execString(cmd.toStdString());
GLJobProc.enqueueJobBlocking([&]() {
_application->getLuaVmState()->execString(cmd.toStdString());
});
_application->getLuaVmState()->getGlobalTable()->updateValueMap();
_scriptingConsoleWidget->_editCommand->setCompleter(new LuaCompleter(_application->getLuaVmState(), _scriptingConsoleWidget->_editCommand));
......
......@@ -133,6 +133,10 @@ namespace campvis {
template<class T>
campvis::GenericGeometryTransferFunction<T>::~GenericGeometryTransferFunction() {
for (typename std::vector<T*>::iterator it = _geometries.begin(); it != _geometries.end(); ++it) {
delete *it;
}
_geometries.clear();
}
template<class T>
......@@ -163,17 +167,15 @@ namespace campvis {
for (typename std::vector<T*>::iterator it = _geometries.begin(); it != _geometries.end(); ++it) {
(*it)->s_changed.disconnect(this);
delete *it;
}
_geometries.clear();
if (_fbo != 0) {
if (_fbo != nullptr) {
delete _fbo;
_fbo = 0;
_fbo = nullptr;
}
ShdrMgr.dispose(_shader);
_shader = 0;
_shader = nullptr;
AbstractTransferFunction::deinit();
}
......
......@@ -108,21 +108,27 @@ namespace cgt {
_evaluationCondition.notify_all();
}
void OpenGLJobProcessor::setContext(cgt::GLCanvas* context) {
cgtAssert(_context == nullptr, "You are trying to change an already set context, thou shalt not do that!");
_context = context;
}
cgt::GLCanvas* OpenGLJobProcessor::getContext() {
return _context;
void OpenGLJobProcessor::enqueueJob(std::function<void(void)> fn) {
enqueueJob(cgt::makeJobOnHeap([fn]() { fn(); }));
}
void OpenGLJobProcessor::enqueueJobBlocking(std::function<void(void)> fn) {
char signalVariable = 0;
enqueueJob(cgt::makeJobOnHeap([&signalVariable, fn]() { fn(); signalVariable = 1; }));
while (signalVariable == 0)
while (signalVariable == 0) {
_evaluationCondition.notify_all();
std::this_thread::yield();
}
}
void OpenGLJobProcessor::setContext(cgt::GLCanvas* context) {
cgtAssert(_context == nullptr, "You are trying to change an already set context, thou shalt not do that!");
_context = context;
}
cgt::GLCanvas* OpenGLJobProcessor::getContext() {
return _context;
}
}
......
......@@ -103,11 +103,19 @@ namespace cgt {
*/
void enqueueJob(AbstractJob* job);
/**
* Enqueues the given job.
*
* \note OpenGLJobProcessor takes ownership of \a job.
* \param jfn Functor defining job to execute.
*/
void enqueueJob(std::function<void(void)> fn);
/**
* Enqueues the given job and blockes the execution until the job has been processed.
*
* \note OpenGLJobProcessor takes ownership of \a job.
* \param fn Functor defining job to execute!
* \param fn Functor defining job to execute.
*/
void enqueueJobBlocking(std::function<void(void)> fn);
......
......@@ -29,7 +29,6 @@
#include "qtcanvas.h"
#include <QThread>
#include <QOpenGLContext>
namespace cgt {
......@@ -40,8 +39,8 @@ QtCanvas::QtCanvas(const std::string& title,
const ivec2& size,
const Buffers buffers,
QWidget* parent, bool shared, Qt::WindowFlags f, char* /*name*/)
: GLCanvas(title, size, buffers)
, QGLWidget(getQGLFormat(buffers), 0, (shared ? shareWidget_ : 0), f)
: QGLWidget(getQGLFormat(buffers), 0, (shared ? shareWidget_ : 0), f)
, GLCanvas(title, size, buffers)
{
resize(size.x, size.y);
if (shared && shareWidget_ == 0)
......@@ -68,8 +67,7 @@ QtCanvas::QtCanvas(const std::string& title,
}
QtCanvas::QtCanvas(QWidget* parent, bool shared, Qt::WindowFlags f, char* /*name*/)
: GLCanvas()
, QGLWidget(0, (shared ? shareWidget_ : 0), f)
: QGLWidget(0, (shared ? shareWidget_ : 0), f)
{
if (shared && shareWidget_ == 0)
shareWidget_ = this;
......
......@@ -34,8 +34,10 @@ namespace campvis {
return nullptr;
if (const AbstractImageRepresentationItk* tester = dynamic_cast<const AbstractImageRepresentationItk*>(source)) {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
ImageRepresentationGL* toReturn = ImageRepresentationGL::create(const_cast<ImageData*>(tester->getParent()), tester->getWeaklyTypedPointer());
ImageRepresentationGL* toReturn = nullptr;
GLJobProc.enqueueJobBlocking([&]() {
toReturn = ImageRepresentationGL::create(const_cast<ImageData*>(tester->getParent()), tester->getWeaklyTypedPointer());
});
return toReturn;
}
......
......@@ -22,6 +22,8 @@
//
// ================================================================================================
#ifdef CAMPVIS_HAS_MODULE_DEVIL
#include "ssimdemo.h"
#include "cgt/glcontextmanager.h"
......@@ -161,4 +163,6 @@ namespace campvis {
_currentlyBatchProcessing = false;
}
}
\ No newline at end of file
}
#endif // CAMPVIS_HAS_MODULE_DEVIL
......@@ -25,6 +25,8 @@
#ifndef SSIMDEMO_H__
#define SSIMDEMO_H__
#ifdef CAMPVIS_HAS_MODULE_DEVIL
#include "core/tools/glreduction.h"
#include "core/pipeline/autoevaluationpipeline.h"
......@@ -77,4 +79,5 @@ namespace campvis {
};
}
#endif //CAMPVIS_HAS_MODULE_DEVIL
#endif // SSIMDEMO_H__
......@@ -45,7 +45,10 @@ namespace campvis {
// explicitly instantiate templates to register the pipelines
template class PipelineRegistrar<MorphologyDemo>;
template class PipelineRegistrar<ResamplingDemo>;
#ifdef CAMPVIS_HAS_MODULE_DEVIL
template class PipelineRegistrar<SsimDemo>;
#endif
template class SmartProcessorRegistrar<GlGaussianFilter>;
template class SmartProcessorRegistrar<GlGradientVolumeGenerator>;
......
......@@ -238,21 +238,22 @@ namespace campvis {
GLJobProc.enqueueJobBlocking([&]() {
_raycaster->init();
_raycaster->p_sourceImageID.setValue(currentRaycaster->p_sourceImageID.getValue());
_raycaster->p_entryImageID.setValue(currentRaycaster->p_entryImageID.getValue());
_raycaster->p_exitImageID.setValue(currentRaycaster->p_exitImageID.getValue());
_raycaster->p_targetImageID.setValue(currentRaycaster->p_targetImageID.getValue());
_raycaster->p_camera.setValue(currentRaycaster->p_camera.getValue());
_raycaster->p_transferFunction.replaceTF(currentRaycaster->p_transferFunction.getTF()->clone());
_raycaster->p_jitterStepSizeMultiplier.setValue(currentRaycaster->p_jitterStepSizeMultiplier.getValue());
_raycaster->p_samplingRate.setValue(currentRaycaster->p_samplingRate.getValue());
currentRaycaster->deinit();
});
invalidate(PG_INVALID | EEP_INVALID | RAYCASTER_INVALID | AbstractProcessor::INVALID_RESULT);
_raycaster->p_sourceImageID.setValue(currentRaycaster->p_sourceImageID.getValue());
_raycaster->p_entryImageID.setValue(currentRaycaster->p_entryImageID.getValue());
_raycaster->p_exitImageID.setValue(currentRaycaster->p_exitImageID.getValue());
_raycaster->p_targetImageID.setValue(currentRaycaster->p_targetImageID.getValue());
_raycaster->p_camera.setValue(currentRaycaster->p_camera.getValue());
_raycaster->p_transferFunction.replaceTF(currentRaycaster->p_transferFunction.getTF()->clone());
_raycaster->p_jitterStepSizeMultiplier.setValue(currentRaycaster->p_jitterStepSizeMultiplier.getValue());
_raycaster->p_samplingRate.setValue(currentRaycaster->p_samplingRate.getValue());
delete currentRaycaster;
invalidate(PG_INVALID | EEP_INVALID | RAYCASTER_INVALID | AbstractProcessor::INVALID_RESULT);
}
VisualizationProcessor::onPropertyChanged(prop);
......
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