-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.cpp
96 lines (77 loc) · 2.63 KB
/
driver.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
#include <iostream>
#include <sstream>
#include <string>
#include "VolImage.h"
#define PRINT(x) std::cout << x;
int main(int argc, char *argv[])
{
PRINT("\n\n");
if (argc == 2)
{
std::string imageBase = argv[1];
CHNJAR003::VolImage *temp = new CHNJAR003::VolImage();
temp->readImages(imageBase);
PRINT("Number of bytes required: " + std::to_string(temp->volImageSize()) + "\n\n");
delete temp;
}
else if (argc > 2)
{
std::string imageBase = argv[1];
//PRINT("imageBase=" + imageBase + "\n");
std::string flag1 = argv[2];
//PRINT("flag1=" + flag1 + "\n");
if (flag1 == "-d")
{
if (argc == 6)
{
int imageI = std::stoi(argv[3]);
int imageJ = std::stoi(argv[4]);
std::string outputFileName = argv[5];
CHNJAR003::VolImage *temp = new CHNJAR003::VolImage();
temp->readImages(imageBase);
temp->diffmap(imageI, imageJ, outputFileName);
PRINT("Number of bytes required: " + std::to_string(temp->volImageSize()) + "\n\n");
delete temp;
}
else
{
std::cerr << "Incorrect flag parameters passed in for -d (difference map).";
}
}
else if (flag1 == "-x")
{
if (argc == 5)
{
int imageI = std::stoi(argv[3]);
std::string outputFileName = argv[4];
CHNJAR003::VolImage *temp = new CHNJAR003::VolImage();
temp->readImages(imageBase);
temp->extract(imageI, outputFileName);
PRINT("Number of bytes required: " + std::to_string(temp->volImageSize()) + "\n\n");
delete temp;
}
else
{
std::cerr << "Incorrect flag parameters passed in for -x (slice extraction).";
}
}
else if (flag1 == "-g")
{
if (argc == 5)
{
int row = std::stoi(argv[3]);
std::string outputFileName = argv[4];
CHNJAR003::VolImage *temp = new CHNJAR003::VolImage();
temp->readImages(imageBase);
temp->extractRow(row, outputFileName);
PRINT("Number of bytes required: " + std::to_string(temp->volImageSize()) + "\n\n");
delete temp;
}
else
{
std::cerr << "Incorrect flag parameters passed in for -g (row slice extraction).";
}
}
}
return 0;
}