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

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

Added more test cases.

parent 412f2e72
...@@ -34,7 +34,7 @@ namespace campvis { ...@@ -34,7 +34,7 @@ namespace campvis {
DVRVis::DVRVis(DataContainer* dc) DVRVis::DVRVis(DataContainer* dc)
: AutoEvaluationPipeline(dc) : AutoEvaluationPipeline(dc)
, _camera("camera", "Camera") , _camera("Camera", "Camera")
, _lsp() , _lsp()
, _imageReader() , _imageReader()
, _pgGenerator() , _pgGenerator()
...@@ -97,13 +97,13 @@ namespace campvis { ...@@ -97,13 +97,13 @@ namespace campvis {
_dvrVM.p_targetImageID.setValue("dvr.output"); _dvrVM.p_targetImageID.setValue("dvr.output");
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .05f)); Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .05f));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .42f), tgt::col4(255, 0, 0, 255), tgt::col4(255, 0, 0, 255))); dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.12f, .15f), tgt::col4(85, 0, 0, 128), tgt::col4(255, 0, 0, 128)));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.45f, .5f), tgt::col4(0, 255, 0, 255), tgt::col4(0, 255, 0, 255))); dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.19f, .28f), tgt::col4(89, 89, 89, 155), tgt::col4(89, 89, 89, 155)));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.41f, .51f), tgt::col4(170, 170, 128, 64), tgt::col4(192, 192, 128, 64)));
_dvrNormal.p_transferFunction.replaceTF(dvrTF); _dvrNormal.p_transferFunction.replaceTF(dvrTF);
Geometry1DTransferFunction* vmTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .05f)); Geometry1DTransferFunction* vmTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .05f));
vmTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .42f), tgt::col4(255, 0, 0, 255), tgt::col4(255, 0, 0, 255))); vmTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.41f, .51f), tgt::col4(170, 170, 128, 64), tgt::col4(192, 192, 128, 64)));
vmTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.45f, .5f), tgt::col4(0, 255, 0, 255), tgt::col4(0, 255, 0, 255)));
_dvrVM.p_transferFunction.replaceTF(vmTF); _dvrVM.p_transferFunction.replaceTF(vmTF);
_vmRenderer.p_renderTargetID.addSharedProperty(&_combine.p_mirrorRenderID); _vmRenderer.p_renderTargetID.addSharedProperty(&_combine.p_mirrorRenderID);
...@@ -124,8 +124,8 @@ namespace campvis { ...@@ -124,8 +124,8 @@ namespace campvis {
_vmgGenerator.p_mirrorID.addSharedProperty(&_vmEepGenerator.p_mirrorID); _vmgGenerator.p_mirrorID.addSharedProperty(&_vmEepGenerator.p_mirrorID);
_vmgGenerator.p_mirrorID.addSharedProperty(&_vmRenderer.p_geometryID); _vmgGenerator.p_mirrorID.addSharedProperty(&_vmRenderer.p_geometryID);
_vmgGenerator.p_mirrorCenter.setValue(tgt::vec3(0.f, 0.f, -20.f)); _vmgGenerator.p_mirrorCenter.setValue(tgt::vec3(0.f, 0.f, -20.f));
_vmgGenerator.p_poi.setValue(tgt::vec3(40.f, 40.f, 40.f)); _vmgGenerator.p_poi.setValue(tgt::vec3(50.f, 80.f, 15.f));
_vmgGenerator.p_size.setValue(60.f); _vmgGenerator.p_size.setValue(128.f);
_eepGenerator.p_entryImageID.addSharedProperty(&_dvrNormal.p_entryImageID); _eepGenerator.p_entryImageID.addSharedProperty(&_dvrNormal.p_entryImageID);
_vmEepGenerator.p_entryImageID.addSharedProperty(&_dvrVM.p_entryImageID); _vmEepGenerator.p_entryImageID.addSharedProperty(&_dvrVM.p_entryImageID);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "core/datastructures/datacontainer.h" #include "core/datastructures/datacontainer.h"
#include "core/datastructures/renderdata.h" #include "core/datastructures/renderdata.h"
#include "core/pipeline/abstractpipeline.h" #include "core/pipeline/abstractpipeline.h"
#include "core/properties/allproperties.h"
#include "core/tools/stringutils.h" #include "core/tools/stringutils.h"
#include "modules/pipelinefactory.h" #include "modules/pipelinefactory.h"
...@@ -89,22 +90,23 @@ protected: ...@@ -89,22 +90,23 @@ protected:
_pipeline->init(); _pipeline->init();
_pipeline->setEnabled(true); _pipeline->setEnabled(true);
_pipeline->setRenderTargetSize(tgt::ivec2(1024, 1024)); _pipeline->setRenderTargetSize(tgt::ivec2(1024, 1024));
}
}
void execute() {
if (_pipeline != nullptr) {
// invalidate each processor // invalidate each processor
std::vector<AbstractProcessor*> processors = _pipeline->getProcessors(); std::vector<AbstractProcessor*> processors = _pipeline->getProcessors();
for (size_t i = 0; i < processors.size(); ++i) { for (size_t i = 0; i < processors.size(); ++i) {
processors[i]->invalidate(AbstractProcessor::INVALID_RESULT); processors[i]->invalidate(AbstractProcessor::INVALID_RESULT);
} }
}
}
void execute() {
if (_pipeline != nullptr) {
_pipeline->executePipeline(); _pipeline->executePipeline();
// write result image // write result image
_imageWriter.p_inputImage.setValue(_pipeline->getRenderTargetID()); _imageWriter.p_inputImage.setValue(_pipeline->getRenderTargetID());
_imageWriter.p_url.setValue(_fileName); _imageWriter.p_url.setValue(_fileName);
_imageWriter.invalidate(AbstractProcessor::INVALID_RESULT);
_imageWriter.process(_dataContainer); _imageWriter.process(_dataContainer);
_wroteFile = tgt::FileSystem::fileExists(_fileName); _wroteFile = tgt::FileSystem::fileExists(_fileName);
...@@ -127,7 +129,7 @@ int PipelineWriteResultImageTest::_prevNoCases = 0; ...@@ -127,7 +129,7 @@ int PipelineWriteResultImageTest::_prevNoCases = 0;
TEST_F(PipelineWriteResultImageTest, VolumeExplorerDemo) { TEST_F(PipelineWriteResultImageTest, VolumeExplorerDemo) {
_pipelineName = "VolumeExplorerDemo"; _pipelineName = "VolumeExplorerDemo";
_fileName = _basePath +"volumeexplorerdemo.png"; _fileName = _basePath + "volumeexplorerdemo.png";
init(); init();
execute(); execute();
EXPECT_TRUE(_wroteFile); EXPECT_TRUE(_wroteFile);
...@@ -143,9 +145,66 @@ TEST_F(PipelineWriteResultImageTest, GeometryRendererDemo) { ...@@ -143,9 +145,66 @@ TEST_F(PipelineWriteResultImageTest, GeometryRendererDemo) {
TEST_F(PipelineWriteResultImageTest, SliceVis) { TEST_F(PipelineWriteResultImageTest, SliceVis) {
_pipelineName = "SliceVis"; _pipelineName = "SliceVis";
_fileName = _basePath +"slicevis.png"; _fileName = _basePath + "slicevis.png";
init();
execute();
EXPECT_TRUE(_wroteFile);
}
TEST_F(PipelineWriteResultImageTest, AdvancedUsVis) {
_pipelineName = "AdvancedUsVis";
_fileName = _basePath + "advancedusvis.png";
init();
execute();
EXPECT_TRUE(_wroteFile);
}
TEST_F(PipelineWriteResultImageTest, VectorFieldDemo) {
_pipelineName = "VectorFieldDemo";
_fileName = _basePath + "vectorfielddemo.png";
init();
execute();
AbstractProperty* p = _pipeline->getProperty("SliceNuber");
if (IntProperty* tester = dynamic_cast<IntProperty*>(p)) {
tester->setValue(64);
}
execute();
EXPECT_TRUE(_wroteFile);
}
TEST_F(PipelineWriteResultImageTest, DVRVis) {
_pipelineName = "DVRVis";
_fileName = _basePath + "dvrvis.png";
init();
execute();
AbstractProperty* p = _pipeline->getProperty("Camera");
if (CameraProperty* tester = dynamic_cast<CameraProperty*>(p)) {
tgt::Camera c = tester->getValue();
c.setPosition(tgt::vec3(417.f, 44.5f, -112.5f));
c.setFocus(tgt::vec3(91.f, 91.f, 80.f));
c.setUpVector(tgt::vec3(-0.487f, 0.142f, -0.861f));
tester->setValue(c);
}
execute();
EXPECT_TRUE(_wroteFile);
}
TEST_F(PipelineWriteResultImageTest, TensorDemo) {
_pipelineName = "TensorDemo";
_fileName = _basePath + "tensordemo.png";
init(); init();
execute(); execute();
AbstractProperty* p = _pipeline->getProperty("SliceNuber");
if (IntProperty* tester = dynamic_cast<IntProperty*>(p)) {
tester->setValue(6);
}
execute();
EXPECT_TRUE(_wroteFile); EXPECT_TRUE(_wroteFile);
} }
......
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