# Adapt hard-coded paths to the directory structure of Gentoo (including Prefix) # From: Francois Bissey # Signed-off-by: Horea Christian diff -Naur fsl.orig/src/fast4/fast_two.cc fsl/src/fast4/fast_two.cc --- fsl.orig/src/fast4/fast_two.cc 2015-03-30 11:54:10.522550233 +1300 +++ fsl/src/fast4/fast_two.cc 2015-03-30 11:54:18.412569892 +1300 @@ -166,7 +166,7 @@ string csfPriorName, grayPriorName, whitePriorName; if(alternatePriors.unset()) { - string priorRootName=string(getenv("FSLDIR")) + "/data/standard/tissuepriors/avg152T1_"; + string priorRootName="@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/tissuepriors/avg152T1_"; csfPriorName = priorRootName+"csf"; grayPriorName = priorRootName+"gray"; whitePriorName = priorRootName+"white"; @@ -215,15 +215,15 @@ if(bapused>0) { char reg[1024]; - sprintf(reg, "%s/bin/flirt -ref %s -in %s -out %s -applyxfm -init %s", getenv("FSLDIR"), inname.c_str(), csfPriorName.c_str(), (main_prior_vol+"_csf_stdspace").c_str(), bapriori.value().c_str()); + sprintf(reg, "flirt -ref %s -in %s -out %s -applyxfm -init %s", inname.c_str(), csfPriorName.c_str(), (main_prior_vol+"_csf_stdspace").c_str(), bapriori.value().c_str()); if(verbose.value()) cout< G; vector titles; float tr, mult, trmult, nltffwhm=0, maxconvwin=0; - char fl[10000], *FSLDIR; + char fl[10000]; string fn, filename; FONT_DATA *font_data = new FONT_DATA[1]; @@ -760,8 +760,6 @@ if (argc==3) motionparams=remmean(read_ascii_matrix(argv[2])); - FSLDIR=getenv("FSLDIR"); - fn = string(argv[1])+".fsf"; level = atoi(find_line(fn, "fmri(level)", fl)); @@ -1491,7 +1489,7 @@ writeCovarianceImage(string(argv[1])+"_cov.ppm", contrasts, F, nftests, realDesign, level, evs.eigenvals, font_data, contrasts.RE); writeImagePreview(string(argv[1])+".ppm", contrasts, F, nftests, realDesign, level, evs, font_data, titles, tr, nltffwhm, nTimepoints, G); - filename=string(getenv("FSLDIR"))+"/bin/wpng -q -overwrite "+string(argv[1])+".ppm "; + filename="wpng -q -overwrite "+string(argv[1])+".ppm "; system(filename.c_str()); return(0); @@ -2134,6 +2132,6 @@ fclose(outputfile); - filename=string(getenv("FSLDIR")) + "/bin/wpng -q -overwrite " + filename; + filename="wpng -q -overwrite " + filename; system(filename.c_str()); } diff -Naur fsl.orig/src/feat5/tsplot.cc fsl/src/feat5/tsplot.cc --- fsl.orig/src/feat5/tsplot.cc 2015-03-30 11:54:10.502550183 +1300 +++ fsl/src/feat5/tsplot.cc 2015-03-30 11:54:18.412569892 +1300 @@ -293,7 +293,7 @@ ofstream outputFile; int numEVs, npts, numContrasts=1, nftests=0, GRPHSIZE(600), PSSIZE(600); vector normalisedContrasts, model, triggers; - string fmriFileName, fslPath, featdir, vType, indexText; + string fmriFileName, featdir, vType, indexText; ColumnVector NewimageVoxCoord(4),NiftiVoxCoord(4); bool outputText(true), useCoordinate(false), prewhiten(false), useTriggers(false), customMask(false), modelFree(false), isHigherLevel(false), outputDataOnly(false); bool zWeightClusters(true); @@ -307,7 +307,6 @@ if (argc<2) usage(""); featdir=string(argv[1]); fmriFileName=featdir+"/filtered_func_data"; - fslPath=string(getenv("FSLDIR")); string outputName(featdir); @@ -725,7 +724,7 @@ cerr << "Can't open output report file " << outputName << endl; exit(1); } - outputFile << "\n"<< statType << num2str(i) <<"\n\n
\n

FEAT Time Series Report - "<< statType << num2str(i) <<"

\n
\n
Full plots

\n"<< graphText; + outputFile << "\n"<< statType << num2str(i) <<"\n\n


\n

FEAT Time Series Report - "<< statType << num2str(i) <<"

\n
\n
Full plots

\n"<< graphText; if (useTriggers) outputFile << "\n


Peristimulus plots

\n"<< peristimulusText <<"\n


\n\n"; else outputFile << "\n\n\n"; outputFile.close(); @@ -740,7 +739,7 @@ cerr << "Can't open output report file " << outputName << endl; exit(1); } - outputFile << "\nFEAT Time Series Report\n\n
\n

FEAT Time Series Report

\n
\n
" << indexText << "
" << endl << endl; + outputFile << "\nFEAT Time Series Report\n\n
\n

FEAT Time Series Report

\n
\n
" << indexText << "
" << endl << endl; outputFile.close(); /* now output same thing without start and end, for inclusion in feat report */ diff -Naur fsl.orig/src/first/first_utils.cc fsl/src/first/first_utils.cc --- fsl.orig/src/first/first_utils.cc 2015-03-30 11:54:10.482550135 +1300 +++ fsl/src/first/first_utils.cc 2015-03-30 11:54:18.412569892 +1300 @@ -1954,8 +1954,8 @@ if (!surfaceVAout.value()) { // do not output on the surface, instead do the new default of outputting a volume with the scalar normal dot product values (for use with randomise) volume refim; - if (useReconMNI.value()) { read_volume(refim,string(getenv("FSLDIR")) + "/data/standard/MNI152_T1_1mm"); } - else { read_volume(refim,string(getenv("FSLDIR")) + "/data/standard/MNI152_T1_1mm"); } + if (useReconMNI.value()) { read_volume(refim,"@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm"); } + else { read_volume(refim,"@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm"); } volume maskvol(refim); maskvol=0.0f; volume4D volnormals; diff -Naur fsl.orig/src/fnirt/fnirtfns.cpp fsl/src/fnirt/fnirtfns.cpp --- fsl.orig/src/fnirt/fnirtfns.cpp 2015-03-30 11:54:10.522550233 +1300 +++ fsl/src/fnirt/fnirtfns.cpp 2015-03-30 11:54:18.412569892 +1300 @@ -1203,8 +1203,7 @@ return(string(ref_fname)); } else { - const char *fsldir_ptr = getenv("FSLDIR"); - string eref_fname = string(fsldir_ptr) + string("/data/standard/") + ref_fname; + string eref_fname = string("@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/") + ref_fname; if (NEWIMAGE::fsl_imageexists(eref_fname)) return(eref_fname); else return(string("")); } @@ -1230,9 +1229,8 @@ NEWIMAGE::read_volume_hdr_only(vref,ref_fname); // Throws if file dont exist eref_fname = ref_fname; } - catch(...) { // Didn't exist in current directory, try in ${FSLDIR}/data/standard - const char *fsldir_ptr = getenv("FSLDIR"); - eref_fname = string(fsldir_ptr) + string("/data/standard/") + ref_fname; + catch(...) { // Didn't exist in current directory, try in .../data/standard + eref_fname = string("@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/") + ref_fname; try { cout << "Could not find " << ref_fname << ", now checking " << eref_fname << endl; NEWIMAGE::read_volume_hdr_only(vref,eref_fname); // Throws if file dont exist @@ -1267,8 +1265,7 @@ if (check_exist(ecfname)) return(ecfname); } if (!FNIRT::path(cfname).length()) { // If no path explicitly given - const char *fsldir_ptr = getenv("FSLDIR"); - ecfname = string(fsldir_ptr) + string("/etc/flirtsch/") + cfname; + ecfname = string("@GENTOO_PORTAGE_EPREFIX@/etc/flirtsch/") + cfname; if (check_exist(ecfname)) return(ecfname); else if (!FNIRT::extension(ecfname).length()) { // If no path _and_ no extension given ecfname += string(".cnf"); diff -Naur fsl.orig/src/fslsurface/fslsurface_first.cc fsl/src/fslsurface/fslsurface_first.cc --- fsl.orig/src/fslsurface/fslsurface_first.cc 2015-03-30 11:54:10.522550233 +1300 +++ fsl/src/fslsurface/fslsurface_first.cc 2015-03-30 11:54:18.412569892 +1300 @@ -500,8 +500,7 @@ volume* immni = new volume(); - char* fsldir = getenv("FSLDIR"); - read_volume_hdr_only(*immni, string(fsldir) + "/data/standard/MNI152_T1_1mm"); + read_volume_hdr_only(*immni, "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm"); //read_volume_hdr_only(*immni, template_name); @@ -699,8 +698,7 @@ volume* immni = new volume(); - char* fsldir = getenv("FSLDIR"); - read_volume_hdr_only(*immni, string(fsldir) + "/data/standard/MNI152_T1_1mm"); + read_volume_hdr_only(*immni, "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm"); //read_volume_hdr_only(*immni, template_name); diff -Naur fsl.orig/src/fslsurface/fslsurfacemaths.cpp fsl/src/fslsurface/fslsurfacemaths.cpp --- fsl.orig/src/fslsurface/fslsurfacemaths.cpp 2015-03-30 11:54:10.522550233 +1300 +++ fsl/src/fslsurface/fslsurfacemaths.cpp 2015-03-30 11:54:18.412569892 +1300 @@ -598,12 +598,6 @@ }else if (command == "-reconFromBvars"){ cout<<"do recon "<0){ @@ -1136,7 +1136,7 @@ // set up all strings string BET_outputfname = string(Mean_fname)+"_brain"; - string BET_path = opts.binpath + "bet"; + string BET_path = "bet"; string BET_optarg = "-m -f 0.4"; // see man bet string Mask_fname = BET_outputfname+"_mask"; diff -Naur fsl.orig/src/melodic/meloptions.cc fsl/src/melodic/meloptions.cc --- fsl.orig/src/melodic/meloptions.cc 2015-03-30 11:54:10.502550183 +1300 +++ fsl/src/melodic/meloptions.cc 2015-03-30 11:54:18.412569892 +1300 @@ -93,14 +93,6 @@ explicitnums = false; logfname = string("log.txt"); - // work out the path to the $FSLDIR/bin directory - if(getenv("FSLDIR")!=0){ - binpath = (string) getenv("FSLDIR") + "/bin/"; - } else{ - binpath = argv[0]; - binpath = binpath.substr(0,binpath.length()-7); - } - // parse once to establish log directory name for(int a = options.parse_command_line(argc, argv); a < argc; a++); diff -Naur fsl.orig/src/melodic/meloptions.h fsl/src/melodic/meloptions.h --- fsl.orig/src/melodic/meloptions.h 2015-03-30 11:54:10.502550183 +1300 +++ fsl/src/melodic/meloptions.h 2015-03-30 11:54:18.412569892 +1300 @@ -93,7 +93,6 @@ ~MelodicOptions() { delete gopt; } string version; - string binpath; string logfname; bool filtermode; bool explicitnums; diff -Naur fsl.orig/src/melodic/melreport.cc fsl/src/melodic/melreport.cc --- fsl.orig/src/melodic/melreport.cc 2015-03-30 11:54:10.502550183 +1300 +++ fsl/src/melodic/melreport.cc 2015-03-30 11:54:18.412569892 +1300 @@ -84,8 +84,8 @@ IChtml.setDir(report.getDir(),mmodel.get_prefix()+".html"); {//start IC page - IChtml << "" << endl + IChtml << "" << endl << "" << "FSL" << endl << "