1 |
|
|
/* |
2 |
|
|
Teem: Tools to process and visualize scientific data and images . |
3 |
|
|
Copyright (C) 2013, 2012, 2011, 2010, 2009 University of Chicago |
4 |
|
|
Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann |
5 |
|
|
Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah |
6 |
|
|
|
7 |
|
|
This library is free software; you can redistribute it and/or |
8 |
|
|
modify it under the terms of the GNU Lesser General Public License |
9 |
|
|
(LGPL) as published by the Free Software Foundation; either |
10 |
|
|
version 2.1 of the License, or (at your option) any later version. |
11 |
|
|
The terms of redistributing and/or modifying this software also |
12 |
|
|
include exceptions to the LGPL that facilitate static linking. |
13 |
|
|
|
14 |
|
|
This library is distributed in the hope that it will be useful, |
15 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 |
|
|
Lesser General Public License for more details. |
18 |
|
|
|
19 |
|
|
You should have received a copy of the GNU Lesser General Public License |
20 |
|
|
along with this library; if not, write to Free Software Foundation, Inc., |
21 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 |
|
|
*/ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include <teem/biff.h> |
26 |
|
|
#include <teem/nrrd.h> |
27 |
|
|
|
28 |
|
|
int |
29 |
|
|
main(int argc, char *argv[]) { |
30 |
|
|
char *me, *err; |
31 |
|
|
int enc, form; |
32 |
|
|
|
33 |
|
2 |
me = argv[0]; |
34 |
✗✓ |
1 |
if (2 == argc) { |
35 |
|
|
if (!strcmp(argv[1], "--version")) { |
36 |
|
|
char vbuff[AIR_STRLEN_LARGE]; |
37 |
|
|
airTeemVersionSprint(vbuff); |
38 |
|
|
printf("%s\n", vbuff); |
39 |
|
|
exit(0); |
40 |
|
|
} else if (!strcmp(argv[1], "--help")) { |
41 |
|
|
char par1[] = "\n Usage: nrrdSanity\n "; |
42 |
|
|
char par2[] = "\t\t\t\t" |
43 |
|
|
"nrrdSanity calls the nrrdSanity() check to verify the correctness " |
44 |
|
|
"of all the information (set at compile-time) about the architecture, " |
45 |
|
|
"such as endianness, 32/64-bit, and the size of various types, as " |
46 |
|
|
"well as running sanity checks on the global default (nrrdDefault*) " |
47 |
|
|
"and state (nrrdState*) variables. "; |
48 |
|
|
char par3[] = "\t\t\t\t" |
49 |
|
|
"As a convenience, nrrdSanity also list the availability of the " |
50 |
|
|
"different formats and data encodings (for Nrrd files) supported " |
51 |
|
|
"by this build.\n "; |
52 |
|
|
_hestPrintStr(stdout, 1, 0, 78, par1, AIR_FALSE); |
53 |
|
|
_hestPrintStr(stdout, 1, 0, 78, par2, AIR_FALSE); |
54 |
|
|
_hestPrintStr(stdout, 1, 0, 78, par3, AIR_FALSE); |
55 |
|
|
exit(0); |
56 |
|
|
} else { |
57 |
|
|
fprintf(stderr, "%s: unexpected arguments; " |
58 |
|
|
"\"%s --help\" for more information\n", me, me); |
59 |
|
|
exit(1); |
60 |
|
|
} |
61 |
|
|
} |
62 |
|
|
/* else it was run with no arguments */ |
63 |
✗✓ |
1 |
if (!nrrdSanity()) { |
64 |
|
|
printf("%s: nrrd sanity check FAILED:\n%s\n", me, err = biffGet(NRRD)); |
65 |
|
|
free(err); |
66 |
|
|
return 1; |
67 |
|
|
} |
68 |
|
|
else { |
69 |
|
1 |
printf("%s: nrrd sanity check passed.\n", me); |
70 |
|
1 |
printf("\n"); |
71 |
|
1 |
printf("%s: encodings supported in this build:\n", me); |
72 |
✓✓ |
14 |
for (enc=nrrdEncodingTypeUnknown+1; enc<nrrdEncodingTypeLast; enc++) { |
73 |
|
12 |
printf("%s: %s\n", airEnumStr(nrrdEncodingType, enc), |
74 |
|
6 |
nrrdEncodingArray[enc]->available() ? "yes" : "not available"); |
75 |
|
|
} |
76 |
|
1 |
printf("%s: formats supported in this build:\n", me); |
77 |
✓✓ |
14 |
for (form=nrrdFormatTypeUnknown+1; form<nrrdFormatTypeLast; form++) { |
78 |
|
12 |
printf("%s: %s\n", airEnumStr(nrrdFormatType, form), |
79 |
|
6 |
nrrdFormatArray[form]->available() ? "yes" : "not available"); |
80 |
|
|
} |
81 |
|
|
} |
82 |
|
|
|
83 |
|
1 |
return 0; |
84 |
|
1 |
} |