File: appsTestDriver.sh.in

package info (click to toggle)
cmtk 3.3.1p1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,504 kB
  • sloc: cpp: 87,098; ansic: 23,347; sh: 3,896; xml: 1,551; perl: 707; makefile: 332
file content (2925 lines) | stat: -rwxr-xr-x 129,794 bytes parent folder | download | duplicates (7)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
#!/bin/bash

##
##  Copyright 2004-2014 SRI International
##
##  Copyright 1997-2011 Torsten Rohlfing
##
##  This file is part of the Computational Morphometry Toolkit.
##
##  http://www.nitrc.org/projects/cmtk/
##
##  The Computational Morphometry Toolkit is free software: you can
##  redistribute it and/or modify it under the terms of the GNU General Public
##  License as published by the Free Software Foundation, either version 3 of
##  the License, or (at your option) any later version.
##
##  The Computational Morphometry Toolkit is distributed in the hope that it
##  will be useful, but WITHOUT ANY WARRANTY; without even the implied
##  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License along
##  with the Computational Morphometry Toolkit.  If not, see
##  <http://www.gnu.org/licenses/>.
##
##  $Revision: 5370 $
##
##  $LastChangedDate: 2014-07-28 21:26:05 -0700 (Mon, 28 Jul 2014) $
##
##  $LastChangedBy: torsten_at_home $
##

RUNTEST=$1
CONFIG=$2
VALGRIND=$3

BUILDNAME=@BUILDNAME@
DATADIR=@CMTK_DATA_ROOT@/testing/inputs

BINDIR=@EXECUTABLE_OUTPUT_PATH@/${CONFIG}
if [ ! -d ${BINDIR}/. ]; then
    BINDIR=@EXECUTABLE_OUTPUT_PATH@
fi

BASELINE_DEFAULT=@CMTK_DATA_ROOT@/testing/baseline/${RUNTEST}
BASELINE=${BINDIR}/../testing/baseline/${RUNTEST}
if [ ! -d ${BASELINE} ]; then
    BASELINE=${BASELINE_DEFAULT}
fi

HOSTNAME=`uname -n`

NUMDIFF=@NUMDIFF_EXECUTABLE@

tmpdir=${BINDIR}/../testing/temporary/${HOSTNAME}/${RUNTEST}
if [ -e ${tmpdir} ]; then
    rm -rf ${tmpdir}
fi
mkdir -p ${tmpdir}

sqlite=${BINDIR}/sqlite
if [ ! -f ${sqlite} ]; then
    sqlite=sqlite3
fi

sed=/opt/local/bin/gsed
if [ ! -f ${sed} ]; then
    sed=sed
fi

cd ${DATADIR}

run()
{
    cmd=$*

    echo "pushd $PWD; ${BINDIR}/$cmd; popd" 1>&2
    if ${VALGRIND} ${BINDIR}/$cmd; then
	return
    else
	exit 1
    fi
}

run_expect_fail()
{
    cmd=$*

    echo "pushd $PWD; ${BINDIR}/$cmd; popd"
    if ${BINDIR}/$cmd; then
	exit 1
    else
	return
    fi
}

run_eval()
{
    cmd=$*

    echo "pushd $PWD; $cmd; popd"
    if eval "${VALGRIND} $cmd"; then
	return
    else
	exit 1
    fi
}

run_eval_expect_fail()
{
    cmd=$*

    echo "pushd $PWD; $cmd; popd"
    if eval "${VALGRIND} $cmd"; then
	exit 1
    else
	return
    fi
}

get_unzipped()
{
    if test -f ${1}.gz; then
	if [ "`uname`" = "Darwin" ]; then
	    local tmp=`mktemp /tmp/temp.XXXX`
	else
	    local tmp=`mktemp`
	fi
	gzip -cd ${1}.gz > ${tmp}
	echo ${tmp}
    else
	echo ${1}
    fi
}

remove_if_tempfile()
{
    for f in $*; do
	local dir=`dirname $f`
	if [ "${dir}" == "/tmp" ]; then
	    rm $f
	fi 
    done
}

check_result()
{
    baseline=`get_unzipped ${BASELINE}/$1`
    result=`get_unzipped ${tmpdir}/$1`

    if test ! -f ${result}; then
	echo "Results file ${result} does not exist"
	remove_if_tempfile ${baseline} ${result}
	exit 1
    fi

    if test ! -f ${baseline}; then
	echo "Baseline file ${baseline} does not exist"
	remove_if_tempfile ${baseline} ${result}
	exit 1
    fi

    local diff="cmp"
    if file ${result} | fgrep text; then
##	diff="diff --strip-trailing-cr"
	diff="${NUMDIFF} --relative-tolerance=1e-5 --absolute-tolerance=5e-7"
    fi

    echo "${diff} ${tmpdir}/$1 ${BASELINE}/$1"

    if ${diff} $result $baseline; then
	remove_if_tempfile ${baseline} ${result}
	return
    else
	remove_if_tempfile ${baseline} ${result}
	exit 1
    fi
}

check_results()
{
    for r in $*; do
	check_result $r
    done
}

check_image()
{
    baseline=${BASELINE}/$1
    result=${tmpdir}/$1
    
    abs_threshold=1e-5 ## if this is made much smaller, need to adjust "scale=" on next line:

    # see if maximum relative difference between images exceeds 1e-6
    difference=`${BINDIR}/similarity $baseline $result | fgrep SIMval | cut -f3`
    compare=`echo "SCALE; $difference > $abs_threshold" | sed 's/e/*10^/g;s/SCALE/scale=10/' | bc`

    echo difference=$difference compare=$compare

    if [ "${compare}" = "0" ]; then
	return
    else
	echo "Absolute image difference $difference exceeds threshold $abs_threshold"
    fi

    rel_threshold=1e-5 ## if this is made much smaller, need to adjust "scale=" on next line:

    difference=`${BINDIR}/similarity $baseline $result | fgrep SIMval | cut -f4`
    compare=`echo "SCALE; $difference > $rel_threshold" | sed 's/e/*10^/g;s/SCALE/scale=10/' | bc`

    echo difference=$difference compare=$compare

    if [ "${compare}" = "0" ]; then
	return
    else
	echo "Relative image difference $difference exceeds threshold $rel_threshold"
	exit 1
    fi
}

check_images()
{
    for r in $*; do
	check_image $r
    done
}

case ${RUNTEST} in
    average_imagesMean)
	run average_images -o ${tmpdir}/average.hdr spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results average.img
	;;
    average_imagesMeanNormPadd)
	run average_images -o ${tmpdir}/average.hdr --set-padding-value 0 --normalize-mean-stdev spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results average.img
	;;
    average_imagesMeanAbsLog)
	run average_images --set-padding-value 0 -o ${tmpdir}/average.hdr --abs --log spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results average.img
	;;
    average_imagesVariance)
	run average_images -o ${tmpdir}/variance.hdr --var spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results variance.img
	;;
    average_imagesStDev)
	run average_images -o ${tmpdir}/stdev.hdr --stdev spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results stdev.img
	;;
    average_imagesEntropy)
	run average_images -o ${tmpdir}/entropy.hdr --entropy spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results entropy.img
	;;
    average_imagesZScore)
	run average_images -o ${tmpdir}/zscore.hdr --zscore spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results zscore.img
	;;
    avg_admDefault2)
        run avg_adm --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list
	check_results avg.img avg.warp
	;;
    avg_admDefault3)
        run avg_adm --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    avg_admJacobianFloat)
        run avg_adm --jacobian --float --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    avg_admLabels)
        run avg_adm --nn --label --replace-from spgr_brain_ --replace-to parc --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    avg_admPaddOutZeroNN)
        run avg_adm --nn --pad-out 0 --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    avg_admNoReferenceModelCubic)
        run avg_adm --byte --cubic --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp --no-ref-model spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    avg_admNoScaleModelAutoScale)
        run avg_adm --byte --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp --no-scale-model --auto-scale spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    avg_admWithAffineNoRefData)
        run avg_adm --byte --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp --no-ref-data --with-affine spgr_brain_12_warp.list spgr_brain_13_warp.list
	check_results avg.img avg.warp
	;;
    concat_affineABA)
	run concat_affine -o ${tmpdir}/concat.xform affineA.xform affineB.xform affineA.xform
	check_results concat.xform
	;;
    concat_affineABAInvert)
	run concat_affine --invert-output -o ${tmpdir}/concat.xform affineA.xform affineB.xform affineA.xform
	check_results concat.xform
	;;
    concat_affineAB1A)
	run concat_affine -o ${tmpdir}/concat.xform affineA.xform --inverse affineB.xform affineA.xform
	check_results concat.xform
	;;
    concat_affineAA1)
	run concat_affine -o ${tmpdir}/concat.xform affineA.xform --inverse affineA.xform
	check_results concat.xform
	;;
    concat_affineA1A)
	run concat_affine -o ${tmpdir}/concat.xform -- --inverse affineA.xform affineA.xform
	check_results concat.xform
	;;
    convert_warpFractional)
	run convert_warp --fractional 0.5 vol001_mr_t0t1_warp.xform ${tmpdir}/fractional.xform
	check_results fractional.xform
	;;
    convert_warpDeformation)
	run convert_warp --deformation-only vol001_mr_t0t1_warp.xform ${tmpdir}/deformation.xform
	check_results deformation.xform
	;;
    convertxType)
        run convertx --byte --char --float --double --int --uint --short --ushort spgr_brain_1.hdr ${tmpdir}/convert.nii
	check_results convert.nii
	;;
    convertxLabels)
        run convertx --labels binary_mask.nii ${tmpdir}/convert.nii
	check_results convert.nii
	;;
    convertxBinarize)
        run convertx --binarize-thresh 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr
	check_results thresh.img
	;;
    convertxBinarizeOtsu)
        run convertx --otsu-thresh --byte phantom_ax.nii ${tmpdir}/binary.nii
	check_results binary.nii
	;;
    convertxBinarizeOtsuNBins)
        run convertx --otsu-thresh-nbins 128 --byte phantom_ax.nii ${tmpdir}/binary.nii
	check_results binary.nii
	;;
    convertxPruneHighLow)
        run convertx --prune-histogram 16 pat001_pet.hdr ${tmpdir}/prune.nii
	check_results prune.nii
	;;
    convertxPruneHigh)
        run convertx --prune-histogram-high 16 pat001_pet.hdr ${tmpdir}/prune.nii
	check_results prune.nii
	;;
    convertxPruneLow)
        run convertx --prune-histogram-low 16 pat001_pet.hdr ${tmpdir}/prune.nii
	check_results prune.nii
	;;
    convertxBoundaryMap)
	run convertx --boundary-map parc1.hdr ${tmpdir}/boundary_map.hdr
	check_results boundary_map.img
	;;
    convertxConnectedComponents)
        run convertx --connected-components binary_mask.nii ${tmpdir}/connected.hdr
	check_results connected.img
	;;
    convertxDistanceUnsigned)
        run convertx --distance-map parc1_bin.hdr ${tmpdir}/dmap.hdr
	check_results dmap.img
	;;
    convertxLaplace)
        run convertx --float --laplace-filter spgr_brain_1.hdr ${tmpdir}/laplace.hdr
	check_results laplace.img
	;;
    convertxMapValues)
        run convertx --map-values 82,86:254 --map-values 16:255 --set-padding 128 --map-values 0 parc3.hdr ${tmpdir}/mapped.hdr
	check_results mapped.img
        ;;
    convertxMapValues2)
        run convertx --set-padding 128 --map-values 82,86:254+16:255+0 parc3.hdr ${tmpdir}/mapped.hdr
	check_results mapped.img
        ;;
    convertxMapValues3)
        run convertx --set-padding 128 --map-values 16:255+82,86:254+0 parc3.hdr ${tmpdir}/mapped.hdr
	check_results mapped.img
        ;;
    convertxMapValuesOnly)
        run convertx  --set-padding 255 --map-values-only 82,86:1 parc3.hdr ${tmpdir}/mapped.hdr
	check_results mapped.img
        ;;
    convertxMapValuesOnly2)
        run convertx  --set-padding 255 --map-values-only 82:1+86:1 parc3.hdr ${tmpdir}/mapped.hdr
	check_results mapped.img
        ;;
    convertxRevert)
        run convertx --revert parc1_bin.hdr ${tmpdir}/revert.hdr
	check_results revert.img
        run convertx --revert parc1.hdr ${tmpdir}/revert.hdr
	check_results revert.img
	;;
    convertxDistanceSigned)
        run convertx --signed-distance-map parc1_bin.hdr ${tmpdir}/dmap.hdr
	check_results dmap.img
	;;
    convertxDistanceSigned2)
        run convertx --signed-distance-map parc1.hdr ${tmpdir}/dmap.hdr
	check_results dmap.img
	;;
    convertxBoundaryMapMultiValue)
	run convertx --multi-boundary-map parc1.hdr ${tmpdir}/boundary_map_multi.hdr
	check_results boundary_map_multi.img
	;;
    convertxCropThresholdWriteRegion)
        run_eval "${BINDIR}/convertx --crop-by-threshold-write-region 1 spgr_brain_1.hdr ${tmpdir}/cropped.nii > ${tmpdir}/crop.txt"
	check_results cropped.nii crop.txt
	;;
    convertxCropRegion1)
        run_eval "${BINDIR}/convertx --crop-by-index 2,2,2,12,12,12 spgr_brain_1.hdr ${tmpdir}/cropped.nii"
	check_results cropped.nii
	;;
    convertxCropRegion2)
        run_eval "${BINDIR}/convertx --crop-by-index 10,10,10,-10,-10,-10 spgr_brain_1.hdr ${tmpdir}/cropped.nii"
	check_results cropped.nii
	;;
    convertxResample)
	run convertx --resample 1.0 phantom_ax.nii ${tmpdir}/resample.nii
	check_results resample.nii
	;;
    convertxResampleExactLabels)
	run convertx --resample-exact 10 lvote_atlas_l0.nii ${tmpdir}/resample.nii
	check_results resample.nii
	;;
    convertxDownsample)
	run convertx --downsample-average 8,4,1 phantom_ax.hdr ${tmpdir}/downsample.hdr
	check_results downsample.hdr downsample.img
	;;
    convertxDownsampleNiftiSform)
	run convertx --downsample-average 8,4,1 phantom_ax_sform.nii ${tmpdir}/downsample_ax.nii
	run convertx --downsample-average 1,8,4 phantom_sa_sform.nii ${tmpdir}/downsample_sa.nii
	run convertx --downsample-average 4,1,8 phantom_co_sform.nii ${tmpdir}/downsample_co.nii
	check_results downsample_ax.nii downsample_sa.nii downsample_co.nii
	;;
    convertxDownsampleNiftiQform)
	run convertx --downsample-average 8,4,1 phantom_ax_qform.nii ${tmpdir}/downsample_ax.nii
	run convertx --downsample-average 1,8,4 phantom_sa_qform.nii ${tmpdir}/downsample_sa.nii
	run convertx --downsample-average 4,1,8 phantom_co_qform.nii ${tmpdir}/downsample_co.nii
	check_results downsample_ax.nii downsample_sa.nii downsample_co.nii
	;;
    convertxDownsampleNiftiQformSform)
	run convertx --downsample-average 8,4,1 phantom_ax_qform_sform.nii ${tmpdir}/downsample_ax.nii
	run convertx --downsample-average 1,8,4 phantom_sa_qform_sform.nii ${tmpdir}/downsample_sa.nii
	run convertx --downsample-average 4,1,8 phantom_co_qform_sform.nii ${tmpdir}/downsample_co.nii
	check_results downsample_ax.nii downsample_sa.nii downsample_co.nii
	;;
    convertxDownsampleNrrd)
	run convertx --downsample-average 8,4,1 phantom_ax.nhdr ${tmpdir}/downsample.nhdr
	check_results downsample.nhdr downsample.raw
	;;
    convertxDownsampleSelect)
	run convertx --downsample-select 8,4,1 phantom_ax.hdr ${tmpdir}/downsample.hdr
	check_results downsample.hdr downsample.img
	;;
    convertxDownsampleSelectNrrd)
	run convertx --downsample-select 8,4,1 phantom_ax.nhdr ${tmpdir}/downsample.nhdr
	check_results downsample.nhdr downsample.raw
	;;
    convertxFlipX)
        run convertx --flip-x parc1_bin.hdr ${tmpdir}/flip.hdr
	check_results flip.img
	;;
    convertxFlipYZ)
        run convertx --flip-y --flip-z parc1_bin.hdr ${tmpdir}/flip.hdr
	check_results flip.img
	;;
    convertxErodeDilateErode)
	run convertx --erode 1 --dilate 2 --erode 1 parc1_bin.hdr ${tmpdir}/parc1_ede.img
	check_results parc1_ede.img
	;;
    convertxDilateErodeDilate)
	run convertx --dilate 1 --erode 2 --dilate 1 parc1_bin.hdr ${tmpdir}/parc1_ded.img
	check_results parc1_ded.img
	;;
    convertxErodeByDistance)
	run convertx --erode-distance 10 parc1_bin.hdr ${tmpdir}/parc1_erode.nii
	check_results parc1_erode.nii
	;;
    convertxErodeByDistanceMultiLabel)
	run convertx --erode-distance-multilabel 10 lvote_atlas_l0.nii ${tmpdir}/erode.nii
	check_results erode.nii
	;;
    convertxDilateByDistance)
	run convertx --dilate-distance 10 parc1_bin.hdr ${tmpdir}/parc1_dilate.nii
	check_results parc1_dilate.nii
	;;
    convertxGaussianFilterSigma)
	run convertx --gaussian-filter-sigma 5.0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxGaussianFilterFWHM)
        run convertx --gaussian-filter-fwhm 10.0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxHistogramEqualization)
        run convertx --histogram-equalization spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxHistogramEqualizationNBins)
        run convertx --histogram-equalization-nbins 32 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxMatchMeanSDev)
        run convertx --match-mean-sdev spgr_brain_2.hdr spgr_brain_1.hdr ${tmpdir}/match.nii
        check_results match.nii
        ;;
    convertxMatchHistograms)
        run convertx --match-histograms spgr_brain_2.hdr spgr_brain_1.hdr ${tmpdir}/match.nii
        check_results match.nii
        ;;
    convertxMask)
	run convertx --mask spgr_3t_mask.hdr spgr_3t.hdr ${tmpdir}/masked.hdr
	check_results masked.img
	;;
    convertxMaskInverse)
	run convertx --mask-inverse spgr_3t_mask.hdr spgr_3t.hdr ${tmpdir}/masked.hdr
	check_results masked.img
	;;
    convertxMedianFilter1)
	run convertx --median-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxMedianFilter2)
	run convertx --median-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxMedianFilterXYZ)
	run convertx --median-filter 2,2,1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxMeanFilter)
	run convertx --float --mean-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastMean0Filter)
	run convertx --float --fast-mean-filter 0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastMean1Filter)
	run convertx --float --fast-mean-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastMean2Filter)
	run convertx --float --fast-mean-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastMean2PadFilter)
	run convertx --set-padding 0 --float --fast-mean-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxVarianceFilter)
	run convertx --float --variance-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastVariance0Filter)
	run convertx --float --fast-variance-filter 0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastVariance1Filter)
	run convertx --float --fast-variance-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastVariance2Filter)
	run convertx --float --fast-variance-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxFastVariance2PadFilter)
	run convertx --set-padding 0 --float --fast-variance-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxThirdMomentFilter)
	run convertx --float --third-moment-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxStandardDeviationFilter)
	run convertx --float --standard-deviation-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxSmoothnessFilter)
	run convertx --float --smoothness-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.img
	;;
    convertxNiftiToAnalyze)
	run convertx spgr_brain_1.nii ${tmpdir}/spgr_brain_1.hdr
	check_results spgr_brain_1.hdr spgr_brain_1.img
	;;
    convertxNiftiToMetaImage)
	run convertx spgr_brain_1.nii ${tmpdir}/spgr_brain_1.mha
	check_results spgr_brain_1.mha
	;;
    convertxAnalyzeToNifti)
	run convertx spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.nii
	check_results spgr_brain_1.nii
	;;
    convertxAnalyzeToNiftiRAS)
        export CMTK_LEGACY_WRITE_IMAGES_RAS=1
	run convertx spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.nii
	unset CMTK_LEGACY_WRITE_IMAGES_RAS
	check_results spgr_brain_1.nii	
	;;
    convertxNiftiDetachedToNifti)
	run convertx spgr_brain_nifti.hdr ${tmpdir}/spgr_brain_1.nii
	check_results spgr_brain_1.nii
	;;
    convertxAnalyzeToNiftiDetached)
	run convertx spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.img
	check_results spgr_brain_1.hdr spgr_brain_1.img
	;;
    convertxUncompressedNIFTI1)
        export CMTK_WRITE_UNCOMPRESSED=1
        run convertx parc1_bin.hdr ${tmpdir}/out.nii
	unset CMTK_WRITE_UNCOMPRESSED
	if [ ! -e ${tmpdir}/out.nii ]; then exit 1; fi
	;;
    convertxUncompressedNIFTI2)
        export CMTK_WRITE_UNCOMPRESSED=1
        run convertx parc1_bin.hdr ${tmpdir}/out.nii.gz
	unset CMTK_WRITE_UNCOMPRESSED
	if [ ! -e ${tmpdir}/out.nii.gz ]; then exit 1; fi
	;;
    convertxUncompressedNIFTI3)
        unset CMTK_WRITE_UNCOMPRESSED
        run convertx parc1_bin.hdr ${tmpdir}/out.nii
	if [ ! -e ${tmpdir}/out.nii.gz ]; then exit 1; fi
	;;
    convertxUncompressedNIFTI4)
        unset CMTK_WRITE_UNCOMPRESSED
        run convertx parc1_bin.hdr ${tmpdir}/out.nii.gz
	if [ ! -e ${tmpdir}/out.nii.gz ]; then exit 1; fi
	;;
    convertxThresholdBelow)
	run convertx --set-padding 0 --thresh-below 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr
	check_results thresh.img
	;;
    convertxThresholdAbove)
        run convertx --set-padding 0 --thresh-above 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr
	check_results thresh.img
	;;
    convertxThresholdBelowToPadding)
	run convertx --set-padding 0 --thresh-below-to-padding 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr
	check_results thresh.img
	;;
    convertxThresholdAboveToPadding)
        run convertx --set-padding 0 --thresh-above-to-padding 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr
	check_results thresh.img
	;;
    convertxScaleToRange)
	run convertx --scale-to-range 128:192 spgr_brain_1.hdr ${tmpdir}/scaled.hdr
	check_results scaled.img
	;;
    convertxReplacePadding)
	run convertx --byte --set-padding 0 --replace-padding 255 spgr_brain_1.hdr ${tmpdir}/replaced.hdr
	check_results replaced.img
        ;;
    convertxReplaceInfNaN)
	run convertx --replace-inf-nan 255 infinite.nii ${tmpdir}/replaced.hdr
	check_results replaced.img
        ;;
    dbtool_AddImages)
      run dbtool add_images ${tmpdir}/db.sqlite image1 image2
      ${sqlite} ${tmpdir}/db.sqlite "SELECT * FROM images ORDER BY path ASC" > ${tmpdir}/images
      check_results images
      ;;
    dbtool_AddImages2)
      run dbtool add_images ${tmpdir}/db.sqlite image1 image2 image3 image3
      ${sqlite} ${tmpdir}/db.sqlite "SELECT * FROM images ORDER BY path ASC" > ${tmpdir}/images
      check_results images
      ;;
    dbtool_ListSpace)
      run_eval "${BINDIR}/dbtool list_space images.sqlite image1c > ${tmpdir}/list.txt"
      check_results list.txt
      ;;
    dbtool_GetXform1)
      run_eval "${BINDIR}/dbtool get_xform imagesSingleXform.sqlite image1.nii image2.nii > ${tmpdir}/xform.txt"
      check_results xform.txt
      ;;
    dbtool_GetXform2)
      run_eval "${BINDIR}/dbtool get_xform imagesSingleXform.sqlite image2.nii image1.nii > ${tmpdir}/xform.txt"
      check_results xform.txt
      ;;
    dbtool_GetXform3)
      run_eval "${BINDIR}/dbtool get_xform imagesMultiXforms.sqlite image1.nii image2.nii > ${tmpdir}/xform.txt"
      check_results xform.txt
      ;;
    dbtool_GetXform4)
      run_eval "${BINDIR}/dbtool get_xform imagesMultiXforms.sqlite image2.nii image1.nii > ${tmpdir}/xform.txt"
      check_results xform.txt
      ;;
    dbtool_GetXform5)
      run_eval "${BINDIR}/dbtool get_xform --all imagesMultiXforms.sqlite image1.nii image2.nii > ${tmpdir}/xform.txt"
      check_results xform.txt
      ;;
    dbtool_GetXform6)
      run_eval "${BINDIR}/dbtool get_xform --all imagesMultiXforms.sqlite image2.nii image1.nii > ${tmpdir}/xform.txt"
      check_results xform.txt
      ;;
    dcm2image)
	run dcm2image -O ${tmpdir}/00%n.hdr dcm/
	check_results 001.hdr 001.img 002.hdr 002.img 003.hdr 003.img
	;;
    dcm2imageSubs)
        run dcm2image -O ${tmpdir}/%D_%R_%E%N.nii dcm/
	check_results 3-plane-localizer_5.104_1.52-1.nii 3-plane-localizer_5.104_1.52-2.nii 3-plane-localizer_5.104_1.52-3.nii
	;;
    dcm2imageZ)
	run dcm2image -O ${tmpdir}/00%n.nii dcmz/
	check_results 001.nii 002.nii 003.nii
	;;
    dcm2imageNrrd)
	run dcm2image -O ${tmpdir}/00%n.nhdr dcm/
	check_results 001.nhdr 001.raw 002.nhdr 002.raw 003.nhdr 003.raw
	;;
    dcm2imageEmbedPatientNameAnalyze)
	run dcm2image --embed PatientName -O ${tmpdir}/00%n.hdr dcm/
	check_results 001.hdr 002.hdr 003.hdr
	;;
    dcm2imageEmbedPatientNameNifti)
	run dcm2image --embed PatientName -O ${tmpdir}/00%n.nii dcm/
	check_results 001.nii 002.nii 003.nii
	;;
    dcm2imageEmbedSeriesDescriptionNifti)
	run dcm2image --embed SeriesDescription -O ${tmpdir}/00%n.nii dcm/
	check_results 001.nii 002.nii 003.nii
	;;
    dcm2imageEmbedStudyIDDateNifti)
        run dcm2image --embed StudyID_StudyDate -O ${tmpdir}/00%n.nii dcm/
	check_results 001.nii
	;;
    dcm2imageEmbedPatientNameNrrd)
	run dcm2image --embed PatientName -O ${tmpdir}/00%n.nhdr dcm/
	check_results 001.nhdr 002.nhdr 003.nhdr
	;;
    dcm2imageMosaic)
	run dcm2image -x --include-identifiers -O ${tmpdir}/00.nii mr-mosaic/
	check_results 00.nii 00.nii.xml
	;;
    dcm2imageMosaicPACS)
	run dcm2image -x --include-identifiers -O ${tmpdir}/00.nii mr-mosaic-pacs/
	check_results 00.nii 00.nii.xml
	;;
    dcm2imageDiffusionGEXML)
        run dcm2image -x --tolerance 1e-4 --include-identifiers -O ${tmpdir}/%n.nii mr-dwi-ge/
	check_results 1.nii 1.nii.xml 2.nii 2.nii.xml
	;;
    dcm2imageDiffusionSiemensXML)
        run dcm2image -x --include-identifiers -O ${tmpdir}/%n.nii mr-dwi-siemens/
	check_results 1.nii 1.nii.xml 2.nii 2.nii.xml 3.nii 3.nii.xml 4.nii 4.nii.xml
	;;
    dcm2imageMosaicAnon)
	run dcm2image -x -O ${tmpdir}/00.nii mr-mosaic/
	check_results 00.nii 00.nii.xml
	;;
    dcm2imageMosaicPACSAnon)
	run dcm2image -x -O ${tmpdir}/00.nii mr-mosaic-pacs/
	check_results 00.nii 00.nii.xml
	;;
    dcm2imageDiffusionGEXMLAnon)
        run dcm2image -x --tolerance 1e-4 -O ${tmpdir}/%n.nii mr-dwi-ge/
	check_results 1.nii 1.nii.xml 2.nii 2.nii.xml
	;;
    dcm2imageDiffusionSiemensXMLAnon)
        run dcm2image -x -O ${tmpdir}/%n.nii mr-dwi-siemens/
	check_results 1.nii 1.nii.xml 2.nii 2.nii.xml 3.nii 3.nii.xml 4.nii 4.nii.xml
	;;
    dcm2imageExclude)
        run dcm2image --exclude ImageOrientationPatient=1\\-0\\0\\-0\\1\\0 -O ${tmpdir}/image%n.nii dcm/
	check_results image1.nii image2.nii
	;;
    dcm2imageInclude)
        run dcm2image --filter ImageOrientationPatient=1\\-0\\0\\-0\\1\\0 -O ${tmpdir}/image%n.nii dcm/
	check_results image.nii
	;;
    dcm2imageSubsDirName)
        run dcm2image -x --tolerance 1e-4 --include-identifiers -O ${tmpdir}/%1/%0.nii mr-dwi-ge/ mr-dwi-siemens/
	check_results mr-dwi-ge/I0150.dcm.nii mr-dwi-ge/I0150.dcm.nii.xml mr-dwi-ge/I0280.dcm.nii mr-dwi-ge/I0280.dcm.nii.xml
	check_results mr-dwi-siemens/I0001.dcm.nii mr-dwi-siemens/I0001.dcm.nii.xml mr-dwi-siemens/I0002.dcm.nii mr-dwi-siemens/I0002.dcm.nii.xml 
	check_results mr-dwi-siemens/I0003.dcm.nii mr-dwi-siemens/I0003.dcm.nii.xml mr-dwi-siemens/I0004.dcm.nii mr-dwi-siemens/I0004.dcm.nii.xml
	;;
    describeEmpty)
	run_eval "${BINDIR}/describe -m empty.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMountPoints)
        run_eval "CMTK_MOUNTPOINTS=INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMountPointsMulti)
        run_eval "CMTK_MOUNTPOINTS=DUMMY=/fs/dummy,INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMountPointsPrefix)
        run_eval "CMTK_MOUNTPOINTS=^INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMountPointsPrefixInvalid)
        run_eval "CMTK_MOUNTPOINTS=^NPUTS=INVALID,^INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeDICOM)
	run_eval "${BINDIR}/describe -m dcm/I0007.dcm > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeDICOMZ)
	run_eval "${BINDIR}/describe -m dcmz/I0007.dcm > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMosaicDICOM)
	run_eval "${BINDIR}/describe -m mr-mosaic/fmri.dcm > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMosaicPACSDICOM)
	run_eval "${BINDIR}/describe -m mr-mosaic-pacs/image.dcm > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeVanderbilt)
	run_eval "${BINDIR}/describe -m vanderbilt/header.ascii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeBZip2a)
        run_eval "${BINDIR}/describe -m bzip_test.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeBZip2b)
        run_eval "${BINDIR}/describe -m bzip_test.nii.bz2 > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeLZMAa)
        run_eval "${BINDIR}/describe -m lzma_test.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeLZMAb)
        run_eval "${BINDIR}/describe -m lzma_test.nii.lzma > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeXZa)
        run_eval "${BINDIR}/describe -m xz_test.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeXZb)
        run_eval "${BINDIR}/describe -m xz_test.nii.xz > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMR1)
	run_eval "${BINDIR}/describe -m parc1_bin.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMR2)
	run_eval "${BINDIR}/describe -m phantom_ax.hdr phantom_co.hdr phantom_sa.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMR3)
	run_eval "${BINDIR}/describe -m header_only.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMR4)
	run_eval "${BINDIR}/describe -m phantom_ax.nii phantom_co.nii phantom_sa.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeHuman)
	run_eval "${BINDIR}/describe --read-ras phantom_ax.nii phantom_co.nii phantom_sa.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMRBiorad)
	run_eval "${BINDIR}/describe -m bioradvol.PIC > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMRBioradGz)
	run_eval "${BINDIR}/describe -m gz_bioradvol.PIC.gz > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMRNrrd1)
	run_eval "${BINDIR}/describe -m phantom_ax.nhdr phantom_co.nhdr phantom_sa.nhdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeMRNrrd2)
	run_eval "${BINDIR}/describe -m split_ax_0.nhdr split_ax_1.nhdr split_ax_2.nhdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeNrrdNoOrigin)
	run_eval "${BINDIR}/describe -m phantom_ax_noOrigin.nhdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeNiftiDetached348)
	run_eval "${BINDIR}/describe -m spgr_brain_nifti_hdr348.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeEmbedAnalyze)
	run_eval "${BINDIR}/describe -m embed_patient.hdr > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeEmbedNifti)
	run_eval "${BINDIR}/describe -m embed_patient.nii > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeEmbedNrrd)
	run_eval "${BINDIR}/describe -m embed_patient.nrrd > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeXform)
	run_eval "${BINDIR}/describe spgr_brain_12_warp.list vol001_mr_t0t1.list > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    describeXformMachine)
	run_eval "${BINDIR}/describe -m spgr_brain_12_warp.list vol001_mr_t0t1.list > ${tmpdir}/describe.txt"
	check_results describe.txt
	;;
    destripeDefault)
        run destripe -y stripes_crop_byte.nii ${tmpdir}/destripe.nii
	check_results destripe.nii
	;;
    destripeKernelFloat)
        run destripe -y --kernel-fwhm 5 --kernel-radius 2 --write-float stripes_crop_byte.nii ${tmpdir}/destripe.nii
	check_results destripe.nii
	;;
    detect_adni_phantomDefault)
        run detect_adni_phantom --write-labels ${tmpdir}/labels.nii --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan.nii ${tmpdir}/magphan.xml
        check_results labels.nii rigid.xform affine.xform magphan.xml
	;;
    detect_adni_phantomRefineXform)
        run detect_adni_phantom --tolerant --refine-xform --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_lowcontrast.nii ${tmpdir}/magphan.xml
        check_results rigid.xform affine.xform magphan.xml
	;;
    detect_adni_phantomRefineOutliers)
        run detect_adni_phantom --tolerant --refine-outliers --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_lowcontrast.nii ${tmpdir}/magphan.xml
        check_results rigid.xform affine.xform magphan.xml
	;;
    detect_adni_phantomExcludeOutliers)
        run detect_adni_phantom --tolerant --exclude-outliers --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_lowcontrast.nii ${tmpdir}/magphan.xml
        check_results rigid.xform affine.xform magphan.xml
	;;
    detect_adni_phantomErodeNonStd)
        run detect_adni_phantom --erode-snr 20 --erode-cnr 2 spgr_magphan.nii ${tmpdir}/magphan.xml
        check_results magphan.xml
	;;
    detect_adni_phantomBadFOV)
        run_expect_fail detect_adni_phantom spgr_magphan_badFOV.nii ${tmpdir}/magphan.xml
	;;
    detect_adni_phantomTolerantBadFOV)
        run detect_adni_phantom --tolerant --write-labels ${tmpdir}/labels.nii spgr_magphan_badFOV.nii ${tmpdir}/magphan.xml
	check_results magphan.xml labels.nii
	;;
    detect_adni_phantomMissingSphere)
        run detect_adni_phantom --write-labels ${tmpdir}/labels.nii --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_missingSphere.nii ${tmpdir}/magphan.xml
        check_results labels.nii rigid.xform affine.xform magphan.xml
	;;
    detect_adni_phantomBrokenSNR)
        run detect_adni_phantom --write-labels ${tmpdir}/labels.nii --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_brokenSNR.nii ${tmpdir}/magphan.xml
        check_results labels.nii rigid.xform affine.xform magphan.xml
	;;
    detect_spheres_matched_filter)
        run detect_spheres_matched_filter --radius 15 --filter-margin 2 adni_phantom2mm.nii ${tmpdir}/filtered.nii
	run convertx --float --downsample-select 4,4,4 ${tmpdir}/filtered.nii ${tmpdir}/filtered.nii
	check_images filtered.nii
	;;
    detect_spheres_matched_filterNormalized)
        run detect_spheres_matched_filter --normalized --radius 15 --filter-margin 1 adni_phantom2mm.nii ${tmpdir}/filtered.nii
	run convertx --float --downsample-select 4,4,4 ${tmpdir}/filtered.nii ${tmpdir}/filtered.nii
	check_images filtered.nii
	;;
    dof2mat)
        run_eval "${BINDIR}/dof2mat parc1_parc2_9dof.xform > ${tmpdir}/matrix"
	check_results matrix
        ;;
    dof2matTranspose)
        run_eval "${BINDIR}/dof2mat --transpose parc1_parc2_9dof.xform > ${tmpdir}/matrix"
	check_results matrix
        ;;
    dof2matLegacy)
        run_eval "${BINDIR}/dof2mat vol001_mr_t0t1.list > ${tmpdir}/matrix"
	check_results matrix
        ;;    
    dof2matLegacyFwd)
        run_eval "${BINDIR}/dof2mat vol001_mr_t0t1_fwd.list > ${tmpdir}/matrix"
	check_results matrix
        ;;    
    dof2matFixed)
        run_eval "${BINDIR}/dof2mat vol001_mr_t0t1_fwd24.list > ${tmpdir}/matrix"
	check_results matrix
        ;;    
    dof2matSuffix)
        run_eval "${BINDIR}/dof2mat xform.ZYX > ${tmpdir}/matrix"
	check_results matrix
        ;;    
    dof2mat3x3)
        run_eval "${BINDIR}/dof2mat --matrix3x3 vol001_mr_t0t1_fwd24.list > ${tmpdir}/matrix"
	check_results matrix
        ;;    
    stream_pixels)
        run_eval "${BINDIR}/stream_pixels jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw"
	check_results stream.raw
	;;
    stream_pixelsConvert)
        run_eval "${BINDIR}/stream_pixels --convert int jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw"
	check_results stream.raw
	;;
    stream_pixelsReorient)
        run_eval "${BINDIR}/stream_pixels --reorient RIP jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw"
	check_results stream.raw
	;;
    stream_pixelsEndian)
        run_eval "${BINDIR}/stream_pixels --change-endian jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw"
	check_results stream.raw
	;;
    epiunwarp)
        export CMTK_NUM_THREADS=1
        run epiunwarp --no-init-shift-com --write-jacobian-fwd ${tmpdir}/jacobian.nii --folding-constraint-weight 0 --smooth-sigma-max 16 --smooth-sigma-min 0 --smooth-sigma-diff 1 --iterations 5 --smoothness-constraint-weight 1e4 --phase-encode-ap dwi_fwd.nii dwi_rev.nii ${tmpdir}/c1.nii ${tmpdir}/c2.nii ${tmpdir}/df.nrrd ${tmpdir}/df2.nrrd
        unset CMTK_NUM_THREADS
	check_images c1.nii c2.nii jacobian.nii
	check_results df.nrrd df2.nrrd
	;;
    epiunwarpInitShift)
        export CMTK_NUM_THREADS=1
        run epiunwarp --write-jacobian-fwd ${tmpdir}/jacobian.nii --folding-constraint-weight 0 --smooth-sigma-max 16 --smooth-sigma-min 0 --smooth-sigma-diff 1 --iterations 5 --smoothness-constraint-weight 1e4 --phase-encode-ap dwi_fwd.nii dwi_rev.nii ${tmpdir}/c1.nii ${tmpdir}/c2.nii ${tmpdir}/df.nrrd
        unset CMTK_NUM_THREADS
	check_images c1.nii c2.nii jacobian.nii
	check_results df.nrrd
	;;
    fib2image)
        run_eval "${BINDIR}/fib2image -o ${tmpdir}/fibers.nii fiber_grid.hdr < fibers.fib"
	check_images fibers.nii
        ;;
    fibxform)
        run_eval "${BINDIR}/fibxform crop-x30.xform < fibers.fib > ${tmpdir}/output.fib"
	check_results output.fib
        ;;
    fibxformSourceTarget)
        run_eval "${BINDIR}/fibxform --source-image fiber_grid.hdr --target-image fiber_grid.hdr crop-x30.xform < fibers.fib > ${tmpdir}/output.fib"
	check_results output.fib
        ;;
    filterGaussian)
	run filter --gaussian 1 --radius 2 rat_fse_erly.hdr ${tmpdir}/filter.hdr
	check_results filter.img
	;;
    filterGaussianSmallKernel)
	run filter --gaussian 1 --radius 1.1 rat_fse_erly.hdr ${tmpdir}/filter.hdr
	check_results filter.img
	;;
    filterGaussianNoFilter)
	run filter --gaussian 1 --radius 0.5 rat_fse_erly.hdr ${tmpdir}/filter.hdr
	check_results filter.img
	;;
    filterRohlfing)
        run filter --rohlfing --intensity-gaussian 1 --gaussian 10 spgr_3t.hdr ${tmpdir}/filter.hdr spgr_3t_mask.hdr
	check_results filter.img
	;;
    filmFourthOrder)
	run film --coronal --nmi --fourth-order-error --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    filmCubic)
	run film --coronal --nmi --cubic --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    filmMSDLinearNoTrunc)
	run film --msd --coronal --linear --no-truncation --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    filmMISincRefSPGR)
	run film --mi --coronal --cubic --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --reference-image interleave_3dspgr.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    fit_affine_xform)
        run fit_affine_xform -o ${tmpdir}/affine.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list
	check_results affine.xform
	;;
    fit_affine_xformRigid)
        run fit_affine_xform --rigid -o ${tmpdir}/rigid.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list
	check_results rigid.xform
	;;
    fit_affine_xformReverse)
        run fit_affine_xform -o ${tmpdir}/affine.xform vol001_mr_t1.hdr --inverse vol001_mr_t0t1.list vol001_mr_t0t1_warp.xform
	check_results affine.xform
	;;
    fit_affine_xform_landmarksRigid)
        run fit_affine_xform_landmarks landmarksSource landmarksTargetRigid ${tmpdir}/affine.xform
	check_results affine.xform
	;;
    fit_affine_xform_landmarksScales)
        run fit_affine_xform_landmarks landmarksSource landmarksTargetScales ${tmpdir}/affine.xform
	check_results affine.xform
	;;
    fit_affine_xform_landmarksShear)
        run fit_affine_xform_landmarks landmarksSource landmarksTargetShear ${tmpdir}/affine.xform
	check_results affine.xform
	;;
    fit_affine_xform_landmarksRigidRigid)
        run fit_affine_xform_landmarks --rigid landmarksSource landmarksTargetRigid ${tmpdir}/affine.xform
	check_results affine.xform
	;;
    fit_affine_xform_landmarksRigidRigidFlip)
        run fit_affine_xform_landmarks --rigid landmarksSource2 landmarksTarget2 ${tmpdir}/rigid.xform
	check_results rigid.xform
	;;
    fit_affine_xform_landmarksRigidScales)
        run fit_affine_xform_landmarks --rigid landmarksSource landmarksTargetScales ${tmpdir}/affine.xform
	check_results affine.xform
	;;
    fit_affine_xform_landmarksRigidShear)
        run fit_affine_xform_landmarks --rigid landmarksSource landmarksTargetShear ${tmpdir}/affine.xform
	check_results affine.xform
	;;
    fit_affine_dfieldDField)
        run fit_affine_dfield vol001_mr_t0t1_dfield.nrrd ${tmpdir}/affine_fit.xform
	check_results affine_fit.xform
	;;
    fit_affine_dfieldFFD)
        run fit_affine_dfield vol001_mr_t0t1_warp.xform ${tmpdir}/affine_fit.xform
	check_results affine_fit.xform
	;;
    fit_spline_dfieldSpacing)
        run fit_spline_dfield --final-cp-spacing 40 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_dfieldSpacingMultiLevel)
        run fit_spline_dfield --final-cp-spacing 40 --levels 2 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_dfieldDims)
        run fit_spline_dfield --final-cp-dims 10,10,5 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_dfieldDimsRelative)
        run fit_spline_dfield --relative --final-cp-dims 10,10,5 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_dfieldDimsMultiLevel)
        run fit_spline_dfield --final-cp-dims 10,10,5 --levels 2 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_dfieldDimsMultiLevelSafe)
        run fit_spline_dfield --final-cp-dims 10,10,5 --levels 400 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_dfieldDimsWithAffine)
        run fit_spline_dfield --fit-affine-first --final-cp-dims 10,10,5 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform
	check_results warp.xform
	;;
    fit_spline_xformSpacing)
        run fit_spline_xform --final-cp-spacing 40 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list
	check_results warp.xform
	;;
    fit_spline_xformSpacingReverse)
        run fit_spline_xform --final-cp-spacing 40 -o ${tmpdir}/warp.xform vol001_mr_t1.hdr --inverse vol001_mr_t0t1.list vol001_mr_t0t1_warp.xform
	check_results warp.xform
	;;
    fit_spline_xformSpacingMultiLevel)
        run fit_spline_xform --final-cp-spacing 40 --levels 2 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list
	check_results warp.xform
	;;
    fit_spline_xformDims)
        run fit_spline_xform --final-cp-dims 10,10,5 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list
	check_results warp.xform
	;;
    fit_spline_xformDimsMultiLevel)
        run fit_spline_xform --final-cp-dims 10,10,5 --levels 2 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list
	check_results warp.xform
	;;
    geomatchAxSa)
	run_eval_expect_fail "${BINDIR}/geomatch -v phantom_ax.nii.gz phantom_sa.nii.gz >& ${tmpdir}/stderr"
	check_results stderr
	;;
    geomatchAxSaRAS)
	run_eval_expect_fail "${BINDIR}/geomatch -v --no-check-xforms --read-ras phantom_ax.nii.gz phantom_sa.nii.gz >& ${tmpdir}/stderr"
	check_results stderr
	;;
    geomatchAxSaNoXforms)
	run_eval "${BINDIR}/geomatch -v --no-check-xforms phantom_ax.nii.gz phantom_sa.nii.gz >& ${tmpdir}/stderr"
	check_results stderr
	;;
    glmDefault)
	run_eval "${BINDIR}/glm -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img  model_tstat_00_age.img model_param_00_age.img
	check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img
	;;
    glmNormalize)
	run_eval "${BINDIR}/glm --normalize -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img  model_tstat_00_age.img model_param_00_age.img
	check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img
	;;
    glmExp)
	run_eval "${BINDIR}/glm --exp -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img  model_tstat_00_age.img model_param_00_age.img
	check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img
	;;
    glmNoConstant)
	run_eval "${BINDIR}/glm --exclude-constant -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img  model_tstat_00_age.img model_param_00_age.img
	check_results model_tstat_01_sex.img model_param_01_sex.img
	;;
    glmIgnore)
	run_eval "${BINDIR}/glm --ignore-parameter 1 -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img  model_tstat_00_age.img model_param_00_age.img
	check_results model_tstat_02_CONST.img model_param_02_CONST.img
	;;
    glmSelect)
	run_eval "${BINDIR}/glm --select-parameter age -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img
	check_results model_tstat_00_age.img model_param_00_age.img model_tstat_02_CONST.img model_param_02_CONST.img
	;; 
    glmCrop)
	run_eval "${BINDIR}/glm --crop 10,10,0,20,20,2 -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt"
	check_results model_stdout.txt model_fstat_00_model.img  model_tstat_00_age.img model_param_00_age.img
	check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img
	;;
    gmmDefault)
        run gmm --mask gmm/mask.nii gmm/spgr.nii ${tmpdir}/gmm.nii gmm/prior1.nii gmm/prior2.nii gmm/prior3.nii
	check_results gmm.nii
	;;
    gmmAlternative)
        run gmm --classes 2 --iterations 5 --priors-init-only --prior-epsilon 0.05 --probability-maps gmm/spgr.nii ${tmpdir}/gmm.nii gmm/prior1.nii gmm/prior2.nii
	check_results gmm.nii
	check_images gmm_prob1.nii gmm_prob2.nii
	;;
    gregxformFordwardBackward)
	run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform -f vol001_mr_t0t1_warp.xform | ${BINDIR}/gregxform vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyz"
	check_results vol001_t0_points.xyz
	;;
    gregxformAffine)
	run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform -f vol001_mr_t0t1.list > ${tmpdir}/vol001_t0_points.xyz"
	check_results vol001_t0_points.xyz
	;;
    gregxformAffineFromWarp)
	run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform --affine -f vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyz"
	check_results vol001_t0_points.xyz
	;;
    gregxformAffineFromWarpFwdBwd)
	run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform --affine -f vol001_mr_t0t1_warp.xform | ${BINDIR}/gregxform --affine vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyz"
	check_results vol001_t0_points.xyz
	;;
    groupwise_affineFromInit)
	run groupwise_affine -v --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineMatchHistograms)
        export CMTK_NUM_THREADS=1
	run groupwise_affine -v --match-histograms --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms
	unset CMTK_NUM_THREADS
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineFromInitSampling)
	run groupwise_affine -v --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-to 1 --sampling-density 0.5 --zero-sum groupwise_init_brain123.xforms
	## no baseline; this mode uses probabilistic sampling
	;;
    groupwise_affineBackground)
	run groupwise_affine -v --force-background 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineUseTemplate)
        export CMTK_NUM_THREADS=1
	run groupwise_affine -v --force-background 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --template-with-data spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
        unset CMTK_NUM_THREADS
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineZeroSumSmooth)
        export CMTK_NUM_THREADS=1
	run groupwise_affine -v --smooth 0.5 --downsample-to 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
        unset CMTK_NUM_THREADS
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineRMIFromInit)
	run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineRMIFromInitDeltaF)
	run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --dofs 6,9 -e 4 --delta-f-threshold 0.1 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineRMIFromInitSampling)
	run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-to 1 --sampling-density 0.5 --zero-sum groupwise_init_brain123.xforms
	## no baseline; this mode uses probabilistic sampling
	;;
    groupwise_affineRMIBackground)
	run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms average.nii
	;;
    groupwise_affineRMIZeroSumSmooth)
	run groupwise_affine --rmi --smooth 0.5  --downsample-to 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpFromInit)
	run groupwise_warp -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpFromInitProtect)
	run groupwise_warp -v --force-background 0 -vv --disable-cp-mask box_corner.nii -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms
	;;
    groupwise_warpFitFromInit)
	run groupwise_warp -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --grid-spacing-fit --refine-grid 1 -e 4 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpUseTemplate)
	run groupwise_warp -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template-with-data spgr_brain_1.hdr groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpUseTemplateMatchHistograms)
        export CMTK_NUM_THREADS=1
	run groupwise_warp -v --match-histograms --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template-with-data spgr_brain_1.hdr groupwise_init_brain123.xforms
        unset CMTK_NUM_THREADS
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpMatchHistograms)
        export CMTK_NUM_THREADS=1
	run groupwise_warp -v --match-histograms --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template spgr_brain_1.hdr groupwise_init_brain123.xforms
        unset CMTK_NUM_THREADS
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpFromInitZeroSum)
	run groupwise_warp -v --zero-sum --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpFromInitNoBG)
	run groupwise_warp -v -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpUseTemplateNoBG)
	run groupwise_warp -v -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template-with-data spgr_brain_1.hdr groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpRMIFromInit)
	run groupwise_warp --rmi -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpRMIFitFromInit)
	run groupwise_warp --rmi -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --grid-spacing-fit --refine-grid 1 -e 4 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_warpRMIFromInitZeroSum)
	run groupwise_warp --rmi -v --zero-sum --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms
	check_results groupwise.xforms average.nii
	;;
    groupwise_initCentersOfMass)
	run groupwise_init -O ${tmpdir} --align-centers-of-mass spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms
	# cannot compare separate xforms due to local file system path in the file
	check_results average.nii
	;;
    groupwise_initCenterFOV)
	run groupwise_init -O ${tmpdir} --center-template spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms
	# cannot compare separate xforms due to local file system path in the file
	check_results average.nii
	;;
    groupwise_initCentersOfMassScale)
	run groupwise_init -O ${tmpdir} --align-centers-of-mass --init-scales spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms
	# cannot compare separate xforms due to local file system path in the file
	check_results average.nii
	;;
    groupwise_initCentersOfMassTemplate)
	run groupwise_init -O ${tmpdir} --template spgr_brain_1.hdr --align-centers-of-mass spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr
	check_results groupwise.xforms
	check_results pairs/target-000.list/registration pairs/target-001.list/registration pairs/target-002.list/registration
	check_results average.nii
	;;
    hausdorffBinary12)
        run_eval "${BINDIR}/hausdorff parc1_bin.hdr parc2_bin.hdr > ${tmpdir}/hd.txt"
	check_results hd.txt
	;;
    hausdorffBinary21)
        run_eval "${BINDIR}/hausdorff parc2_bin.hdr parc1_bin.hdr > ${tmpdir}/hd.txt"
	check_results hd.txt
	;;
    hausdorffBinaryForced)
        run_eval "${BINDIR}/hausdorff parc1.hdr parc2.hdr > ${tmpdir}/hd.txt"
	check_results hd.txt
	;;
    histogram)
	run histogram -o ${tmpdir}/histogram spgr_3t.hdr
	check_results histogram
	;;
    histogramNorm)
	run histogram --normalize -o ${tmpdir}/histogram spgr_3t.hdr
	check_results histogram
	;;
    histogramBinsMinMax)
	run histogram --min 300 --max 3000 --nbins 16 -o ${tmpdir}/histogram spgr_3t.hdr
	check_results histogram
	;;
    histogramBinsMinMaxTrunc)
	run histogram --truncate --min 300 --max 3000 --nbins 16 -o ${tmpdir}/histogram spgr_3t.hdr
	check_results histogram
	;;
    histogramMask)
	run histogram --mask spgr_3t_mask.hdr -o ${tmpdir}/histogram spgr_3t.hdr
	check_results histogram
	;;
    imagemathAbsPop)
        run imagemath --in pat001_pet.hdr pat001_mr_T1.hdr --pop --abs --out ${tmpdir}/abs.nii
	check_results abs.nii
	;;
    imagemathSqrSqrt)
        run imagemath --in pat001_pet.hdr --sqr --sqrt --out ${tmpdir}/abs.nii
	check_results abs.nii
	;;
    imagemathLogExp)
        run imagemath --in spgr_brain_1.hdr --log --exp --out ${tmpdir}/logexp.nii
	check_results logexp.nii
	;;
    imagemathDupAddMulDiv)
        run imagemath --in spgr_brain_1.hdr --dup --in spgr_brain_2.hdr spgr_brain_3.hdr --add --mul --div --out ${tmpdir}/damd.nii
	check_results damd.nii
	;;
    imagemathThreshAboveBelow)
        run imagemath --in pat001_pet.hdr --thresh-above 1000 --thresh-below 0 --out ${tmpdir}/thresh.nii
	check_results thresh.nii
	;;
    imagemathAverage)
	run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --average --out ${tmpdir}/average.hdr
	check_results average.img
	;;
    imagemathVariance)
	run imagemath --in  spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr --variance --out ${tmpdir}/variance.nii
	check_results variance.nii
	;;
    imagemathMaskAverage)
        run imagemath --in spgr_3t.hdr spgr_3t_mask.hdr --mask-average --out ${tmpdir}/average.hdr
	check_results average.img
	;;
    imagemathXor)
	run imagemath --in parc1.hdr --scalar-xor 1 --out ${tmpdir}/xor.hdr
	check_results xor.img
	;;
    imagemathDupFillMaxValue)
	run imagemath --in parc1.hdr --dup --fill 1 --max-value --out ${tmpdir}/result.hdr
	check_results result.img
	;;
    imagemathAnd)
        run imagemath --in parc1.hdr --scalar-and 1 --out ${tmpdir}/and.hdr
	check_results and.img
	;;
    imagemathContractLabels)
	run imagemath --in parc1.hdr parc2.hdr parc3.hdr --contract-labels --out ${tmpdir}/contract.hdr
	check_results contract.img
	;;
    imagemathMaxIndex)
	run imagemath --in parc1.hdr parc2.hdr parc3.hdr --max-index --out ${tmpdir}/maxidx.nii
	check_results maxidx.nii
	;;
    imagemathMaxValue)
	run imagemath --in parc1.hdr parc2.hdr parc3.hdr --max-value --out ${tmpdir}/maxval.nii
	check_results maxval.nii
	;;
    imagemathVote)
	run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --vote --out ${tmpdir}/vote.hdr
	check_results vote.img
	;;
    imagemathProduct)
	run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --product --out ${tmpdir}/prod.nii
	check_results prod.nii
	;;
    imagemathStackEntropyLabels)
	run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --stack-entropy-labels --out ${tmpdir}/entropy.hdr
	check_results entropy.img
	;;
    imagemathSTAPLE)
	run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --staple 10 --out ${tmpdir}/staple.hdr
	check_results staple.img
	;;
    imagemathMultiClassSTAPLE)
	run imagemath --in parc1.hdr parc2.hdr parc3.hdr --mstaple 2 --out ${tmpdir}/mstaple.hdr
	check_results mstaple.img
	;;
    imagemathMultiClassDisputedSTAPLE)
	run imagemath --in parc1.hdr parc2.hdr parc3.hdr --mstaple-disputed 2 --out ${tmpdir}/mstaple.hdr
	check_results mstaple.img
	;;
    imagemathCombinePCA)
	run imagemath --in rat_fse_erly.hdr rat_fse_late.hdr --combine-pca --trunc --out ${tmpdir}/combine_pca.hdr
	check_results combine_pca.img
	;;
    imagemathT2)
	run imagemath --float --in rat_fse_erly.hdr --log --in rat_fse_late.hdr --log --scalar-mul -1 --add --one-over --out ${tmpdir}/t2.hdr
	check_results t2.img
	;;
    imagemathAtan2)
	run imagemath --float --in rat_fse_erly.hdr rat_fse_late.hdr --atan2 --out ${tmpdir}/atan.nii
	check_results atan.nii
	;;
    imagemathLogOddsAdd)
	run imagemath --float --in pbmap_wm_2.nii --logit --in pbmap_wm_1.nii --logit --average --logistic --out ${tmpdir}/logodds_add.hdr
	check_results logodds_add.img
	;;
    imagemathLogOddsAdd2)
	run imagemath --float --in pbmap_wm_2.nii pbmap_wm_1.nii --all --logit --average --all --logistic --out ${tmpdir}/logodds_add.hdr
	check_results logodds_add.img
	;;
    imagemathMatchMeanSDev)
        run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr --match-mean-sdev --out ${tmpdir}/match.nii
        check_results match.nii
        ;;
    imagemathMatchMeanSDev3)
        run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr --match-mean-sdev3 --out ${tmpdir}/match.nii
        check_results match.nii
        ;;
    imagemathMatchHistograms)
        run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr --match-histograms --out ${tmpdir}/match_histograms.hdr
        check_results match_histograms.img
        ;;
    imagemathMatchHistogramsPadding)
        run imagemath --set-padding-value 0 --in spgr_brain_1.hdr spgr_brain_2.hdr --match-histograms --out ${tmpdir}/match_histograms.hdr
        check_results match_histograms.img
        ;;
    imagemathMatchHistogramsPadding2)
        run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr --set-padding-value 0 --match-histograms --out ${tmpdir}/match_histograms.hdr
        check_results match_histograms.img
        ;;
    imagemathMatchHistogramsPaddingUnset)
        run imagemath --set-padding-value 0 --in spgr_brain_1.hdr --unset-padding --in spgr_brain_2.hdr --match-histograms --out ${tmpdir}/match_histograms.hdr
        check_results match_histograms.img
        ;;
    interleaved_bad_slicesDefault)
	run interleaved_bad_slices rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt
	check_results badSlices.txt
	;;
    interleaved_bad_slicesStdDev1)
	run interleaved_bad_slices --stdev-thresh 1 rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt
	check_results badSlices.txt
	;;
    interleaved_bad_slicesRMS)
	run interleaved_bad_slices --rms rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt
	check_results badSlices.txt
	;;
    interleaved_bad_slicesBulk)
	run interleaved_bad_slices --bad-slices-thresh 1 rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt
	check_results badSlices.txt
	;;
    jidbBoxFourthOrder)
        run jidb --coronal --nmi --psf box --fourth-order-error --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    jidbGaussian)
	run jidb --coronal --nmi --psf gaussian --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    jidbGaussianScale)
	run jidb --psf gaussian --nmi --psf-scale 0.5 --no-truncation --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    jidbMIRefSPGR)
	run jidb --mi --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --reference-image interleave_3dspgr.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    levelsetDefault)
	run levelset -v vol001_mr_t1.hdr ${tmpdir}/levelset.hdr
	check_results levelset.img
	;;
    levelsetScaleInitial)
        run levelset -v --scale-initial-sphere 0.5 vol001_mr_t1.hdr ${tmpdir}/levelset.hdr
	check_results levelset.img
	;;
    levelsetBinarizeFastWideBinary)
        run levelset -v --binarize --delta 1.0 --filter-sigma 4.0 vol001_mr_t1.hdr ${tmpdir}/levelset.hdr
	check_results levelset.img
	;;
    lvoteDefault)
        run lvote -v -o ${tmpdir}/lvote.nii lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lvote.nii
	;;
    lvoteGlobalWeights)
        run lvote -v -o ${tmpdir}/lvote.nii --use-global-weights lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lvote.nii
	;;
    lvoteRadius3)
        run lvote -v -o ${tmpdir}/lvote.nii --patch-radius 3 lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lvote.nii
	;;
    lvoteOutliersGlobal)
        run lvote -v -o ${tmpdir}/lvote.nii --patch-radius 3 --no-global-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lvote.nii
	;;
    lsbaRadius3)
        run lsba -v -o ${tmpdir}/lsba.nii --patch-radius 3 lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lsba.nii
	;;
    lsbaRadius3Outliers)
        run lsba -v -o ${tmpdir}/lsba.nii --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lsba.nii
	;;
    lsbaRadius3OutliersGlobal)
        run lsba -v -o ${tmpdir}/lsba.nii --patch-radius 3 --no-global-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lsba.nii
	;;
    lsbaRadius3Search1)
        run lsba -v -o ${tmpdir}/lsba.nii --search-radius 1 --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lsba.nii
	;;
    lmsbaRadius3)
        run lmsba -v -o ${tmpdir}/lmsba.nii --patch-radius 3 lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lmsba.nii
	;;
    lmsbaRadius3Outliers)
        run lmsba -v -o ${tmpdir}/lmsba.nii --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lmsba.nii
	;;
    lmsbaRadius3OutliersGlobal)
        run lmsba -v -o ${tmpdir}/lmsba.nii --patch-radius 3 --no-global-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lmsba.nii
	;;
    lmsbaRadius3Search1)
        run lmsba -v -o ${tmpdir}/lmsba.nii --search-radius 1 --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii
	check_results lmsba.nii
	;;
    make_initial_affineCenterOfMass)
	run make_initial_affine --mode centers-of-mass box1.hdr box3.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affinePrincipalAxes1)
	run make_initial_affine --mode principal-axes box1.hdr box2.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affinePrincipalAxes2)
	run make_initial_affine --mode principal-axes box1.hdr box3.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affinePrincipalAxes3)
	run make_initial_affine --mode principal-axes box2.hdr box3.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affinePrincipalAxes4)
	run make_initial_affine --mode principal-axes box1.hdr box4.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affinePrincipalAxes5)
	run make_initial_affine --mode principal-axes box2.hdr box4.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affinePrincipalAxes6)
	run make_initial_affine --mode principal-axes box3.hdr box4.hdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDirectionVectorsNrrdAxSa)
	run make_initial_affine phantom_ax.nhdr phantom_sa.nhdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDirectionVectorsNrrdAxCo)
	run make_initial_affine phantom_ax.nhdr phantom_co.nhdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDirectionVectorsNrrdSaCo)
	run make_initial_affine phantom_sa.nhdr phantom_co.nhdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDirectionVectorsNrrdAxSaNative)
	run make_initial_affine --native-space phantom_ax.nhdr phantom_sa.nhdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDirectionVectorsNrrdAxCoNative)
	run make_initial_affine --native-space phantom_ax.nhdr phantom_co.nhdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDirectionVectorsNrrdSaCoNative)
	run make_initial_affine --native-space phantom_sa.nhdr phantom_co.nhdr ${tmpdir}/xform
	check_results xform
	;;
    make_initial_affineDB)
	run make_initial_affine --db ${tmpdir}/db.sqlite box1.hdr box3.hdr ${tmpdir}/xform
	# only test for crash; local xform path in database is not portable for comparison
	;;
    mat2dof1)
        run_eval "${BINDIR}/mat2dof --transpose --center -28,-48,-28 --offset 28,48,28 --pixel-size 1.06667,0.5,1.06667 --list ${tmpdir} < rigid-air.mat"
	check_results registration
	;;
    mat2dof2)
        run_eval "${BINDIR}/mat2dof --transpose --center -28,-48,-28 --offset 28,48,28 --pixel-size 1.06667,0.5,1.06667 --inverse --list ${tmpdir} < rigid-air.mat"
	check_results registration
	;;
    mat2dofFile)
        run_eval "${BINDIR}/mat2dof --transpose --center -28,-48,-28 --offset 28,48,28 --pixel-size 1.06667,0.5,1.06667 --list ${tmpdir} rigid-air.mat"
	check_results registration
	;;    
    mat2dofToFile)
        run_eval "${BINDIR}/mat2dof -o ${tmpdir}/xform rigid-air.mat"
	check_results xform
	;;    
    mat2dofToFileAppend)
	echo "WILL THIS STILL BE HERE?" > ${tmpdir}/xform
        run_eval "${BINDIR}/mat2dof --append -o ${tmpdir}/xform rigid-air.mat"
	check_results xform
	;;    
    mcaffine1)
	export CMTK_NUM_THREADS=1
	run mcaffine --downsample-from 4 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --dofs 6 --covariance -o ${tmpdir}/xform pat001_mr_T1.hdr -- pat001_pet.hdr
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mcaffine2)
	run mcaffine --initial-xform mcaffine2_initial.xform --downsample-from 4 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --dofs 6 --histograms -o ${tmpdir}/xform pat001_mr_T1.hdr -- pat001_pet.hdr
	check_results xform
	;;
    mcaffine3)
	run mcaffine --downsample-from 4 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --dofs 6 --dofs 9 --covariance -o ${tmpdir}/xform rat_fse_erly.hdr rat_fse_late.hdr -- rat2_fse_erly.hdr rat2_fse_late.hdr
	check_results xform
	;;
    mcaffine4)
	run mcaffine --downsample-from 4 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --dofs 6,9 --covariance -o ${tmpdir}/xform rat_fse_erly.hdr rat_fse_late.hdr -- rat2_fse_erly.hdr rat2_fse_late.hdr
	check_results xform
	;;
    mcwarp1)
	# Test breaks when using multiple threads due to floating point effects
	export CMTK_NUM_THREADS=1
	run mcwarp --downsample-from 2 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --covariance -o ${tmpdir}/xform mcaffine_rat_rat2.xform
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mcwarp2)
	# Test breaks when using multiple threads due to floating point effects
	export CMTK_NUM_THREADS=1
	run mcwarp --downsample-from 2 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --histograms -o ${tmpdir}/xform mcaffine_rat_rat2.xform
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mcwarp3)
	# Test breaks when using multiple threads due to floating point effects
	export CMTK_NUM_THREADS=1
	run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --covariance -o ${tmpdir}/xform mcaffine_rat_rat2.xform
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mcwarp4)
	# Test breaks when using multiple threads due to floating point effects
	export CMTK_NUM_THREADS=1
	run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --covariance --intensity-correction -o ${tmpdir}/xform mcaffine_rat_rat2.xform
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mcwarp5)
	# Test breaks when using multiple threads due to floating point effects
	export CMTK_NUM_THREADS=1
	run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --adaptive-fix-thresh-factor 0.5 -o ${tmpdir}/xform mcaffine_rat_rat2.xform
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mcwarp6)
	# Test breaks when using multiple threads due to floating point effects
	export CMTK_NUM_THREADS=1
	run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --adaptive-fix-thresh-factor-entropy 0.5 -o ${tmpdir}/xform mcaffine_rat_rat2.xform
	unset CMTK_NUM_THREADS
	check_results xform
	;;
    mk_adni_phantom2mm)
        run mk_adni_phantom --resolution 2 ${tmpdir}/phantom.nii
        check_results phantom.nii
        ;;
    mk_adni_phantom2mmLabels)
        run mk_adni_phantom --resolution 2 --write-labels ${tmpdir}/phantom.lbl --write-landmarks ${tmpdir}/phantom.xyz --labels ${tmpdir}/phantom.nii
        check_results phantom.nii phantom.lbl phantom.xyz
        ;;
    mk_analyze_hdrDefault)
        run mk_analyze_hdr ${tmpdir}/analyze.hdr
	run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt"
	check_results analyze.hdr analyze.txt
	;;
    mk_analyze_hdrImport)
        run mk_analyze_hdr --import spgr_3t.hdr ${tmpdir}/analyze.hdr
	run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt"
	check_results analyze.hdr analyze.txt
	;;
    mk_analyze_hdrLittleEndian)
        run mk_analyze_hdr --description LittleEndian --little-endian --float --dims 100,200,300 --voxel 0.3,0.2,0.1 --offset 1024 ${tmpdir}/analyze.hdr
	run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt"
	check_results analyze.hdr analyze.txt
	;;
    mk_analyze_hdrBigEndian)
        run mk_analyze_hdr --description BigEndian  --big-endian --ushort --dims 100,200,300 --voxel 0.3,0.2,0.1 --offset 1024 ${tmpdir}/analyze.hdr
	run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt"
	check_results analyze.hdr analyze.txt
	;;
    mk_nifti_hdrDefault)
        run mk_nifti_hdr ${tmpdir}/nifti.hdr
	run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.hdr | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt"
	check_results nifti.hdr nifti.txt
	;;
    mk_nifti_hdrDescription)
        run_eval "${BINDIR}/mk_nifti_hdr --description \"This is a description text\" ${tmpdir}/nifti.hdr"
	check_results nifti.hdr
	;;
    mk_nifti_hdrImport)
        run mk_nifti_hdr --import phantom_ax.nii ${tmpdir}/nifti.hdr
	run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.hdr | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt"
	check_results nifti.hdr nifti.txt
	;;
    mk_nifti_hdrDefaultAttached)
        run mk_nifti_hdr --attached ${tmpdir}/nifti.nii
	run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.nii | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt"
	check_results nifti.nii nifti.txt
	;;
    mk_nifti_hdrDescriptionAttached)
        run_eval "${BINDIR}/mk_nifti_hdr --attached --description \"This is a description text\" ${tmpdir}/nifti.nii"
	check_results nifti.nii
	;;
    mk_nifti_hdrImportAttached)
        run mk_nifti_hdr --attached --import phantom_ax.nii ${tmpdir}/nifti.nii
	run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.nii | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt"
	check_results nifti.nii nifti.txt
	;;
    mk_phantom_3dBoxIndexed)
	run mk_phantom_3d -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 2,2,2 box 2,2,2 5,5,5 10
	check_results phantom.nii
	;;
    mk_phantom_3dBoxIndexedRange)
        run mk_phantom_3d -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 2,2,2 box 11,11,11 5,5,5 10
	check_results phantom.nii
	;;
    mk_phantom_3dBoxAbsolute)
	run mk_phantom_3d --absolute -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 box 2,2,2 5,5,5 10
	check_results phantom.nii
	;;
    mk_phantom_3dBoxRelative)
    run mk_phantom_3d --relative -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 box 0.1,0.2,0.3 0.5,0.5,0.5 10
	check_results phantom.nii
	;;
    mk_phantom_3dSphereIndexed)
	run mk_phantom_3d --coordinates indexed -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 sphere 7,7,7 5 20
	check_results phantom.nii
	;;
    mk_phantom_3dSphereAbsolute)
        run mk_phantom_3d --coordinates absolute -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 sphere 7,7,7 5 20
	check_results phantom.nii
	;;
    mk_phantom_3dSphereAbsolute2)
        run mk_phantom_3d --coordinates absolute -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,2 sphere 7,7,7 5 20
	check_results phantom.nii
	;;
    mk_phantom_3dSphereRelative)
        run mk_phantom_3d --coordinates relative -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 sphere 0.5,0.4,0.3 0.4 20
	check_results phantom.nii
	;;
    mk_phantom_3dSphereRelative2)
        run mk_phantom_3d --coordinates relative -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,2 sphere 0.5,0.4,0.3 0.4 20
	check_results phantom.nii
	;;
    mk_phantom_3dBoxSphere)
	run mk_phantom_3d -o ${tmpdir}/phantom.nii --char --bg 50 --dims 10,10,10 --voxel 1,1,1 sphere 7,7,7 5 20 box 2,2,2 5,5,5 10
	check_results phantom.nii
	;;
    mk_phantom_3dImport)
	run mk_phantom_3d -o ${tmpdir}/phantom.nii --import spgr_3t_mask.hdr sphere 30,40,30 20 0
	check_results phantom.nii
	;;
    mk_phantom_3dImportGrid)
	run mk_phantom_3d -o ${tmpdir}/phantom.nii --import-grid spgr_3t_mask.hdr sphere 30,40,30 20 10
	check_results phantom.nii
	;;
    mk_phantom_3dMRSVoxel)
	run mk_phantom_3d --echo -v --bg 0 -o ${tmpdir}/voxel.nii --import-grid ge-mrs/lfse.nii mrs-voxel ge-mrs/spectro.dcm 100
	check_results voxel.nii
	;;
    mrbiasMulIncremental)
	run mrbias --incremental -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img bias_mul.img
	;;
    mrbiasMulAutoThresh)
        run mrbias -v -M 2 --set-padding-value 0 --thresh-auto spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    mrbiasMulOtsuThresh)
        run mrbias -v -M 2 --set-padding-value 0 --thresh-otsu-nbins 256 spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img
	;;
    mrbiasMulLogIntensity)
	run mrbias --log-intensities -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img bias_mul.img
	;;
    mrbiasAddMulMask)
	export CMTK_NUM_THREADS=1
	run mrbias -A 1 -M 2 --mask spgr_3t_mask.hdr --write-bias-add ${tmpdir}/bias_add.hdr --write-bias-mul ${tmpdir}/bias_mul.hdr spgr_3t.hdr ${tmpdir}/corrected.hdr
	unset CMTK_NUM_THREADS
	check_results corrected.img bias_mul.img bias_add.img
	;;
    mrbiasMulIncrementalCUDA)
	run mrbias_cuda --incremental -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img bias_mul.img
	;;
    mrbiasMulLogIntensityCUDA)
	run mrbias_cuda --log-intensities -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img bias_mul.img
	;;
    mrbiasAddMulMaskCUDA)
	run mrbias_cuda -A 1 -M 2 --mask spgr_3t_mask.hdr --write-bias-add ${tmpdir}/bias_add.hdr --write-bias-mul ${tmpdir}/bias_mul.hdr spgr_3t.hdr ${tmpdir}/corrected.hdr
	check_results corrected.img bias_mul.img bias_add.img
	;;
    overlap)
	run_eval "${BINDIR}/overlap parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt"
	check_results overlap.txt
	;;
    overlapNumLabels)
	run_eval "${BINDIR}/overlap -N 2 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt"
	check_results overlap.txt
	;;
    overlapByLabel)
	run_eval "${BINDIR}/overlap --by-label parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt"
	check_results overlap.txt
	;;
    overlapFirst)
	run_eval "${BINDIR}/overlap --first-label 10 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt"
	check_results overlap.txt
	;;
    overlapFirstByLabel)
	run_eval "${BINDIR}/overlap --by-label --first-label 10 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt"
	check_results overlap.txt
	;;
    overlapFirstByLabelNumLabels)
	run_eval "${BINDIR}/overlap --by-label --first-label 10 --num-labels 10 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt"
	check_results overlap.txt
	;;
    probeIndexed)
        run_eval "echo 98 154 1 |${BINDIR}/probe --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    probeAbsolute)
        run_eval "echo 91.875 144.375 3 |${BINDIR}/probe --absolute phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    probeRelative)
        run_eval "echo 0.384313725 0.603921569 0.5 |${BINDIR}/probe --relative phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    probePhysical)
        run_eval "echo -27.656 24.844 0 |${BINDIR}/probe --physical phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    probeIndexedLinear)
        run_eval "echo 98.5 154.5 1 |${BINDIR}/probe --linear --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    probeIndexedCubic)
        run_eval "echo 98.5 154.5 1 |${BINDIR}/probe --cubic --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    probeIndexedSinc)
        run_eval "echo 98.5 154.5 1 |${BINDIR}/probe --sinc-cosine --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt"
	check_results probe.txt
	;;
    pxsearchIndexed)
        run_eval "echo 98 154 1 |${BINDIR}/pxsearch --input-coordinates indexed --output-coordinates indexed phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt"
	check_results pxsearch.txt
	;;
    pxsearchIndexedRadius3)
        run_eval "echo 98 154 1 |${BINDIR}/pxsearch --radius 3 --input-coordinates indexed --output-coordinates indexed phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt"
	check_results pxsearch.txt
	;;
    pxsearchIndexedRadius311)
        run_eval "echo 98 154 1 |${BINDIR}/pxsearch --radius 3,1,1 --input-coordinates indexed --output-coordinates indexed phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt"
	check_results pxsearch.txt
	;;
    pxsearchAbsolute)
        run_eval "echo 91.875 144.375 3 |${BINDIR}/pxsearch --input-coordinates absolute --output-coordinates absolute phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt"
	check_results pxsearch.txt
	;;
    pxsearchRelative)
        run_eval "echo 0.384313725 0.603921569 0.5 |${BINDIR}/pxsearch --input-coordinates relative --output-coordinates relative phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt"
	check_results pxsearch.txt
	;;
    pxsearchPhysical)
        run_eval "echo -27.656 24.844 0 |${BINDIR}/pxsearch --input-coordinates physical --output-coordinates physical phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt"
	check_results pxsearch.txt
	;;
    reformatxNoXform)
	run reformatx --linear -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr
	check_results reformat.img
	;;
    reformatxLinear)
	run reformatx --linear -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxNearestNeighbor)
	run reformatx --nn -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxPartialVolume)
	run reformatx --pv -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxLinearFwdBwd)
	run reformatx --linear --short -o ${tmpdir}/reformat.hdr --floating vol001_mr_t0.hdr vol001_mr_t0.hdr vol001_mr_t0t1.list --inverse vol001_mr_t0t1.list
	check_results vol001_mr_t0.img
	;;
    reformatxCubic)
	run reformatx --cubic -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxCubicInverse)
	run reformatx --cubic -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr --inverse vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxSincCosine)
	run reformatx --sinc-cosine -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxSincHamming)
	run reformatx --sinc-hamming -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxSincCosine5)
	run reformatx --sinc-cosine --sinc-window-radius 5 -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list
	check_results reformat.img
	;;
    reformatxMassPreserving)
        run reformatx --preserve-mass -o ${tmpdir}/reformat.hdr  --floating vol001_mr_t1.hdr vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform
	check_results reformat.img
	;;
    reformatxJacobian)
	run reformatx --jacobian-correct-global -o ${tmpdir}/jacobian.hdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --jacobian vol001_mr_t0t1_warp.xform
	check_results jacobian.img
	;;
    reformatxJacobianDefault)
	run reformatx -o ${tmpdir}/jacobian.hdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --jacobian vol001_mr_t0t1_warp.xform
	check_results jacobian.img
	;;
    reformatxInverseJacobian)
	run reformatx --jacobian-correct-global -o ${tmpdir}/jacobian.hdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --jacobian --inverse vol001_mr_t0t1_warp.xform
	check_results jacobian.img
	;;
    reformatxInverseJacobianDefault)
	run reformatx -o ${tmpdir}/jacobian.hdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --jacobian --inverse vol001_mr_t0t1_warp.xform
	check_results jacobian.img
	;;
    reformatxDfieldNrrd)
	run reformatx -o ${tmpdir}/reformat.hdr --floating parc2.hdr parc1.hdr parc1_parc2_dfield.nrrd
	check_results reformat.img
	;;
    reformatxDfieldNrrdJacobian)
	run reformatx -o ${tmpdir}/jacobian.hdr vol001_mr_t0.hdr --jacobian vol001_mr_t0t1_dfield.nrrd
	check_results jacobian.img
	;;
    reformatxTargetGrid)
        run reformatx -o ${tmpdir}/reformat.nii --target-grid 32,43,21:5.625,5.625,7.5 --floating spgr_brain_1.hdr
	check_results reformat.nii
	;;
    reformatxTargetGridAnalyze)
        run reformatx -o ${tmpdir}/reformat.hdr --target-grid 32,43,21:5.625,5.625,7.5 --floating spgr_brain_1.hdr
	check_results reformat.hdr reformat.img
	;;
    reformatxTargetGridOffset)
        run reformatx -o ${tmpdir}/reformat.nii --target-grid 32,43,21:5.625,5.625,7.5:5.625,0,0 --floating spgr_brain_1.hdr
	check_results reformat.nii
	;;
    registrationAffineMrMrMSD)
	run registration -i --dofs 6,9 --msd --match-histograms -o ${tmpdir} pat001_mr_T1.hdr pat002_mr_T2.hdr
	check_results registration
	;;
    registrationFromList)
	run registration -v --dofs 0 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    registrationWithInitial)
	run registration -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list vol001_mr_t0.hdr vol001_mr_t1.hdr
	check_results registration
	;;
    registrationWithInitialInverse)
	run registration -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list --initial-is-inverse vol001_mr_t0t1.list
	check_results registration
	;;
    registrationAutoLevelsRat4)
	run registration -v -i --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationAutoLevelsRat2)
	run registration -v -i --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationAutoLevelsRatToRat)
	run registration -v -i --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
	check_results registration
	;;
    registrationAutoLevelsRatToRatDeltaFThreshold)
	run registration -v -i --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms --delta-f-threshold 0.01 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
	check_results registration
	;;
    registrationAutoLevelsCt3)
	run registration --msd --auto-multi-levels 3 --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_ct.hdr
	check_results registration
	;;
    registrationxAffineMrMrMSD)
	run registrationx --init fov --dofs 6,9 --msd --match-histograms -o ${tmpdir} pat001_mr_T1.hdr pat002_mr_T2.hdr
	check_results registration
	;;
    registrationxShearNoScaleMrMrMSD)
	run registrationx --auto-multi-levels 4 --init fov --dofs 603 --msd --match-histograms -o ${tmpdir} pat001_mr_T1.hdr pat002_mr_T2.hdr
	check_results registration
	;;
    registrationxFromList)
	run registrationx -v --dofs 0 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    registrationxWithInitial)
	run registrationx -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list vol001_mr_t0.hdr vol001_mr_t1.hdr
	check_results registration
	;;
    registrationxWithInitialInverse)
	run registrationx -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list --initial-is-inverse vol001_mr_t0t1.list
	check_results registration
	;;
    registrationxFromListDB)
	run registrationx --db ${tmpdir}/db.sqlite -v --dofs 0 -o ${tmpdir} vol001_mr_t0t1.list
	;;
    registrationxWithInitialDB)
	run registrationx --db ${tmpdir}/db.sqlite -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list vol001_mr_t0.hdr vol001_mr_t1.hdr
	;;
    registrationxWithInitialInverseDB)
	run registrationx --db ${tmpdir}/db.sqlite -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list --initial-is-inverse vol001_mr_t0t1.list
	;;
    registrationxAutoLevelsRat4)
	run registrationx -v --auto-multi-levels 4 --dofs 6 -o ${tmpdir} --write-itk ${tmpdir}/xform.tfm rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration xform.tfm
	;;
    registrationxAutoLevelsRat4XY)
        run registrationx -v --restrict-in-plane xy --auto-multi-levels 4 --dofs 6,9,12 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4XZ)
        run registrationx -v --restrict-in-plane xz --auto-multi-levels 4 --dofs 6,9,12 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4YZ)
        run registrationx -v --restrict-in-plane yz --auto-multi-levels 4 --dofs 6,9,12 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4Symmetric)
	run registrationx -v --symmetric --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4NONE)
	run registrationx -v --init none --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4FOV)
	run registrationx -v --init fov --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4COM)
	run registrationx -v --init com --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat4PAX)
	run registrationx -v --init pax --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat2)
	run registrationx -v --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat2Cubic)
	run registrationx -v --cubic --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat2Sinc)
	run registrationx -v --cosine-sinc --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRat2NN)
	run registrationx -v --nearest-neighbor --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    registrationxAutoLevelsRatToRat)
        export CMTK_NUM_THREADS=1
        run registrationx -v --init fov --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
        unset CMTK_NUM_THREADS
	check_results registration
	;;
    registrationxAutoLevelsRatToRatNCC)
        run registrationx -v --init fov --auto-multi-levels 2 --ncc -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
	check_results registration
	;;
    registrationxAutoLevelsRatToRatRMS)
        run registrationx -v --init fov --auto-multi-levels 2 --rms -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
	check_results registration
	;;
    registrationxAutoLevelsRatToRatCR)
        run registrationx -v --init fov --auto-multi-levels 2 --cr -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
	check_results registration
	;;
    registrationxAutoLevelsRatToRatMI)
        run registrationx -v --init fov --auto-multi-levels 2 --mi -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
	check_results registration
	;;
    registrationxAutoLevelsRatToRatDeltaFThreshold)
        export CMTK_NUM_THREADS=1
	run registrationx -v --init fov --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms --delta-f-threshold 0.01 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr
        unset CMTK_NUM_THREADS
	check_results registration
	;;
    registrationxAutoLevelsCt3)
	run registrationx --pad-flt -10000 --write-reformatted ${tmpdir}/reformat.nii --msd --auto-multi-levels 3 --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_ct.hdr
	check_results registration reformat.nii
	;;
    registrationxAutoLevelsLabelsNN)
        run registrationx -v --interpolation nearest-neighbor --class-ref label --class-flt label --auto-multi-levels 4 --dofs 6,9 --nmi -o ${tmpdir} parc1.hdr parc2.hdr
	check_results registration
	;;
    registrationxAutoLevelsLabelsPV)
        run registrationx -v --interpolation partial-volume --class-ref label --class-flt label --auto-multi-levels 4 --dofs 6,9 --nmi -o ${tmpdir} parc1.hdr parc2.hdr
	check_results registration
	;;
    reorientHdrSaToAx)
	run reorient -o RAS phantom_sa.hdr ${tmpdir}/reorient.hdr
	check_results reorient.hdr reorient.img
	;;
    reorientHdrSaToAxNifti)
	run reorient -i RAS -o RAS phantom_sa.hdr ${tmpdir}/reorient.nii
	check_results reorient.nii
	;;
    reorientHdrCoToAx)
	run reorient -o RAS phantom_co.hdr ${tmpdir}/reorient.hdr
	check_results reorient.hdr reorient.img
	;;
    reorientHdrAxToSa)
	run reorient -o ASL phantom_ax.hdr ${tmpdir}/reorient.hdr
	check_results reorient.hdr reorient.img
	;;
    reorientHdrCoToSa)
	run reorient -o ASL phantom_co.hdr ${tmpdir}/reorient.hdr
	check_results reorient.hdr reorient.img
	;;
    reorientHdrAxToCo)
	run reorient -o LSA phantom_ax.hdr ${tmpdir}/reorient.hdr
	check_results reorient.hdr reorient.img
	;;
    reorientHdrSaToCo)
	run reorient -o LSA phantom_sa.hdr ${tmpdir}/reorient.hdr
	check_results reorient.hdr reorient.img
	;;
    reorientNrrdToNrrd)
        run reorient vol001_mr_t0_crop.nrrd ${tmpdir}/vol001_mr_t0_crop.nhdr
        check_results vol001_mr_t0_crop.nhdr vol001_mr_t0_crop.raw
	;;
    reorientNrrdToNrrdRAS)
        run reorient --output-orientation RAS vol001_mr_t0_crop.nrrd ${tmpdir}/vol001_mr_t0_crop.nhdr
        check_results vol001_mr_t0_crop.nhdr vol001_mr_t0_crop.raw
	;;
    reorientNrrdToNrrdSpaceLPS)
        run reorient --output-space LPS vol001_mr_t0_crop.nrrd ${tmpdir}/vol001_mr_t0_crop.nhdr
        check_results vol001_mr_t0_crop.nhdr vol001_mr_t0_crop.raw
	;;
    registrationRigidMrPet)
	run registration -i --dofs 6 -o ${tmpdir} pat001_mr_T1.hdr pat001_pet.hdr
	check_results registration
	;;
    registrationRigidMrCt)
	run registration -i --dofs 6 -o ${tmpdir} pat002_mr_T2.hdr pat002_ct.hdr
	check_results registration
	;;
    registrationRigidCt)
	run registration --msd -i --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_ct.hdr
	check_results registration
	;;
    registrationRigidPetMr)
	run registration -i --dofs 6 -o ${tmpdir} pat001_pet.hdr pat001_mr_T1.hdr
	check_results registration
	;;
    registrationRigidCtMr)
	run registration -i --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_mr_T2.hdr
	check_results registration
	;;
    registrationRigidMrPetNoSwap)
	run registration --no-switch -i --dofs 6 -o ${tmpdir} pat001_mr_T1.hdr pat001_pet.hdr
	check_results registration
	;;
    registrationRigidMrCtNoSwap)
	run registration --no-switch -i --dofs 6 -o ${tmpdir} pat002_mr_T2.hdr pat002_ct.hdr
	check_results registration
	;;
    registrationRigidPetMrDOF9)
	run registration -i --dofs 9 -o ${tmpdir} pat001_pet.hdr pat001_mr_T1.hdr
	check_results registration
	;;
    registrationRigidCtMrDOF7)
	run registration -i --dofs 7 -o ${tmpdir} pat002_ct.hdr pat002_mr_T2.hdr
	check_results registration
	;;
    registrationRigidLabelsDOF69)
	run registration --dofs 6 --dofs 9 --class-ref label --class-flt label -o ${tmpdir} parc1.hdr parc2.hdr
	check_results registration
	;;
    registrationRigidCrop)
	run registration -v -i -e 2.0 -a 0.125 --sampling 0.25 --crop-index-ref 17,20,0,47,49,12 --crop-index-flt 12,15,0,52,54,12 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr
	check_results registration
	;;
    sbaDefault)
	run sba -o ${tmpdir}/sba.nii -n 255 parc1.hdr parc2.hdr parc3.hdr
	check_results sba.nii
	;;
    sbaOutliers)
	run sba --exclude-outliers -o ${tmpdir}/sba.nii -n 255 parc1.hdr parc1.hdr parc1.hdr parc1.hdr parc1.hdr parc2.hdr
	check_results sba.nii
	;;
    sbaOutliers2)
	run sba --exclude-outliers -o ${tmpdir}/sba.nii -n 255 parc1.hdr parc2.hdr parc3.hdr
	check_results sba.nii
	;;
    sbaiDefault)
	run sbai -o ${tmpdir}/sbai.nii -n 255 parc12_warp.xform parc13_warp.xform
	check_results sbai.nii
	;;
    sequenceDefault)
	run_eval "cat numbers.txt | ${BINDIR}/sequence > ${tmpdir}/sequence.txt"
	check_results sequence.txt
	;;
    sequenceFormat)
	run_eval "cat numbers.txt | ${BINDIR}/sequence --format %g > ${tmpdir}/sequence.txt"
	check_results sequence.txt
	;;
    sequenceThresh)
	run_eval "cat numbers.txt | ${BINDIR}/sequence --thresh 1e4 > ${tmpdir}/sequence.txt"	
	check_results sequence.txt
	;;
    sequenceAbs)
	run_eval "cat numbers.txt | ${BINDIR}/sequence --abs > ${tmpdir}/sequence.txt"
	check_results sequence.txt
	;;
    sequenceAbsThresh)
	run_eval "cat numbers.txt | ${BINDIR}/sequence --thresh 1000 --abs > ${tmpdir}/sequence.txt"
	check_results sequence.txt
	;;
    sequenceHistogramDefault)
	run_eval "cat numbers.txt | ${BINDIR}/sequence --write-histogram ${tmpdir}/histogram.csv > ${tmpdir}/sequence.txt"
	check_results sequence.txt histogram.csv
	;;
    sequenceHistogramExplicit)
	run_eval "cat numbers.txt | ${BINDIR}/sequence --histogram-bins 10 --histogram-min 0 --histogram-max 1000 --write-histogram ${tmpdir}/histogram.csv > ${tmpdir}/sequence.txt"
	check_results sequence.txt histogram.csv
	;;
    similarityGrey)
	run_eval "${BINDIR}/similarity --histogram-text-file ${tmpdir}/histogram.txt rat_fse_erly.hdr rat_fse_late.hdr > ${tmpdir}/similarity.txt"
	check_results histogram.txt similarity.txt
	;;
    similarityWithInf)
	run_eval "${BINDIR}/similarity float_with_inf.nii.gz float_with_inf.nii.gz > ${tmpdir}/similarity.txt"
	check_results similarity.txt
	;;
    similarityLabels)
	run_eval "${BINDIR}/similarity --labels --histogram-text-file ${tmpdir}/histogram.txt parc1.hdr parc2.hdr > ${tmpdir}/similarity.txt"
	check_results histogram.txt similarity.txt
	;;
    similarityGreyMask)
	run_eval "${BINDIR}/similarity --mask rat_fse_erly.hdr --histogram-text-file ${tmpdir}/histogram.txt rat_fse_erly.hdr rat_fse_late.hdr > ${tmpdir}/similarity.txt"
	check_results histogram.txt similarity.txt
	;;
    similarityLabelsMask)
	run_eval "${BINDIR}/similarity --mask parc3_bin.hdr --labels --histogram-text-file ${tmpdir}/histogram.txt parc1.hdr parc2.hdr > ${tmpdir}/similarity.txt"
	check_results histogram.txt similarity.txt
	;;
    splitAxial)
	run split --output-xform-path ${tmpdir}/split_ax_%1d.xform --axial spgr_3t.hdr ${tmpdir}/split_ax_%1d.hdr
	check_results split_ax_0.img split_ax_1.img split_ax_0.xform split_ax_1.xform
	;;
    splitAxialSlices)
	run split --factor 0 --axial phantom_ax_downsampled.nii ${tmpdir}/slice_%1d.nii
	check_results slice_0.nii slice_1.nii slice_2.nii
	;;
    splitAxialNrrd)
	run split --axial --factor 3 spgr_3t.hdr ${tmpdir}/split_ax_%1d.nhdr
	check_results split_ax_0.nhdr split_ax_0.raw split_ax_1.nhdr split_ax_1.raw split_ax_2.nhdr split_ax_2.raw
	;;
    splitSagittal2)
	run split --output-xform-path ${tmpdir}/split_sa_%1d.xform --factor 2 --sagittal spgr_3t.hdr ${tmpdir}/split_sa_%1d.hdr
	check_results split_sa_0.img split_sa_1.img split_sa_0.xform split_sa_1.xform
	;;
    splitCoronal3)
	run split --output-xform-path ${tmpdir}/split_co_%1d.xform --factor 3 --coronal spgr_3t.hdr ${tmpdir}/split_co_%1d.hdr
	check_results split_co_0.img split_co_1.img split_co_2.img split_co_0.xform split_co_1.xform split_co_2.xform
	;;
    statisticsGrey)
	run_eval "${BINDIR}/statistics spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsPercentiles)
	run_eval "${BINDIR}/statistics -p 0.1 --percentile 0.5 -p 0.75 spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsGreyColumn)
	run_eval "${BINDIR}/statistics -C spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsGreyExpNotation)
	run_eval "${BINDIR}/statistics -E spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsGreyMask)
	run_eval "${BINDIR}/statistics -m spgr_3t_mask.hdr spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsGreyMultiMask)
	run_eval "${BINDIR}/statistics -M spgr_3t_mask.hdr spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsMaskMismatch)
	run_eval "${BINDIR}/statistics -M parc1.hdr spgr_3t.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsLabels)
	run_eval "${BINDIR}/statistics -l parc1.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsLabelsAllUpToHi)
	run_eval "${BINDIR}/statistics --mask-output-all-up-to 256 -l parc1.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    statisticsLabelsAllUpToLo)
	run_eval "${BINDIR}/statistics --mask-output-all-up-to 2 -l parc1.hdr > ${tmpdir}/statistics.txt"
	check_results statistics.txt
	;;
    streamxformFordwardBackward)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformBackwardForward)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform -- --inverse vol001_mr_t0t1_warp.xform vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformFordwardBackwardPoly0)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform poly0.xform --inverse poly0.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformFordwardBackwardPoly1)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform poly1.xform --inverse poly1.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformFordwardBackwardPoly2)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform poly2.xform --inverse poly2.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformFordwardBackwardPoly3)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform poly3.xform --inverse poly3.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformFordwardBackwardPoly4)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform poly4.xform --inverse poly4.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformAffinePoly4)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --affine-only poly4.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformAffineForward)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --affine-only vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t1_points.xyzl"
	check_results vol001_t1_points.xyzl
	;;
    streamxformAffineForwardBackward)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --affine-only vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformFordwardBackwardTolerance)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --inversion-tolerance 0.1 vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformAffine)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform vol001_mr_t0t1.list > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    streamxformAffineFromTo)
	run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --source-image vol001_mr_t0.hdr --target-image vol001_mr_t1.hdr vol001_mr_t0t1.list > ${tmpdir}/vol001_t0_points.xyzl"
	check_results vol001_t0_points.xyzl
	;;
    symmetry_plane)
	run sympl --sampling 1 --levels 4 --accuracy 0.1 --write-xform ${tmpdir}/xform --sinc --write-subtract ${tmpdir}/subtract.hdr --write-marked ${tmpdir}/marked.nii --write-mirror ${tmpdir}/mirror.nii -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters xform subtract.img marked.nii mirror.nii
	;;
    symmetry_planeThresh)
	run sympl --sampling 1 --levels 4 --accuracy 0.1 --min-value -224 --max-value 176 --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters aligned.img
	;;
    symplx_Default)
	run symplx --sampling 1 --levels 4 --accuracy 0.1 --write-xform ${tmpdir}/xform --sinc --write-subtract ${tmpdir}/subtract.hdr --write-marked ${tmpdir}/marked.nii --write-mirror ${tmpdir}/mirror.nii -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters xform subtract.img marked.nii mirror.nii
	;;
    symplx_Thresh)
	run symplx --sampling 1 --levels 4 --accuracy 0.1 --min-value -224 --max-value 176 --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters aligned.img
	;;
    symplx_FixOffset)
	run symplx --sampling 1 --levels 4 --accuracy 0.1 --fix-offset --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters aligned.img
	;;
    symplx_DefaultCUDA)
	run symplx_cuda --sampling 1 --levels 4 --accuracy 0.1 --write-xform ${tmpdir}/xform --sinc --write-subtract ${tmpdir}/subtract.hdr -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters xform subtract.img
	;;
    symplx_ThreshCUDA)
	run symplx_cuda --sampling 1 --levels 4 --accuracy 0.1 --min-value -224 --max-value 176 --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters aligned.img
	;;
    symplx_FixOffsetCUDA)
	run symplx_cuda --sampling 1 --levels 4 --accuracy 0.1 --fix-offset --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr
	check_results parameters aligned.img
	;;
    ttestDefault)
	run ttest -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestOneSided)
	run ttest -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestSymmetric)
	run ttest -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr --symmetric jacobian-01.nii jacobian-02.nii jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestLog)
	run ttest --log -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestAbsLog)
	run ttest --abs --log -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestInvert)
	run ttest --invert -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestPaired)
	run ttest --paired -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    ttestCrossCorrelation)
	run ttest --cross-correlation -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/pvals.hdr jacobian-01.nii jacobian-02.nii jacobian-03.nii -- jacobian-04.nii jacobian-03.nii jacobian-02.nii 
	check_results ttest.img pvals.img
	;;
    ttestZScores)
	run ttest --zscores -o ${tmpdir}/zscores.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results zscores.img
	;;
    ttestMask)
	run ttest --mask jacobian-mask.nii -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii
	check_results ttest.img tstats.img
	;;
    unsplitHdrAx)
	run unsplit --axial -o ${tmpdir}/unsplit.hdr split_ax_0.hdr split_ax_1.hdr
	check_results unsplit.hdr unsplit.img
	;;
    unsplitHdrSa)
	run unsplit --sagittal -o ${tmpdir}/unsplit.hdr split_sa_0.hdr split_sa_1.hdr
	check_results unsplit.hdr unsplit.img
	;;
    unsplitHdrCo)
	run unsplit --coronal -o ${tmpdir}/unsplit.hdr split_co_0.hdr split_co_1.hdr split_co_2.hdr
	check_results unsplit.hdr unsplit.img
	;;
    unsplitHdrNrrdAx)
	run unsplit --axial -o ${tmpdir}/unsplit.nhdr split_ax_0.hdr split_ax_1.hdr
	check_results unsplit.nhdr unsplit.raw
	;;
    unsplitHdrNrrdSa)
	run unsplit --sagittal -o ${tmpdir}/unsplit.nhdr split_sa_0.hdr split_sa_1.hdr
	check_results unsplit.nhdr unsplit.raw
	;;
    unsplitHdrNrrdCo)
	run unsplit --coronal -o ${tmpdir}/unsplit.nhdr split_co_0.hdr split_co_1.hdr split_co_2.hdr
	check_results unsplit.nhdr unsplit.raw
	;;
    unsplitNrrdNrrd)
	run unsplit --axial -o ${tmpdir}/unsplit.nhdr split_ax_0.nhdr split_ax_1.nhdr split_ax_2.nhdr
	check_results unsplit.nhdr unsplit.raw
	;;
    unsplitSlices)
        run unsplit --axial -o ${tmpdir}/unsplit.nii phantom_ax_downsampled_slice_0.nii phantom_ax_downsampled_slice_1.nii phantom_ax_downsampled_slice_2.nii
	check_results unsplit.nii
	;;
    unwarp_image_phantomDefault)
        run unwarp_image_phantom magphan.xml spgr_magphan.nii ${tmpdir}/poly.xform
	check_results poly.xform
	;;
    unwarp_image_phantomPoly)
        run unwarp_image_phantom --poly magphan.xml spgr_magphan.nii ${tmpdir}/poly.xform
	check_results poly.xform
	;;
    unwarp_image_phantomPolyDegree2)
        run unwarp_image_phantom --poly --degree 2 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomSpacing)
        run unwarp_image_phantom --spline --iterations-per-level 1 --final-cp-spacing 80 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomSpacingInverse)
        run unwarp_image_phantom --spline --iterations-per-level 1 --final-cp-spacing 80 --fit-inverse magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomSpacingLevels)
        run unwarp_image_phantom --spline --iterations-per-level 1 --final-cp-spacing 80 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomSpacingDirect)
        run unwarp_image_phantom --spline --iterations-per-level 1 --no-fit-affine --final-cp-spacing 80 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomDims)
        run unwarp_image_phantom --spline --iterations-per-level 1 --final-cp-dims 5,5,5 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomDimsLevels)
        run unwarp_image_phantom --spline --iterations-per-level 1 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomDimsLevelsIterations)
        run unwarp_image_phantom --spline --iterations-per-level 10 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomDimsLevelsThreshold)
        run unwarp_image_phantom --spline --iterations-per-level 1 --rms-threshold 0.1 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomDimsLevelsIterationsThreshold)
        run unwarp_image_phantom --spline --iterations-per-level 10 --rms-threshold 0.1 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    unwarp_image_phantomDimsDefault)
        run unwarp_image_phantom --spline --final-cp-dims 5,5,5 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform
	check_results ffd.xform
	;;
    volume_injection)
	run volume_injection --recon-grid-path spgr_3t.hdr -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img
	;;
    volume_injectionReconGrid)
	run volume_injection --recon-grid 49,65,35:3.75,3.75,3.75 -o ${tmpdir}/injection.nii --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.nii
	;;
    volume_injectionReconGridOffset)
	run volume_injection --recon-grid 48,64,34:3.75,3.75,3.75:1.875,1.875,1.875 -o ${tmpdir}/injection.nii --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.nii
	;;
    volume_injectionIsotropic)
	run volume_injection --recon-grid-path spgr_3t.hdr -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img
	;;
    volume_injectionNoXform)
	run volume_injection -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --exclude-first-image spgr_3t.hdr -- split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img
	;;
    volume_injectionNoXformIsotropic)
	run volume_injection -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --exclude-first-image spgr_3t.hdr -- split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img
	;;
    volume_reconstructionFourthOrder)
	run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --linear --fourth-order-error --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --write-injected-image ${tmpdir}/injection.hdr split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img reconstruction.img
	;;
    volume_reconstructionCubic)
	run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --cubic --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --write-injected-image ${tmpdir}/injection.hdr split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img reconstruction.img
	;;
    volume_reconstructionNoXform)
	run volume_reconstruction -o ${tmpdir}/reconstruction.hdr --linear --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --write-injected-image ${tmpdir}/injection.hdr --exclude-first-image spgr_3t.hdr -- split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results injection.img reconstruction.img
	;;
    volume_reconstructionBoxPSF)
	run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --deblurring box --psf 0.9375,0.9375,1.25 --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results reconstruction.img
	;;
    volume_reconstructionGaussianPSF)
	run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --deblurring gaussian --psf 0.9375,0.9375,1.25 --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr
	check_results reconstruction.img
	;;
    warpSingleLevel)
	run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --no-adaptive-fix -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpSingleLevelExact)
	run warp --fast --exploration 8 --grid-spacing 180 --exact-spacing --accuracy 1 --sampling 3 --no-adaptive-fix -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpInverseConsistentCC)
	run warp --fast --exploration 8 --grid-spacing 80 --accuracy 1 --ncc --ic-weight 1e-2 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpMultiLevel)
	run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpMultiLevelMatchHistograms)
	run warp --fast --exploration 8 --match-histograms --msd --grid-spacing 160 --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpMultiLevelDeltaFThreshold)
	run warp --fast --exploration 8 --delta-f-threshold 0.01 --msd --grid-spacing 160 --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpMultiLevelExact)
	run warp --fast --exploration 8 --grid-spacing 160 --exact-spacing --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpDelayRefine)
	run warp --fast --exploration 12 --grid-spacing 160 --accuracy 2 --refine 1 --delay-refine --sampling 6 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpEnergy)
	run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --refine 1 --energy-weight 1e-1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpEnergyRelax)
	run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --refine 1 --energy-weight 1e-1 --relax 1e-2 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpJacobian)
	export CMTK_NUM_THREADS=1
	run warp --fast --exploration 12 --grid-spacing 160 --accuracy 2 --refine 1 --jacobian-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list
	unset CMTK_NUM_THREADS
	check_results registration
	;;
    warpRigidity)
	run warp --fast --exploration 12 --grid-spacing 160 --accuracy 2 --refine 1 --rigidity-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpLabels)
	run warp --fast --exploration 8 --grid-spacing 90 --accuracy 1 --refine 1 --class-ref label --class-flt label -o ${tmpdir} --initial parc1_parc2_9dof.xform parc1.hdr parc2.hdr
	check_results registration
	;;
    warpxSingleLevel)
	run warpx --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --no-adaptive-fix -o ${tmpdir} --write-itk-xform ${tmpdir}/xform.tfm vol001_mr_t0t1.list
	check_results registration xform.tfm
	;;
    warpxSingleLevelExact)
	run warpx --fast --max-stepsize 8 --grid-spacing 180 --exact-spacing --min-stepsize 1 --sampling 3 --no-adaptive-fix -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpxInverseConsistentCC)
        export CMTK_NUM_THREADS=1
	run warpx --fast --max-stepsize 8 --grid-spacing 80 --min-stepsize 1 --ncc --inverse-consistency-weight 1e-2 -o ${tmpdir} vol001_mr_t0t1.list
        unset CMTK_NUM_THREADS
	check_results registration
	;;
    warpxMultiLevel)
	run warpx --pad-flt -10000 --write-reformatted ${tmpdir}/reformat.nii --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration reformat.nii
	;;
    warpxMultiLevelMatchHistograms)
        export CMTK_NUM_THREADS=1
	run warpx --fast --max-stepsize 8 --match-histograms --msd --grid-spacing 160 --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	unset CMTK_NUM_THREADS
	check_results registration
	;;
    warpxMultiLevelDeltaFThreshold)
        export CMTK_NUM_THREADS=1
	run warpx --fast --max-stepsize 8 --delta-f-threshold 0.01 --msd --grid-spacing 160 --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	unset CMTK_NUM_THREADS
	check_results registration
	;;
    warpxMultiLevelExact)
	run warpx --fast --max-stepsize 8 --grid-spacing 160 --exact-spacing --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpxDelayRefine)
	run warpx --fast --max-stepsize 12 --grid-spacing 160 --min-stepsize 2 --grid-refine 1 --delay-refine --sampling 6 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpxEnergy)
	run warpx --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --grid-refine 1 --smoothness-constraint-weight 1e-1 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpxEnergyRelax)
	run warpx --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --grid-refine 1 --smoothness-constraint-weight 1e-1 --constraint-relaxation-factor 1e-2 -o ${tmpdir} vol001_mr_t0t1.list
	check_results registration
	;;
    warpxJacobian)
	export CMTK_NUM_THREADS=1
	run warpx --fast --max-stepsize 12 --grid-spacing 160 --min-stepsize 2 --grid-refine 1 --jacobian-constraint-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list
	unset CMTK_NUM_THREADS
	check_results registration
	;;
    warpxJacobianUnfold)
	export CMTK_NUM_THREADS=1
	run warpx --fast --relax-to-unfold --max-stepsize 12 --grid-spacing 160 --min-stepsize 2 --grid-refine 1 --jacobian-constraint-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list
	unset CMTK_NUM_THREADS
	check_results registration
	;;
    warpxLabels)
	run warpx --fast --max-stepsize 8 --grid-spacing 90 --min-stepsize 1 --grid-refine 1 --class-ref label --class-flt label -o ${tmpdir} --initial parc1_parc2_9dof.xform parc1.hdr parc2.hdr
	check_results registration
	;;
    vtkxform)
        run_eval "${BINDIR}/vtkxform vol001_mr_t0t1.list < polydata_ascii.vtk > ${tmpdir}/output.vtk"
	check_results output.vtk
	;;
    vtkxformInverse)
        run_eval "${BINDIR}/vtkxform -- --inverse vol001_mr_t0t1.list < polydata_ascii.vtk > ${tmpdir}/output.vtk"
	check_results output.vtk
	;;
    xform2dfieldWarpNrrd)
	run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0t1_warp.xform
	check_results dfield.nhdr dfield.raw
	;;
    xform2dfieldWarpNifti)
	run xform2dfield -v ${tmpdir}/dfield.nii vol001_mr_t0_crop.hdr vol001_mr_t0t1_warp.xform
	check_results dfield.nii
	;;
    xform2dfieldWarpNiftiFSL)
	run xform2dfield --target-image-fsl ncanda_t1_jacobian.nii.gz --output-absolute ${tmpdir}/dfield.nii vol001_mr_t0_crop.hdr vol001_mr_t0t1_warp.xform
	check_results dfield.nii
	;;
    xform2dfieldWarpNiftiHdr)
	run xform2dfield -v ${tmpdir}/dfield.img vol001_mr_t0_crop.hdr vol001_mr_t0t1_warp.xform
	check_results dfield.hdr dfield.img
	;;
    xform2dfieldAffineNrrd)
	run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform
	check_results dfield.nhdr dfield.raw
	;;
    xform2dfieldDownsampleXYZNrrd)
	run xform2dfield -v --downsample 4,4,2 ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform
	check_results dfield.nhdr dfield.raw
	;;
    xform2dfieldDownsampleXNrrd)
	run xform2dfield -v --downsample 4 ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform
	check_results dfield.nhdr dfield.raw
	;;
    xform2dfieldConcatNrrd)
	run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform vol001_mr_t0t1_warp.xform
	check_results dfield.nhdr dfield.raw
	;;
    xform2dfieldInverseNrrd)
	run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --inverse vol001_mr_t0t1_warp.xform
	check_results dfield.nhdr dfield.raw
	;;
    xform2scalarAffine)
	run xform2scalar --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1.list
	check_results magnitude.nii
	;;
    xform2scalarAffineDoubleY)
	run xform2scalar --mode x-component --output ${tmpdir}/xcomponent.nii vol001_mr_t0.hdr vol001_mr_t0t1.list
	check_results xcomponent.nii
	;;
    xform2scalarWarp)
	run xform2scalar --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform
	check_results magnitude.nii
	;;
    xform2scalarWarpInverseError)
	run xform2scalar --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform
	check_results magnitude.nii
	;;
    xform2scalarWarpOnly)
	run xform2scalar --warp-only --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform
	check_results magnitude.nii
	;;
    xform2scalarDfield)
	run xform2scalar --float --output ${tmpdir}/magnitude.nii parc1.hdr parc1_parc2_dfield.nrrd
	check_results magnitude.nii
	;;
    vol2csvLabels)
	run vol2csv -o ${tmpdir}/volumes.csv --labels-file sri24_ventricles.txt ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii
	check_results volumes.csv
	;;
    vol2csvLabelsNoBackground)
	run vol2csv -o ${tmpdir}/volumes.csv --labels-file sri24_ventricles_noBG.txt ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii
	check_results volumes.csv
	;;
    vol2csvDensityLabels)
	run vol2csv -o ${tmpdir}/volumes.csv --density-labels CSF,GM,WM ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii
	check_results volumes.csv
	;;
    vol2csvScale)
	run vol2csv -o ${tmpdir}/volumes.csv --pixel-scale-image ncanda_t1_jacobian.nii ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii
	check_results volumes.csv
	;;
    vol2csvScaleGlobal)
	run vol2csv -o ${tmpdir}/volumes.csv --pixel-scale-factor 2 ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii
	check_results volumes.csv
	;;
    help_film)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --help > ${tmpdir}/film.help"
	check_results film.help
	;;
    help_all_film)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --help-all > ${tmpdir}/film.help"
	check_results film.help
	;;
    xml_film)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --xml | ${sed} '/<version>/{ N; s/^.*$/<version>/ }' > ${tmpdir}/film.xml"
	check_results film.xml
	;;
    xml_gmm)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/gmm --xml | ${sed} '/<version>/{ N; s/^.*$/<version>/ }' > ${tmpdir}/gmm.xml"
	check_results gmm.xml
	;;
    xml_levelset)
        run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/levelset --xml | ${sed} '/<version>/{ N; s/^.*$/<version>/ }' > ${tmpdir}/levelset.xml"
	check_results levelset.xml
	;;
    xml_mrbias)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/mrbias --xml | ${sed} '/<version>/{ N; s/^.*$/<version>/ }' > ${tmpdir}/mrbias.xml"
	check_results mrbias.xml
	;;
    xml_registration)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/registration --xml | ${sed} '/<version>/{ N; s/^.*$/<version>/ }' > ${tmpdir}/registration.xml"
	check_results registration.xml
	;;
    wiki_film)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --wiki > ${tmpdir}/film.wiki"
	check_results film.wiki
	;;
    wiki_levelset)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/levelset --wiki > ${tmpdir}/levelset.wiki"
	check_results levelset.wiki
	;;
    wiki_mrbias)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/mrbias --wiki > ${tmpdir}/mrbias.wiki"
	check_results mrbias.wiki
	;;
    wiki_registration)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/registration --wiki > ${tmpdir}/registration.wiki"
	check_results registration.wiki
	;;
    man_film)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --man | fgrep -v .TH > ${tmpdir}/film.man"
	check_results film.man
	;;
    man_levelset)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/levelset --man | fgrep -v .TH > ${tmpdir}/levelset.man"
	check_results levelset.man
	;;
    man_mrbias)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/mrbias --man | fgrep -v .TH > ${tmpdir}/mrbias.man"
	check_results mrbias.man
	;;
    man_registration)
	run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/registration --man | fgrep -v .TH > ${tmpdir}/registration.man"
	check_results registration.man
	;;
    *)
	exit 2
	;;
esac

if [ "${tmpdir}" != "" ]; then
    rm -rf ${tmpdir}
fi