#!/usr/bin/env ruby


system("echo Running Testing Hammer Module ... ");
system("rm *warped*");

#copy the scripts
myApplicationsPath = "/Users/andresmf/Applications/";
system("cp ../scripts/performlabeling.pl " + myApplicationsPath + "/hammer/bin/performlabeling_dev.pl");
#system("cp ../scripts/linearlyregisterbyfsl.sh " + myApplicationsPath + "/hammer/bin/linearlyregisterbyfsl_dev.sh");
system("cp ../scripts/templinearlyregisterbyfsl.rb " + myApplicationsPath + "/hammer/bin/templinearlyregisterbyfsl_dev.rb");
#copy the binaries for labeling script
system("cp ../bin/hammer " + myApplicationsPath + "/hammer/bin/hammer_dev");
system("cp ../bin/cropslices " + myApplicationsPath + "/hammer/bin/cropslices_dev");
system("cp ../bin/splitfile " + myApplicationsPath + "/hammer/bin/splitfile_dev");
system("cp ../bin/transform3dvectorfield " + myApplicationsPath + "/hammer/bin/transform3dvectorfield_dev");
system("cp ../bin/performdeformationusingvectorfield " + myApplicationsPath + "/hammer/bin/performdeformationusingvectorfield_dev");
#copy the binaries for the registrtion by fsl script
system("cp ../bin/transform3dimg " + myApplicationsPath + "/hammer/bin/transform3dimg_dev");
system("cp ../bin/getfilesize " + myApplicationsPath + "/hammer/bin/getfilesize_dev");
system("cp ../bin/makeheader " + myApplicationsPath + "/hammer/bin/makeheader_dev");
system("cp ../bin/fslmat2mymat " + myApplicationsPath + "/hammer/bin/fslmat2mymat_dev");

system("echo Attempting to start the labeling process ... ");
system("echo performlabeling_dev.pl -S subject1_preprocessed.img -d subject1_warped -M " + myApplicationsPath + "/hammer/models/jakob_rad_convention_segmented.img -L " + myApplicationsPath + "/hammer/models/jakob_rad_convention_labels_nocere.img -X256,256,110 -x256,256,198 -V0.9375,0.9375,1.5 -v1.0,1.0,1.0 -i10 -R0.05 -r12,10,8 -m0.06 -T");
system("performlabeling_dev.pl -S subject1_preprocessed.img -d subject1_warped -M " + myApplicationsPath + "/hammer/models/jakob_rad_convention_segmented.img -L " + myApplicationsPath + "/hammer/models/jakob_rad_convention_labels_nocere.img -X256,256,110 -x256,256,198 -V0.9375,0.9375,1.5 -v1.0,1.0,1.0 -i10 -R0.05 -r12,10,8 -m0.06 -T");

system("echo Checking  the results ... ");
system("md5 subject1_warped.Field.1.img.Subj2Mdl");
system("md5 subject1_warped.Warped.Labels.trans");
system("md5 subject1_warped.Warped.MdlSeg.img");

#system("echo The results are ok ... ");
#system("echo The results differ from current distribution ... ");
