25 #ifndef WFIBERCLUSTER_TEST_H
26 #define WFIBERCLUSTER_TEST_H
30 #include <cxxtest/TestSuite.h>
32 #include "../../../common/WLimits.h"
33 #include "../../../common/WLogger.h"
34 #include "../../test/WDataSetFiberVectorTraits.h"
35 #include "../WFiberCluster.h"
51 size_t mydata[] = { 16, 2, 77, 29 };
52 std::list< size_t > data( mydata, mydata +
sizeof( mydata ) /
sizeof(
size_t ) );
55 TS_ASSERT( b.
empty() );
56 size_t mxdata[] = { 1, 16, 2, 77, 29 };
57 std::list< size_t > xdata( mxdata, mxdata +
sizeof( mxdata ) /
sizeof(
size_t ) );
60 TS_ASSERT_EQUALS( expected, a );
93 expected.
push_back(
WPosition( ( ( 9.0 - 3 * std::sqrt( 2.0 ) ) / 4.0 - 1.0 ) / 2.0 + 1, 1.5, 0 ) );
94 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 ) );
95 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 ) );
99 std::cout << *
m_cluster->getDataSetReference() << std::endl;
111 fibs->at( 1 ).reverseOrder();
114 using string_utils::operator<<;
115 TS_ASSERT_EQUALS( *fibs, expected );
147 ds->at( 1 ).reverseOrder();
149 TS_ASSERT_EQUALS( *ds, expected );
151 TS_ASSERT_EQUALS( *ds, expected );
194 ds->at( 1 ).reverseOrder();
196 TS_ASSERT_EQUALS( *ds, expected );
198 TS_ASSERT_EQUALS( *ds, expected );
243 ds->at( 1 ).reverseOrder();
245 TS_ASSERT_EQUALS( *ds, expected );
247 TS_ASSERT_EQUALS( *ds, expected );
299 ds->at( 1 ).reverseOrder();
301 TS_ASSERT_EQUALS( *ds, expected );
303 TS_ASSERT_EQUALS( *ds, expected );
346 ds->at( 1 ).reverseOrder();
348 TS_ASSERT_EQUALS( *ds, expected );
350 TS_ASSERT_EQUALS( *ds, expected );
364 if( ( diffPos = equalsDelta( first, second, delta ) ) != -1 )
366 using string_utils::operator<<;
367 std::stringstream msg;
368 msg <<
"Lines are different in at least point: " << diffPos;
369 TS_FAIL( msg.str() );
370 std::cout <<
"first line at: " << diffPos << std::endl << first[diffPos] << std::endl;
371 std::cout <<
"second line at: " << diffPos << std::endl << second[diffPos] << std::endl;
372 std::cout <<
"first line: " << std::endl << first << std::endl;
373 std::cout <<
"second line: " << std::endl << second << std::endl;
417 ds->push_back( fib_a );
418 ds->push_back( fib_b );
432 std::list< size_t > idx;
433 for(
size_t i = 0; i < ds->size(); ++i )
451 #endif // WFIBERCLUSTER_TEST_H
A line is an ordered sequence of WPositions.
Unit test the WFiberCluster class.
void setUp(void)
Generates a dataset for some unit tests.
void testUnifyDirectionOnTwoCSTShapedFibers(void)
Check determination of the direction of a pair of fibers which are in the following shape...
Represents a neural pathway.
void testMerge(void)
When merging two clusters the indices are merged and the second cluster becomes empty.
void push_back(const value_type &value)
Wrapper around std::vector member function.
void testUnifyDirectionOnTwoNearlyParallelFibers(void)
If there are two fibers which are nearly parallel changing ones direction will have huge effect...
Represents a cluster of indices of a WDataSetFiberVector.
void testUnifyDirectionOnTwoCircularShapedFibersInSameCircle(void)
Check determination of the direction of a pair of fibers which are in the following shape...
This only is a 3d double vector.
Represents a simple set of WFibers.
void testCenterLine(void)
Generates a dataset for some unit tests.
void merge(WFiberCluster &other)
Merge the fibers of the other cluster with the fibers of this cluster.
bool empty() const
Returns true if there are no fibers in that cluster, false otherwise.
const float FLT_EPS
Smallest float such: 1.0 + FLT_EPS == 1.0 is still true.
IndexList m_memberIndices
All indices in this set are members of this cluster.
void testUnifyDirectionOnTwoConsecutiveFibers(void)
Check determination of the direction of a pair of fibers which are in the following shape (all points...
const double DBL_EPS
Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.
void testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle(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 generateFiberCluster(const boost::shared_ptr< WDataSetFiberVector > ds)
Generates out of the given dataset a WFiberCluster containing all fibers.
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.
boost::shared_ptr< WFiberCluster > m_cluster
pre generated cluster for some unit tests
void testUnifyDirectionOnTwoInverseCSTShapedFibers(void)
Check determination of the direction of a pair of fibers which are in the following shape...