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

* added AbstractProcessor::getDescription

 * added offset and voxelSize to ImageMappingInformation
 * introducing early EEPGenerator processor and DVRVis pipeline

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@215 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 01342928
......@@ -73,6 +73,8 @@ namespace TUMVis {
case Qt::DisplayRole:
if (column == 0)
return QVariant(QString::fromStdString(_processor->getName()));
if (column == 1)
return QVariant(QString::fromStdString(_processor->getDescription()));
case Qt::UserRole:
return qVariantFromValue(static_cast<void*>(_processor));
default:
......@@ -185,6 +187,9 @@ namespace TUMVis {
}
void PipelineTreeModel::setData(const std::vector<AbstractPipeline*>& pipelines) {
delete _rootItem;
_rootItem = new RootTreeItem();
for (std::vector<AbstractPipeline*>::const_iterator pipe = pipelines.begin(); pipe != pipelines.end(); ++pipe) {
PipelineTreeItem* pipeti = new PipelineTreeItem(*pipe, _rootItem);
......
#include "application/tumvisapplication.h"
#include "modules/pipelines/dvrvis.h"
#include "modules/pipelines/slicevis.h"
using namespace TUMVis;
......@@ -13,6 +14,7 @@ using namespace TUMVis;
int main(int argc, char** argv) {
TumVisApplication app(argc, argv);
app.addVisualizationPipeline("SliceVis", new SliceVis());
app.addVisualizationPipeline("DVRVis", new DVRVis());
app.init();
int toReturn = app.run();
......
......@@ -8,6 +8,7 @@ namespace TUMVis {
, _dimensionality(dimensionality)
, _size(size)
, _numElements(tgt::hmul(size))
, _mappingInformation(tgt::vec3(0.f), tgt::vec3(1.f)) // TODO: get offset/voxel size as parameter or put default values into ImageMappingInformation ctor.
{
}
......@@ -26,8 +27,8 @@ namespace TUMVis {
return _mappingInformation;
}
ImageMappingInformation& ImageData::getMappingInformation() {
return _mappingInformation;
tgt::Bounds ImageData::getWorldBounds() const {
return tgt::Bounds(_mappingInformation.getOffset(), _mappingInformation.getOffset() + (tgt::vec3(_size) * _mappingInformation.getVoxelSize()));
}
size_t ImageData::getNumElements() const {
......
#ifndef IMAGEDATA_H__
#define IMAGEDATA_H__
#include "tgt/bounds.h"
#include "tgt/vector.h"
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/imagemappinginformation.h"
#include "tgt/vector.h"
namespace TUMVis {
......@@ -45,10 +46,10 @@ namespace TUMVis {
const ImageMappingInformation& getMappingInformation() const;
/**
* Mapping information of this image
* \return _mappingInformation
* Returns the image extent in world coordinates.
* \return The image extent in world coordinates.
*/
ImageMappingInformation& getMappingInformation();
tgt::Bounds getWorldBounds() const;
/**
* Returns the subimage of this image given by \a llf and \a urb.
......
......@@ -2,17 +2,30 @@
namespace TUMVis {
ImageMappingInformation::ImageMappingInformation()
: _realWorldValueMapping(LinearMaping<float>::identity)
, _voxelToWorldTransformation(tgt::mat4::identity)
ImageMappingInformation::ImageMappingInformation(const tgt::vec3& offset, const tgt::vec3& voxelSize, const LinearMapping<float>& realWorldValueMapping /*= LinearMapping<float>::identity*/)
: _offset(offset)
, _voxelSize(voxelSize)
, _realWorldValueMapping(realWorldValueMapping)
{
}
const tgt::vec3& ImageMappingInformation::getOffset() const {
return _offset;
}
const tgt::vec3& ImageMappingInformation::getVoxelSize() const {
return _voxelSize;
}
const LinearMaping<float>& ImageMappingInformation::getRealWorldMapping() const {
const LinearMapping<float>& ImageMappingInformation::getRealWorldMapping() const {
return _realWorldValueMapping;
}
void ImageMappingInformation::setRealWorldMapping(const LinearMaping<float>& rwvm) {
void ImageMappingInformation::setRealWorldMapping(const LinearMapping<float>& rwvm) {
_realWorldValueMapping = rwvm;
}
}
......@@ -2,6 +2,7 @@
#define imagemapping_h__
#include "tgt/matrix.h"
#include "tgt/vector.h"
#include "core/tools/mapping.h"
namespace TUMVis {
......@@ -15,26 +16,46 @@ namespace TUMVis {
class ImageMappingInformation {
public:
/**
* Creates a new default ImageMappingInformation. All mappings are identity.
* Creates a new default ImageMappingInformation.
* \param offset Position of LLF corner in world coordinates (mm)
* \param voxelSize Voxel size in (mm)
* \param realWorldValueMapping Linear mapping for mapping element values to real world values, defaults to identity.
*/
ImageMappingInformation();
ImageMappingInformation(
const tgt::vec3& offset,
const tgt::vec3& voxelSize,
const LinearMapping<float>& realWorldValueMapping = LinearMapping<float>::identity);
/**
* Returns the position of LLF corner in world coordinates (mm).
* \return _offset
*/
const tgt::vec3& getOffset() const;
/**
* Returns the voxel size in mm.
* \return _voxelSize
*/
const tgt::vec3& getVoxelSize() const;
/**
* Get the real world value mapping.
* \return Linear mapping for mapping element values to real world values.
*/
const LinearMaping<float>& getRealWorldMapping() const;
const LinearMapping<float>& getRealWorldMapping() const;
/**
* Set the real world value mapping.
* \param rwvm Linear mapping for mapping element values to real world values.
*/
void setRealWorldMapping(const LinearMaping<float>& rwvm);
void setRealWorldMapping(const LinearMapping<float>& rwvm);
private:
LinearMaping<float> _realWorldValueMapping; ///< Linear mapping for mapping element values to real world values
tgt::mat4 _voxelToWorldTransformation; ///< Transformation matrix from voxel to world coordinates
tgt::vec3 _offset; ///< Position of LLF corner in world coordinates (mm)
tgt::vec3 _voxelSize; ///< Voxel size in (mm)
LinearMapping<float> _realWorldValueMapping; ///< Linear mapping for mapping element values to real world values
//tgt::mat4 _voxelToWorldTransformation; ///< Transformation matrix from voxel to world coordinates
static const std::string loggerCat_;
};
......
......@@ -82,6 +82,12 @@ namespace TUMVis {
*/
virtual const std::string getName() const = 0;
/**
* Gets a description of this processor. To be defined by every subclass.
* \return A description what this processor does.
*/
virtual const std::string getDescription() const = 0;
/**
* Update the processor's invalidation level by \a nl.
* If \a nl is VALID, the processor's invalidation level will be set to VALID.
......
......@@ -98,6 +98,7 @@ namespace TUMVis {
// = Typedefs =====================================================================================
typedef GenericProperty<bool> BoolProperty;
typedef GenericProperty<std::string> StringProperty;
// = Template Implementation ======================================================================
......
......@@ -22,7 +22,7 @@ namespace TUMVis {
**/
virtual ~TransferFunctionProperty();
/// \overload
/// \see AbstractProperty::deinit()
virtual void deinit();
AbstractTransferFunction* getTF();
......
......@@ -9,15 +9,15 @@ namespace TUMVis {
* \tparam T Numeric type for mapping
**/
template<typename T>
struct LinearMaping {
struct LinearMapping {
public:
/**
* Creates a new LinearMaping object
* Creates a new LinearMapping object
* \param shift Shifting coefficient of mapping
* \param scale Scaling coefficient of mapping
* \return
*/
LinearMaping(T shift, T scale)
LinearMapping(T shift, T scale)
: _shift(shift)
, _scale(scale)
{};
......@@ -47,11 +47,11 @@ namespace TUMVis {
/**
* Identity mapping (shift = 0, scale = 1).
*/
static const LinearMaping<T> identity;
static const LinearMapping<T> identity;
};
template<typename T>
const LinearMaping<T> LinearMaping<T>::identity = LinearMaping<T>(T(0), T(1));
const LinearMapping<T> LinearMapping<T>::identity = LinearMapping<T>(T(0), T(1));
}
#endif // mapping_h__
\ No newline at end of file
......@@ -33,6 +33,8 @@ namespace TUMVis {
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "MhdImageReader"; };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Reads an MHD image into the pipeline."; };
GenericProperty<std::string> _url; ///< URL for file to read
GenericProperty<std::string> _targetImageID; ///< image ID for read image
......
#include "dvrvis.h"
#include "tgt/event/keyevent.h"
#include "tgt/glcontext.h"
#include "core/datastructures/imagedataconverter.h"
namespace TUMVis {
DVRVis::DVRVis()
: VisualizationPipeline()
, _imageReader()
, _eepGenerator(_renderTargetSize)
{
_processors.push_back(&_imageReader);
_processors.push_back(&_eepGenerator);
}
DVRVis::~DVRVis() {
}
void DVRVis::init() {
VisualizationPipeline::init();
_imageReader._url.setValue("D:\\Medical Data\\smallHeart.mhd");
_imageReader._targetImageID.setValue("reader.output");
_eepGenerator._sourceImageID.setValue("eep.input");
_eepGenerator._entryImageID.setValue("eep.entry");
_eepGenerator._exitImageID.setValue("eep.exit");
_renderTargetID.setValue("renderTarget");
_renderTargetID.addSharedProperty(&(_eepGenerator._entryImageID));
_imageReader.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_eepGenerator.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
}
void DVRVis::execute() {
{
tbb::spin_mutex::scoped_lock lock(_localMutex);
_invalidationLevel.setValid();
// TODO: think whether we want to lock all processors already here.
}
if (! _imageReader.getInvalidationLevel().isValid()) {
executeProcessor(_imageReader);
// convert data
DataContainer::ScopedTypedData<ImageData> img(_data, "reader.output");
{
tgt::GLContextScopedLock lock(_canvas->getContext());
ImageDataGL* gl = ImageDataConverter::tryConvert<ImageDataGL>(img);
if (gl != 0) {
_data.addData("eep.input", gl);
}
}
}
if (! _eepGenerator.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(_eepGenerator);
}
}
const std::string DVRVis::getName() const {
return "DVRVis";
}
}
\ No newline at end of file
#ifndef DVRVIS_H__
#define DVRVIS_H__
#include "core/datastructures/imagedatalocal.h"
#include "core/eventhandlers/mwheeltonumericpropertyeventhandler.h"
#include "core/pipeline/visualizationpipeline.h"
#include "modules/io/mhdimagereader.h"
#include "modules/vis/eepgenerator.h"
namespace TUMVis {
class DVRVis : public VisualizationPipeline {
public:
/**
* Creates a VisualizationPipeline.
* \param canvas Canvas hosting the OpenGL context for this pipeline.
*/
DVRVis();
/**
* Virtual Destructor
**/
virtual ~DVRVis();
/// \see VisualizationPipeline::init()
virtual void init();
/// \see AbstractPipeline::getName()
virtual const std::string getName() const;
/**
* Execute this pipeline.
**/
virtual void execute();
protected:
MhdImageReader _imageReader;
EEPGenerator _eepGenerator;
};
}
#endif // DVRVIS_H__
#include "eepgenerator.h"
#include "tgt/glmath.h"
#include "tgt/logmanager.h"
#include "tgt/quadrenderer.h"
#include "tgt/shadermanager.h"
#include "tgt/textureunit.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagedatagl.h"
#include "core/datastructures/imagedatarendertarget.h"
#include "core/datastructures/imagedataconverter.h"
#include "core/classification/simpletransferfunction.h"
namespace TUMVis {
const std::string EEPGenerator::loggerCat_ = "TUMVis.modules.vis.EEPGenerator";
EEPGenerator::EEPGenerator(GenericProperty<tgt::ivec2>& canvasSize)
: VisualizationProcessor(canvasSize)
, _sourceImageID("sourceImageID", "Input Image", "")
, _entryImageID("entryImageID", "Output Entry Points Image", "")
, _exitImageID("exitImageID", "Output Exit Points Image", "")
, _camera("camera", "Camera")
, _jitterEntryPoints("jitterEntryPoints", "Jitter Entry Points", true)
, _shader(0)
{
addProperty(&_sourceImageID);
addProperty(&_entryImageID);
addProperty(&_exitImageID);
addProperty(&_camera);
}
EEPGenerator::~EEPGenerator() {
}
void EEPGenerator::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "modules/vis/eepgenerator.frag", "", false);
}
void EEPGenerator::deinit() {
ShdrMgr.dispose(_shader);
VisualizationProcessor::deinit();
}
void EEPGenerator::process(DataContainer& data) {
DataContainer::ScopedTypedData<ImageDataGL> img(data, _sourceImageID.getValue());
if (img != 0) {
if (img->getDimensionality() == 3) {
// TODO: implement some kind of proxy geometry...
tgt::Bounds volumeExtent = img->getWorldBounds();
//tgt::Bounds volumeExtent(tgt::vec3(-1.f), tgt::vec3(1.f));
tgt::Bounds textureBounds(tgt::vec3(0.f), tgt::vec3(1.f));
tgt::vec3 pos = volumeExtent.center() - tgt::vec3(0, 0, tgt::length(volumeExtent.diagonal()));
tgt::Camera cam(pos, volumeExtent.center());
cam.setFarDist(500.f);
// set modelview and projection matrices
glPushAttrib(GL_ALL_ATTRIB_BITS);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
tgt::loadMatrix(cam.getProjectionMatrix());
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
tgt::loadMatrix(cam.getViewMatrix());
_shader->activate();
// create entry points texture
ImageDataRenderTarget* entrypoints = new ImageDataRenderTarget(tgt::svec3(_renderTargetSize.getValue(), 1));
entrypoints->activate();
glDepthFunc(GL_LESS);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glCullFace(GL_BACK);
_shader->setUniform("_jitterPoints", _jitterEntryPoints.getValue());
renderProxyGeometry(volumeExtent, textureBounds);
entrypoints->deactivate();
// create exit points texture
ImageDataRenderTarget* exitpoints = new ImageDataRenderTarget(tgt::svec3(_renderTargetSize.getValue(), 1));
exitpoints->activate();
glDepthFunc(GL_GREATER);
glClearDepth(0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glCullFace(GL_FRONT);
_shader->setUniform("_jitterPoints", false);
renderProxyGeometry(volumeExtent, textureBounds);
exitpoints->deactivate();
_shader->deactivate();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glPopAttrib();
data.addData(_entryImageID.getValue(), entrypoints);
data.addData(_exitImageID.getValue(), exitpoints);
}
else {
LERROR("Input image must have dimensionality of 3.");
}
}
else {
LERROR("No suitable input image found.");
}
_invalidationLevel.setValid();
}
void EEPGenerator::renderProxyGeometry(const tgt::Bounds& bounds, const tgt::Bounds& texBounds) {
const tgt::vec3& llf = bounds.getLLF();
const tgt::vec3& urb = bounds.getURB();
const tgt::vec3& tLlf = texBounds.getLLF();
const tgt::vec3& tUrb = texBounds.getURB();
// TODO: get fuckin' rid of intermediate mode, it simply sucks...
glColor3f(1.f, 0.f, 1.f);
glBegin(GL_QUADS);
// front
glTexCoord3f(tLlf.x, tLlf.y, tLlf.z);
glVertex3fv(llf.elem);
glTexCoord3f(tUrb.x, tLlf.y, tLlf.z);
glVertex3f(urb.x, llf.y, llf.z);
glTexCoord3f(tUrb.x, tUrb.y, tLlf.z);
glVertex3f(urb.x, urb.y, llf.z);
glTexCoord3f(tLlf.x, tLlf.y, tLlf.z);
glVertex3f(llf.x, llf.y, llf.z);
// right
glTexCoord3f(tUrb.x, tLlf.y, tLlf.z);
glVertex3f(urb.x, llf.y, llf.z);
glTexCoord3f(tUrb.x, tLlf.y, tUrb.z);
glVertex3f(urb.x, llf.y, urb.z);
glTexCoord3f(tUrb.x, tUrb.y, tUrb.z);
glVertex3f(urb.x, urb.y, urb.z);
glTexCoord3f(tUrb.x, tUrb.y, tLlf.z);
glVertex3f(urb.x, urb.y, llf.z);
// top
glTexCoord3f(tLlf.x, tUrb.y, tLlf.z);
glVertex3f(llf.x, urb.y, llf.z);
glTexCoord3f(tUrb.x, tUrb.y, tLlf.z);
glVertex3f(urb.x, urb.y, llf.z);
glTexCoord3f(tUrb.x, tUrb.y, tUrb.z);
glVertex3f(urb.x, urb.y, urb.z);
glTexCoord3f(tLlf.x, tUrb.y, tUrb.z);
glVertex3f(llf.x, urb.y, urb.z);
// left
glTexCoord3f(tLlf.x, tLlf.y, tUrb.z);
glVertex3f(llf.x, llf.y, urb.z);
glTexCoord3f(tLlf.x, tLlf.y, tLlf.z);
glVertex3f(llf.x, llf.y, llf.z);
glTexCoord3f(tLlf.x, tUrb.y, tLlf.z);
glVertex3f(llf.x, urb.y, llf.z);
glTexCoord3f(tLlf.x, tUrb.y, tUrb.z);
glVertex3f(llf.x, urb.y, urb.z);
// bottom
glTexCoord3f(tLlf.x, tLlf.y, tLlf.z);
glVertex3f(llf.x, llf.y, llf.z);
glTexCoord3f(tLlf.x, tLlf.y, tUrb.z);
glVertex3f(llf.x, llf.y, urb.z);
glTexCoord3f(tUrb.x, tLlf.y, tUrb.z);
glVertex3f(urb.x, llf.y, urb.z);
glTexCoord3f(tUrb.x, tLlf.y, tLlf.z);
glVertex3f(urb.x, llf.y, llf.z);
// back
glTexCoord3f(tUrb.x, tLlf.y, tUrb.z);
glVertex3f(urb.x, llf.y, urb.z);
glTexCoord3f(tLlf.x, tLlf.y, tUrb.z);
glVertex3f(llf.x, llf.y, urb.z);
glTexCoord3f(tLlf.x, tUrb.y, tUrb.z);
glVertex3f(llf.x, urb.y, urb.z);
glTexCoord3f(tUrb.x, tUrb.y, tUrb.z);
glVertex3f(urb.x, urb.y, urb.z);
glEnd();
}
}
uniform bool _jitterPoints;
void main() {
gl_FragData[0] = gl_TexCoord[0];
}
#ifndef EEPGENERATOR_H__
#define EEPGENERATOR_H__
#include <string>
#include "core/classification/abstracttransferfunction.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/cameraproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/transferfunctionproperty.h"
namespace tgt {
class Shader;
}
namespace TUMVis {
/**
* Genereates entry-/exit point textures for the given image and camera.
*/
class EEPGenerator : public VisualizationProcessor {
public:
/**
* Constructs a new EEPGenerator Processor
**/
EEPGenerator(GenericProperty<tgt::ivec2>& canvasSize);
/**
* Destructor
**/
virtual ~EEPGenerator();