3
// Copyright (c) 1998-2010 by The VoxBo Development Team
5
// This file is part of VoxBo
7
// VoxBo is free software: you can redistribute it and/or modify it
8
// under the terms of the GNU General Public License as published by
9
// the Free Software Foundation, either version 3 of the License, or
10
// (at your option) any later version.
12
// VoxBo is distributed in the hope that it will be useful, but
13
// WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with VoxBo. If not, see <http://www.gnu.org/licenses/>.
20
// For general information on VoxBo, including the latest complete
21
// source code and binary distributions, manual, and associated files,
22
// see the VoxBo home page at: http://www.voxbo.org/
24
// original version written by Kosh Banerjee
26
/*********************************************************************
28
* VoxBo CalcGS utility. *
29
* K. Banerjee 03/06/2001 *
31
* This program computes the Global Spectrum of the input 4D data *
36
* 4D data file name. Required. *
37
* Flag to specify if the GS should have unit variance or not. *
42
* The Global spectrum is written to a file called *_GS.ref where *
43
* "*" represents the input 4D data file name without the ".tes" *
45
*********************************************************************/
47
void usage(const unsigned short exitValue, char *progName);
51
#include "calc_gs_ps.h"
53
int main(int argc, char *argv[], char *[]) {
56
/*********************************************************************
57
* VARIABLES: TYPE: DESCRIPTION: *
58
* ---------- ----- ------------ *
59
* unitVar bool TRUE if the user wants the GS to have *
61
* printHelp bool Will be set to TRUE is the user omits *
62
* required options or wants usage *
63
* information printed out. *
64
* printVersion bool Will be set to TRUE is the user wants *
65
* the global VoxBo version printed. *
66
*********************************************************************/
72
/*********************************************************************
73
* Now processing the command line options. *
75
* -h ==> Display usage information. *
76
* -i ==> Specifies the input 4D data file. *
77
* -u ==> The unit variance flag. *
78
* -v ==> Print global VoxBo version. *
79
*********************************************************************/
81
a.setArgs("-h", "--help", 0);
82
a.setArgs("-i", "--inputfile", 1);
83
a.setArgs("-u", "--unitvariance", 1);
84
a.setArgs("-v", "--version", 0);
85
a.parseArgs(argc, argv);
86
string errstring = a.badArg();
87
if (errstring.size()) {
88
errstring = "[E] unknown flag: " + errstring;
89
printErrorMsg(VB_ERROR, errstring.c_str());
92
if (a.flagPresent("-h"))
94
tesFile = a.getFlaggedArgs("-i")[0];
95
unitVar = atoi(a.getFlaggedArgs("-u")[0].c_str());
96
if (a.flagPresent("-v"))
97
printf("\nVoxBo v%s\n",vbversion.c_str());
98
if (tesFile.size() == 0) {
99
cerr << "ERROR: Must specify the input 4D data file name." << endl;
102
CalcGs myGs(tesFile);
104
myGs.normalizeVariance();
109
/*********************************************************************
110
* This function calls genusage() to write out the usage information. *
114
* exitValue: The desired exit value. *
115
* progName: String holding the program name. *
120
*********************************************************************/
121
void usage(const unsigned short, char *)
123
printf("\nVoxBo calcgs (v%s)\n",vbversion.c_str());
125
printf(" Calc GS routine for VoxBo.\n");
127
printf(" calcgs -h -i[4D data file name] -u -v\n");
129
printf(" -h Print usage information. Optional.\n");
130
printf(" -i <4D data file> Specify the input 4D data file. Required.\n");
131
printf(" -u Unit variance flag for GS. Optional.\n");
132
printf(" -v Global VoxBo version number. Optional.\n\n");