-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvxVrmlOut_UT.cpp
56 lines (45 loc) · 1.27 KB
/
vxVrmlOut_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
/**
*
* file vxVrmlOut_UT.cpp
*
* This test file is a part of VoxelBrain software.
*
* (c) Nanyang Technological University
*
* Author: Konstantin Levinski
*
*/
#include <gtest/gtest.h>
#include "vxVrmlOut.h"
#include "vxFileGzipIo.h"
#include "vxLoader.h"
TEST(MAIN, VrmlOut){
EXPECT_TRUE(VrmlTemplate("v","n","c","i").size()>0);
vector<V3f> v; //Vertices
vector<V3i> i; //Indices
EXPECT_TRUE(VrmlFormat(v).size()==0);
EXPECT_TRUE(VrmlFormat(i).size()==0);
v.push_back(V3f(0.5,0.5,0.5));
v.push_back(V3f(1,1,1));
v.push_back(V3f(2.0,2.0,2.0));
i.push_back(V3i(1,2,3));
i.push_back(V3i(3,2,1));
EXPECT_TRUE(VrmlFormat(v).size()>0);
EXPECT_TRUE(VrmlFormat(i).size()>0);
};
TEST(MAIN, Loading){
Surface surf;
EXPECT_TRUE(read_surface_binary(surf, "data/lh.pial"));
FastVolume vol;
MgzLoader mri(vol);
EXPECT_TRUE(mri.Load("data/t1.mgz"));
AnalyzeSurface(surf, vol);
WriteFile("out.wrl", VrmlTemplate(VrmlFormat(surf.v, false), VrmlFormat(surf.n, true), VrmlFormat(surf.c, false), VrmlFormat(surf.tri)));
unsigned char * data = new unsigned char[256*256*256];
for(int i = 0; i < 256*256*256; i ++){
data[i] = vol.vol[i];
};
std::string data_str((char *)data, 256*256*256);
WriteFile("data.raw", data_str);
};
//End of vxVrmlOut_UT.cpp