diff --git a/science/minc-tools/Makefile b/science/minc-tools/Makefile new file mode 100644 index 000000000000..ce5ca4378725 --- /dev/null +++ b/science/minc-tools/Makefile @@ -0,0 +1,36 @@ +PORTNAME= minc-tools +DISTVERSION= 2-3-00 +CATEGORIES= science biology +MASTER_SITES= https://github.com/BIC-MNI/${PORTNAME}/archive/refs/tags/ + +MAINTAINER= ports@FreeBSD.org +COMMENT= Basic minc-tools from former minc repository +WWW= https://www.bic.mni.mcgill.ca/ServicesSoftware/MINC + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/COPYING + +BUILD_DEPENDS= nifticlib>0:science/nifticlib +LIB_DEPENDS= libhdf5.so:science/hdf5 \ + libnetcdf.so:science/netcdf \ + libminc2.so:science/libminc +RUN_DEPENDS= bash:shells/bash + +#USE_GITHUB= yes +#GH_ACCOUNT= BIC-MNI + +USES= bison cmake localbase perl5 shebangfix +SHEBANG_FILES= progs/mincview/mincview Testing/*.sh +CMAKE_ARGS= -DCMAKE_PREFIX_PATH=${LOCALBASE}/lib/cmake + +WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTNAME}-${DISTVERSION} +USE_LDCONFIG= yes + +#CFLAGS+= -Wno-error=return-type + +pre-patch: + ${RM} ${WRKSRC}/progs/minccalc/gram.[ch] + ${RM} ${WRKSRC}/progs/mincgen/ncgentab.[ch] + ${RM} ${WRKSRC}/cmake-modules/FindHDF5.cmake + +.include diff --git a/science/minc-tools/distinfo b/science/minc-tools/distinfo new file mode 100644 index 000000000000..d72ed737cee5 --- /dev/null +++ b/science/minc-tools/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1782294411 +SHA256 (minc-tools-2-3-00.tar.gz) = b505e9666706ac2e7f58febb1e5fcda24fc858b0dc7625d433d409cff33e85b4 +SIZE (minc-tools-2-3-00.tar.gz) = 3002667 diff --git a/science/minc-tools/files/patch-Testing_CMakeLists.txt b/science/minc-tools/files/patch-Testing_CMakeLists.txt new file mode 100644 index 000000000000..ba98aede3c49 --- /dev/null +++ b/science/minc-tools/files/patch-Testing_CMakeLists.txt @@ -0,0 +1,74 @@ +--- Testing/CMakeLists.txt.orig 2015-09-11 19:22:24 UTC ++++ Testing/CMakeLists.txt +@@ -1,21 +1,7 @@ + # Fix tools tests to avoid modifications to source directory (bert). + # + +-# Get path to mincstats binary. +-GET_PROPERTY(mincstats_bin TARGET mincstats PROPERTY LOCATION) + +-# Get path to mincinfo binary. +-GET_PROPERTY(mincinfo_bin TARGET mincinfo PROPERTY LOCATION) +- +-# Get path to mincextract binary +-GET_PROPERTY(mincextract_bin TARGET mincextract PROPERTY LOCATION) +- +-# Get path to mincaverage binary. +-GET_PROPERTY(mincaverage_bin TARGET mincaverage PROPERTY LOCATION) +- +-# Get path to mincaverage binary. +-GET_PROPERTY(mincresample_bin TARGET mincresample PROPERTY LOCATION) +- + # Copy files used by minccalc-test and other tests. + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/test-zero.mnc" "${CMAKE_CURRENT_BINARY_DIR}/test-zero.mnc" COPYONLY) + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/test-one.mnc" "${CMAKE_CURRENT_BINARY_DIR}/test-one.mnc" COPYONLY) +@@ -24,11 +10,11 @@ SET_TESTS_PROPERTIES(mincinfo-test + + ADD_TEST(mincinfo-test ${CMAKE_CURRENT_SOURCE_DIR}/mincinfo-test.pl) + SET_TESTS_PROPERTIES(mincinfo-test +- PROPERTIES ENVIRONMENT "MINCINFO_BIN=${mincinfo_bin}") ++ PROPERTIES ENVIRONMENT "MINCINFO_BIN=bin") + + ADD_TEST(mincstats-test ${CMAKE_CURRENT_SOURCE_DIR}/mincstats-test.pl) + SET_TESTS_PROPERTIES(mincstats-test +- PROPERTIES ENVIRONMENT "MINCSTATS_BIN=${mincstats_bin}") ++ PROPERTIES ENVIRONMENT "MINCSTATS_BIN=bin") + + # Copy files used by mincaverage-test + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/mincaverage-in0.mnc" "${CMAKE_CURRENT_BINARY_DIR}/mincaverage-in0.mnc" COPYONLY) +@@ -39,31 +25,27 @@ SET_TESTS_PROPERTIES(mincaverage-test + + # Set its environment variables. + SET_TESTS_PROPERTIES(mincaverage-test +- PROPERTIES ENVIRONMENT "MINCAVERAGE_BIN=${mincaverage_bin};MINCSTATS_BIN=${mincstats_bin}") ++ PROPERTIES ENVIRONMENT "MINCAVERAGE_BIN=bin;MINCSTATS_BIN=bin") + +-# Get path to the binary. +-GET_PROPERTY(minccalc_bin TARGET minccalc PROPERTY LOCATION) + + # Add the test. + ADD_TEST(minccalc-test ${CMAKE_CURRENT_SOURCE_DIR}/minccalc-test.sh) + + # Set the test's environment. + SET_TESTS_PROPERTIES(minccalc-test +- PROPERTIES ENVIRONMENT "MINCCALC_BIN=${minccalc_bin};MINCSTATS_BIN=${mincstats_bin}") ++ PROPERTIES ENVIRONMENT "MINCCALC_BIN=bin;MINCSTATS_BIN=bin") + + # Add the test itself. + ADD_TEST(mincresample-test ${CMAKE_CURRENT_SOURCE_DIR}/mincresample-test.sh) + + # Set its environment variables. + SET_TESTS_PROPERTIES(mincresample-test +- PROPERTIES ENVIRONMENT "MINCRESAMPLE_BIN=${mincresample_bin};MINCSTATS_BIN=${mincstats_bin}") ++ PROPERTIES ENVIRONMENT "MINCRESAMPLE_BIN=bin;MINCSTATS_BIN=bin") + +-# Get path to mincaverage binary. +-GET_PROPERTY(mincreshape_bin TARGET mincreshape PROPERTY LOCATION) + + ADD_TEST(mincreshape-test ${CMAKE_CURRENT_SOURCE_DIR}/mincreshape-test.pl) + + SET_TESTS_PROPERTIES(mincreshape-test +- PROPERTIES ENVIRONMENT "MINCRESHAPE_BIN=${mincreshape_bin};MINCSTATS_BIN=${mincstats_bin};MINCINFO_BIN=${mincinfo_bin};MINCEXTRACT_BIN=${mincextract_bin}") ++ PROPERTIES ENVIRONMENT "MINCRESHAPE_BIN=bin;MINCSTATS_BIN=bin;MINCINFO_BIN=bin;MINCEXTRACT_BIN=bin") + + #TODO: add more tests? diff --git a/science/minc-tools/files/patch-conversion_CMakeLists.txt b/science/minc-tools/files/patch-conversion_CMakeLists.txt new file mode 100644 index 000000000000..7af74fbc92df --- /dev/null +++ b/science/minc-tools/files/patch-conversion_CMakeLists.txt @@ -0,0 +1,11 @@ +--- conversion/CMakeLists.txt.orig 2026-06-24 14:11:21 UTC ++++ conversion/CMakeLists.txt +@@ -84,7 +84,7 @@ INSTALL(TARGETS + DESTINATION bin) + + +-INSTALL_MAN_PAGES( ${CMAKE_INSTALL_PREFIX}/man ++INSTALL_MAN_PAGES( ${CMAKE_INSTALL_PREFIX}/share/man + dcm2mnc/dcm2mnc.man1 + ecattominc/ecattominc.man1 + micropet/upet2mnc.man1 diff --git a/science/minc-tools/files/patch-conversion_minctoecat_ecat__write.c b/science/minc-tools/files/patch-conversion_minctoecat_ecat__write.c new file mode 100644 index 000000000000..4369323f90d8 --- /dev/null +++ b/science/minc-tools/files/patch-conversion_minctoecat_ecat__write.c @@ -0,0 +1,12 @@ +--- conversion/minctoecat/ecat_write.c.orig 2023-04-11 00:36:34 UTC ++++ conversion/minctoecat/ecat_write.c +@@ -11,6 +11,9 @@ + #define ERROR -1 + #define V7 70 + ++MatrixErrorCode matrix_errno; ++ ++char matrix_errtxt[132]; + + char* dstypecode[NumDataSetTypes] = + { "u","s","i","a","n","pm","v8","v","p8","p","i8","S","S8","N", "FS"}; diff --git a/science/minc-tools/files/patch-conversion_minctoecat_ecat__write.h b/science/minc-tools/files/patch-conversion_minctoecat_ecat__write.h new file mode 100644 index 000000000000..902eafc23a84 --- /dev/null +++ b/science/minc-tools/files/patch-conversion_minctoecat_ecat__write.h @@ -0,0 +1,14 @@ +--- conversion/minctoecat/ecat_write.h.orig 2023-04-11 00:36:27 UTC ++++ conversion/minctoecat/ecat_write.h +@@ -39,9 +39,9 @@ typedef enum { + BitData + } MatrixDataType; + +-MatrixErrorCode matrix_errno; ++extern MatrixErrorCode matrix_errno; + +-char matrix_errtxt[132]; ++extern char matrix_errtxt[132]; + + typedef struct XMAIN_HEAD { + char magic_number[14]; diff --git a/science/minc-tools/files/patch-progs_CMakeLists.txt b/science/minc-tools/files/patch-progs_CMakeLists.txt new file mode 100644 index 000000000000..ef0660931f29 --- /dev/null +++ b/science/minc-tools/files/patch-progs_CMakeLists.txt @@ -0,0 +1,11 @@ +--- progs/CMakeLists.txt.orig 2015-09-11 19:22:24 UTC ++++ progs/CMakeLists.txt +@@ -222,7 +222,7 @@ INSTALL(PROGRAMS + DESTINATION bin ) + + +-INSTALL_MAN_PAGES( ${CMAKE_INSTALL_PREFIX}/man ++INSTALL_MAN_PAGES( ${CMAKE_INSTALL_PREFIX}/share/man + coordinates/voxeltoworld.man1 + mincaverage/mincaverage.man1 + mincblob/mincblob.man1 diff --git a/science/minc-tools/files/patch-progs_mincdump_mincdump.c b/science/minc-tools/files/patch-progs_mincdump_mincdump.c new file mode 100644 index 000000000000..f9503b67535c --- /dev/null +++ b/science/minc-tools/files/patch-progs_mincdump_mincdump.c @@ -0,0 +1,72 @@ +--- progs/mincdump/mincdump.c.orig 2015-09-11 19:22:24 UTC ++++ progs/mincdump/mincdump.c +@@ -478,17 +478,17 @@ do_ncdump(char *path, struct fspec* specp) + /* get _FillValue attribute */ + old_nc_opts = ncopts; + ncopts = 0; +- nc_status = ncattinq(ncid,varid,_FillValue,&att.type,&att.len); ++ nc_status = ncattinq(ncid,varid,NC_FillValue,&att.type,&att.len); + ncopts = old_nc_opts; + if(nc_status == NC_NOERR && + att.type == var.type && att.len == 1) { + if(var.type == NC_CHAR) { + char fillc; +- ncattget(ncid, varid, _FillValue, &fillc ); ++ ncattget(ncid, varid, NC_FillValue, &fillc ); + var.fillval = fillc; + } + else { +- ncattget(ncid, varid, _FillValue, &var.fillval); ++ ncattget(ncid, varid, NC_FillValue, &var.fillval); + } + } else { + switch (var.type) { +@@ -537,7 +537,7 @@ set_brief(struct fspec * fspecp, char *key, char *opta + static void + set_brief(struct fspec * fspecp, char *key, char *optarg) + { +- fspecp->brief_data_cmnts = true; ++ fspecp->brief_data_cmnts = my_true; + switch (tolower(optarg[0])) { + case 'c': + fspecp->data_lang = LANG_C; +@@ -553,7 +553,7 @@ set_full(struct fspec * fspecp, char *key, char *optar + static void + set_full(struct fspec * fspecp, char *key, char *optarg) + { +- fspecp->full_data_cmnts = true; ++ fspecp->full_data_cmnts = my_true; + switch (tolower(optarg[0])) { + case 'c': + fspecp->data_lang = LANG_C; +@@ -672,10 +672,10 @@ main(int argc, char *argv[]) + static struct fspec fspec = /* defaults, overridden on command line */ + { + 0, /* construct netcdf name from file name */ +- false, /* print header info only, no data? */ +- false, /* just print coord vars? */ +- false, /* brief comments in data section? */ +- false, /* full annotations in data section? */ ++ my_false, /* print header info only, no data? */ ++ my_false, /* just print coord vars? */ ++ my_false, /* brief comments in data section? */ ++ my_false, /* full annotations in data section? */ + LANG_C, /* language conventions for indices */ + 0, /* if -v specified, number of variables */ + 0 /* if -v specified, list of variable names */ +@@ -685,13 +685,13 @@ main(int argc, char *argv[]) + static ArgvInfo argTable[] = { + {"-b", ARGV_FUNC, (char *) set_brief, (char *) &fspec, + "Brief annotations for C or Fortran indices in data" }, +- {"-c", ARGV_CONSTANT, (char *) true, (char *) &fspec.coord_vals, ++ {"-c", ARGV_CONSTANT, (char *) my_true, (char *) &fspec.coord_vals, + "Coordinate variable data and header information" }, + {"-d", ARGV_FUNC, (char *) set_sigdigs, (char *) NULL, + "Obsolete option for setting significant digits" }, + {"-f", ARGV_FUNC, (char *) set_full, (char *) &fspec, + "Full annotations for C or Fortran indices in data" }, +- {"-h", ARGV_CONSTANT, (char *) true, (char *) &fspec.header_only, ++ {"-h", ARGV_CONSTANT, (char *) my_true, (char *) &fspec.header_only, + "Header information only, no data" }, + {"-l", ARGV_INT, (char *) 1, (char *) &max_len, + "Line length maximum in data section" }, diff --git a/science/minc-tools/files/patch-progs_mincdump_mincdump.h b/science/minc-tools/files/patch-progs_mincdump_mincdump.h new file mode 100644 index 000000000000..ee9704df9d93 --- /dev/null +++ b/science/minc-tools/files/patch-progs_mincdump_mincdump.h @@ -0,0 +1,11 @@ +--- progs/mincdump/mincdump.h.orig 2012-09-24 17:35:36 UTC ++++ progs/mincdump/mincdump.h +@@ -15,7 +15,7 @@ + #define Printf (void) printf + + typedef int boolean; +-enum {false=0, true=1}; ++enum {my_false=0, my_true=1}; + + struct ncdim { /* dimension */ + char name[NC_MAX_NAME]; diff --git a/science/minc-tools/files/patch-progs_mincdump_vardata.c b/science/minc-tools/files/patch-progs_mincdump_vardata.c new file mode 100644 index 000000000000..b22617aa7391 --- /dev/null +++ b/science/minc-tools/files/patch-progs_mincdump_vardata.c @@ -0,0 +1,11 @@ +--- progs/mincdump/vardata.c.orig 2012-09-24 17:35:36 UTC ++++ progs/mincdump/vardata.c +@@ -775,7 +775,7 @@ vardata( + + if (vrank > 0) { + corsav = cor[vrank-1]; +- if (fsp->brief_data_cmnts != false ++ if (fsp->brief_data_cmnts != my_false + && vrank > 1 + && left > 0) { /* print brief comment with indices range */ + Printf("// %s(",vp->name); diff --git a/science/minc-tools/files/patch-progs_mincgen_ncgentab.y b/science/minc-tools/files/patch-progs_mincgen_ncgentab.y new file mode 100644 index 000000000000..7b52dccc11d2 --- /dev/null +++ b/science/minc-tools/files/patch-progs_mincgen_ncgentab.y @@ -0,0 +1,19 @@ +--- progs/mincgen/ncgentab.y.orig 2015-09-11 19:22:24 UTC ++++ progs/mincgen/ncgentab.y +@@ -275,14 +275,14 @@ attdecl: att + /* shrink space down to what was really needed */ + att_space = erealloc(att_space, valnum*nctypesize(valtype)); + atts[natts].val = att_space; +- if (STREQ(atts[natts].name, _FillValue) && ++ if (STREQ(atts[natts].name, NC_FillValue) && + atts[natts].var != NC_GLOBAL) { + nc_putfill(atts[natts].type, + atts[natts].val, + &vars[atts[natts].var].fill_value); + if(atts[natts].type != vars[atts[natts].var].type) { + derror("variable %s: %s type mismatch", +- vars[atts[natts].var].name, _FillValue); ++ vars[atts[natts].var].name, NC_FillValue); + } + } + natts++; diff --git a/science/minc-tools/pkg-descr b/science/minc-tools/pkg-descr new file mode 100644 index 000000000000..7c23a89b11bb --- /dev/null +++ b/science/minc-tools/pkg-descr @@ -0,0 +1,7 @@ +MINC - Medical Image NetCDF or MINC isn't netCDF. + +This metaproject bundles multiple MINC-based packages that historically have +been developed somewhat independently. + +Note: previously, this port was science/mint2, but it is now split into two +parts: libminc and minc-tools. diff --git a/science/minc-tools/pkg-plist b/science/minc-tools/pkg-plist new file mode 100644 index 000000000000..636d162edb9c --- /dev/null +++ b/science/minc-tools/pkg-plist @@ -0,0 +1,85 @@ +bin/dcm2mnc +bin/ecattominc +bin/invert_raw_image +bin/minc_modify_header +bin/mincaverage +bin/mincblob +bin/minccalc +bin/minccmp +bin/mincconcat +bin/mincconvert +bin/minccopy +bin/mincdiff +bin/mincdump +bin/mincedit +bin/mincexpand +bin/mincextract +bin/mincgen +bin/mincheader +bin/minchistory +bin/mincinfo +bin/minclookup +bin/mincmakescalar +bin/mincmakevector +bin/mincmath +bin/mincmorph +bin/mincpik +bin/mincresample +bin/mincreshape +bin/mincsample +bin/mincstats +bin/minctoecat +bin/minctoraw +bin/mincview +bin/mincwindow +bin/mnc2nii +bin/nii2mnc +bin/rawtominc +bin/transformtags +bin/upet2mnc +bin/voxeltoworld +bin/worldtovoxel +bin/xfmconcat +bin/xfminvert +share/man/man1/dcm2mnc.1.gz +share/man/man1/ecattominc.1.gz +share/man/man1/invert_raw_image.1.gz +share/man/man1/minc_modify_header.1.gz +share/man/man1/mincaverage.1.gz +share/man/man1/mincblob.1.gz +share/man/man1/minccalc.1.gz +share/man/man1/minccmp.1.gz +share/man/man1/mincconcat.1.gz +share/man/man1/mincconvert.1.gz +share/man/man1/minccopy.1.gz +share/man/man1/mincdiff.1.gz +share/man/man1/mincdump.1.gz +share/man/man1/mincedit.1.gz +share/man/man1/mincexpand.1.gz +share/man/man1/mincextract.1.gz +share/man/man1/mincgen.1.gz +share/man/man1/mincheader.1.gz +share/man/man1/mincinfo.1.gz +share/man/man1/minclookup.1.gz +share/man/man1/mincmakescalar.1.gz +share/man/man1/mincmakevector.1.gz +share/man/man1/mincmath.1.gz +share/man/man1/mincresample.1.gz +share/man/man1/mincreshape.1.gz +share/man/man1/mincsample.1.gz +share/man/man1/mincstats.1.gz +share/man/man1/minctoecat.1.gz +share/man/man1/minctoraw.1.gz +share/man/man1/mincview.1.gz +share/man/man1/mincwindow.1.gz +share/man/man1/mnc2nii.1.gz +share/man/man1/nii2mnc.1.gz +share/man/man1/rawtominc.1.gz +share/man/man1/transformtags.1.gz +share/man/man1/upet2mnc.1.gz +share/man/man1/vff2mnc.1.gz +share/man/man1/voxeltoworld.1.gz +share/man/man1/xfm2def.1.gz +share/man/man1/xfmconcat.1.gz +share/man/man1/xfmflip.1.gz +share/man/man1/xfminvert.1.gz