25 #ifndef WFIBERCLUSTER_TEST_H
26 #define WFIBERCLUSTER_TEST_H
31 #include <cxxtest/TestSuite.h>
33 #include "../../../common/WLimits.h"
34 #include "../../../common/WLogger.h"
35 #include "../../test/WDataSetFiberVectorTraits.h"
36 #include "../WFiberCluster.h"
52 size_t mydata[] = { 16, 2, 77, 29 };
53 std::list< size_t > data( mydata, mydata +
sizeof( mydata ) /
sizeof(
size_t ) );
56 TS_ASSERT( b.
empty() );
57 size_t mxdata[] = { 1, 16, 2, 77, 29 };
58 std::list< size_t > xdata( mxdata, mxdata +
sizeof( mxdata ) /
sizeof(
size_t ) );
61 TS_ASSERT_EQUALS( expected, a );
94 expected.
push_back(
WPosition( ( ( 9.0 - 3 * std::sqrt( 2.0 ) ) / 4.0 - 1.0 ) / 2.0 + 1, 1.5, 0 ) );
95 expected.
push_back(
WPosition( ( ( 9.0 - 3 * std::sqrt( 2.0 ) ) / 4.0 + ( 5 + std::sqrt( 2.0 ) ) / 4.0 - 2.0 ) / 2.0 + 2, 1.5, 0 ) );
96 expected.
push_back(
WPosition( ( ( 9.0 - 3 * std::sqrt( 2.0 ) ) / 4.0 + 2 * ( 5 + std::sqrt( 2.0 ) ) / 4.0 - 3.0 ) / 2.0 + 3, 1.5, 0 ) );
100 std::cout << *
m_cluster->getDataSetReference() << std::endl;
112 fibs->at( 1 ).reverseOrder();
115 using string_utils::operator<<;
116 TS_ASSERT_EQUALS( *fibs, expected );
148 ds->at( 1 ).reverseOrder();
150 TS_ASSERT_EQUALS( *ds, expected );
152 TS_ASSERT_EQUALS( *ds, expected );
195 ds->at( 1 ).reverseOrder();
197 TS_ASSERT_EQUALS( *ds, expected );
199 TS_ASSERT_EQUALS( *ds, expected );
244 ds->at( 1 ).reverseOrder();
246 TS_ASSERT_EQUALS( *ds, expected );
248 TS_ASSERT_EQUALS( *ds, expected );
300 ds->at( 1 ).reverseOrder();
302 TS_ASSERT_EQUALS( *ds, expected );
304 TS_ASSERT_EQUALS( *ds, expected );
347 ds->at( 1 ).reverseOrder();
349 TS_ASSERT_EQUALS( *ds, expected );
351 TS_ASSERT_EQUALS( *ds, expected );
365 if( ( diffPos = equalsDelta( first, second, delta ) ) != -1 )
367 using string_utils::operator<<;
368 std::stringstream msg;
369 msg <<
"Lines are different in at least point: " << diffPos;
370 TS_FAIL( msg.str() );
371 std::cout <<
"first line at: " << diffPos << std::endl << first[diffPos] << std::endl;
372 std::cout <<
"second line at: " << diffPos << std::endl << second[diffPos] << std::endl;
373 std::cout <<
"first line: " << std::endl << first << std::endl;
374 std::cout <<
"second line: " << std::endl << second << std::endl;
418 ds->push_back( fib_a );
419 ds->push_back( fib_b );
433 std::list< size_t > idx;
434 for(
size_t i = 0; i < ds->size(); ++i )
Represents a simple set of WFibers.
Unit test the WFiberCluster class.
void generateFiberCluster(const std::shared_ptr< WDataSetFiberVector > ds)
Generates out of the given dataset a WFiberCluster containing all fibers.
void testUnifyDirectionOnTwoNearlyParallelFibers(void)
If there are two fibers which are nearly parallel changing ones direction will have huge effect.
std::shared_ptr< WFiberCluster > m_cluster
pre generated cluster for some unit tests
void testMerge(void)
When merging two clusters the indices are merged and the second cluster becomes empty.
void assert_equals_delta(const WLine &first, const WLine &second, double delta=wlimits::DBL_EPS) const
Compares to point sequences (aka lines) with a given delta.
void testUnifyDirectionOnTwoConsecutiveFibers(void)
Check determination of the direction of a pair of fibers which are in the following shape (all points...
void testUnifyDirectionOnTwoCSTShapedFibers(void)
Check determination of the direction of a pair of fibers which are in the following shape.
void tearDown(void)
Tidyups the dataset used in some unit tests.
void testCenterLine(void)
Generates a dataset for some unit tests.
void setUp(void)
Generates a dataset for some unit tests.
void testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle(void)
Check determination of the direction of a pair of fibers which are in the following shape.
void testUnifyDirectionOnTwoInverseCSTShapedFibers(void)
Check determination of the direction of a pair of fibers which are in the following shape.
void testUnifyDirectionOnTwoCircularShapedFibersInSameCircle(void)
Check determination of the direction of a pair of fibers which are in the following shape.
Represents a cluster of indices of a WDataSetFiberVector.
IndexList m_memberIndices
All indices in this set are members of this cluster.
bool empty() const
Returns true if there are no fibers in that cluster, false otherwise.
void merge(WFiberCluster &other)
Merge the fibers of the other cluster with the fibers of this cluster.
Represents a neural pathway.
A line is an ordered sequence of WPositions.
void push_back(const value_type &value)
Wrapper around std::vector member function.
This only is a 3d double vector.
const float FLT_EPS
Smallest float such: 1.0 + FLT_EPS == 1.0 is still true.
const double DBL_EPS
Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.