-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvxFastVolume_UT.cpp
115 lines (89 loc) · 2.5 KB
/
vxFastVolume_UT.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
*
* file vxFastVolume_UT.cpp
*
* This test file is a part of VoxelBrain software.
*
* (c) Nanyang Technological University
*
* Author: Konstantin Levinski
*
*/
#include <gtest/gtest.h>
#include "vxFastVolume.h"
#include "vxLoader.h"
#include "vxTools.h"
#include "vxSurface.h"
#include <iostream>
TEST(MAIN, DISABLED_FastVolume){
FastVolume vol;
MgzLoader mri(vol);
EXPECT_TRUE(mri.Load("data/brainmask.mgz"));
};
TEST( Simple, DISABLED_FastVolume ){
V3f in(0,0,0);
V3f out(0,0,0);
out = FastVolume::FromSurface(in);
EXPECT_NE(in, out);
std::cout << out;
};
/*
So, the idea is as follows -
Load another volume data, actual mask.
Allow the user to review and change it.
*/
TEST( RasterizeTriangle, DISABLED_FastVolume ) {
FastVolume m; //A set of bitmasks; eight;
V3f a (10,10,10);
V3f b (10,100,110);
V3f c (10,100,10);
V3f o = (a + b + c) / 3; //Center.
EXPECT_FALSE(m.GetMask(o,1)); //Center, unmasked.
EXPECT_FALSE(m.GetMask(a,1)); //Basic mask function.
m.SetMask(a,1,true);
EXPECT_TRUE(m.GetMask(a,1)); //Trivial plane check.
m.SetMask(a,2,false);
EXPECT_TRUE(m.GetMask(a,1));
m.SetMask(a,1,false);
EXPECT_FALSE(m.GetMask(a,1));
m.RasterizeTriangle(a,b,c,1); //Use mask plane 1.
EXPECT_TRUE(m.GetMask(a,1));
EXPECT_TRUE(m.GetMask(b,1));
EXPECT_TRUE(m.GetMask(c,1));
EXPECT_TRUE(m.GetMask(o,1));
};
TEST( RasterizeTriangleExplore, DISABLED_FastVolume ) {
FastVolume m; //A set of bitmasks; eight;
V3f a (10,10,10);
V3f b (10,12,10);
V3f c (10,10,12);
m.RasterizeTriangle(a,b,c,1);
EXPECT_TRUE(m.GetMask(a,1));
std::cout << "VS " << b << c << "\n";
m.SetMask(b,1, true);
EXPECT_TRUE(m.GetMask(b,1));
EXPECT_TRUE(m.GetMask(c,1));
}
//Test flood-fill.
TEST( RasterizeSurface, DISABLED_FastVolumeFill ) {
FastVolume m; //A set of bitmasks; eight;
Surface surf;
EXPECT_TRUE(read_surface_binary(surf, "data/lh.pial"));
TIME( RasterizeSurface( m, surf, 3) , "RasterizeSurface" );
V3f c = find_center_point(surf);
c = m.FromSurface(c);
TIME( m.FloodFill ( c, 4, 3 ) , "FloodFill" );
}
//Dilution test.
TEST( Dilute, FastVolume ) {
FastVolume m; //A set of bitmasks; eight;
Surface surf;
EXPECT_TRUE(read_surface_binary(surf, "data/lh.pial"));
TIME( RasterizeSurface( m, surf, 3) , "RasterizeSurface" );
V3f c = find_center_point(surf);
c = m.FromSurface(c);
TIME( m.FloodFill ( c, 4, 3 ) , "FloodFill" );
int res = m.Dilute ( 4 ); //Dilute fourth plane.
EXPECT_GT( res, 1000.0);
}
//End of vxFastVolume_UT.cpp