forked from freesurfer/freesurfer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of /space/freesurfer/repo/freesurfer
Not sure what I'm doing here or if it is important.
- Loading branch information
Showing
20 changed files
with
460 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## | ||
## Makefile.am | ||
## | ||
|
||
AM_CPPFLAGS=-I$(top_srcdir)/include | ||
AM_LDFLAGS= | ||
|
||
check_PROGRAMS = test_MRIScomputeBorderValues | ||
|
||
TESTS=run_test_MRIScomputeBorderValues | ||
|
||
test_MRIScomputeBorderValues_SOURCES=test_MRIScomputeBorderValues.cpp | ||
test_MRIScomputeBorderValues_LDADD= $(addprefix $(top_builddir)/, $(LIBS_MGH)) | ||
test_MRIScomputeBorderValues_LDFLAGS= $(OS_LDFLAGS) | ||
|
||
EXTRA_DIST=run_test_MRIScomputeBorderValues testdata.tar.gz | ||
|
||
EXCLUDE_FILES= | ||
include $(top_srcdir)/Makefile.extra | ||
|
||
clean-local: | ||
rm -f *.o |
52 changes: 52 additions & 0 deletions
52
utils/test/MRIScomputeBorderValues/run_test_MRIScomputeBorderValues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/tcsh -f | ||
# | ||
# unit test for: MRIScomputeBorderValues | ||
# - this script provides source and reference data for the testing binary | ||
# | ||
|
||
|
||
umask 002 | ||
|
||
# extract testing data: | ||
gunzip -c testdata.tar.gz | tar xvf - | ||
|
||
|
||
# | ||
# run test_MRIScomputeBorderValues with the source and reference files: | ||
# | ||
|
||
cd testdata | ||
|
||
setenv FREESURFER_HOME ../../distribution | ||
setenv SUBJECTS_DIR "" | ||
|
||
|
||
set threads=( 1 8 ) | ||
foreach num ($threads) | ||
|
||
setenv OMP_NUM_THREADS $num | ||
echo | ||
echo "running test_MRIScomputeBorderValues with $num thread(s)" | ||
|
||
set cmd=(../test_MRIScomputeBorderValues lh.surf mri_brain.mgz mri_smooth.mgz mri_aseg.mgz) | ||
echo | ||
$cmd | ||
if ($status != 0) then | ||
echo "test_MRIScomputeBorderValues FAILED" | ||
exit 1 | ||
endif | ||
|
||
end | ||
|
||
echo | ||
echo | ||
echo | ||
|
||
|
||
# cleanup: | ||
cd .. | ||
rm -rf testdata | ||
|
||
echo | ||
echo "MRIScomputeBorderValues passed test" | ||
exit 0 |
138 changes: 138 additions & 0 deletions
138
utils/test/MRIScomputeBorderValues/test_MRIScomputeBorderValues.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// | ||
// unit test for MRIScomputeBorderValues - located in utils/mrisurf.c | ||
// | ||
|
||
#include <string> | ||
#include <iostream> | ||
#include <iomanip> | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
#include "error.h" | ||
#include "utils.h" | ||
#include "macros.h" | ||
#include "mri.h" | ||
#include "mrisurf.h" | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int err = 0; | ||
|
||
// check arg count: | ||
if (argc != 5) | ||
{ | ||
std::cerr << "ERROR: 4 args are required: mris mri_brain mri_smooth mri_aseg\n"; | ||
exit(1); | ||
} | ||
|
||
|
||
// read args: | ||
std::string Progname = argv[0]; | ||
std::string s_mris = argv[1]; | ||
std::string s_brain = argv[2]; | ||
std::string s_smooth = argv[3]; | ||
std::string s_aseg = argv[4]; | ||
|
||
std::cout << Progname << std::endl; | ||
|
||
|
||
// read MRIS input: | ||
std::cout << "reading " << s_mris << std::endl; | ||
MRIS *mris = MRISread(s_mris.c_str()); | ||
if (!mris) | ||
{ | ||
std::cerr << "ERROR: could not read mris '" << s_mris << "'!\n"; | ||
exit(ERROR_BADPARM); | ||
} | ||
// read MRI_BRAIN input: | ||
std::cout << "reading " << s_brain << std::endl; | ||
MRI *mri_brain = MRIread(s_brain.c_str()); | ||
if (!mri_brain) | ||
{ | ||
std::cerr << "ERROR: could not read mri_brain '" << s_brain << "'!\n"; | ||
exit(ERROR_BADPARM); | ||
} | ||
// read MRI_SMOOTH input: | ||
std::cout << "reading " << s_smooth << std::endl; | ||
MRI *mri_smooth = MRIread(s_smooth.c_str()); | ||
if (!mri_smooth) | ||
{ | ||
std::cerr << "ERROR: could not read mri_smooth '" << s_smooth << "'!\n"; | ||
exit(ERROR_BADPARM); | ||
} | ||
// read MRI_ASEG input: | ||
std::cout << "reading " << s_aseg << std::endl; | ||
MRI *mri_aseg = MRIread(s_aseg.c_str()); | ||
if (!mri_aseg) | ||
{ | ||
std::cerr << "ERROR: could not read mri_aseg '" << s_aseg << "'!\n"; | ||
exit(ERROR_BADPARM); | ||
} | ||
|
||
|
||
// run: | ||
std::cout << "running MRIScomputeBorderValues...\n"; | ||
err = MRIScomputeBorderValues(mris, mri_brain, mri_smooth, | ||
120.0, 112.28, 64.0, 53.24, 112.28, | ||
1.0, 10.0, NULL, 1, NULL, 0.0, 0, mri_aseg); | ||
if (err) | ||
{ | ||
std::cerr << "ERROR: could not run MRIScomputeBorderValues!\n"; | ||
exit(err); | ||
} | ||
|
||
|
||
// check averages of val, d, and mean across all vertices with nonzero val: | ||
int vno, vtot = 0; | ||
VERTEX *v; | ||
float val_sum = 0, d_sum = 0, mean_sum = 0; | ||
float val_avg, d_avg, mean_avg; | ||
|
||
for (vno = 0 ; vno < mris->nvertices ; vno++) | ||
{ | ||
v = &mris->vertices[vno]; | ||
if (!FZERO(v->val)) | ||
{ | ||
val_sum += v->val; | ||
d_sum += v->d; | ||
mean_sum += v->mean; | ||
|
||
vtot++; | ||
} | ||
} | ||
|
||
val_avg = val_sum / vtot; | ||
d_avg = d_sum / vtot; | ||
mean_avg = mean_sum / vtot; | ||
|
||
std::cout << "\ncomputing stats for comparison:\n"; | ||
std::cout << std::fixed; | ||
std::cout << std::setprecision(8); | ||
std::cout << "avg val: " << val_avg << std::endl; | ||
std::cout << "avg d: " << d_avg << std::endl; | ||
std::cout << "avg mean: " << mean_avg << std::endl; | ||
|
||
if (!FEQUAL(val_avg, 80.10114288)) { err = 1; } | ||
if (!FEQUAL(d_avg, -0.26251045)) { err = 1; } | ||
if (!FEQUAL(mean_avg, 6.81254005)) { err = 1; } | ||
if (err == 1) | ||
{ | ||
std::cout << "surface vertex stats DO NOT match reference data!\n"; | ||
} | ||
|
||
|
||
// shut down: | ||
MRISfree(&mris); | ||
MRIfree(&mri_brain); | ||
MRIfree(&mri_smooth); | ||
MRIfree(&mri_aseg); | ||
|
||
exit(err); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.git/annex/objects/QZ/9J/SHA256E-s4936477--7f6ee280388db93e286ded9f2a2c44ac236d556d44e8be56c505c17250c71911.tar.gz/SHA256E-s4936477--7f6ee280388db93e286ded9f2a2c44ac236d556d44e8be56c505c17250c71911.tar.gz |
Oops, something went wrong.