From d9b5e0dead876c8919c3459bce494e1ba0c6da33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Fri, 8 Nov 2019 09:09:04 +1300 Subject: [PATCH 1/5] sci-biology/fsl: do not build tcl/tk/libpng Package-Manager: Portage-2.3.76, Repoman-2.3.16 --- sci-biology/fsl/ChangeLog | 4 ++++ sci-biology/fsl/files/fsl-6.0.2-setup.patch | 24 +++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/sci-biology/fsl/ChangeLog b/sci-biology/fsl/ChangeLog index a09f355..6255cef 100644 --- a/sci-biology/fsl/ChangeLog +++ b/sci-biology/fsl/ChangeLog @@ -1,3 +1,7 @@ + 07 Nov 2019; François Bissey + files/fsl-6.0.2-setup.patch: + sci-biology/fsl: do not build tcl/tk/libpng + 07 Nov 2019; François Bissey +files/fsl-6.0.2-setup.patch, fsl-6.0.2.ebuild: sci-biology/fsl: Initial fix to fsl 6.0.2 diff --git a/sci-biology/fsl/files/fsl-6.0.2-setup.patch b/sci-biology/fsl/files/fsl-6.0.2-setup.patch index 1aa5a44..67761e3 100644 --- a/sci-biology/fsl/files/fsl-6.0.2-setup.patch +++ b/sci-biology/fsl/files/fsl-6.0.2-setup.patch @@ -1,5 +1,5 @@ diff --git a/build b/build -index 05dac06..d90e407 100755 +index 05dac06c..d90e407b 100755 --- a/build +++ b/build @@ -3,7 +3,7 @@ @@ -23,7 +23,7 @@ index 05dac06..d90e407 100755 if [ $finalStatus -eq 0 ]; then echo "Build completed successfully."; diff --git a/config/buildSettings.mk b/config/buildSettings.mk -index b2e1f15..04532fc 100644 +index b2e1f150..04532fc2 100644 --- a/config/buildSettings.mk +++ b/config/buildSettings.mk @@ -18,7 +18,7 @@ MV = /bin/mv @@ -74,7 +74,7 @@ index b2e1f15..04532fc 100644 QTDIR = /usr/lib/qt3 LIB_QT = ${QTDIR}/lib diff --git a/config/common/buildproj b/config/common/buildproj -index 2f0f2b8..48624a1 100755 +index 2f0f2b8f..48624a1f 100755 --- a/config/common/buildproj +++ b/config/common/buildproj @@ -11,10 +11,10 @@ if [ X$1 = X-strict ] ; then @@ -116,7 +116,7 @@ index 2f0f2b8..48624a1 100755 fi done diff --git a/config/common/vars.mk b/config/common/vars.mk -index b027b01..aeeae67 100755 +index b027b010..aeeae67c 100755 --- a/config/common/vars.mk +++ b/config/common/vars.mk @@ -24,15 +24,15 @@ USRINCFLAGS = @@ -141,10 +141,20 @@ index b027b01..aeeae67 100755 HFILES = *.h AFILES = *.a diff --git a/extras/build b/extras/build -index 59e7a2e..2cead09 100755 +index 59e7a2ed..0d68232e 100755 --- a/extras/build +++ b/extras/build -@@ -104,8 +104,8 @@ PROJECTS="${PROJECTS} libpng" +@@ -96,16 +96,16 @@ if [ X"${OS}" = "XDarwin" ]; then + BUILDICONV=1 + fi + fi +-PROJECTS="tcl tk" ++#PROJECTS="tcl tk" + if [ ${BUILDZLIB} -eq 1 ]; then + PROJECTS="${PROJECTS} zlib" + fi +-PROJECTS="${PROJECTS} libpng" ++#PROJECTS="${PROJECTS} libpng" if [ ${BUILDICONV} -eq 1 ]; then PROJECTS="${PROJECTS} libiconv" fi @@ -156,7 +166,7 @@ index 59e7a2e..2cead09 100755 if [ -d $FSLESRCDIR/$projname ] ; then buildIt $FSLESRCDIR $projname 1 diff --git a/src/mist-clean/Makefile b/src/mist-clean/Makefile -index 20402cc..6918bee 100755 +index 20402cca..6918bee4 100755 --- a/src/mist-clean/Makefile +++ b/src/mist-clean/Makefile @@ -52,6 +52,6 @@ installpython: From 304ee84ff0207240fa4bdad79e5b4b643a02aefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Fri, 8 Nov 2019 09:10:30 +1300 Subject: [PATCH 2/5] sci-biology/fsl: tcl/tk is needed at build time Package-Manager: Portage-2.3.76, Repoman-2.3.16 --- sci-biology/fsl/ChangeLog | 3 +++ sci-biology/fsl/fsl-6.0.2.ebuild | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sci-biology/fsl/ChangeLog b/sci-biology/fsl/ChangeLog index 6255cef..753a4c3 100644 --- a/sci-biology/fsl/ChangeLog +++ b/sci-biology/fsl/ChangeLog @@ -1,3 +1,6 @@ + 07 Nov 2019; François Bissey fsl-6.0.2.ebuild: + sci-biology/fsl: tcl/tk is needed at build time + 07 Nov 2019; François Bissey files/fsl-6.0.2-setup.patch: sci-biology/fsl: do not build tcl/tk/libpng diff --git a/sci-biology/fsl/fsl-6.0.2.ebuild b/sci-biology/fsl/fsl-6.0.2.ebuild index 908b5f3..16f4ec9 100644 --- a/sci-biology/fsl/fsl-6.0.2.ebuild +++ b/sci-biology/fsl/fsl-6.0.2.ebuild @@ -14,7 +14,7 @@ SLOT="0" KEYWORDS="~amd64" IUSE="" -COMMON_DEPEND=" +DEPEND=" dev-libs/boost media-gfx/graphviz media-libs/gd @@ -23,12 +23,10 @@ COMMON_DEPEND=" sci-libs/ciftilib sci-libs/nlopt sys-libs/zlib - " -DEPEND="${COMMON_DEPEND}" -RDEPEND="${COMMON_DEPEND} dev-lang/tcl:0= dev-lang/tk:0= " +RDEPEND="${DEPEND}" S=${WORKDIR}/${PN} UPSTREAM_FSLDIR="/usr/share/fsl" From 6dfe74edc7e6327b614f0e1d15f95aa9d05c9637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Fri, 8 Nov 2019 10:20:38 +1300 Subject: [PATCH 3/5] sci-biology/fsl: patch porting to deal with cifti Package-Manager: Portage-2.3.76, Repoman-2.3.16 --- sci-biology/fsl/ChangeLog | 5 ++ .../fsl/files/fsl-6.0.2-no_xmlpp.patch | 44 +++++++++++++++++ .../fsl/files/fsl-6.0.2-qstring_compat.patch | 48 +++++++++++++++++++ sci-biology/fsl/fsl-6.0.2.ebuild | 4 +- 4 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 sci-biology/fsl/files/fsl-6.0.2-no_xmlpp.patch create mode 100644 sci-biology/fsl/files/fsl-6.0.2-qstring_compat.patch diff --git a/sci-biology/fsl/ChangeLog b/sci-biology/fsl/ChangeLog index 753a4c3..bea88ac 100644 --- a/sci-biology/fsl/ChangeLog +++ b/sci-biology/fsl/ChangeLog @@ -1,3 +1,8 @@ + 07 Nov 2019; François Bissey + +files/fsl-6.0.2-no_xmlpp.patch, +files/fsl-6.0.2-qstring_compat.patch, + fsl-6.0.2.ebuild: + sci-biology/fsl: patch porting to deal with cifti + 07 Nov 2019; François Bissey fsl-6.0.2.ebuild: sci-biology/fsl: tcl/tk is needed at build time diff --git a/sci-biology/fsl/files/fsl-6.0.2-no_xmlpp.patch b/sci-biology/fsl/files/fsl-6.0.2-no_xmlpp.patch new file mode 100644 index 0000000..47c9120 --- /dev/null +++ b/sci-biology/fsl/files/fsl-6.0.2-no_xmlpp.patch @@ -0,0 +1,44 @@ +diff --git a/src/flameo/Makefile b/src/flameo/Makefile +index d22eb965..e967e682 100644 +--- a/src/flameo/Makefile ++++ b/src/flameo/Makefile +@@ -2,7 +2,7 @@ include ${FSLCONFDIR}/default.mk + + PROJNAME = flame + +-USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB} -DCIFTILIB_USE_XMLPP -I${FSLEXTINC} -I${INC_XML2} -I${INC_XML++} -I${INC_XML++CONF} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio ++USRINCFLAGS = -fPIC -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB} -I${FSLEXTINC} ${CIFTICFLAGS} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio + USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_ZLIB} + + UNAME := $(shell uname) +@@ -10,7 +10,7 @@ ifeq (${UNAME},Darwin) + LIBS = -liconv + endif + +-LIBS += -lutils -lnewimage -lmiscmaths -lm -lnewmat -lNewNifti -lcifti -lxml++-2.6 -lxml2 -lboost_filesystem -lboost_system -lznz -lprob -lz ++LIBS += -lutils -lnewimage -lmiscmaths -lm -lnewmat -lNewNifti ${CIFTILIBS} -lboost_filesystem -lboost_system -lznz -lprob -lz + + XFILES = flameo + +diff --git a/src/melodic/Makefile b/src/melodic/Makefile +index 50666517..0c356a2d 100644 +--- a/src/melodic/Makefile ++++ b/src/melodic/Makefile +@@ -7,7 +7,7 @@ OPTFLAGS_alphaev6-dec-osf5.0-gcc2.95.2 = -O3 -mieee -mfp-trap-mode=sui + + PROJNAME = melodic + +-USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_GD} -I${INC_GDC} -I${INC_PNG} -I${INC_ZLIB} -DCIFTILIB_USE_XMLPP -I${FSLEXTINC} -I${INC_XML2} -I${INC_XML++} -I${INC_XML++CONF} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio ++USRINCFLAGS = -fPIC -I${INC_NEWMAT} -I${INC_PROB} -I${INC_GD} -I${INC_GDC} -I${INC_PNG} -I${INC_ZLIB} -I${FSLEXTINC} ${CIFTICFLAGS} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio + USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_GD} -L${LIB_GDC} -L${LIB_PNG} -L${LIB_ZLIB} + + UNAME := $(shell uname) +@@ -15,7 +15,7 @@ ifeq (${UNAME},Darwin) + LIBS = -liconv + endif + +-LIBS += -lutils -lnewimage -lmiscplot -lmiscpic -lmiscmaths -lNewNifti -lcifti -lxml++-2.6 -lxml2 -lboost_filesystem -lboost_system -lznz -lnewmat -lprob -lm -lgdc -lgd -lpng -lz ++LIBS += -lutils -lnewimage -lmiscplot -lmiscpic -lmiscmaths -lNewNifti ${CIFTILIBS} -lboost_filesystem -lboost_system -lznz -lnewmat -lprob -lm -lgdc -lgd -lpng -lz + + TEST_OBJS = test.o + diff --git a/sci-biology/fsl/files/fsl-6.0.2-qstring_compat.patch b/sci-biology/fsl/files/fsl-6.0.2-qstring_compat.patch new file mode 100644 index 0000000..c0e238c --- /dev/null +++ b/sci-biology/fsl/files/fsl-6.0.2-qstring_compat.patch @@ -0,0 +1,48 @@ +diff --git a/src/flameo/gsa.cc b/src/flameo/gsa.cc +index 70f8f385..16167abe 100644 +--- a/src/flameo/gsa.cc ++++ b/src/flameo/gsa.cc +@@ -74,7 +74,7 @@ namespace GSA { + sourceType=mode; + if ( sourceType.compare("CIFTI") == 0 ) { + cifti::CiftiFile inputCifti; +- inputCifti.openFile(make_basename(filename)+".nii"); ++ inputCifti.openFile((make_basename(filename)+".nii").c_str()); + ciftiExemplar=inputCifti.getCiftiXML(); + cerr << "ndim " << ciftiExemplar.getNumberOfDimensions() << endl; + cerr << "type1 " << ciftiExemplar.getMappingType(0) << endl; +@@ -194,7 +194,7 @@ namespace GSA { + scalarsMap.setLength(data.Nrows()); + ciftiExemplar.setMap(0, scalarsMap); + CiftiFile outputFile; +- outputFile.setWritingFile(make_basename(filename)+extension+".nii");//sets up on-disk writing with default writing version ++ outputFile.setWritingFile((make_basename(filename)+extension+".nii").c_str());//sets up on-disk writing with default writing version + outputFile.setCiftiXML(ciftiExemplar,false); + vector scratchRow(data.Nrows());//read/write a row at a time + for (int64_t row=0;row& dims = inputCifti.getDimensions(); + tmpData.ReSize(dims[0],dims[1]); //swapped compared to cifti + vector scratchRow(dims[0]);//read/write a row at a time +diff --git a/src/melodic/meldata.h b/src/melodic/meldata.h +index 49774003..f5326bdd 100644 +--- a/src/melodic/meldata.h ++++ b/src/melodic/meldata.h +@@ -109,7 +109,7 @@ namespace Melodic{ + message(" " << logger.appendDir(fname) << endl); + } else { //Process CIFTI save ICs as float + cifti::CiftiFile outputFile; +- outputFile.setWritingFile(logger.appendDir(fname)+".nii");//sets up on-disk writing with default writing version ++ outputFile.setWritingFile((logger.appendDir(fname)+".nii").c_str());//sets up on-disk writing with default writing version + cifti::CiftiXML xml(inputCifti.getCiftiXML()); + cifti::CiftiScalarsMap scalarsMap; + std::vector foo = xml.writeXMLToVector(); diff --git a/sci-biology/fsl/fsl-6.0.2.ebuild b/sci-biology/fsl/fsl-6.0.2.ebuild index 16f4ec9..b45fd8d 100644 --- a/sci-biology/fsl/fsl-6.0.2.ebuild +++ b/sci-biology/fsl/fsl-6.0.2.ebuild @@ -33,11 +33,11 @@ UPSTREAM_FSLDIR="/usr/share/fsl" PATCHES=( "${FILESDIR}/${PN}"-6.0.2-setup.patch - #"${FILESDIR}/${PN}"-5.0.11-no_xmlpp.patch + "${FILESDIR}/${PN}"-6.0.2-no_xmlpp.patch "${FILESDIR}/${PN}"-5.0.11-niftiio_var_fix.patch "${FILESDIR}/${PN}"-5.0.11-ifstream_use.patch "${FILESDIR}/${PN}"-5.0.11-fslsurface_parallel_make.patch - #"${FILESDIR}/${PN}"-5.0.11-qstring_compat.patch + "${FILESDIR}/${PN}"-6.0.2-qstring_compat.patch "${FILESDIR}/${PN}"-5.0.9-headers.patch #"${FILESDIR}/${PN}"-5.0.9-fsldir_redux.patch ) From 62a80a526981cf246916f463c728c9b548b849b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Fri, 8 Nov 2019 12:29:58 +1300 Subject: [PATCH 4/5] sci-biology/fsl: Work on fsldir elimination Package-Manager: Portage-2.3.76, Repoman-2.3.16 --- sci-biology/fsl/ChangeLog | 4 + .../fsl/files/fsl-6.0.2-fsldir_redux.patch | 467 ++++++++++++++++++ sci-biology/fsl/fsl-6.0.2.ebuild | 8 +- 3 files changed, 477 insertions(+), 2 deletions(-) create mode 100644 sci-biology/fsl/files/fsl-6.0.2-fsldir_redux.patch diff --git a/sci-biology/fsl/ChangeLog b/sci-biology/fsl/ChangeLog index bea88ac..bb4eba0 100644 --- a/sci-biology/fsl/ChangeLog +++ b/sci-biology/fsl/ChangeLog @@ -1,3 +1,7 @@ + 07 Nov 2019; François Bissey + +files/fsl-6.0.2-fsldir_redux.patch, fsl-6.0.2.ebuild: + sci-biology/fsl: Work on fsldir elimination + 07 Nov 2019; François Bissey +files/fsl-6.0.2-no_xmlpp.patch, +files/fsl-6.0.2-qstring_compat.patch, fsl-6.0.2.ebuild: diff --git a/sci-biology/fsl/files/fsl-6.0.2-fsldir_redux.patch b/sci-biology/fsl/files/fsl-6.0.2-fsldir_redux.patch new file mode 100644 index 0000000..ffa793d --- /dev/null +++ b/sci-biology/fsl/files/fsl-6.0.2-fsldir_redux.patch @@ -0,0 +1,467 @@ +diff --git a/src/fast4/fast_two.cc b/src/fast4/fast_two.cc +index 592b5df..b525444 100644 +--- a/src/fast4/fast_two.cc ++++ b/src/fast4/fast_two.cc +@@ -166,7 +166,7 @@ int prior_registration(string inname, string main_prior_vol, NEWIMAGE::volume0) + { + 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]; + +@@ -763,8 +763,6 @@ int main(int argc, char **argv) + 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)); +@@ -1510,7 +1508,7 @@ int main(int argc, char **argv) + 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); +@@ -2161,6 +2159,6 @@ char the_string[10000]; + + fclose(outputfile); + +- filename=string(getenv("FSLDIR")) + "/bin/wpng -q -overwrite " + filename; ++ filename="wpng -q -overwrite " + filename; + system(filename.c_str()); + } +diff --git a/src/feat5/tsplot.cc b/src/feat5/tsplot.cc +index ae191fd..3a02b55 100644 +--- a/src/feat5/tsplot.cc ++++ b/src/feat5/tsplot.cc +@@ -293,7 +293,7 @@ int main(int argc, char **argv) + 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 @@ volume immask; + if (argc<2) usage(""); + featdir=string(argv[1]); + fmriFileName=featdir+"/filtered_func_data"; +- fslPath=string(getenv("FSLDIR")); + + string outputName(featdir); + +@@ -753,7 +752,7 @@ volume4D acs; + 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(); +@@ -768,7 +767,7 @@ volume4D acs; + 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 --git a/src/first/first_utils.cc b/src/first/first_utils.cc +index 68be44b..85960f4 100644 +--- a/src/first/first_utils.cc ++++ b/src/first/first_utils.cc +@@ -1954,8 +1954,8 @@ void do_work_bvars(){ + 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 --git a/src/fnirt/fnirtfns.cpp b/src/fnirt/fnirtfns.cpp +index 24e26fd..77899e7 100644 +--- a/src/fnirt/fnirtfns.cpp ++++ b/src/fnirt/fnirtfns.cpp +@@ -1203,8 +1203,7 @@ string existing_ref_fname(const string& ref_fname) + 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::FslFileExists(eref_fname)) return(eref_fname); + else return(string("")); + } +@@ -1230,9 +1229,8 @@ string existing_ref_fname(const string& ref_fname) + 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 @@ string existing_conf_file(const string& cfname) + 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 --git a/src/fslsurface/fslsurface_first.cc b/src/fslsurface/fslsurface_first.cc +index faec642..b2ef794 100644 +--- a/src/fslsurface/fslsurface_first.cc ++++ b/src/fslsurface/fslsurface_first.cc +@@ -500,8 +500,7 @@ namespace fslsurface_name { + + 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 @@ namespace fslsurface_name { + + 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 --git a/src/fslsurface/fslsurfacemaths.cpp b/src/fslsurface/fslsurfacemaths.cpp +index eaf55eb..3dc184d 100644 +--- a/src/fslsurface/fslsurfacemaths.cpp ++++ b/src/fslsurface/fslsurfacemaths.cpp +@@ -598,12 +598,6 @@ int main (int argc, char * argv[]) + + }else if (command == "-reconFromBvars"){ + cout<<"do recon "<0){ +@@ -1157,7 +1157,7 @@ namespace Melodic{ + // 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 --git a/src/melodic/meloptions.cc b/src/melodic/meloptions.cc +index 08170c7..252e72b 100644 +--- a/src/melodic/meloptions.cc ++++ b/src/melodic/meloptions.cc +@@ -93,14 +93,6 @@ MelodicOptions* MelodicOptions::gopt = NULL; + 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 --git a/src/melodic/meloptions.h b/src/melodic/meloptions.h +index f546125..b964b7d 100644 +--- a/src/melodic/meloptions.h ++++ b/src/melodic/meloptions.h +@@ -93,7 +93,6 @@ class MelodicOptions { + ~MelodicOptions() { delete gopt; } + + string version; +- string binpath; + string logfname; + bool filtermode; + bool explicitnums; +diff --git a/src/melodic/melreport.cc b/src/melodic/melreport.cc +index 141b6c2..2625059 100644 +--- a/src/melodic/melreport.cc ++++ b/src/melodic/melreport.cc +@@ -84,8 +84,8 @@ namespace Melodic{ + IChtml.setDir(report.getDir(),mmodel.get_prefix()+".html"); + + {//start IC page +- IChtml << "" << endl ++ IChtml << "" << endl + << "" + << "FSL" << endl + << "