diff --git a/sci-biology/fsl/ChangeLog b/sci-biology/fsl/ChangeLog new file mode 100644 index 0000000..06dd698 --- /dev/null +++ b/sci-biology/fsl/ChangeLog @@ -0,0 +1,11 @@ +*fsl-6.0.2 (08 Aug 2020) + + 08 Aug 2020; +files/99fsl, + +files/fsl-5.0.11-fslsurface_parallel_make.patch, + +files/fsl-5.0.11-ifstream_use.patch, +files/fsl-5.0.11-niftiio_var_fix.patch, + +files/fsl-5.0.9-headers.patch, +files/fsl-6.0.2-fsldir_redux.patch, + +files/fsl-6.0.2-gcc10_include.patch, +files/fsl-6.0.2-no_xmlpp.patch, + +files/fsl-6.0.2-qstring_compat.patch, +files/fsl-6.0.2-setup.patch, + +files/fsl-6.0.2-template.patch, +fsl-6.0.2.ebuild, +metadata.xml: + sci-biology/fsl: patching to allow compilation with modern toolchains + https://github.com/gentoo/sci/issues/963 diff --git a/sci-biology/fsl/Manifest b/sci-biology/fsl/Manifest new file mode 100644 index 0000000..6fb2c02 --- /dev/null +++ b/sci-biology/fsl/Manifest @@ -0,0 +1 @@ +DIST fsl-6.0.2.tar.gz 2505331864 SHA256 c118b351c6cedb441af7e1b9d194cf344505ff53b417063f697b86305a908afd SHA512 fe308393076c51c50b086f9bf7ff5ddebcf8b1284128e734b9d9e501019917ceba7c0ee5cd5aa1ed44452bcd042ad72653c1a8693f94eab9b83a80fe508a56ca WHIRLPOOL ecb62e9d09cc34ac926353e4a9a131be875428b729bcf2d6f1433d9ea1a7e2b9382d1a1b305651705449a48eb3c576899f09f82ae4254b149a6219096eb45d3d diff --git a/sci-biology/fsl/files/99fsl b/sci-biology/fsl/files/99fsl new file mode 100644 index 0000000..41db5c5 --- /dev/null +++ b/sci-biology/fsl/files/99fsl @@ -0,0 +1,5 @@ +FSLOUTPUTTYPE=NIFTI_GZ +FSLMULTIFILEQUIT=TRUE +FSLTCLSH=tclsh +FSLWISH=wish +FSLDIR=/usr/share/fsl diff --git a/sci-biology/fsl/files/fsl-5.0.11-fslsurface_parallel_make.patch b/sci-biology/fsl/files/fsl-5.0.11-fslsurface_parallel_make.patch new file mode 100644 index 0000000..026543d --- /dev/null +++ b/sci-biology/fsl/files/fsl-5.0.11-fslsurface_parallel_make.patch @@ -0,0 +1,14 @@ +diff --git a/src/fslsurface/Makefile b/src/fslsurface/Makefile +index 37f459c..008f443 100644 +--- a/src/fslsurface/Makefile ++++ b/src/fslsurface/Makefile +@@ -57,7 +57,7 @@ fslsurfacegl.a: fslsurfacegl.o fslsurface.a + ${AR} -r libfslsurfacegl.a fslsurfacegl.o + fslsurface_backcompat.a: fslsurface_first.o fslsurface_dataconv.o fslsurface.a + ${AR} -r libfslsurface_backcompat.a fslsurface_first.o fslsurface_dataconv.o +-fslsurfacemaths: fslsurface.a fslsurfacemaths.o ++fslsurfacemaths: fslsurface.a fslsurfacemaths.o fslsurfaceio.o fslsurfacefns.o fslsurface_first.o fslsurface.o + ${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ fslsurfacemaths.o fslsurfaceio.o fslsurfacefns.o fslsurface_first.o fslsurface.o ${LIBS} ${FMLIBS} +-marching_cubes: fslsurface.a marching_cubes.o ++marching_cubes: fslsurface.a marching_cubes.o fslsurfaceio.o fslsurfacefns.o + ${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ marching_cubes.o fslsurfaceio.o fslsurfacefns.o ${LIBS} ${FMLIBS} diff --git a/sci-biology/fsl/files/fsl-5.0.11-ifstream_use.patch b/sci-biology/fsl/files/fsl-5.0.11-ifstream_use.patch new file mode 100644 index 0000000..c4ba003 --- /dev/null +++ b/sci-biology/fsl/files/fsl-5.0.11-ifstream_use.patch @@ -0,0 +1,13 @@ +diff --git a/src/melodic/meldata.cc b/src/melodic/meldata.cc +index f310dc7..03fe8bb 100644 +--- a/src/melodic/meldata.cc ++++ b/src/melodic/meldata.cc +@@ -1015,7 +1015,7 @@ namespace Melodic{ + Resels = 1.0; + + in.open(logger.appendDir("smoothest").c_str(), ios::in); +- if(in>0){ ++ if(in.is_open()){ + for(int ctr=1; ctr<7; ctr++) + in >> str; + in.close(); diff --git a/sci-biology/fsl/files/fsl-5.0.11-niftiio_var_fix.patch b/sci-biology/fsl/files/fsl-5.0.11-niftiio_var_fix.patch new file mode 100644 index 0000000..f1a833b --- /dev/null +++ b/sci-biology/fsl/files/fsl-5.0.11-niftiio_var_fix.patch @@ -0,0 +1,24 @@ +diff --git a/src/fslio/dbh.h b/src/fslio/dbh.h +index eff0a50a..fbce1770 100644 +--- a/src/fslio/dbh.h ++++ b/src/fslio/dbh.h +@@ -79,19 +79,6 @@ struct dsr /* dsr */ + struct data_history hist; /* 148 + 200 */ + }; /* total=348 */ + +-/* Acceptable values for hdr.dime.datatype */ +- +-#define DT_NONE 0 +-#define DT_UNKNOWN 0 +-#define DT_BINARY 1 +-#define DT_UNSIGNED_CHAR 2 +-#define DT_SIGNED_SHORT 4 +-#define DT_SIGNED_INT 8 +-#define DT_FLOAT 16 +-#define DT_COMPLEX 32 +-#define DT_DOUBLE 64 +-#define DT_RGB 128 +-#define DT_ALL 255 + + typedef struct + { diff --git a/sci-biology/fsl/files/fsl-5.0.9-headers.patch b/sci-biology/fsl/files/fsl-5.0.9-headers.patch new file mode 100644 index 0000000..663dc56 --- /dev/null +++ b/sci-biology/fsl/files/fsl-5.0.9-headers.patch @@ -0,0 +1,15 @@ +# Include zlib header directly. +# From: Francois Bissey +# Signed-off-by: Horea Christian +# Submitted upstream: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1709&L=FSL&F=&S=&X=95C10F0B7D62EAAE7A&P=169254 + +--- fsl/src/miscvis/writepng.c.orig 2013-10-19 00:18:32.415203592 +1300 ++++ fsl/src/miscvis/writepng.c 2013-10-19 00:19:05.414255132 +1300 +@@ -32,6 +32,7 @@ + + #include /* for exit() prototype */ + ++#include "zlib.h" + #include "png.h" /* libpng header; includes zlib.h and setjmp.h */ + #include "writepng.h" /* typedefs, common macros, public prototypes */ + 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..dc1babd --- /dev/null +++ b/sci-biology/fsl/files/fsl-6.0.2-fsldir_redux.patch @@ -0,0 +1,495 @@ +From 2bc4be1f55b27a733e1e624b34bc570187ba95e1 Mon Sep 17 00:00:00 2001 +From: François Bissey +Date: Mon, 20 Jan 2020 11:40:53 +1300 +Subject: [PATCH] Making sure fsl code and executable can find other executable + and data in standard location. + +--- + src/fast4/fast_two.cc | 8 ++++---- + src/feat5/feat_model.cc | 8 +++----- + src/feat5/tsplot.cc | 7 +++---- + src/first/first_utils.cc | 4 ++-- + src/fnirt/fnirtfns.cpp | 11 ++++------- + src/fslsurface/fslsurface_first.cc | 6 ++---- + src/fslsurface/fslsurfacemaths.cpp | 12 ------------ + src/libvis/miscpic.h | 7 +------ + src/melodic/meldata.cc | 4 ++-- + src/melodic/meloptions.cc | 8 -------- + src/melodic/meloptions.h | 1 - + src/melodic/melreport.cc | 12 ++++++------ + src/melodic/melreport.h | 20 ++++++++++---------- + src/mm/mixture_model.cc | 4 ++-- + src/siena/siena_diff.cc | 28 +++++++++++++--------------- + src/topup/topupfns.cpp | 3 +-- + 16 files changed, 53 insertions(+), 90 deletions(-) + +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 + << "