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

some last minor fixes before merge

parent 6702d5b8
......@@ -5,8 +5,8 @@
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, Germany
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
......
......@@ -33,7 +33,6 @@
#include "core/datastructures/datacontainer.h"
#include "core/datastructures/imagedata.h"
#include <thread>
using namespace campvis;
......@@ -43,7 +42,7 @@ class DummyTestProcessor : public AbstractProcessor {
public:
DummyTestProcessor () {
_invalidateExternally = false;
this->invalidate(AbstractProcessor::InvalidationLevel::VALID);
this->invalidate(AbstractProcessor::VALID);
}
~DummyTestProcessor () {}
......@@ -100,9 +99,9 @@ protected:
*/
TEST_F(AbstractProcessorTest, invalidationTest) {
this->_processor1.process(this->_dataContainer);
EXPECT_EQ(AbstractProcessor::InvalidationLevel::VALID, this->_processor1.getInvalidationLevel());
EXPECT_EQ(AbstractProcessor::VALID, this->_processor1.getInvalidationLevel());
this->_processor1.setExternalInvalidation(true, AbstractProcessor::InvalidationLevel::INVALID_RESULT);
this->_processor1.setExternalInvalidation(true, AbstractProcessor::INVALID_RESULT);
this->_processor1.process(this->_dataContainer);
EXPECT_NE(AbstractProcessor::InvalidationLevel::VALID, this->_processor1.getInvalidationLevel());
EXPECT_NE(AbstractProcessor::VALID, this->_processor1.getInvalidationLevel());
}
......@@ -56,10 +56,11 @@ protected:
numBuckets[i] = max[i] - min[i] + 1;
}
numSamples = static_cast<int>(pow(max[0]-min[0]+1, ND));
int nd = ND;
numSamples = static_cast<int>(pow(static_cast<float>(max[0]-min[0]+1), nd));
initSamples();
histogram = new int[static_cast<int>(pow(max[0]-min[0]+1, ND))];
histogram = new int[numSamples];
computeHistogram();
_cgh = new campvis::ConcurrentGenericHistogramND<int, ND>(min, max, numBuckets);
......@@ -79,7 +80,7 @@ protected:
}
void initSamples() {
int range = max[0] - min[0] + 1;
double range = max[0] - min[0] + 1;
for (int i = 0; i < numSamples; i++) {
std::vector<int> sample;
int x = i;
......@@ -188,10 +189,11 @@ protected:
numBuckets[i] = 2;
}
numSamples = static_cast<int>(pow(max[0]-min[0]+1, ND));
int nd = ND;
numSamples = static_cast<int>(pow(static_cast<double>(max[0]-min[0]+1), nd));
initSamples();
histogram = new int[static_cast<int>(pow(2, ND))];
histogram = new int[numSamples];
computeHistogram();
_cgh = new campvis::ConcurrentGenericHistogramND<int, ND>(min, max, numBuckets);
......@@ -211,7 +213,7 @@ protected:
}
void initSamples() {
int range = max[0] - min[0] + 1;
double range = static_cast<double>(max[0] - min[0] + 1);
for (int i = 0; i < numSamples; i++) {
std::vector<int> sample;
int x = i;
......@@ -224,8 +226,9 @@ protected:
}
void computeHistogram() {
int total = 0;
for (int i = 0; i < pow(2, ND); i++) {
histogram[i] = static_cast<int>(numSamples / pow(2, ND) );
int nd = ND;
for (int i = 0; i < pow(2.0, nd); i++) {
histogram[i] = static_cast<int>(numSamples / pow(2.0, nd) );
total += histogram[i];
}
EXPECT_EQ(numSamples, total);
......
......@@ -58,7 +58,7 @@ protected:
rawData = new float[width * height * depth];
initData(rawData, width * height * depth);
imgData = new ImageData(depth == 1? 2 : 3, tgt::svec3(width, height, depth), 1);
localRep = ImageRepresentationLocal::create(imgData, WeaklyTypedPointer(WeaklyTypedPointer::BaseType::FLOAT, 1, rawData));
localRep = ImageRepresentationLocal::create(imgData, WeaklyTypedPointer(WeaklyTypedPointer::FLOAT, 1, rawData));
glReduction = nullptr;
}
......@@ -118,7 +118,7 @@ TEST_P(GlReductionTest, localRepCreationTest) {
* Tests for ReducationOperator::MIN.
*/
TEST_P(GlReductionTest, minTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::MIN);
glReduction = new GlReduction(GlReduction::MIN);
std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(0, reduced[0], 0.0001);
......@@ -129,7 +129,7 @@ TEST_P(GlReductionTest, minTest) {
* Tests for ReducationOperator::MAX.
*/
TEST_P(GlReductionTest, maxTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::MAX);
glReduction = new GlReduction(GlReduction::MAX);
std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(1, reduced[0], 0.0001);
......@@ -140,7 +140,7 @@ TEST_P(GlReductionTest, maxTest) {
* Tests for ReducationOperator::PLUS.
*/
TEST_P(GlReductionTest, sumTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::PLUS);
glReduction = new GlReduction(GlReduction::PLUS);
std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(getSize() - 1, reduced[0], 0.0001);
......@@ -151,7 +151,7 @@ TEST_P(GlReductionTest, sumTest) {
* Tests for ReducationOperator::MULTIPLICATION.
*/
TEST_P(GlReductionTest, multTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::MULTIPLICATION);
glReduction = new GlReduction(GlReduction::MULTIPLICATION);
std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(0, reduced[0], 0.0001);
......
#include "gtest/gtest.h"
//#include "someclass.h"
//#include "modules/io/processors/abstractimagereader.h"
//#include "modules/io/processors/mhdimagereader.h"
//#include "core/properties/genericproperty.h"
class SomeClassTest : public ::testing::Test {
protected:
SomeClassTest() {
}
~SomeClassTest() {
}
// If the constructor and destructor are not enough for setting up
// and cleaning up each test, you can define the following two methods
virtual void SetUp() {
}
virtual void TearDown() {
}
private:
};
TEST_F(SomeClassTest, assertTrue) {
ASSERT_EQ(1, 1);
}
TEST_F(SomeClassTest, assertFalse) {
ASSERT_NE(1, 0);
}
//TEST(ImageReaderTest, MhdImageReaderTest) {
// campvis::MhdImageReader *ir = new campvis::MhdImageReader();
// ir->setURL(campvis::StringProperty("url","sometitle", "someurl"));
// EXPECT_STRCASEEQ("someurl", ir->p_url.getValue().c_str());
//}
\ No newline at end of file
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