You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: <kin...@us...> - 2023-07-15 14:27:22
|
Revision: 7111
http://sourceforge.net/p/teem/code/7111
Author: kindlmann
Date: 2023-07-15 14:27:19 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
fixing one oversight in hest usage update
Modified Paths:
--------------
teem/trunk/src/ten/tendGlyph.c
Modified: teem/trunk/src/ten/tendGlyph.c
===================================================================
--- teem/trunk/src/ten/tendGlyph.c 2023-07-15 14:24:54 UTC (rev 7110)
+++ teem/trunk/src/ten/tendGlyph.c 2023-07-15 14:27:19 UTC (rev 7111)
@@ -189,8 +189,8 @@
"for superquadric glyphs, how much to sharp edges form as a "
"function of differences between eigenvalues. Higher values "
"mean that edges form more easily");
- hestOptAdd(&hopt, "gsc", "scale", airTypeFloat, 1, 1, &(gparm->glyphScale), "0.01",
- "over-all glyph size in world-space");
+ hestOptAdd_1_Float(&hopt, "gsc", "scale", &(gparm->glyphScale), "0.01",
+ "over-all glyph size in world-space");
/* how glyphs will be colored */
hestOptAdd_1_Int(&hopt, "c", "evector #", &(gparm->colEvec), "0",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-15 14:24:57
|
Revision: 7110
http://sourceforge.net/p/teem/code/7110
Author: kindlmann
Date: 2023-07-15 14:24:54 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
restoring block and unblock commands, but they are hidden
Modified Paths:
--------------
teem/trunk/src/unrrdu/CMakeLists.txt
teem/trunk/src/unrrdu/GNUmakefile
teem/trunk/src/unrrdu/block.c
teem/trunk/src/unrrdu/privateUnrrdu.h
teem/trunk/src/unrrdu/unblock.c
Modified: teem/trunk/src/unrrdu/CMakeLists.txt
===================================================================
--- teem/trunk/src/unrrdu/CMakeLists.txt 2023-07-15 14:15:33 UTC (rev 7109)
+++ teem/trunk/src/unrrdu/CMakeLists.txt 2023-07-15 14:24:54 UTC (rev 7110)
@@ -15,6 +15,7 @@
axinsert.c
axmerge.c
axsplit.c
+ block.c
ccadj.c
ccfind.c
ccmerge.c
@@ -77,10 +78,8 @@
unquantize.c
unrrdu.h
untile.c
- )
-# no longer used:
-# block.c
-# unblock.c
+ unblock.c
+)
target_sources(teem PRIVATE ${UNRRDU_SOURCES})
# This will group all the source files in the VS project by directory
Modified: teem/trunk/src/unrrdu/GNUmakefile
===================================================================
--- teem/trunk/src/unrrdu/GNUmakefile 2023-07-15 14:15:33 UTC (rev 7109)
+++ teem/trunk/src/unrrdu/GNUmakefile 2023-07-15 14:24:54 UTC (rev 7110)
@@ -61,8 +61,7 @@
ccsettle.o about.o axsplit.o axmerge.o mlut.o mrmap.o tile.o untile.o \
unorient.o env.o dist.o affine.o i2w.o w2i.o fft.o acrop.o dering.o \
diff.o cksum.o dnorm.o vidicon.o undos.o uncmt.o basinfo.o grid.o ilk.o \
- ninspect.o hack.o aabplot.o
-# no longer used: block.o unblock.o
+ ninspect.o hack.o aabplot.o block.o unblock.o
####
####
####
Modified: teem/trunk/src/unrrdu/block.c
===================================================================
--- teem/trunk/src/unrrdu/block.c 2023-07-15 14:15:33 UTC (rev 7109)
+++ teem/trunk/src/unrrdu/block.c 2023-07-15 14:24:54 UTC (rev 7110)
@@ -69,4 +69,4 @@
return 0;
}
-UNRRDU_CMD(block, INFO);
+UNRRDU_CMD_HIDE(block, INFO);
Modified: teem/trunk/src/unrrdu/privateUnrrdu.h
===================================================================
--- teem/trunk/src/unrrdu/privateUnrrdu.h 2023-07-15 14:15:33 UTC (rev 7109)
+++ teem/trunk/src/unrrdu/privateUnrrdu.h 2023-07-15 14:24:54 UTC (rev 7110)
@@ -107,6 +107,8 @@
F(flip) \
F(unorient) \
F(basinfo) \
+ F(block) \
+ F(unblock) \
F(axinfo) \
F(axinsert) \
F(axsplit) \
@@ -145,10 +147,6 @@
F(undos) \
F(uncmt) \
F(save)
-/* these two have been removed since no one uses them
-F(block) \
-F(unblock) \
-*/
/* xxx.c */
/* Declare the extern unrrduCmds unrrdu_xxxCmd, for all xxx. These are
Modified: teem/trunk/src/unrrdu/unblock.c
===================================================================
--- teem/trunk/src/unrrdu/unblock.c 2023-07-15 14:15:33 UTC (rev 7109)
+++ teem/trunk/src/unrrdu/unblock.c 2023-07-15 14:24:54 UTC (rev 7110)
@@ -68,4 +68,4 @@
return 0;
}
-UNRRDU_CMD(unblock, INFO);
+UNRRDU_CMD_HIDE(unblock, INFO);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-15 14:15:35
|
Revision: 7109
http://sourceforge.net/p/teem/code/7109
Author: kindlmann
Date: 2023-07-15 14:15:33 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
updating hest usage
Modified Paths:
--------------
teem/trunk/src/bane/gkmsHvol.c
teem/trunk/src/bane/gkmsInfo.c
teem/trunk/src/bane/gkmsMite.c
teem/trunk/src/bane/gkmsOpac.c
teem/trunk/src/bane/gkmsPvg.c
teem/trunk/src/bane/gkmsScat.c
teem/trunk/src/bane/gkmsTxf.c
teem/trunk/src/bane/privateBane.h
Modified: teem/trunk/src/bane/gkmsHvol.c
===================================================================
--- teem/trunk/src/bane/gkmsHvol.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsHvol.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -41,51 +41,49 @@
NrrdIoState *nio;
NrrdKernelSpec *ksp00, *ksp11, *ksp22;
- hestOptAdd(&opt, "s", "incV incG incH", airTypeOther, 3, 3, inc,
- "f:1.0 p:0.005 p:0.015",
- "Strategies for determining how much of the range "
- "of a quantity should be included and quantized in its axis "
- "of the histogram volume. Possibilities include:\n "
- "\b\bo \"f:<F>\": included range is some fraction of the "
- "total range, as scaled by F\n "
- "\b\bo \"p:<P>\": exclude the extremal P percent of "
- "the values\n "
- "\b\bo \"s:<S>\": included range is S times the standard "
- "deviation of the values\n "
- "\b\bo \"a:<min>,<max>\": range is from <min> to <max>",
- NULL, NULL, baneGkmsHestIncStrategy);
- hestOptAdd(&opt, "d", "dimV dimG dimH", airTypeInt, 3, 3, dim, "256 256 256",
- "Dimensions of histogram volume; number of samples along "
- "each axis");
- hestOptAdd(&opt, "k00", "kernel", airTypeOther, 1, 1, &ksp00, "tent",
- "value reconstruction kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&opt, "k11", "kernel", airTypeOther, 1, 1, &ksp11, "cubicd:1,0",
- "first derivative kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&opt, "k22", "kernel", airTypeOther, 1, 1, &ksp22, "cubicdd:1,0",
- "second derivative kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&opt, "l", NULL, airTypeInt, 0, 0, &lapl, NULL,
- "Use Laplacian instead of Hessian to approximate second "
- "directional derivative. No faster, less accurate.");
- hestOptAdd(&opt, "slow", NULL, airTypeInt, 0, 0, &slow, NULL,
- "Instead of allocating a floating point VGH volume and measuring "
- "V,G,H once, measure V,G,H multiple times on separate passes "
- "(slower, but needs less memory)");
+ hestOptAdd_3_Other(&opt, "s", "incV incG incH", inc, "f:1.0 p:0.005 p:0.015",
+ "Strategies for determining how much of the range "
+ "of a quantity should be included and quantized in its axis "
+ "of the histogram volume. Possibilities include:\n "
+ "\b\bo \"f:<F>\": included range is some fraction of the "
+ "total range, as scaled by F\n "
+ "\b\bo \"p:<P>\": exclude the extremal P percent of "
+ "the values\n "
+ "\b\bo \"s:<S>\": included range is S times the standard "
+ "deviation of the values\n "
+ "\b\bo \"a:<min>,<max>\": range is from <min> to <max>",
+ baneGkmsHestIncStrategy);
+ hestOptAdd_3_Int(&opt, "d", "dimV dimG dimH", dim, "256 256 256",
+ "Dimensions of histogram volume; number of samples along "
+ "each axis");
+ hestOptAdd_1_Other(&opt, "k00", "kernel", &ksp00, "tent",
+ "value reconstruction kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&opt, "k11", "kernel", &ksp11, "cubicd:1,0",
+ "first derivative kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&opt, "k22", "kernel", &ksp22, "cubicdd:1,0",
+ "second derivative kernel", nrrdHestKernelSpec);
+ hestOptAdd_Flag(&opt, "l", &lapl,
+ "Use Laplacian instead of Hessian to approximate second "
+ "directional derivative. No faster, less accurate.");
+ hestOptAdd_Flag(&opt, "slow", &slow,
+ "Instead of allocating a floating point VGH volume and measuring "
+ "V,G,H once, measure V,G,H multiple times on separate passes "
+ "(slower, but needs less memory)");
if (nrrdEncodingGzip->available()) {
- hestOptAdd(&opt, "gz", NULL, airTypeInt, 0, 0, &gz, NULL,
- "Use gzip compression for output histo-volume; "
- "much less disk space, slightly slower to read/write");
+ hestOptAdd_Flag(&opt, "gz", &gz,
+ "Use gzip compression for output histo-volume; "
+ "much less disk space, slightly slower to read/write");
}
- hestOptAdd(&opt, "i", "volumeIn", airTypeOther, 1, 1, &nin, NULL,
- "input scalar volume for which a transfer function is needed", NULL, NULL,
- nrrdHestNrrd);
- hestOptAdd(&opt, "o", "hvolOut", airTypeString, 1, 1, &out, NULL,
- "output histogram volume, used by \"gkms scat\" and "
- "\"gkms info\"");
+ hestOptAdd_1_Other(&opt, "i", "volumeIn", &nin, NULL,
+ "input scalar volume for which a transfer function is needed",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&opt, "o", "hvolOut", &out, NULL,
+ "output histogram volume, used by \"gkms scat\" and "
+ "\"gkms info\"");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_hvolInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_hvolInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
Modified: teem/trunk/src/bane/gkmsInfo.c
===================================================================
--- teem/trunk/src/bane/gkmsInfo.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsInfo.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -35,25 +35,24 @@
airArray *mop;
int pret, one, measr;
- hestOptAdd(&opt, "m", "measr", airTypeEnum, 1, 1, &measr, "mean",
- "How to project along the 2nd derivative axis. Possibilities "
- "include:\n "
- "\b\bo \"mean\": average value\n "
- "\b\bo \"median\": value at 50th percentile\n "
- "\b\bo \"mode\": most common value\n "
- "\b\bo \"min\", \"max\": probably not useful",
- NULL, baneGkmsMeasr);
- hestOptAdd(&opt, "one", NULL, airTypeInt, 0, 0, &one, NULL,
- "Create 1-dimensional info file; default is 2-dimensional");
- hestOptAdd(&opt, "i", "hvolIn", airTypeOther, 1, 1, &hvol, NULL,
- "input histogram volume (from \"gkms hvol\")", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "o", "infoOut", airTypeString, 1, 1, &outS, NULL,
- "output info file, used by \"gkms pvg\" and \"gkms opac\"");
+ hestOptAdd_1_Enum(&opt, "m", "measr", &measr, "mean",
+ "How to project along the 2nd derivative axis. Possibilities "
+ "include:\n "
+ "\b\bo \"mean\": average value\n "
+ "\b\bo \"median\": value at 50th percentile\n "
+ "\b\bo \"mode\": most common value\n "
+ "\b\bo \"min\", \"max\": probably not useful",
+ baneGkmsMeasr);
+ hestOptAdd_Flag(&opt, "one", &one,
+ "Create 1-dimensional info file; default is 2-dimensional");
+ hestOptAdd_1_Other(&opt, "i", "hvolIn", &hvol, NULL,
+ "input histogram volume (from \"gkms hvol\")", nrrdHestNrrd);
+ hestOptAdd_1_String(&opt, "o", "infoOut", &outS, NULL,
+ "output info file, used by \"gkms pvg\" and \"gkms opac\"");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_infoInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_infoInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
Modified: teem/trunk/src/bane/gkmsMite.c
===================================================================
--- teem/trunk/src/bane/gkmsMite.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsMite.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -36,17 +36,16 @@
airArray *mop;
int pret, E;
- hestOptAdd(&opt, "i", "opacIn", airTypeOther, 1, 1, &nin, NULL,
- "input opacity function (1 or 2 dimensional), from "
- "\"gkms opac\"",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "o", "opacOut", airTypeString, 1, 1, &out, NULL,
- "output opacity function filename");
+ hestOptAdd_1_Other(&opt, "i", "opacIn", &nin, NULL,
+ "input opacity function (1 or 2 dimensional), from "
+ "\"gkms opac\"",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&opt, "o", "opacOut", &out, NULL,
+ "output opacity function filename");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_miteInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_miteInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
if (1 == nin->axis[0].size && nin->axis[0].label && !strcmp("A", nin->axis[0].label)) {
Modified: teem/trunk/src/bane/gkmsOpac.c
===================================================================
--- teem/trunk/src/bane/gkmsOpac.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsOpac.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -36,48 +36,47 @@
int pret, radius, idim;
float sigma, gthrInfo[2], gthresh;
- hestOptAdd(&opt, "b", "bef", airTypeOther, 1, 1, &nbef, "1,1,0,1",
- "boundary emphasis function mapping from \"position\" to "
- "opacity. Can be either:\n "
- "\b\bo filename of nrrd suitable for \"unu imap\", or:\n "
- "\b\bo comma-separated list of four floats, with no spaces: "
- "\"s,w,c,a\", where\n "
- "s = shape of function, between 0.0 for box and "
- "1.0 for tent\n "
- "w = full-width half-max of function support\n "
- "c = where to center function support\n "
- "a = maximum opacity\n "
- "If all goes well, the units for \"w\" and \"c\" are voxels.",
- NULL, NULL, baneGkmsHestBEF);
- hestOptAdd(&opt, "s", "sigma", airTypeFloat, 1, 1, &sigma, "nan",
- "scaling in position calculation, accounts for thickness "
- "of transition region between materials. Lower sigmas lead to "
- "wider peaks in opacity function. "
- "Calculated automatically by default.");
- hestOptAdd(&opt, "g", "gthresh", airTypeOther, 1, 1, gthrInfo, "x0.04",
- "minimum significant gradient magnitude. Can be given "
- "in two different ways:\n "
- "\b\bo \"<float>\": specify gthresh as <float> exactly.\n "
- "\b\bo \"x<float>\": gthresh is a scaling, by <float>, of "
- "the maximum gradient magnitude in the info file.",
- NULL, NULL, baneGkmsHestGthresh);
- hestOptAdd(&opt, "r", "radius", airTypeInt, 1, 1, &radius, "0",
- "radius of median filtering to apply to opacity function, "
- "use \"0\" to signify no median filtering");
- hestOptAdd(&opt, "m", "befOut", airTypeString, 1, 1, &befS, "",
- "if boundary emphasis function given via \"-b\" "
- "is in the \"s,w,c,a\" form, then save out the "
- "corresponding nrrd to <befOut>, suitable for use in this "
- "command or \"unu imap\"");
- hestOptAdd(&opt, "i", "infoIn", airTypeOther, 1, 1, &ninfo, NULL,
- "input info file (from \"gkms info\")", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "o", "opacOut", airTypeString, 1, 1, &outS, NULL,
- "output 1D or 2D opacity function");
+ hestOptAdd_1_Other(&opt, "b", "bef", &nbef, "1,1,0,1",
+ "boundary emphasis function mapping from \"position\" to "
+ "opacity. Can be either:\n "
+ "\b\bo filename of nrrd suitable for \"unu imap\", or:\n "
+ "\b\bo comma-separated list of four floats, with no spaces: "
+ "\"s,w,c,a\", where\n "
+ "s = shape of function, between 0.0 for box and "
+ "1.0 for tent\n "
+ "w = full-width half-max of function support\n "
+ "c = where to center function support\n "
+ "a = maximum opacity\n "
+ "If all goes well, the units for \"w\" and \"c\" are voxels.",
+ baneGkmsHestBEF);
+ hestOptAdd_1_Float(&opt, "s", "sigma", &sigma, "nan",
+ "scaling in position calculation, accounts for thickness "
+ "of transition region between materials. Lower sigmas lead to "
+ "wider peaks in opacity function. "
+ "Calculated automatically by default.");
+ hestOptAdd_1_Other(&opt, "g", "gthresh", gthrInfo, "x0.04",
+ "minimum significant gradient magnitude. Can be given "
+ "in two different ways:\n "
+ "\b\bo \"<float>\": specify gthresh as <float> exactly.\n "
+ "\b\bo \"x<float>\": gthresh is a scaling, by <float>, of "
+ "the maximum gradient magnitude in the info file.",
+ baneGkmsHestGthresh);
+ hestOptAdd_1_Int(&opt, "r", "radius", &radius, "0",
+ "radius of median filtering to apply to opacity function, "
+ "use \"0\" to signify no median filtering");
+ hestOptAdd_1_String(&opt, "m", "befOut", &befS, "",
+ "if boundary emphasis function given via \"-b\" "
+ "is in the \"s,w,c,a\" form, then save out the "
+ "corresponding nrrd to <befOut>, suitable for use in this "
+ "command or \"unu imap\"");
+ hestOptAdd_1_Other(&opt, "i", "infoIn", &ninfo, NULL,
+ "input info file (from \"gkms info\")", nrrdHestNrrd);
+ hestOptAdd_1_String(&opt, "o", "opacOut", &outS, NULL,
+ "output 1D or 2D opacity function");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_opacInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_opacInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
airMopAdd(mop, nmax = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
airMopAdd(mop, npos = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
Modified: teem/trunk/src/bane/gkmsPvg.c
===================================================================
--- teem/trunk/src/bane/gkmsPvg.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsPvg.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -99,20 +99,17 @@
float *pos, p, min, max, sml, newsml, newmin, newmax;
NrrdRange *range;
- hestOptAdd(&opt, "inv", NULL, airTypeInt, 0, 0, &invert, NULL,
- "Draw on white background, instead of black");
- hestOptAdd(&opt, "m", "mapOut", airTypeString, 1, 1, &mapS, "",
- "save out the colormap used here, so that it can be applied "
- "to other nrrds with \"unu imap -r\"");
- hestOptAdd(&opt, "i", "infoIn", airTypeOther, 1, 1, &ninfo, NULL,
- "input info file (from \"gkms info\")", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "o", "imageOut", airTypeString, 1, 1, &outS, NULL,
- "output image, in PPM format");
+ hestOptAdd_Flag(&opt, "inv", &invert, "Draw on white background, instead of black");
+ hestOptAdd_1_String(&opt, "m", "mapOut", &mapS, "",
+ "save out the colormap used here, so that it can be applied "
+ "to other nrrds with \"unu imap -r\"");
+ hestOptAdd_1_Other(&opt, "i", "infoIn", &ninfo, NULL,
+ "input info file (from \"gkms info\")", nrrdHestNrrd);
+ hestOptAdd_1_String(&opt, "o", "imageOut", &outS, NULL, "output image, in PPM format");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_pvgInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_pvgInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
airMopAdd(mop, ndon = _baneGkmsDonNew(invert), (airMopper)nrrdNuke, airMopAlways);
airMopAdd(mop, nposA = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
Modified: teem/trunk/src/bane/gkmsScat.c
===================================================================
--- teem/trunk/src/bane/gkmsScat.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsScat.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -38,21 +38,20 @@
int pret, E;
double _gamma;
- hestOptAdd(&opt, "g", "gamma", airTypeDouble, 1, 1, &_gamma, "1.0",
- "gamma used to brighten/darken scatterplots. "
- "gamma > 1.0 brightens; gamma < 1.0 darkens. "
- "Negative gammas invert values (like in xv). ");
- hestOptAdd(&opt, "i", "hvolIn", airTypeOther, 1, 1, &hvol, NULL,
- "input histogram volume (from \"gkms hvol\")", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "o", "vgOut vhOut", airTypeString, 2, 2, out, NULL,
- "Filenames to use for two output scatterplots, (gradient "
- "magnitude versus value, and 2nd derivative versus value); "
- "can use PGM or PNG format");
+ hestOptAdd_1_Double(&opt, "g", "gamma", &_gamma, "1.0",
+ "gamma used to brighten/darken scatterplots. "
+ "gamma > 1.0 brightens; gamma < 1.0 darkens. "
+ "Negative gammas invert values (like in xv). ");
+ hestOptAdd_1_Other(&opt, "i", "hvolIn", &hvol, NULL,
+ "input histogram volume (from \"gkms hvol\")", nrrdHestNrrd);
+ hestOptAdd_2_String(&opt, "o", "vgOut vhOut", out, NULL,
+ "Filenames to use for two output scatterplots, (gradient "
+ "magnitude versus value, and 2nd derivative versus value); "
+ "can use PGM or PNG format");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_scatInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_scatInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
nvgRaw = nrrdNew();
Modified: teem/trunk/src/bane/gkmsTxf.c
===================================================================
--- teem/trunk/src/bane/gkmsTxf.c 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/gkmsTxf.c 2023-07-15 14:15:33 UTC (rev 7109)
@@ -38,39 +38,39 @@
float min[2], max[2], top[2], v0, g0, *data, v, g, gwidth, width, mwidth, tvl, tvr, vl,
vr, tmp, maxa;
- hestOptAdd(&opt, "r", "Vres Gres", airTypeInt, 2, 2, res, "256 256",
- "resolution of the transfer function in value and gradient "
- "magnitude");
- hestOptAdd(&opt, "min", "Vmin Gmin", airTypeFloat, 2, 2, min, "0.0 0.0",
- "minimum value and grad mag in txf");
- hestOptAdd(&opt, "max", "Vmax Gmax", airTypeFloat, 2, 2, max, NULL,
- "maximum value and grad mag in txf");
- hestOptAdd(&opt, "v", "base value", airTypeFloat, 1, 1, &v0, NULL,
- "data value at which to position bottom of triangle");
- hestOptAdd(&opt, "g", "gthresh", airTypeFloat, 1, 1, &g0, "0.0",
- "lowest grad mag to receive opacity");
- hestOptAdd(&opt, "gw", "gwidth", airTypeFloat, 1, 1, &gwidth, "0.0",
- "range of grad mag values over which to apply threshold "
- "at low gradient magnitudes");
- hestOptAdd(&opt, "top", "Vtop Gtop", airTypeFloat, 2, 2, top, NULL,
- "data value and grad mag at center of top of triangle");
- hestOptAdd(&opt, "w", "value width", airTypeFloat, 1, 1, &width, NULL,
- "range of values to be spanned at top of triangle");
- hestOptAdd(&opt, "mw", "value width", airTypeFloat, 1, 1, &mwidth, "0",
- "range of values to be spanned at BOTTOM of triangle");
- hestOptAdd(&opt, "step", NULL, airTypeInt, 0, 0, &step, NULL,
- "instead of assigning opacity inside a triangular region, "
- "make it more like a step function, in which opacity never "
- "decreases in increasing data value");
- hestOptAdd(&opt, "a", "max opac", airTypeFloat, 1, 1, &maxa, "1.0",
- "highest opacity to assign");
- hestOptAdd(&opt, "o", "opacOut", airTypeString, 1, 1, &out, NULL,
- "output opacity function filename");
+ /* HEY many of these ints should be unsigned, but bane never got the signed->unsigned
+ * treatment */
+ hestOptAdd_2_Int(&opt, "r", "Vres Gres", res, "256 256",
+ "resolution of the transfer function in value and gradient "
+ "magnitude");
+ hestOptAdd_2_Float(&opt, "min", "Vmin Gmin", min, "0.0 0.0",
+ "minimum value and grad mag in txf");
+ hestOptAdd_2_Float(&opt, "max", "Vmax Gmax", max, NULL,
+ "maximum value and grad mag in txf");
+ hestOptAdd_1_Float(&opt, "v", "base value", &v0, NULL,
+ "data value at which to position bottom of triangle");
+ hestOptAdd_1_Float(&opt, "g", "gthresh", &g0, "0.0",
+ "lowest grad mag to receive opacity");
+ hestOptAdd_1_Float(&opt, "gw", "gwidth", &gwidth, "0.0",
+ "range of grad mag values over which to apply threshold "
+ "at low gradient magnitudes");
+ hestOptAdd_2_Float(&opt, "top", "Vtop Gtop", top, NULL,
+ "data value and grad mag at center of top of triangle");
+ hestOptAdd_1_Float(&opt, "w", "value width", &width, NULL,
+ "range of values to be spanned at top of triangle");
+ hestOptAdd_1_Float(&opt, "mw", "value width", &mwidth, "0",
+ "range of values to be spanned at BOTTOM of triangle");
+ hestOptAdd_Flag(&opt, "step", &step,
+ "instead of assigning opacity inside a triangular region, "
+ "make it more like a step function, in which opacity never "
+ "decreases in increasing data value");
+ hestOptAdd_1_Float(&opt, "a", "max opac", &maxa, "1.0", "highest opacity to assign");
+ hestOptAdd_1_String(&opt, "o", "opacOut", &out, NULL,
+ "output opacity function filename");
mop = airMopNew();
airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_baneGkms_txfInfoL);
- PARSE();
+ USAGE_PARSE(_baneGkms_txfInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/bane/privateBane.h
===================================================================
--- teem/trunk/src/bane/privateBane.h 2023-07-15 12:28:05 UTC (rev 7108)
+++ teem/trunk/src/bane/privateBane.h 2023-07-15 14:15:33 UTC (rev 7109)
@@ -31,9 +31,9 @@
/* USAGE, PARSE
all copied from unrrdu/privateUnrrdu.h */
-#define USAGE(info) \
- if (!argc) { \
- hestInfo(stderr, me, (info), hparm); \
+#define USAGE(INFO) \
+ if (!argc && !hparm->noArgsIsNoProblem) { \
+ hestInfo(stderr, me, (INFO), hparm); \
hestUsage(stderr, opt, me, hparm); \
hestGlossary(stderr, opt, hparm); \
airMopError(mop); \
@@ -40,19 +40,31 @@
return 2; \
}
-#define PARSE() \
+#define PARSE(INFO) \
if ((pret = hestParse(opt, argc, argv, &perr, hparm))) { \
if (1 == pret) { \
fprintf(stderr, "%s: %s\n", me, perr); \
free(perr); \
hestUsage(stderr, opt, me, hparm); \
+ if (hparm && hparm->noArgsIsNoProblem) { \
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me); \
+ } else { \
+ fprintf(stderr, "\nFor more info: \"%s\" or \"%s --help\"\n", me, me); \
+ } \
airMopError(mop); \
return 2; \
} else { \
exit(1); \
} \
+ } else if (opt->helpWanted) { \
+ hestInfo(stdout, me, (INFO), hparm); \
+ hestUsage(stdout, opt, me, hparm); \
+ hestGlossary(stdout, opt, hparm); \
+ return 0; \
}
+#define USAGE_PARSE(INFO) USAGE(INFO) PARSE(INFO)
+
#ifdef __cplusplus
}
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-15 12:28:07
|
Revision: 7108
http://sourceforge.net/p/teem/code/7108
Author: kindlmann
Date: 2023-07-15 12:28:05 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
really do have to use hestOptAdd here, better explaining why
Modified Paths:
--------------
teem/trunk/src/bin/miter.c
Modified: teem/trunk/src/bin/miter.c
===================================================================
--- teem/trunk/src/bin/miter.c 2023-07-15 12:27:42 UTC (rev 7107)
+++ teem/trunk/src/bin/miter.c 2023-07-15 12:28:05 UTC (rev 7108)
@@ -84,7 +84,7 @@
hestOptAdd_1_Float(&hopt, "iss", "scale", &isScale, "1.0",
"scaling of image size (from \"is\")");
hestOptAdd_3_Float(&hopt, "ads", "ka kd ks", ads, "0.1 0.6 0.3", "phong components");
- /* mite_at could be float or double */
+ /* mite_at could be float or double, so have to use older hest interface */
hestOptAdd(&hopt, "sp", "spec pow", mite_at, 1, 1, &(muu->rangeInit[miteRangeSP]),
"30", "phong specular power");
hestOptAdd_1_Other(&hopt, "k00", "kernel", &(muu->ksp[gageKernel00]), "tent",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-15 12:27:43
|
Revision: 7107
http://sourceforge.net/p/teem/code/7107
Author: kindlmann
Date: 2023-07-15 12:27:42 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
missed one call to hestOptAdd in previous update
Modified Paths:
--------------
teem/trunk/src/bin/gprobe.c
Modified: teem/trunk/src/bin/gprobe.c
===================================================================
--- teem/trunk/src/bin/gprobe.c 2023-07-15 12:25:19 UTC (rev 7106)
+++ teem/trunk/src/bin/gprobe.c 2023-07-15 12:27:42 UTC (rev 7107)
@@ -335,10 +335,10 @@
fprintf(stderr, "%s: PANIC nsi %u != %u", me, nsi, NON_SBP_OPT_NUM);
exit(1);
}
- hestOptAdd(&hopt, "sbp", "blur spec", airTypeOther, 1, 1, &sbpCL, "",
- "complete specification of stack blur parms; "
- "over-rides all previous \"ss\" options",
- NULL, NULL, gageHestStackBlurParm);
+ hestOptAdd_1_Other(&hopt, "sbp", "blur spec", &sbpCL, "",
+ "complete specification of stack blur parms; "
+ "over-rides all previous \"ss\" options",
+ gageHestStackBlurParm);
/* These two options are needed even if sbp is used, because they are *not*
part of the gageStackBlurParm. In meet, this info is handled by the
extraFlag/extraParm construct, which is not available here */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-15 12:25:22
|
Revision: 7106
http://sourceforge.net/p/teem/code/7106
Author: kindlmann
Date: 2023-07-15 12:25:19 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
updating hest usage
Modified Paths:
--------------
teem/trunk/src/limn/lpu_cbfit.c
teem/trunk/src/limn/lpu_ccfind.c
teem/trunk/src/limn/lpu_meas.c
teem/trunk/src/limn/lpu_psel.c
teem/trunk/src/limn/lpu_rast.c
teem/trunk/src/limn/lpu_sort.c
teem/trunk/src/limn/lpu_verts.c
Modified: teem/trunk/src/limn/lpu_cbfit.c
===================================================================
--- teem/trunk/src/limn/lpu_cbfit.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_cbfit.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -42,44 +42,39 @@
limnCBFContext fctx;
limnCBFPath *path;
- hestOptAdd(&hopt, "i", "input", airTypeOther, 1, 1, &_nin, NULL, "input xy points",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "v", "verbose", airTypeInt, 1, 1, &verbose, "1", "verbosity level");
- hestOptAdd(&hopt, "s", "synth", airTypeInt, 0, 0, &synth, NULL,
- "synthesize xy points from control points");
- hestOptAdd(&hopt, "so", "synth out", airTypeString, 1, 1, &synthOut, "",
- "if non-empty, filename in which to save synthesized xy pts");
- hestOptAdd(&hopt, "snf", NULL, airTypeInt, 0, 0, &nofit, NULL,
- "actually do not fit, just save -so synthetic "
- "output and quit");
- hestOptAdd(&hopt, "t1", "tan", airTypeDouble, 2, 2, utt1, "nan nan",
- "if non-nan, the outgoing tangent from the first point");
- hestOptAdd(&hopt, "t2", "tan", airTypeDouble, 2, 2, utt2, "nan nan",
- "if non-nan, the incoming tangent to the last point");
- hestOptAdd(&hopt, "im", "max", airTypeUInt, 1, 1, &iterMax, "0",
- "(if non-zero) max # nrp iterations to run");
- hestOptAdd(&hopt, "deltam", "delta", airTypeDouble, 1, 1, &deltaMin, "0.0005",
- "(if non-zero) stop nrp when change in spline "
- "domain sampling goes below this");
- hestOptAdd(&hopt, "distm", "dist", airTypeDouble, 1, 1, &distMin, "0.01",
- "(if non-zero) stop nrp when distance between spline "
- "and points goes below this");
- hestOptAdd(&hopt, "dists", "scl", airTypeDouble, 1, 1, &distScl, "0.25",
- "scaling on nrp distMin check");
- hestOptAdd(&hopt, "psi", "psi", airTypeDouble, 1, 1, &psi, "10", "psi, of course");
- hestOptAdd(&hopt, "ca", "angle", airTypeDouble, 1, 1, &cangle, "100",
- "angle indicating a corner");
- hestOptAdd(&hopt, "scl", "scale", airTypeDouble, 1, 1, &scale, "0",
- "scale for geometry estimation");
- hestOptAdd(&hopt, "loop", NULL, airTypeInt, 0, 0, &loop, NULL,
- "given xy points are actually a loop; BUT "
- "the first and last points need to be the same!");
- hestOptAdd(&hopt, "petc", NULL, airTypeInt, 0, 0, &petc, NULL,
- "(Press Enter To Continue) ");
+ hestOptAdd_1_Other(&hopt, "i", "input", &_nin, NULL, "input xy points", nrrdHestNrrd);
+ hestOptAdd_1_Int(&hopt, "v", "verbose", &verbose, "1", "verbosity level");
+ hestOptAdd_Flag(&hopt, "s", &synth, "synthesize xy points from control points");
+ hestOptAdd_1_String(&hopt, "so", "synth out", &synthOut, "",
+ "if non-empty, filename in which to save synthesized xy pts");
+ hestOptAdd_Flag(&hopt, "snf", &nofit,
+ "actually do not fit, just save -so synthetic "
+ "output and quit");
+ hestOptAdd_2_Double(&hopt, "t1", "tan", utt1, "nan nan",
+ "if non-nan, the outgoing tangent from the first point");
+ hestOptAdd_2_Double(&hopt, "t2", "tan", utt2, "nan nan",
+ "if non-nan, the incoming tangent to the last point");
+ hestOptAdd_1_UInt(&hopt, "im", "max", &iterMax, "0",
+ "(if non-zero) max # nrp iterations to run");
+ hestOptAdd_1_Double(&hopt, "deltam", "delta", &deltaMin, "0.0005",
+ "(if non-zero) stop nrp when change in spline "
+ "domain sampling goes below this");
+ hestOptAdd_1_Double(&hopt, "distm", "dist", &distMin, "0.01",
+ "(if non-zero) stop nrp when distance between spline "
+ "and points goes below this");
+ hestOptAdd_1_Double(&hopt, "dists", "scl", &distScl, "0.25",
+ "scaling on nrp distMin check");
+ hestOptAdd_1_Double(&hopt, "psi", "psi", &psi, "10", "psi, of course");
+ hestOptAdd_1_Double(&hopt, "ca", "angle", &cangle, "100", "angle indicating a corner");
+ hestOptAdd_1_Double(&hopt, "scl", "scale", &scale, "0",
+ "scale for geometry estimation");
+ hestOptAdd_Flag(&hopt, "loop", &loop,
+ "given xy points are actually a loop; BUT "
+ "the first and last points need to be the same!");
+ hestOptAdd_Flag(&hopt, "petc", &petc, "(Press Enter To Continue) ");
/*
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output nrrd filename");
- */
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output nrrd filename");
+ */
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/limn/lpu_ccfind.c
===================================================================
--- teem/trunk/src/limn/lpu_ccfind.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_ccfind.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -36,10 +36,9 @@
Nrrd *nmeas;
char *out;
- hestOptAdd(&hopt, NULL, "input", airTypeOther, 1, 1, &pld, NULL,
- "input polydata filename", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output polydata filename");
+ hestOptAdd_1_Other(&hopt, NULL, "input", &pld, NULL, "input polydata filename",
+ limnHestPolyDataLMPD);
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output polydata filename");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/limn/lpu_meas.c
===================================================================
--- teem/trunk/src/limn/lpu_meas.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_meas.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -37,10 +37,9 @@
Nrrd *nout;
char *out;
- hestOptAdd(&hopt, NULL, "input", airTypeOther, 1, 1, &pld, NULL,
- "input polydata filename", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output nrrd filename");
+ hestOptAdd_1_Other(&hopt, NULL, "input", &pld, NULL, "input polydata filename",
+ limnHestPolyDataLMPD);
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output nrrd filename");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/limn/lpu_psel.c
===================================================================
--- teem/trunk/src/limn/lpu_psel.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_psel.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -40,12 +40,11 @@
char *out;
size_t size[NRRD_DIM_MAX];
- hestOptAdd(&hopt, "r", "range", airTypeUInt, 2, 2, prange, NULL,
- "range of indices of primitives to select");
- hestOptAdd(&hopt, NULL, "input", airTypeOther, 1, 1, &pldIn, NULL,
- "input polydata filename", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output polydata filename");
+ hestOptAdd_2_UInt(&hopt, "r", "range", prange, NULL,
+ "range of indices of primitives to select");
+ hestOptAdd_1_Other(&hopt, NULL, "input", &pldIn, NULL, "input polydata filename",
+ limnHestPolyDataLMPD);
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output polydata filename");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/limn/lpu_rast.c
===================================================================
--- teem/trunk/src/limn/lpu_rast.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_rast.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -39,16 +39,14 @@
int type;
size_t size[NRRD_DIM_MAX];
- hestOptAdd(&hopt, "min", "min", airTypeDouble, 3, 3, min, NULL, "bottom corner");
- hestOptAdd(&hopt, "max", "max", airTypeDouble, 3, 3, max, NULL, "top corner");
- hestOptAdd(&hopt, "s", "size", airTypeSize_t, 3, 3, size, NULL,
- "number of samples along each axis");
- hestOptAdd(&hopt, "t", "type", airTypeEnum, 1, 1, &type, "uchar",
- "type of output nrrd", NULL, nrrdType);
- hestOptAdd(&hopt, NULL, "input", airTypeOther, 1, 1, &pld, NULL,
- "input polydata filename", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output nrrd filename");
+ hestOptAdd_3_Double(&hopt, "min", "min", min, NULL, "bottom corner");
+ hestOptAdd_3_Double(&hopt, "max", "max", max, NULL, "top corner");
+ hestOptAdd_3_Size_t(&hopt, "s", "size", size, NULL,
+ "number of samples along each axis");
+ hestOptAdd_1_Enum(&hopt, "t", "type", &type, "uchar", "type of output nrrd", nrrdType);
+ hestOptAdd_1_Other(&hopt, NULL, "input", &pld, NULL, "input polydata filename",
+ limnHestPolyDataLMPD);
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output nrrd filename");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/limn/lpu_sort.c
===================================================================
--- teem/trunk/src/limn/lpu_sort.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_sort.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -36,12 +36,11 @@
Nrrd *nin;
char *out;
- hestOptAdd(&hopt, NULL, "input lpld", airTypeOther, 1, 1, &pld, NULL,
- "input polydata filename", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, NULL, "input nrrd", airTypeOther, 1, 1, &nin, NULL,
- "input nrrd filename", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output lpld filename");
+ hestOptAdd_1_Other(&hopt, NULL, "input lpld", &pld, NULL, "input polydata filename",
+ limnHestPolyDataLMPD);
+ hestOptAdd_1_Other(&hopt, NULL, "input nrrd", &nin, NULL, "input nrrd filename",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output lpld filename");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/limn/lpu_verts.c
===================================================================
--- teem/trunk/src/limn/lpu_verts.c 2023-07-15 12:13:27 UTC (rev 7105)
+++ teem/trunk/src/limn/lpu_verts.c 2023-07-15 12:25:19 UTC (rev 7106)
@@ -36,10 +36,9 @@
Nrrd *nout;
char *out;
- hestOptAdd(&hopt, NULL, "input", airTypeOther, 1, 1, &pld, NULL,
- "input polydata filename", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, NULL, "output", airTypeString, 1, 1, &out, NULL,
- "output nrrd filename");
+ hestOptAdd_1_Other(&hopt, NULL, "input", &pld, NULL, "input polydata filename",
+ limnHestPolyDataLMPD);
+ hestOptAdd_1_String(&hopt, NULL, "output", &out, NULL, "output nrrd filename");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-15 12:13:36
|
Revision: 7105
http://sourceforge.net/p/teem/code/7105
Author: kindlmann
Date: 2023-07-15 12:13:27 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
upating hest usage
Modified Paths:
--------------
teem/trunk/src/ten/tendAnhist.c
teem/trunk/src/ten/tendAnplot.c
teem/trunk/src/ten/tendAnscale.c
teem/trunk/src/ten/tendAnvol.c
teem/trunk/src/ten/tendAvg.c
teem/trunk/src/ten/tendBfit.c
teem/trunk/src/ten/tendBmat.c
teem/trunk/src/ten/tendEllipse.c
teem/trunk/src/ten/tendEpireg.c
teem/trunk/src/ten/tendEstim.c
teem/trunk/src/ten/tendEval.c
teem/trunk/src/ten/tendEvaladd.c
teem/trunk/src/ten/tendEvalclamp.c
teem/trunk/src/ten/tendEvalmult.c
teem/trunk/src/ten/tendEvalpow.c
teem/trunk/src/ten/tendEvec.c
teem/trunk/src/ten/tendEvecrgb.c
teem/trunk/src/ten/tendEvq.c
teem/trunk/src/ten/tendExp.c
teem/trunk/src/ten/tendExpand.c
teem/trunk/src/ten/tendFiber.c
teem/trunk/src/ten/tendGlyph.c
teem/trunk/src/ten/tendGrads.c
teem/trunk/src/ten/tendHelix.c
teem/trunk/src/ten/tendLog.c
teem/trunk/src/ten/tendMake.c
teem/trunk/src/ten/tendMconv.c
teem/trunk/src/ten/tendMfit.c
teem/trunk/src/ten/tendMsim.c
teem/trunk/src/ten/tendNorm.c
teem/trunk/src/ten/tendPoint.c
teem/trunk/src/ten/tendSatin.c
teem/trunk/src/ten/tendShrink.c
teem/trunk/src/ten/tendSim.c
teem/trunk/src/ten/tendSlice.c
teem/trunk/src/ten/tendSten.c
teem/trunk/src/ten/tendTconv.c
teem/trunk/src/ten/tendTriple.c
teem/trunk/src/ten/tendUnmf.c
Modified: teem/trunk/src/ten/tendAnhist.c
===================================================================
--- teem/trunk/src/ten/tendAnhist.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendAnhist.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -39,29 +39,26 @@
Nrrd *nin, *nout, *nwght;
char *outS;
- hestOptAdd(&hopt, "v", "westin version", airTypeInt, 1, 1, &version, "1",
- "Which version of Westin's anisotropy metric triple "
- "to use, either \"1\" or \"2\"");
- hestOptAdd(&hopt, "w", "nweight", airTypeOther, 1, 1, &nwght, "",
- "how to weigh contributions to histogram. By default "
- "(not using this option), the increment is one bin count per "
- "sample, but by giving a nrrd, the value in the nrrd at the "
- "corresponding location will be the bin count increment ",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "r", "res", airTypeInt, 1, 1, &res, NULL,
- "resolution of anisotropy plot");
- hestOptAdd(&hopt, "right", NULL, airTypeInt, 0, 0, &right, NULL,
- "sample a right-triangle-shaped region, instead of "
- "a roughly equilateral triangle. ");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_Int(&hopt, "v", "westin version", &version, "1",
+ "Which version of Westin's anisotropy metric triple "
+ "to use, either \"1\" or \"2\"");
+ hestOptAdd_1_Other(&hopt, "w", "nweight", &nwght, "",
+ "how to weigh contributions to histogram. By default "
+ "(not using this option), the increment is one bin count per "
+ "sample, but by giving a nrrd, the value in the nrrd at the "
+ "corresponding location will be the bin count increment ",
+ nrrdHestNrrd);
+ hestOptAdd_1_Int(&hopt, "r", "res", &res, NULL, "resolution of anisotropy plot");
+ hestOptAdd_Flag(&hopt, "right", &right,
+ "sample a right-triangle-shaped region, instead of "
+ "a roughly equilateral triangle. ");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_anhistInfoL);
- PARSE();
+ USAGE_PARSE(_tend_anhistInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendAnplot.c
===================================================================
--- teem/trunk/src/ten/tendAnplot.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendAnplot.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -40,32 +40,30 @@
char *perr, *err;
airArray *mop;
- int res, aniso, whole, nanout, hflip;
+ int aniso, whole, nanout, hflip;
+ unsigned int res;
Nrrd *nout;
char *outS;
- hestOptAdd(&hopt, "r", "res", airTypeInt, 1, 1, &res, "256",
- "resolution of anisotropy plot");
- hestOptAdd(&hopt, "w", NULL, airTypeInt, 0, 0, &whole, NULL,
- "sample the whole triangle of constant trace, "
- "instead of just the "
- "sixth of it in which the eigenvalues have the "
- "traditional sorted order. ");
- hestOptAdd(&hopt, "hflip", NULL, airTypeInt, 0, 0, &hflip, NULL,
- "flip the two bottom corners (swapping the place of "
- "linear and planar)");
- hestOptAdd(&hopt, "nan", NULL, airTypeInt, 0, 0, &nanout, NULL,
- "set the pixel values outside the triangle to be NaN, "
- "instead of 0");
- hestOptAdd(&hopt, "a", "aniso", airTypeEnum, 1, 1, &aniso, NULL,
- "Which anisotropy metric to plot. " TEN_ANISO_DESC, NULL, tenAniso);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_UInt(&hopt, "r", "res", &res, "256", "resolution of anisotropy plot");
+ hestOptAdd_Flag(&hopt, "w", &whole,
+ "sample the whole triangle of constant trace, "
+ "instead of just the "
+ "sixth of it in which the eigenvalues have the "
+ "traditional sorted order. ");
+ hestOptAdd_Flag(&hopt, "hflip", &hflip,
+ "flip the two bottom corners (swapping the place of "
+ "linear and planar)");
+ hestOptAdd_Flag(&hopt, "nan", &nanout,
+ "set the pixel values outside the triangle to be NaN, "
+ "instead of 0");
+ hestOptAdd_1_Enum(&hopt, "a", "aniso", &aniso, NULL,
+ "Which anisotropy metric to plot. " TEN_ANISO_DESC, tenAniso);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_anplotInfoL);
- JUSTPARSE();
+ USAGE_JUSTPARSE(_tend_anplotInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendAnscale.c
===================================================================
--- teem/trunk/src/ten/tendAnscale.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendAnscale.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -42,23 +42,21 @@
float scale;
int fixDet, makePositive;
- hestOptAdd(&hopt, "s", "scale", airTypeFloat, 1, 1, &scale, NULL,
- "Amount by which to scale deviatoric component of tensor.");
- hestOptAdd(&hopt, "fd", NULL, airTypeInt, 0, 0, &fixDet, NULL,
- "instead of fixing the per-sample trace (the default), fix the "
- "determinant (ellipsoid volume)");
- hestOptAdd(&hopt, "mp", NULL, airTypeInt, 0, 0, &makePositive, NULL,
- "after changing the eigenvalues of the tensor, enforce their "
- "non-negative-ness. By default, no such constraint is imposed.");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_Float(&hopt, "s", "scale", &scale, NULL,
+ "Amount by which to scale deviatoric component of tensor.");
+ hestOptAdd_Flag(&hopt, "fd", &fixDet,
+ "instead of fixing the per-sample trace (the default), fix the "
+ "determinant (ellipsoid volume)");
+ hestOptAdd_Flag(&hopt, "mp", &makePositive,
+ "after changing the eigenvalues of the tensor, enforce their "
+ "non-negative-ness. By default, no such constraint is imposed.");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_anscaleInfoL);
- PARSE();
+ USAGE_PARSE(_tend_anscaleInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendAnvol.c
===================================================================
--- teem/trunk/src/ten/tendAnvol.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendAnvol.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -39,19 +39,16 @@
char *outS;
float thresh;
- hestOptAdd(&hopt, "a", "aniso", airTypeEnum, 1, 1, &aniso, NULL,
- "Which anisotropy metric to plot. " TEN_ANISO_DESC, NULL, tenAniso);
- hestOptAdd(&hopt, "t", "thresh", airTypeFloat, 1, 1, &thresh, "0.5",
- "confidence threshold");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_Enum(&hopt, "a", "aniso", &aniso, NULL,
+ "Which anisotropy metric to plot. " TEN_ANISO_DESC, tenAniso);
+ hestOptAdd_1_Float(&hopt, "t", "thresh", &thresh, "0.5", "confidence threshold");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_anvolInfoL);
- PARSE();
+ USAGE_PARSE(_tend_anvolInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendAvg.c
===================================================================
--- teem/trunk/src/ten/tendAvg.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendAvg.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -34,21 +34,20 @@
char *perr, *err;
airArray *mop;
- int ninLen, itype;
+ int itype;
+ unsigned int ninLen;
Nrrd **nin, *nout;
char *outS;
- hestOptAdd(&hopt, "i", "nin1 nin2", airTypeOther, 2, -1, &nin, NULL,
- "list of input diffusion tensor volumes", &ninLen, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "t", "type", airTypeEnum, 1, 1, &itype, "linear", "averaging method",
- NULL, tenInterpType);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_Nv_Other(&hopt, "i", "nin1 nin2", 2, -1, &nin, NULL,
+ "list of input diffusion tensor volumes", &ninLen, nrrdHestNrrd);
+ hestOptAdd_1_Enum(&hopt, "t", "type", &itype, "linear", "averaging method",
+ tenInterpType);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_avgInfoL);
- JUSTPARSE();
+ USAGE_JUSTPARSE(_tend_avgInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendBfit.c
===================================================================
--- teem/trunk/src/ten/tendBfit.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendBfit.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -43,26 +43,24 @@
hparm->respFileEnable = AIR_TRUE;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "Input nrrd. List of DWIs from different b-values must "
- "be along axis 0",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "b", "b1 b2", airTypeDouble, 2, -1, &bb, NULL,
- "b values across axis 0 of input nrrd", &bbLen);
- hestOptAdd(&hopt, "w", "w1 w2", airTypeDouble, 2, -1, &_ww, "nan nan",
- "weights for samples in non-linear fitting", &_wwLen);
- hestOptAdd(&hopt, "imax", "# iter", airTypeInt, 1, 1, &iterMax, "10",
- "max number of iterations to use in non-linear fitting, or, "
- "use 0 to do only initial linear fit");
- hestOptAdd(&hopt, "eps", "epsilon", airTypeDouble, 1, 1, &eps, "1",
- "epsilon convergence threshold for non-linear fitting");
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output tensor volume");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-",
+ "Input nrrd. List of DWIs from different b-values must "
+ "be along axis 0",
+ nrrdHestNrrd);
+ hestOptAdd_Nv_Double(&hopt, "b", "b1 b2", 2, -1, &bb, NULL,
+ "b values across axis 0 of input nrrd", &bbLen);
+ hestOptAdd_Nv_Double(&hopt, "w", "w1 w2", 2, -1, &_ww, "nan nan",
+ "weights for samples in non-linear fitting", &_wwLen);
+ hestOptAdd_1_Int(&hopt, "imax", "# iter", &iterMax, "10",
+ "max number of iterations to use in non-linear fitting, or, "
+ "use 0 to do only initial linear fit");
+ hestOptAdd_1_Double(&hopt, "eps", "epsilon", &eps, "1",
+ "epsilon convergence threshold for non-linear fitting");
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output tensor volume");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_bfitInfoL);
- PARSE();
+ USAGE_PARSE(_tend_bfitInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
if (!(bbLen == nin->axis[0].size)) {
Modified: teem/trunk/src/ten/tendBmat.c
===================================================================
--- teem/trunk/src/ten/tendBmat.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendBmat.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -45,14 +45,13 @@
Nrrd *ngrad, *nout;
char *outS;
- hestOptAdd(&hopt, "i", "grads", airTypeOther, 1, 1, &ngrad, NULL,
- "array of gradient directions", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-", "output B matrix");
+ hestOptAdd_1_Other(&hopt, "i", "grads", &ngrad, NULL, "array of gradient directions",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output B matrix");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_bmatInfoL);
- JUSTPARSE();
+ USAGE_JUSTPARSE(_tend_bmatInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
Modified: teem/trunk/src/ten/tendEllipse.c
===================================================================
--- teem/trunk/src/ten/tendEllipse.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEllipse.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -216,39 +216,34 @@
mop = airMopNew();
- hestOptAdd(&hopt, "ctr", "conf thresh", airTypeFloat, 1, 1, &cthresh, "0.5",
- "Glyphs will be drawn only for tensors with confidence "
- "values greater than this threshold");
- hestOptAdd(&hopt, "gsc", "scale", airTypeFloat, 1, 1, &gscale, "1",
- "over-all glyph size");
- hestOptAdd(&hopt, "dot", "radius", airTypeFloat, 1, 1, &dotRad, "0.0",
- "radius of little dot to put in middle of ellipse, or \"0\" "
- "for no such dot");
- hestOptAdd(&hopt, "wid", "width", airTypeFloat, 1, 1, &lineWidth, "0.0",
- "with of lines for tractlets");
- hestOptAdd(&hopt, "inv", NULL, airTypeInt, 0, 0, &invert, NULL,
- "use white ellipses on black background, instead of reverse");
- hestOptAdd(&hopt, "min", "minX minY", airTypeFloat, 2, 2, min, "-1 -1",
- "when using \"-p\", minimum corner");
- hestOptAdd(&hopt, "max", "maxX maxY", airTypeFloat, 2, 2, max, "1 1",
- "when using \"-p\", maximum corner");
+ hestOptAdd_1_Float(&hopt, "ctr", "conf thresh", &cthresh, "0.5",
+ "Glyphs will be drawn only for tensors with confidence "
+ "values greater than this threshold");
+ hestOptAdd_1_Float(&hopt, "gsc", "scale", &gscale, "1", "over-all glyph size");
+ hestOptAdd_1_Float(&hopt, "dot", "radius", &dotRad, "0.0",
+ "radius of little dot to put in middle of ellipse, or \"0\" "
+ "for no such dot");
+ hestOptAdd_1_Float(&hopt, "wid", "width", &lineWidth, "0.0",
+ "with of lines for tractlets");
+ hestOptAdd_Flag(&hopt, "inv", &invert,
+ "use white ellipses on black background, instead of reverse");
+ hestOptAdd_2_Float(&hopt, "min", "minX minY", min, "-1 -1",
+ "when using \"-p\", minimum corner");
+ hestOptAdd_2_Float(&hopt, "max", "maxX maxY", max, "1 1",
+ "when using \"-p\", maximum corner");
/* input/output */
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nten, "-", "image of 2D tensors",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "p", "pos array", airTypeOther, 1, 1, &npos, "",
- "Instead of being on a grid, tensors are at arbitrary locations, "
- "as defined by this 2-by-N array of floats",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "s", "stn array", airTypeOther, 1, 1, &nstn, "",
- "Locations given by \"-p\" have this connectivity", NULL, NULL,
- nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output PostScript file");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nten, "-", "image of 2D tensors", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "p", "pos array", &npos, "",
+ "Instead of being on a grid, tensors are at arbitrary locations, "
+ "as defined by this 2-by-N array of floats",
+ nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "s", "stn array", &nstn, "",
+ "Locations given by \"-p\" have this connectivity", nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output PostScript file");
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_ellipseInfoL);
- JUSTPARSE();
+ USAGE_JUSTPARSE(_tend_ellipseInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
if (npos) {
Modified: teem/trunk/src/ten/tendEpireg.c
===================================================================
--- teem/trunk/src/ten/tendEpireg.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEpireg.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -45,76 +45,73 @@
char *gradS;
NrrdKernelSpec *ksp;
Nrrd **nin, **nout3D, *nout4D, *ngrad, *ngradKVP, *nbmatKVP;
- unsigned int ni, ninLen, *skip, skipNum;
- int ref, noverbose, progress, nocc, baseNum;
+ unsigned int ni, ninLen, *skip, skipNum, baseNum;
+ int ref, noverbose, progress, nocc;
float bw[2], thr, fitFrac;
double bvalue;
- hestOptAdd(&hopt, "i", "dwi0 dwi1", airTypeOther, 1, -1, &nin, NULL,
- "all the diffusion-weighted images (DWIs), as separate 3D nrrds, "
- "**OR**: one 4D nrrd of all DWIs stacked along axis 0",
- &ninLen, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "g", "grads", airTypeString, 1, 1, &gradS, NULL,
- "array of gradient directions, in the same order as the "
- "associated DWIs were given to \"-i\", "
- "**OR** \"-g kvp\" signifies that gradient directions should "
- "be read from the key/value pairs of the DWI",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "r", "reference", airTypeInt, 1, 1, &ref, "-1",
- "which of the DW volumes (zero-based numbering) should be used "
- "as the standard, to which all other images are transformed. "
- "Using -1 (the default) means that 9 intrinsic parameters "
- "governing the relationship between the gradient direction "
- "and the resulting distortion are estimated and fitted, "
- "ensuring good registration with the non-diffusion-weighted "
- "T2 image (which is never explicitly used in registration). "
- "Otherwise, by picking a specific DWI, no distortion parameter "
- "estimation is done. ");
- hestOptAdd(&hopt, "nv", NULL, airTypeInt, 0, 0, &noverbose, NULL,
- "turn OFF verbose mode, and "
- "have no idea what stage processing is at.");
- hestOptAdd(&hopt, "p", NULL, airTypeInt, 0, 0, &progress, NULL,
- "save out intermediate steps of processing");
- hestOptAdd(&hopt, "bw", "x,y blur", airTypeFloat, 2, 2, bw, "1.0 2.0",
- "standard devs in X and Y directions of gaussian filter used "
- "to blur the DWIs prior to doing segmentation. This blurring "
- "does not effect the final resampling of registered DWIs. "
- "Use \"0.0 0.0\" to say \"no blurring\"");
- hestOptAdd(&hopt, "t", "DWI thresh", airTypeFloat, 1, 1, &thr, "nan",
- "Threshold value to use on DWIs, "
- "to do initial separation of brain and non-brain. By default, "
- "the threshold is determined automatically by histogram "
- "analysis. ");
- hestOptAdd(&hopt, "ncc", NULL, airTypeInt, 0, 0, &nocc, NULL,
- "do *NOT* do connected component (CC) analysis, after "
- "thresholding and before moment calculation. Doing CC analysis "
- "usually gives better results because it converts the "
- "thresholding output into something much closer to a "
- "real segmentation");
- hestOptAdd(&hopt, "f", "fit frac", airTypeFloat, 1, 1, &fitFrac, "0.70",
- "(only meaningful with \"-r -1\") When doing linear fitting "
- "of the intrinsic distortion parameters, it is good "
- "to ignore the slices for which the segmentation was poor. A "
- "heuristic is used to rank the slices according to segmentation "
- "quality. This option controls how many of the (best) slices "
- "contribute to the fitting. Use \"0\" to disable distortion "
- "parameter fitting. ");
- hestOptAdd(&hopt, "k", "kernel", airTypeOther, 1, 1, &ksp, "cubic:0,0.5",
- "kernel for resampling DWIs along the phase-encoding "
- "direction during final registration stage",
- NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "s", "start #", airTypeInt, 1, 1, &baseNum, "1",
- "first number to use in numbered sequence of output files.");
- hestOptAdd(&hopt, "o", "output/prefix", airTypeString, 1, 1, &outS, "-",
- "For separate 3D DWI volume inputs: prefix for output filenames; "
- "will save out one (registered) "
- "DWI for each input DWI, using the same type as the input. "
- "**OR**: For single 4D DWI input: output file name. ");
+ hestOptAdd_Nv_Other(&hopt, "i", "dwi0 dwi1", 1, -1, &nin, NULL,
+ "all the diffusion-weighted images (DWIs), as separate 3D nrrds, "
+ "**OR**: one 4D nrrd of all DWIs stacked along axis 0",
+ &ninLen, nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "g", "grads", &gradS, NULL,
+ "array of gradient directions, in the same order as the "
+ "associated DWIs were given to \"-i\", "
+ "**OR** \"-g kvp\" signifies that gradient directions should "
+ "be read from the key/value pairs of the DWI");
+ hestOptAdd_1_Int(&hopt, "r", "reference", &ref, "-1",
+ "which of the DW volumes (zero-based numbering) should be used "
+ "as the standard, to which all other images are transformed. "
+ "Using -1 (the default) means that 9 intrinsic parameters "
+ "governing the relationship between the gradient direction "
+ "and the resulting distortion are estimated and fitted, "
+ "ensuring good registration with the non-diffusion-weighted "
+ "T2 image (which is never explicitly used in registration). "
+ "Otherwise, by picking a specific DWI, no distortion parameter "
+ "estimation is done. ");
+ hestOptAdd_Flag(&hopt, "nv", &noverbose,
+ "turn OFF verbose mode, and "
+ "have no idea what stage processing is at.");
+ hestOptAdd_Flag(&hopt, "p", &progress, "save out intermediate steps of processing");
+ hestOptAdd_2_Float(&hopt, "bw", "x,y blur", bw, "1.0 2.0",
+ "standard devs in X and Y directions of gaussian filter used "
+ "to blur the DWIs prior to doing segmentation. This blurring "
+ "does not effect the final resampling of registered DWIs. "
+ "Use \"0.0 0.0\" to say \"no blurring\"");
+ hestOptAdd_1_Float(&hopt, "t", "DWI thresh", &thr, "nan",
+ "Threshold value to use on DWIs, "
+ "to do initial separation of brain and non-brain. By default, "
+ "the threshold is determined automatically by histogram "
+ "analysis.");
+ hestOptAdd_Flag(&hopt, "ncc", &nocc,
+ "do *NOT* do connected component (CC) analysis, after "
+ "thresholding and before moment calculation. Doing CC analysis "
+ "usually gives better results because it converts the "
+ "thresholding output into something much closer to a "
+ "real segmentation");
+ hestOptAdd_1_Float(&hopt, "f", "fit frac", &fitFrac, "0.70",
+ "(only meaningful with \"-r -1\") When doing linear fitting "
+ "of the intrinsic distortion parameters, it is good "
+ "to ignore the slices for which the segmentation was poor. A "
+ "heuristic is used to rank the slices according to segmentation "
+ "quality. This option controls how many of the (best) slices "
+ "contribute to the fitting. Use \"0\" to disable distortion "
+ "parameter fitting. ");
+ hestOptAdd_1_Other(&hopt, "k", "kernel", &ksp, "cubic:0,0.5",
+ "kernel for resampling DWIs along the phase-encoding "
+ "direction during final registration stage",
+ nrrdHestKernelSpec);
+ hestOptAdd_1_UInt(&hopt, "s", "start #", &baseNum, "1",
+ "first number to use in numbered sequence of output files.");
+ hestOptAdd_1_String(&hopt, "o", "output/prefix", &outS, "-",
+ "For separate 3D DWI volume inputs: prefix for output filenames; "
+ "will save out one (registered) "
+ "DWI for each input DWI, using the same type as the input. "
+ "**OR**: For single 4D DWI input: output file name. ");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_epiregInfoL);
- JUSTPARSE();
+ USAGE_JUSTPARSE(_tend_epiregInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
if (strcmp("kvp", gradS)) {
@@ -186,11 +183,11 @@
} else {
for (ni = 0; ni < ninLen; ni++) {
if (ninLen + baseNum > 99) {
- sprintf(buff, "%s%05d.nrrd", outS, ni + baseNum);
+ sprintf(buff, "%s%05u.nrrd", outS, ni + baseNum);
} else if (ninLen + baseNum > 9) {
- sprintf(buff, "%s%02d.nrrd", outS, ni + baseNum);
+ sprintf(buff, "%s%02u.nrrd", outS, ni + baseNum);
} else {
- sprintf(buff, "%s%d.nrrd", outS, ni + baseNum);
+ sprintf(buff, "%s%u.nrrd", outS, ni + baseNum);
}
if (nrrdSave(buff, nout3D[ni], NULL)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
Modified: teem/trunk/src/ten/tendEstim.c
===================================================================
--- teem/trunk/src/ten/tendEstim.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEstim.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -50,84 +50,81 @@
tenEstimateContext *tec;
- hestOptAdd(&hopt, "old", NULL, airTypeInt, 0, 0, &oldstuff, NULL,
- "instead of the new tenEstimateContext code, use "
- "the old tenEstimateLinear code");
- hestOptAdd(&hopt, "sigma", "sigma", airTypeFloat, 1, 1, &sigma, "nan",
- "Rician noise parameter");
- hestOptAdd(&hopt, "v", "verbose", airTypeInt, 1, 1, &verbose, "0", "verbosity level");
- hestOptAdd(&hopt, "est", "estimate method", airTypeEnum, 1, 1, &estmeth, "lls",
- "estimation method to use. \"lls\": linear-least squares", NULL,
- tenEstimate1Method);
- hestOptAdd(&hopt, "wlsi", "WLS iters", airTypeUInt, 1, 1, &wlsi, "1",
- "when using weighted-least-squares (\"-est wls\"), how "
- "many iterations to do after the initial weighted fit.");
- hestOptAdd(&hopt, "fixneg", NULL, airTypeInt, 0, 0, &fixneg, NULL,
- "after estimating the tensor, ensure that there are no negative "
- "eigenvalues by adding (to all eigenvalues) the amount by which "
- "the smallest is negative (corresponding to increasing the "
- "non-DWI image value).");
- hestOptAdd(&hopt, "ee", "filename", airTypeString, 1, 1, &terrS, "",
- "Giving a filename here allows you to save out the tensor "
- "estimation error: a value which measures how much error there "
- "is between the tensor model and the given diffusion weighted "
- "measurements for each sample. By default, no such error "
- "calculation is saved.");
- hestOptAdd(&hopt, "eb", "filename", airTypeString, 1, 1, &eb0S, "",
- "In those cases where there is no B=0 reference image given "
- "(\"-knownB0 false\"), "
- "giving a filename here allows you to save out the B=0 image "
- "which is estimated from the data. By default, this image value "
- "is estimated but not saved.");
- hestOptAdd(&hopt, "t", "thresh", airTypeDouble, 1, 1, &thresh, "nan",
- "value at which to threshold the mean DWI value per pixel "
- "in order to generate the \"confidence\" mask. By default, "
- "the threshold value is calculated automatically, based on "
- "histogram analysis.");
- hestOptAdd(&hopt, "soft", "soft", airTypeFloat, 1, 1, &soft, "0",
- "how fuzzy the confidence boundary should be. By default, "
- "confidence boundary is perfectly sharp");
- hestOptAdd(&hopt, "scale", "scale", airTypeFloat, 1, 1, &scale, "1",
- "After estimating the tensor, scale all of its elements "
- "(but not the confidence value) by this amount. Can help with "
- "downstream numerical precision if values are very large "
- "or small.");
- hestOptAdd(&hopt, "mv", "min val", airTypeDouble, 1, 1, &valueMin, "1.0",
- "minimum plausible value (especially important for linear "
- "least squares estimation)");
- hestOptAdd(&hopt, "B", "B-list", airTypeString, 1, 1, &bmatS, NULL,
- "6-by-N list of B-matrices characterizing "
- "the diffusion weighting for each "
- "image. \"tend bmat\" is one source for such a matrix; see "
- "its usage info for specifics on how the coefficients of "
- "the B-matrix are ordered. "
- "An unadorned plain text file is a great way to "
- "specify the B-matrix.\n **OR**\n "
- "Can say just \"-B kvp\" to try to learn B matrices from "
- "key/value pair information in input images.");
- hestOptAdd(&hopt, "b", "b", airTypeDouble, 1, 1, &bval, "nan",
- "\"b\" diffusion-weighting factor (units of sec/mm^2)");
- hestOptAdd(&hopt, "knownB0", "bool", airTypeBool, 1, 1, &knownB0, NULL,
- "Indicates if the B=0 non-diffusion-weighted reference image "
- "is known, or if it has to be estimated along with the tensor "
- "elements.\n "
- "\b\bo if \"true\": in the given list of diffusion gradients or "
- "B-matrices, there are one or more with zero norm, which are "
- "simply averaged to find the B=0 reference image value\n "
- "\b\bo if \"false\": there may or may not be diffusion-weighted "
- "images among the input; the B=0 image value is going to be "
- "estimated along with the diffusion model");
- hestOptAdd(&hopt, "i", "dwi0 dwi1", airTypeOther, 1, -1, &nin, "-",
- "all the diffusion-weighted images (DWIs), as separate 3D nrrds, "
- "**OR**: One 4D nrrd of all DWIs stacked along axis 0",
- &ninLen, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output tensor volume");
+ hestOptAdd_Flag(&hopt, "old", &oldstuff,
+ "instead of the new tenEstimateContext code, use "
+ "the old tenEstimateLinear code");
+ hestOptAdd_1_Float(&hopt, "sigma", "sigma", &sigma, "nan", "Rician noise parameter");
+ hestOptAdd_1_Int(&hopt, "v", "verbose", &verbose, "0", "verbosity level");
+ hestOptAdd_1_Enum(&hopt, "est", "estimate method", &estmeth, "lls",
+ "estimation method to use. \"lls\": linear-least squares",
+ tenEstimate1Method);
+ hestOptAdd_1_UInt(&hopt, "wlsi", "WLS iters", &wlsi, "1",
+ "when using weighted-least-squares (\"-est wls\"), how "
+ "many iterations to do after the initial weighted fit.");
+ hestOptAdd_Flag(&hopt, "fixneg", &fixneg,
+ "after estimating the tensor, ensure that there are no negative "
+ "eigenvalues by adding (to all eigenvalues) the amount by which "
+ "the smallest is negative (corresponding to increasing the "
+ "non-DWI image value).");
+ hestOptAdd_1_String(&hopt, "ee", "filename", &terrS, "",
+ "Giving a filename here allows you to save out the tensor "
+ "estimation error: a value which measures how much error there "
+ "is between the tensor model and the given diffusion weighted "
+ "measurements for each sample. By default, no such error "
+ "calculation is saved.");
+ hestOptAdd_1_String(&hopt, "eb", "filename", &eb0S, "",
+ "In those cases where there is no B=0 reference image given "
+ "(\"-knownB0 false\"), "
+ "giving a filename here allows you to save out the B=0 image "
+ "which is estimated from the data. By default, this image value "
+ "is estimated but not saved.");
+ hestOptAdd_1_Double(&hopt, "t", "thresh", &thresh, "nan",
+ "value at which to threshold the mean DWI value per pixel "
+ "in order to generate the \"confidence\" mask. By default, "
+ "the threshold value is calculated automatically, based on "
+ "histogram analysis.");
+ hestOptAdd_1_Float(&hopt, "soft", "soft", &soft, "0",
+ "how fuzzy the confidence boundary should be. By default, "
+ "confidence boundary is perfectly sharp");
+ hestOptAdd_1_Float(&hopt, "scale", "scale", &scale, "1",
+ "After estimating the tensor, scale all of its elements "
+ "(but not the confidence value) by this amount. Can help with "
+ "downstream numerical precision if values are very large "
+ "or small.");
+ hestOptAdd_1_Double(&hopt, "mv", "min val", &valueMin, "1.0",
+ "minimum plausible value (especially important for linear "
+ "least squares estimation)");
+ hestOptAdd_1_String(&hopt, "B", "B-list", &bmatS, NULL,
+ "6-by-N list of B-matrices characterizing "
+ "the diffusion weighting for each "
+ "image. \"tend bmat\" is one source for such a matrix; see "
+ "its usage info for specifics on how the coefficients of "
+ "the B-matrix are ordered. "
+ "An unadorned plain text file is a great way to "
+ "specify the B-matrix.\n **OR**\n "
+ "Can say just \"-B kvp\" to try to learn B matrices from "
+ "key/value pair information in input images.");
+ hestOptAdd_1_Double(&hopt, "b", "b", &bval, "nan",
+ "\"b\" diffusion-weighting factor (units of sec/mm^2)");
+ hestOptAdd_1_Bool(&hopt, "knownB0", "bool", &knownB0, NULL,
+ "Indicates if the B=0 non-diffusion-weighted reference image "
+ "is known, or if it has to be estimated along with the tensor "
+ "elements.\n "
+ "\b\bo if \"true\": in the given list of diffusion gradients or "
+ "B-matrices, there are one or more with zero norm, which are "
+ "simply averaged to find the B=0 reference image value\n "
+ "\b\bo if \"false\": there may or may not be diffusion-weighted "
+ "images among the input; the B=0 image value is going to be "
+ "estimated along with the diffusion model");
+ hestOptAdd_Nv_Other(&hopt, "i", "dwi0 dwi1", 1, -1, &nin, "-",
+ "all the diffusion-weighted images (DWIs), as separate 3D nrrds, "
+ "**OR**: One 4D nrrd of all DWIs stacked along axis 0",
+ &ninLen, nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output tensor volume");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_estimInfoL);
- JUSTPARSE();
+ USAGE_JUSTPARSE(_tend_estimInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendEval.c
===================================================================
--- teem/trunk/src/ten/tendEval.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEval.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -32,34 +32,32 @@
char *perr, *err;
airArray *mop;
- int ret, *comp, compLen, cc;
+ int ret;
+ unsigned int *comp, compLen, cc;
Nrrd *nin, *nout;
char *outS;
float thresh, *edata, *tdata, eval[3], evec[9];
size_t N, I, sx, sy, sz;
- hestOptAdd(&hopt, "c", "c0 ", airTypeInt, 1, 3, &comp, NULL,
- "which eigenvalues should be saved out. \"0\" for the "
- "largest, \"1\" for the middle, \"2\" for the smallest, "
- "\"0 1\", \"1 2\", \"0 1 2\" or similar for more than one",
- &compLen);
- hestOptAdd(&hopt, "t", "thresh", airTypeFloat, 1, 1, &thresh, "0.5",
- "confidence threshold");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_Nv_UInt(&hopt, "c", "c0 ", 1, 3, &comp, NULL,
+ "which eigenvalues should be saved out. \"0\" for the "
+ "largest, \"1\" for the middle, \"2\" for the smallest, "
+ "\"0 1\", \"1 2\", \"0 1 2\" or similar for more than one",
+ &compLen);
+ hestOptAdd_1_Float(&hopt, "t", "thresh", &thresh, "0.5", "confidence threshold");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evalInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evalInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
for (cc = 0; cc < compLen; cc++) {
- if (!AIR_IN_CL(0, comp[cc], 2)) {
- fprintf(stderr, "%s: requested component %d (%d of 3) not in [0..2]\n", me,
- comp[cc], cc + 1);
+ if (!(comp[cc] <= 2)) {
+ fprintf(stderr, "%s: requested component %u (%u of %u) not in [0..2]\n", me,
+ comp[cc], cc + 1, compLen);
airMopError(mop);
return 1;
}
Modified: teem/trunk/src/ten/tendEvaladd.c
===================================================================
--- teem/trunk/src/ten/tendEvaladd.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvaladd.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -39,17 +39,14 @@
char *outS;
float val;
- hestOptAdd(&hopt, "v", "value", airTypeFloat, 1, 1, &val, NULL,
- "Value to add to all eigenvalues");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_Float(&hopt, "v", "value", &val, NULL, "Value to add to all eigenvalues");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evaladdInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evaladdInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendEvalclamp.c
===================================================================
--- teem/trunk/src/ten/tendEvalclamp.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvalclamp.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -39,23 +39,21 @@
char *outS;
float min, max;
- hestOptAdd(&hopt, "min", "min", airTypeFloat, 1, 1, &min, NULL,
- "Eigenvalues are clamped from below by this (the minimum "
- "output eigenvalue). Use \"nan\" to signify that no "
- "minimum clamping should be done.");
- hestOptAdd(&hopt, "max", "max", airTypeFloat, 1, 1, &max, "nan",
- "Eigenvalues are clamped from above by this (the maximum "
- "output eigenvalue). Use \"nan\" to signify that no "
- "maximum clamping should be done.");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_Float(&hopt, "min", "min", &min, NULL,
+ "Eigenvalues are clamped from below by this (the minimum "
+ "output eigenvalue). Use \"nan\" to signify that no "
+ "minimum clamping should be done.");
+ hestOptAdd_1_Float(&hopt, "max", "max", &max, "nan",
+ "Eigenvalues are clamped from above by this (the maximum "
+ "output eigenvalue). Use \"nan\" to signify that no "
+ "maximum clamping should be done.");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evalclampInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evalclampInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendEvalmult.c
===================================================================
--- teem/trunk/src/ten/tendEvalmult.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvalmult.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -37,17 +37,15 @@
char *outS;
float val;
- hestOptAdd(&hopt, "v", "value", airTypeFloat, 1, 1, &val, NULL,
- "Value to multiply eigenvalues by");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_Float(&hopt, "v", "value", &val, NULL,
+ "Value to multiply eigenvalues by");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evalmultInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evalmultInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendEvalpow.c
===================================================================
--- teem/trunk/src/ten/tendEvalpow.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvalpow.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -37,17 +37,15 @@
char *outS;
float expo;
- hestOptAdd(&hopt, "p", "power", airTypeFloat, 1, 1, &expo, NULL,
- "Power to which to raise all the eigenvalues.");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output tensor volume");
+ hestOptAdd_1_Float(&hopt, "p", "power", &expo, NULL,
+ "Power to which to raise all the eigenvalues.");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output tensor volume");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evalpowInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evalpowInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendEvec.c
===================================================================
--- teem/trunk/src/ten/tendEvec.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvec.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -32,28 +32,26 @@
char *perr, *err;
airArray *mop;
- int ret, *comp, compLen, cc;
+ int ret, *comp;
+ unsigned int cc, compLen;
Nrrd *nin, *nout;
char *outS;
float thresh, *edata, *tdata, eval[3], evec[9], scl;
size_t N, I, sx, sy, sz;
- hestOptAdd(&hopt, "c", "c0 ", airTypeInt, 1, 3, &comp, NULL,
- "which eigenvalues should be saved out. \"0\" for the "
- "largest, \"1\" for the middle, \"2\" for the smallest, "
- "\"0 1\", \"1 2\", \"0 1 2\" or similar for more than one",
- &compLen);
- hestOptAdd(&hopt, "t", "thresh", airTypeFloat, 1, 1, &thresh, "0.5",
- "confidence threshold");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_Nv_Int(&hopt, "c", "c0 ", 1, 3, &comp, NULL,
+ "which eigenvalues should be saved out. \"0\" for the "
+ "largest, \"1\" for the middle, \"2\" for the smallest, "
+ "\"0 1\", \"1 2\", \"0 1 2\" or similar for more than one",
+ &compLen);
+ hestOptAdd_1_Float(&hopt, "t", "thresh", &thresh, "0.5", "confidence threshold");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evecInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evecInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
for (cc = 0; cc < compLen; cc++) {
Modified: teem/trunk/src/ten/tendEvecrgb.c
===================================================================
--- teem/trunk/src/ten/tendEvecrgb.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvecrgb.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -42,30 +42,28 @@
rgbp = tenEvecRGBParmNew();
airMopAdd(mop, rgbp, AIR_CAST(airMopper, tenEvecRGBParmNix), airMopAlways);
- hestOptAdd(&hopt, "c", "evec index", airTypeUInt, 1, 1, &(rgbp->which), NULL,
- "which eigenvector will be colored. \"0\" for the "
- "principal, \"1\" for the middle, \"2\" for the minor");
- hestOptAdd(&hopt, "a", "aniso", airTypeEnum, 1, 1, &(rgbp->aniso), NULL,
- "Which anisotropy to use for modulating the saturation "
- "of the colors. " TEN_ANISO_DESC,
- NULL, tenAniso);
- hestOptAdd(&hopt, "t", "thresh", airTypeDouble, 1, 1, &(rgbp->confThresh), "0.5",
- "confidence threshold");
- hestOptAdd(&hopt, "bg", "background", airTypeDouble, 1, 1, &(rgbp->bgGray), "0",
- "gray level to use for voxels who's confidence is zero ");
- hestOptAdd(&hopt, "gr", "gray", airTypeDouble, 1, 1, &(rgbp->isoGray), "0",
- "the gray level to desaturate towards as anisotropy "
- "decreases (while confidence remains 1.0)");
- hestOptAdd(&hopt, "gam", "gamma", airTypeDouble, 1, 1, &(rgbp->gamma), "1",
- "gamma to use on color components");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_UInt(&hopt, "c", "evec index", &(rgbp->which), NULL,
+ "which eigenvector will be colored. \"0\" for the "
+ "principal, \"1\" for the middle, \"2\" for the minor");
+ hestOptAdd_1_Enum(&hopt, "a", "aniso", &(rgbp->aniso), NULL,
+ "Which anisotropy to use for modulating the saturation "
+ "of the colors. " TEN_ANISO_DESC,
+ tenAniso);
+ hestOptAdd_1_Double(&hopt, "t", "thresh", &(rgbp->confThresh), "0.5",
+ "confidence threshold");
+ hestOptAdd_1_Double(&hopt, "bg", "background", &(rgbp->bgGray), "0",
+ "gray level to use for voxels who's confidence is zero ");
+ hestOptAdd_1_Double(&hopt, "gr", "gray", &(rgbp->isoGray), "0",
+ "the gray level to desaturate towards as anisotropy "
+ "decreases (while confidence remains 1.0)");
+ hestOptAdd_1_Double(&hopt, "gam", "gamma", &(rgbp->gamma), "1",
+ "gamma to use on color components");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evecrgbInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evecrgbInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendEvq.c
===================================================================
--- teem/trunk/src/ten/tendEvq.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendEvq.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -24,12 +24,13 @@
#define INFO "Quantize directions of diffusion"
static const char *_tend_evqInfoL
- = (INFO ". Because VTK doesn't do multi-dimensional colormaps, we have to "
- "quantize directions of diffusion (usually just the principal eigenvector) "
- "in order to create the usual XYZ<->RGB coloring. Because "
- "eigenvector directions are poorly defined in regions of low "
- "anisotropy, the length of the vector (pre-quantization) is modulated "
- "by anisotropy, requiring the selection of some anisotropy metric.");
+ = (INFO
+ ". Because VTK doesn't do multi-dimensional colormaps (circa year 2000), we "
+ "have to quantize directions of diffusion (usually just the principal eigenvector) "
+ "in order to create the usual XYZ<->RGB coloring. Because eigenvector directions "
+ "are poorly defined in regions of low anisotropy, the length of the vector "
+ "(pre-quantization) is modulated by anisotropy, requiring the selection of some "
+ "anisotropy metric.");
static int
tend_evqMain(int argc, const char **argv, const char *me, hestParm *hparm) {
@@ -38,32 +39,30 @@
char *perr, *err;
airArray *mop;
- int which, aniso, dontScaleByAniso;
+ int aniso, dontScaleByAniso;
+ unsigned int which;
Nrrd *nin, *nout;
char *outS;
- hestOptAdd(&hopt, "c", "evec index", airTypeInt, 1, 1, &which, "0",
- "Which eigenvector should be quantized: \"0\" for the "
- "direction of fastest diffusion (eigenvector associated "
- "with largest eigenvalue), \"1\" or \"2\" for other two "
- "eigenvectors (associated with middle and smallest eigenvalue)");
- hestOptAdd(&hopt, "a", "aniso", airTypeEnum, 1, 1, &aniso, NULL,
- "Which anisotropy metric to scale the eigenvector "
- "with. " TEN_ANISO_DESC,
- NULL, tenAniso);
- hestOptAdd(&hopt, "ns", NULL, airTypeInt, 0, 0, &dontScaleByAniso, NULL,
- "Don't attenuate the color by anisotropy. By default (not "
- "using this option), regions with low or no anisotropy are "
- "very dark colors or black");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output image (floating point)");
+ hestOptAdd_1_UInt(&hopt, "c", "evec index", &which, "0",
+ "Which eigenvector should be quantized: \"0\" for the "
+ "direction of fastest diffusion (eigenvector associated "
+ "with largest eigenvalue), \"1\" or \"2\" for other two "
+ "eigenvectors (associated with middle and smallest eigenvalue)");
+ hestOptAdd_1_Enum(&hopt, "a", "aniso", &aniso, NULL,
+ "Scale the eigenvector with this anisotropy metric. " TEN_ANISO_DESC,
+ tenAniso);
+ hestOptAdd_Flag(&hopt, "ns", &dontScaleByAniso,
+ "Don't attenuate the color by anisotropy. By default (not "
+ "using this option), regions with low or no anisotropy are "
+ "very dark colors or black");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output image (floating point)");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_evqInfoL);
- PARSE();
+ USAGE_PARSE(_tend_evqInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendExp.c
===================================================================
--- teem/trunk/src/ten/tendExp.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendExp.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -36,14 +36,13 @@
Nrrd *nin, *nout;
char *outS;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, NULL, "output image");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, NULL, "output image");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
- USAGE(_tend_expInfoL);
- PARSE();
+ USAGE_PARSE(_tend_expInfoL);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
nout = nrrdNew();
Modified: teem/trunk/src/ten/tendExpand.c
===================================================================
--- teem/trunk/src/ten/tendExpand.c 2023-07-15 12:12:55 UTC (rev 7104)
+++ teem/trunk/src/ten/tendExpand.c 2023-07-15 12:13:27 UTC (rev 7105)
@@ -45,31 +45,30 @@
int orientRed, orientRedWithOrigin, mfRed;
float scale, thresh;
- hestOptAdd(&hopt, "t", "thresh", airTypeFloat, 1, 1, &thresh, "0.5",
- "confidence level to threshold output tensors at. Should "
- "be between 0.0 and 1.0.");
- hestOptAdd(&hopt, "s", "scale", airTypeFloat, 1, 1, &scale, "1.0",
- "how to scale values before saving as 9-value tensor. Useful "
- "for visualization tools which assume certain characteristic "
- "ranges of eigenvalues");
- hestOptAdd(&hopt, "unmf", NULL, airTypeInt, 0, 0, &mfRed, NULL,
- "apply and remove the measurement frame, if it exists");
- hestOptAdd(&hopt, "ro", NULL, airTypeInt, 0, 0, &orientRed, NULL,
- "reduce general image orientation to axis-aligned spacings");
- hestOptAdd(&hopt, "roo", NULL, airTypeInt, 0, 0, &orientRedWithOrigin, NULL,
- "reduce general image orientation to axis-aligned spacings, "
- "while also making some effort to set axis mins from "
- "space origin");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, "-",
- "input diffusion tensor volume, with 7 values per sample", NULL, NULL,
- nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, NULL,
- "output tensor volume, with the 9 matrix components per sample");
+ hestOptAdd_1_Float(&hopt, "t", "thresh", &thresh, "0.5",
+ "confidence level to threshold output tensors at. Should "
+ "be between 0.0 and 1.0.");
+ hestOptAdd_1_Float(&hopt, "s", "scale", &scale, "1.0",
+ "how to scale values before saving as 9-value tensor. Useful "
+ "for visualization tools which assume certain characteristic "
+ "ranges of eigenvalues");
+ hestOptAdd_Flag(&hopt, "unmf", &mfRed,
+ "apply and remove the measurement frame, if it exists");
+ hestOptAdd_Flag(&hopt, "ro", &orientRed,
+ "reduce general image orientation to axis-aligned spacings");
+ hestOptAdd_Flag(&hopt, "roo", &orientRedWithOrigin,
+ "reduce general image orientation to axis-aligned spacings, "
+ "while also making some effort to set axis mins from "
+ "space origin");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-",
+ "input diffusion tensor volume, with 7 values per sample",
+ nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, NULL,
+ ...
[truncated message content] |
|
From: <kin...@us...> - 2023-07-15 12:12:57
|
Revision: 7104
http://sourceforge.net/p/teem/code/7104
Author: kindlmann
Date: 2023-07-15 12:12:55 +0000 (Sat, 15 Jul 2023)
Log Message:
-----------
like in unu: the PARSE (and the tend-specific JUSTPARSE) macros now take the INFO string, because it is part of how they respond to --help
Modified Paths:
--------------
teem/trunk/src/ten/privateTen.h
Modified: teem/trunk/src/ten/privateTen.h
===================================================================
--- teem/trunk/src/ten/privateTen.h 2023-07-14 16:58:11 UTC (rev 7103)
+++ teem/trunk/src/ten/privateTen.h 2023-07-15 12:12:55 UTC (rev 7104)
@@ -29,9 +29,9 @@
/* USAGE, PARSE: both copied verbatim from unrrdu/privateUnrrdu.h, but
** then some hacking was added . . .
*/
-#define USAGE(info) \
+#define USAGE(INFO) \
if (!argc && !hparm->noArgsIsNoProblem) { \
- hestInfo(stdout, me, (info), hparm); \
+ hestInfo(stdout, me, (INFO), hparm); \
hestUsage(stdout, hopt, me, hparm); \
hestGlossary(stdout, hopt, hparm); \
airMopError(mop); \
@@ -38,10 +38,10 @@
return 0; \
}
-/* JUSTPARSE is called by the tend functions that do *not* take an
+/* JUSTPARSE is used by the tend functions that do *not* take an
** input 7-component tensor volume
*/
-#define JUSTPARSE() \
+#define JUSTPARSE(INFO) \
if ((pret = hestParse(hopt, argc, argv, &perr, hparm))) { \
if (1 == pret) { \
fprintf(stderr, "%s: %s\n", me, perr); \
@@ -65,12 +65,12 @@
}
/*
-** PARSE is called by tend functions that do take a 7-component tensor
+** PARSE is used by tend functions that do take a 7-component tensor
** volume, so that as a hack, we can process 6-component volumes as well,
** by padding on the confidence channel (fixed at 1.0)
*/
-#define PARSE() \
- JUSTPARSE(); \
+#define PARSE(INFO) \
+ JUSTPARSE(INFO); \
if (4 == nin->dim && 6 == nin->axis[0].size && nrrdTypeBlock != nin->type) { \
ptrdiff_t padmin[4], padmax[4]; \
Nrrd *npadtmp; \
@@ -94,6 +94,10 @@
nrrdNuke(npadtmp); \
}
+/* convenience macros now that using INFO is part of how PARSE responds to --help */
+#define USAGE_PARSE(INFO) USAGE(INFO) PARSE(INFO)
+#define USAGE_JUSTPARSE(INFO) USAGE(INFO) JUSTPARSE(INFO)
+
/* enumsTen.c */
extern const airEnum _tenGage;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-14 16:58:13
|
Revision: 7103
http://sourceforge.net/p/teem/code/7103
Author: kindlmann
Date: 2023-07-14 16:58:11 +0000 (Fri, 14 Jul 2023)
Log Message:
-----------
clarifying comment
Modified Paths:
--------------
teem/trunk/src/unrrdu/privateUnrrdu.h
Modified: teem/trunk/src/unrrdu/privateUnrrdu.h
===================================================================
--- teem/trunk/src/unrrdu/privateUnrrdu.h 2023-07-14 16:32:21 UTC (rev 7102)
+++ teem/trunk/src/unrrdu/privateUnrrdu.h 2023-07-14 16:58:11 UTC (rev 7103)
@@ -286,7 +286,8 @@
return 0; \
}
-/* For the (many) times that USAGE and PARSE are used together */
+/* For the (many) times that USAGE and PARSE are used together, useful
+ now that using INFO is part of how PARSE responds to --help */
#define USAGE_OR_PARSE(INFO) \
USAGE(INFO) \
PARSE(INFO)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-14 16:32:23
|
Revision: 7102
http://sourceforge.net/p/teem/code/7102
Author: kindlmann
Date: 2023-07-14 16:32:21 +0000 (Fri, 14 Jul 2023)
Log Message:
-----------
more comments about the new functions
Modified Paths:
--------------
teem/trunk/src/hest/adders.c
Modified: teem/trunk/src/hest/adders.c
===================================================================
--- teem/trunk/src/hest/adders.c 2023-07-14 12:29:56 UTC (rev 7101)
+++ teem/trunk/src/hest/adders.c 2023-07-14 16:32:21 UTC (rev 7102)
@@ -54,8 +54,39 @@
type (like void* is the generic pointer type), and, we're not doing compile-time checks
on the non-NULL-ity of hestCB->destroy. So it all devolves back to plain void*. Still,
the hestOptAdd_*_Other function are generated here to slightly simplify the hestOptAdd
-call, since there is no more NULL and NULL for sawP and enum. Actually, there is a way
-around a type-checking black hole: extreme attentiveness!
+call, since there is no more NULL and NULL for sawP and enum. The only way around this
+particular type-checking black hole is still extreme attentiveness.
+
+Two other design points of note:
+
+(1) If we're moving to more type checking, why not make the default values be something
+other than a mere string? Why isn't the default typed in a way analogous to the newly
+typed valueP? This is a great idea, and it was actually briefly tried, but then
+abandoned. One of the original good ideas that made hest work (when it was created) was
+the recognition that if the point is to get values out of argv strings collected from the
+command-line, then you are absolutely unavoidably in the business of parsing values from
+strings, at which point you are losing zero expressivity to have the default also
+expressed as a string, and, as a happy side-effect, the type of the string was the same
+for all cases. So nothing in hest ever learned to *copy* values from a given default
+value array, it *only* *parses* values from strings. So couldn't all the functions
+generated below take typed default values and generate the default string? Yes, but the
+code is annoying, and it seems fishy to have a string-->value route for user-supplied
+options, but a value-->string-->value route for options using their default, and it risks
+confusion to have the hestGlossary-generated usage info show a default string (and it in
+that context it really does need to be a string) that doesn't seem to match the
+compiled-time value array. Also, the cases where the default is not known at compile
+(and is instead learned only at run-time) are so rare that the cost of converting that
+default value to a string is acceptable. If hest (in Teem v3) learns to copy values from
+a given default value array, this may be revisited.
+
+(2) Why the underscores in the names? Teem is pretty consistent about usingCamelCase for
+everything, no? Yes, except when it gets in the way of legibility, like the airInsane_*
+enum values, the airFP_* enum values, and nrrdWrap_nva, nrrdAlloc_nva ... (and the
+snake_case ell and tijk libraries). The "hestOptAdd" prefix needs to stay the same (we're
+not going to have both hestOptAdd() and hest_opt_add_*() in one library, when other
+necessary functions like hestOptFree() are not going to change. So then the question is:
+which is more reader-friendly: hestOptAddNvUInt or hestOpt_Nv_UInt? Obviously the
+second, and that matters more that superficial consistency.
*/
/* --------------------------------------------------------------- 1 == kind */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-14 12:29:57
|
Revision: 7101
http://sourceforge.net/p/teem/code/7101
Author: kindlmann
Date: 2023-07-14 12:29:56 +0000 (Fri, 14 Jul 2023)
Log Message:
-----------
updating how multi-line piping works to move away from csh towards bash and friends, making output respect hparm->columns
Modified Paths:
--------------
teem/trunk/src/ten/tendAbout.c
Modified: teem/trunk/src/ten/tendAbout.c
===================================================================
--- teem/trunk/src/ten/tendAbout.c 2023-07-14 12:28:18 UTC (rev 7100)
+++ teem/trunk/src/ten/tendAbout.c 2023-07-14 12:29:56 UTC (rev 7101)
@@ -58,10 +58,10 @@
"following, which estimates tensors from DWIs, takes a slice of the "
"tensor volume, computes the standard RGB colormap of the principal "
"eigenvector, and then quantizes it to an 8-bit PNG:\n";
- char par4[] = "\ttend estim -i dwi.nhdr -B kvp -knownB0 true \\\n "
- " | tend slice -a 2 -p 30 \\\n "
- " | tend evecrgb -c 0 -a cl2 -gam 1.2 \\\n "
- " | unu quantize -b 8 -min 0 -max 1 -o z30-rgb.png\n";
+ char par4[] = "\ttend estim -i dwi.nhdr -B kvp -knownB0 true |\n "
+ " tend slice -a 2 -p 30 |\n "
+ " tend evecrgb -c 0 -a cl2 -gam 1.2 |\n "
+ " unu quantize -b 8 -min 0 -max 1 -o z30-rgb.png\n";
AIR_UNUSED(argc);
AIR_UNUSED(argv);
@@ -76,10 +76,10 @@
fprintf(stdout, fmt, buff);
fprintf(stdout, "\n");
- _hestPrintStr(stdout, 1, 0, 78, par1, AIR_FALSE);
- _hestPrintStr(stdout, 1, 0, 78, par2, AIR_FALSE);
- _hestPrintStr(stdout, 1, 0, 78, par3, AIR_FALSE);
- _hestPrintStr(stdout, 2, 0, 78, par4, AIR_FALSE);
+ _hestPrintStr(stdout, 1, 0, hparm->columns, par1, AIR_FALSE);
+ _hestPrintStr(stdout, 1, 0, hparm->columns, par2, AIR_FALSE);
+ _hestPrintStr(stdout, 1, 0, hparm->columns, par3, AIR_FALSE);
+ _hestPrintStr(stdout, 2, 0, hparm->columns, par4, AIR_FALSE);
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-14 12:28:21
|
Revision: 7100
http://sourceforge.net/p/teem/code/7100
Author: kindlmann
Date: 2023-07-14 12:28:18 +0000 (Fri, 14 Jul 2023)
Log Message:
-----------
using new hparm->noArgsIsNoProblem and nrrdHestNrrdNoTTY
Modified Paths:
--------------
teem/trunk/src/ten/tendUnmf.c
Modified: teem/trunk/src/ten/tendUnmf.c
===================================================================
--- teem/trunk/src/ten/tendUnmf.c 2023-07-14 12:27:09 UTC (rev 7099)
+++ teem/trunk/src/ten/tendUnmf.c 2023-07-14 12:28:18 UTC (rev 7100)
@@ -39,13 +39,10 @@
Nrrd *nin, *nout;
char *outS;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input diffusion tensor volume "
- "(sorry, can't use usual default of \"-\" for stdin "
- "because of hest quirk)",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
- "output tensor volume");
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, "-", "input diffusion tensor volume ",
+ nrrdHestNrrdNoTTY);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output tensor volume");
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-14 12:27:11
|
Revision: 7099
http://sourceforge.net/p/teem/code/7099
Author: kindlmann
Date: 2023-07-14 12:27:09 +0000 (Fri, 14 Jul 2023)
Log Message:
-----------
copying from unu new handling of hparm->noArgsIsNoProblem so that commands can have defaults for all options
Modified Paths:
--------------
teem/trunk/src/ten/privateTen.h
Modified: teem/trunk/src/ten/privateTen.h
===================================================================
--- teem/trunk/src/ten/privateTen.h 2023-07-13 23:23:48 UTC (rev 7098)
+++ teem/trunk/src/ten/privateTen.h 2023-07-14 12:27:09 UTC (rev 7099)
@@ -30,7 +30,7 @@
** then some hacking was added . . .
*/
#define USAGE(info) \
- if (!argc) { \
+ if (!argc && !hparm->noArgsIsNoProblem) { \
hestInfo(stdout, me, (info), hparm); \
hestUsage(stdout, hopt, me, hparm); \
hestGlossary(stdout, hopt, hparm); \
@@ -47,7 +47,11 @@
fprintf(stderr, "%s: %s\n", me, perr); \
free(perr); \
hestUsage(stderr, hopt, me, hparm); \
- fprintf(stderr, "\nFor more info: \"%s\" or \"%s ... --help\"\n", me, me); \
+ if (hparm && hparm->noArgsIsNoProblem) { \
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me); \
+ } else { \
+ fprintf(stderr, "\nFor more info: \"%s\" or \"%s --help\"\n", me, me); \
+ } \
airMopError(mop); \
return 2; \
} else { \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 23:23:50
|
Revision: 7098
http://sourceforge.net/p/teem/code/7098
Author: kindlmann
Date: 2023-07-13 23:23:48 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
turning OFF hparm->elideSingleOtherDefault (or, no longer turning it on), since it needlessly obscured what the -i input option to most unu commands was
Modified Paths:
--------------
teem/trunk/src/bin/unu.c
Modified: teem/trunk/src/bin/unu.c
===================================================================
--- teem/trunk/src/bin/unu.c 2023-07-13 23:05:20 UTC (rev 7097)
+++ teem/trunk/src/bin/unu.c 2023-07-13 23:23:48 UTC (rev 7098)
@@ -64,12 +64,17 @@
airMopAdd(mop, hparm, hestParmFree_vp, airMopAlways);
hparm->elideSingleEnumType = AIR_TRUE;
hparm->elideSingleOtherType = AIR_TRUE;
- hparm->elideSingleOtherDefault = AIR_TRUE;
+ /*
+ * This prevents clarifying that the default input is "-" i.e. stdin, and it was
+ * explicitly turned off in multiple commands (such as resample). In the interests of
+ * clarity, no longer want to elide this info.
+ * hparm->elideSingleOtherDefault = AIR_TRUE;
+ */
hparm->elideSingleNonExistFloatDefault = AIR_TRUE;
hparm->elideMultipleNonExistFloatDefault = AIR_TRUE;
hparm->elideSingleEmptyStringDefault = AIR_TRUE;
hparm->elideMultipleEmptyStringDefault = AIR_TRUE;
- /* so that we look for, and know how to handle, seeing "--help" */
+ /* say that we look for, and know how to handle, seeing "--help" */
hparm->respectDashDashHelp = AIR_TRUE;
/* Try to dynamically learn number of columns. Learning the terminal size will probably
work if stdout is the terminal, but not if we're piping elsewhere (as is common with
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 23:05:23
|
Revision: 7097
http://sourceforge.net/p/teem/code/7097
Author: kindlmann
Date: 2023-07-13 23:05:20 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
make some more things unsigned that should always have been so
Modified Paths:
--------------
teem/trunk/src/alan/alan.h
teem/trunk/src/alan/coreAlan.c
teem/trunk/src/alan/methodsAlan.c
Modified: teem/trunk/src/alan/alan.h
===================================================================
--- teem/trunk/src/alan/alan.h 2023-07-13 23:04:28 UTC (rev 7096)
+++ teem/trunk/src/alan/alan.h 2023-07-13 23:05:20 UTC (rev 7097)
@@ -108,15 +108,15 @@
typedef struct alanContext_t {
/* INPUT ----------------------------- */
unsigned int dim, /* either 2 or 3 */
- size[3]; /* number of texels in X, Y, (Z) */
+ size[3], /* number of texels in X, Y, (Z) */
+ numThreads, /* # of threads, if airThreadCapable */
+ frameInterval, /* # of iterations between which to an image */
+ saveInterval, /* # of iterations between which to save all state */
+ maxIteration; /* cap on # of iterations, or 0 if there is no limit */
int verbose, wrap, /* do toroidal boundary wrapping */
textureType, /* what kind are we (from alanTextureType* enum) */
oversample, /* oversampling of tensors to texels */
homogAniso, /* homogenous anisotropy approximation */
- numThreads, /* # of threads, if airThreadCapable */
- frameInterval, /* # of iterations between which to an image */
- saveInterval, /* # of iterations between which to save all state */
- maxIteration, /* cap on # of iterations, or 0 if there is no limit */
constFilename; /* always use the same filename when saving frames */
alan_t K, F, /* simulation variables */
deltaX, /* size of spatial grid discretization */
@@ -137,13 +137,13 @@
int (*perIteration)(struct alanContext_t *, int iter);
/* INTERNAL -------------------------- */
- int iter; /* current iteration */
- Nrrd *_nlev[2], /* levels of morphogens, alternating buffers */
- *nlev; /* pointer to last iterations output */
- Nrrd *nparm; /* alpha, beta values for all texels */
- alan_t averageChange; /* average amount of "change" in last iteration */
- int changeCount; /* # of contributions to averageChange */
- /* to control update of averageChange and changeCount */
+ int iter; /* current iteration */
+ Nrrd *_nlev[2], /* levels of morphogens, alternating buffers */
+ *nlev; /* pointer to last iterations output */
+ Nrrd *nparm; /* alpha, beta values for all texels */
+ alan_t averageChange; /* average amount of "change" in last iteration */
+ unsigned int changeCount; /* # of contributions to averageChange
+ to control update of averageChange and changeCount */
airThreadMutex *changeMutex;
/* to synchronize separate iterations of simulation */
airThreadBarrier *iterBarrier;
Modified: teem/trunk/src/alan/coreAlan.c
===================================================================
--- teem/trunk/src/alan/coreAlan.c 2023-07-13 23:04:28 UTC (rev 7096)
+++ teem/trunk/src/alan/coreAlan.c 2023-07-13 23:05:20 UTC (rev 7097)
@@ -223,8 +223,9 @@
*tpx, *tmx, *tpy, *tmy, /* *tpz, *tmz, */
*lev0, *lev1, *parm, deltaT, alpha, beta, A, B, *v[27], lapA, lapB, corrA, corrB,
deltaA, deltaB, diffA, diffB, change;
- int dim, iter, stop, startW, endW, idx, px, mx, py, my, pz, mz, startY, endY, startZ,
- endZ, sx, sy, sz, x, y, z;
+ int dim, stop, startW, endW, idx, px, mx, py, my, pz, mz, startY, endY, startZ, endZ,
+ sx, sy, sz, x, y, z;
+ unsigned int iter;
alanTask *task;
task = (alanTask *)_task;
@@ -455,7 +456,8 @@
int /* Biff: 1 */
alanRun(alanContext *actx) {
static const char me[] = "alanRun";
- int tid, hack = AIR_FALSE;
+ int hack = AIR_FALSE;
+ unsigned int tid;
alanTask task[ALAN_THREAD_MAX];
if (_alanCheck(actx)) {
Modified: teem/trunk/src/alan/methodsAlan.c
===================================================================
--- teem/trunk/src/alan/methodsAlan.c 2023-07-13 23:04:28 UTC (rev 7096)
+++ teem/trunk/src/alan/methodsAlan.c 2023-07-13 23:05:20 UTC (rev 7097)
@@ -208,6 +208,7 @@
alanParmSet(alanContext *actx, int whichParm, double parm) {
static const char me[] = "alanParmSet";
int parmI;
+ unsigned int parmUI;
GOT_NULL;
DIM_SET;
@@ -239,15 +240,15 @@
actx->textureType = parmI;
break;
case alanParmNumThreads:
- parmI = !!parm;
+ parmUI = AIR_UINT(parm);
if (!airThreadCapable) {
fprintf(stderr,
"%s: WARNING: no multi-threading available, so 1 thread "
- "will be used, not %d\n",
- me, parmI);
- parmI = 1;
+ "will be used, not %u\n",
+ me, parmUI);
+ parmUI = 1;
}
- actx->numThreads = parmI;
+ actx->numThreads = parmUI;
break;
case alanParmHomogAniso:
parmI = !!parm;
@@ -254,16 +255,16 @@
actx->homogAniso = parmI;
break;
case alanParmSaveInterval:
- parmI = !!parm;
- actx->saveInterval = parmI;
+ parmUI = AIR_UINT(parm);
+ actx->saveInterval = parmUI;
break;
case alanParmFrameInterval:
- parmI = !!parm;
- actx->frameInterval = parmI;
+ parmUI = AIR_UINT(parm);
+ actx->frameInterval = parmUI;
break;
case alanParmMaxIteration:
- parmI = !!parm;
- actx->maxIteration = parmI;
+ parmUI = AIR_UINT(parm);
+ actx->maxIteration = parmUI;
break;
case alanParmConstantFilename:
parmI = !!parm;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 23:04:30
|
Revision: 7096
http://sourceforge.net/p/teem/code/7096
Author: kindlmann
Date: 2023-07-13 23:04:28 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
make some more things unsigned that should always have been so
Modified Paths:
--------------
teem/trunk/src/hoover/hoover.h
teem/trunk/src/hoover/rays.c
Modified: teem/trunk/src/hoover/hoover.h
===================================================================
--- teem/trunk/src/hoover/hoover.h 2023-07-13 23:01:51 UTC (rev 7095)
+++ teem/trunk/src/hoover/hoover.h 2023-07-13 23:04:28 UTC (rev 7096)
@@ -116,8 +116,8 @@
void *user; /* passed to all callbacks */
/******** 5) stuff about multi-threading */
- unsigned int numThreads; /* number of threads to spawn per rendering */
- int workIdx; /* next work assignment (such as a scanline) */
+ unsigned int numThreads, /* number of threads to spawn per rendering */
+ workIdx; /* next work assignment (such as a scanline) */
airThreadMutex *workMutex; /* mutex around work assignment */
/*
Modified: teem/trunk/src/hoover/rays.c
===================================================================
--- teem/trunk/src/hoover/rays.c 2023-07-13 23:01:51 UTC (rev 7095)
+++ teem/trunk/src/hoover/rays.c 2023-07-13 23:04:28 UTC (rev 7096)
@@ -139,31 +139,31 @@
_hooverThreadBody(void *_arg) {
_hooverThreadArg *arg;
void *thread;
- int ret, /* to catch return values from callbacks */
- sampleI, /* which sample we're on */
- inside, /* we're inside the volume */
- vI, uI; /* integral coords in image */
- double tmp, mm, /* lowest position in index space, for all axes */
- Mx, My, Mz, /* highest position in index space on each axis */
- u, v, /* floating-point coords in image */
- uvScale, /* how to scale (u,v) to go from image to
- near plane, according to ortho or perspective */
- lx, ly, lz, /* half edge-lengths of volume */
- rayLen = 0, /* length of segment formed by ray line intersecting
- the near and far clipping planes */
- rayT, /* current position along ray (world-space) */
- rayDirW[3], /* unit-length ray direction (world-space) */
- rayDirI[3], /* rayDirW transformed into index space;
- not unit length, but a unit change in
- world space along rayDirW translates to
- this change in index space along rayDirI */
- rayPosW[3], /* current ray location (world-space) */
- rayPosI[3], /* current ray location (index-space) */
- rayStartW[3], /* ray start on near plane (world-space) */
- rayStartI[3], /* ray start on near plane (index-space) */
- rayStep, /* distance between samples (world-space) */
- vOff[3], uOff[3]; /* offsets in arg->ec->wU and arg->ec->wV
- directions towards start of ray */
+ int ret, /* to catch return values from callbacks */
+ inside; /* we're inside the volume */
+ unsigned int sampleI, /* which sample we're on */
+ vI, uI; /* integral coords in image */
+ double tmp, mm, /* lowest position in index space, for all axes */
+ Mx, My, Mz, /* highest position in index space on each axis */
+ u, v, /* floating-point coords in image */
+ uvScale, /* how to scale (u,v) to go from image to
+ near plane, according to ortho or perspective */
+ lx, ly, lz, /* half edge-lengths of volume */
+ rayLen = 0, /* length of segment formed by ray line intersecting
+ the near and far clipping planes */
+ rayT, /* current position along ray (world-space) */
+ rayDirW[3], /* unit-length ray direction (world-space) */
+ rayDirI[3], /* rayDirW transformed into index space;
+ not unit length, but a unit change in
+ world space along rayDirW translates to
+ this change in index space along rayDirI */
+ rayPosW[3], /* current ray location (world-space) */
+ rayPosI[3], /* current ray location (index-space) */
+ rayStartW[3], /* ray start on near plane (world-space) */
+ rayStartI[3], /* ray start on near plane (index-space) */
+ rayStep, /* distance between samples (world-space) */
+ vOff[3], uOff[3]; /* offsets in arg->ec->wU and arg->ec->wV
+ directions towards start of ray */
arg = (_hooverThreadArg *)_arg;
if ((ret = (arg->ctx->threadBegin)(&thread,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 23:01:55
|
Revision: 7095
http://sourceforge.net/p/teem/code/7095
Author: kindlmann
Date: 2023-07-13 23:01:51 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
updating hest usage
Modified Paths:
--------------
teem/trunk/src/unrrdu/aabplot.c
teem/trunk/src/unrrdu/acrop.c
teem/trunk/src/unrrdu/affine.c
teem/trunk/src/unrrdu/axdelete.c
teem/trunk/src/unrrdu/axinfo.c
teem/trunk/src/unrrdu/axinsert.c
teem/trunk/src/unrrdu/axmerge.c
teem/trunk/src/unrrdu/axsplit.c
teem/trunk/src/unrrdu/basinfo.c
teem/trunk/src/unrrdu/ccadj.c
teem/trunk/src/unrrdu/ccfind.c
teem/trunk/src/unrrdu/ccmerge.c
teem/trunk/src/unrrdu/cmedian.c
teem/trunk/src/unrrdu/convert.c
teem/trunk/src/unrrdu/crop.c
teem/trunk/src/unrrdu/dering.c
teem/trunk/src/unrrdu/dhisto.c
teem/trunk/src/unrrdu/dice.c
teem/trunk/src/unrrdu/diff.c
teem/trunk/src/unrrdu/dist.c
teem/trunk/src/unrrdu/fft.c
teem/trunk/src/unrrdu/gamma.c
teem/trunk/src/unrrdu/hack.c
teem/trunk/src/unrrdu/heq.c
teem/trunk/src/unrrdu/histax.c
teem/trunk/src/unrrdu/histo.c
teem/trunk/src/unrrdu/i2w.c
teem/trunk/src/unrrdu/ilk.c
teem/trunk/src/unrrdu/imap.c
teem/trunk/src/unrrdu/inset.c
teem/trunk/src/unrrdu/jhisto.c
teem/trunk/src/unrrdu/join.c
teem/trunk/src/unrrdu/lut.c
teem/trunk/src/unrrdu/lut2.c
teem/trunk/src/unrrdu/ninspect.c
Modified: teem/trunk/src/unrrdu/aabplot.c
===================================================================
--- teem/trunk/src/unrrdu/aabplot.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/aabplot.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -40,21 +40,18 @@
unsigned int plen;
double vrange[2], *single;
- hestOptAdd(&opt, "l", "len", airTypeUInt, 1, 1, &plen, "78",
- "number of characters in box plot");
- hestOptAdd(&opt, "r", "min max", airTypeDouble, 2, 2, vrange, "0 100",
- "values to use as absolute min and max (unfortunately "
- "has to be same for all scanlines (rows).");
- hestOptAdd(&opt, "rs", "show", airTypeBool, 1, 1, &rshow, "false",
- "show range above plots");
- hestOptAdd(&opt, "ms", "show", airTypeBool, 1, 1, &medshow, "false",
- "print the median value");
+ hestOptAdd_1_UInt(&opt, "l", "len", &plen, "78", "number of characters in box plot");
+ hestOptAdd_2_Double(&opt, "r", "min max", vrange, "0 100",
+ "values to use as absolute min and max (unfortunately "
+ "has to be same for all scanlines (rows).");
+ hestOptAdd_1_Bool(&opt, "rs", "show", &rshow, "false", "show range above plots");
+ hestOptAdd_1_Bool(&opt, "ms", "show", &medshow, "false", "print the median value");
OPT_ADD_NIN(_nin, "input nrrd");
- hestOptAdd(&opt, "s", "single", airTypeOther, 1, 1, &_nsingle, "",
- "if given a 1D nrrd here that matches the number of "
- "rows in the \"-i\" input, interpret it as a list of values "
- "that should be indicated with \"X\"s in the plots.",
- NULL, NULL, nrrdHestNrrd);
+ hestOptAdd_1_Other(&opt, "s", "single", &_nsingle, "",
+ "if given a 1D nrrd here that matches the number of "
+ "rows in the \"-i\" input, interpret it as a list of values "
+ "that should be indicated with \"X\"s in the plots.",
+ nrrdHestNrrd);
mop = airMopNew();
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
Modified: teem/trunk/src/unrrdu/acrop.c
===================================================================
--- teem/trunk/src/unrrdu/acrop.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/acrop.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -47,34 +47,34 @@
Nrrd *nbounds;
char *boundsSave;
- hestOptAdd(&opt, "a,axes", "ax0", airTypeUInt, 0, -1, &axes, "",
- "the axes (if any) that should NOT be cropped", &axesLen);
- hestOptAdd(&opt, "m,measure", "measr", airTypeEnum, 1, 1, &measr, NULL,
- "How to measure slices (along axes to crop) as scalars, "
- "to form 1-D array analyzed to determine cropping extent. "
- "All the measures from \"unu project\" can be used, but "
- "those that make more sense here include:\n "
- "\b\bo \"max\", \"mean\", \"median\", "
- "\"variance\": (self-explanatory)\n "
- "\b\bo \"stdv\": standard deviation\n "
- "\b\bo \"cov\": coefficient of variation\n "
- "\b\bo \"product\", \"sum\": product or sum of all values\n "
- "\b\bo \"L1\", \"L2\", \"NL2\", \"RMS\", \"Linf\": "
- "different norms.",
- NULL, nrrdMeasure);
- hestOptAdd(&opt, "f,frac", "frac", airTypeDouble, 1, 1, &frac, "0.1",
- "threshold of cumulative sum of 1-D array at which to crop. "
- "Needs to be in interval [0.0,0.5).");
- hestOptAdd(&opt, "off,offset", "offset", airTypeInt, 1, 1, &offset, "1",
- "how much to offset the numerically determined cropping; "
- "positive offsets means expanding the interval of kept "
- "indices (less cropping)");
- hestOptAdd(&opt, "b,bounds", "filename", airTypeString, 1, 1, &boundsSave, "",
- "if a filename is given here, the automatically determined "
- "min and max bounds for cropping are saved to this file "
- "as a 2-D array; first scanline is for -min, second is for -max. "
- "Unfortunately nothing using the \"m\" and \"M\" semantics "
- "(above) can currently be saved in the bounds file.");
+ hestOptAdd_Nv_UInt(&opt, "a,axes", "ax0", 0, -1, &axes, "",
+ "the axes (if any) that should NOT be cropped", &axesLen);
+ hestOptAdd_1_Enum(&opt, "m,measure", "measr", &measr, NULL,
+ "How to measure slices (along axes to crop) as scalars, "
+ "to form 1-D array analyzed to determine cropping extent. "
+ "All the measures from \"unu project\" can be used, but "
+ "those that make more sense here include:\n "
+ "\b\bo \"max\", \"mean\", \"median\", "
+ "\"variance\": (self-explanatory)\n "
+ "\b\bo \"stdv\": standard deviation\n "
+ "\b\bo \"cov\": coefficient of variation\n "
+ "\b\bo \"product\", \"sum\": product or sum of all values\n "
+ "\b\bo \"L1\", \"L2\", \"NL2\", \"RMS\", \"Linf\": "
+ "different norms.",
+ nrrdMeasure);
+ hestOptAdd_1_Double(&opt, "f,frac", "frac", &frac, "0.1",
+ "threshold of cumulative sum of 1-D array at which to crop. "
+ "Needs to be in interval [0.0,0.5).");
+ hestOptAdd_1_Int(&opt, "off,offset", "offset", &offset, "1",
+ "how much to offset the numerically determined cropping; "
+ "positive offsets means expanding the interval of kept "
+ "indices (less cropping)");
+ hestOptAdd_1_String(&opt, "b,bounds", "filename", &boundsSave, "",
+ "if a filename is given here, the automatically determined "
+ "min and max bounds for cropping are saved to this file "
+ "as a 2-D array; first scanline is for -min, second is for -max. "
+ "Unfortunately nothing using the \"m\" and \"M\" semantics "
+ "(above) can currently be saved in the bounds file.");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/affine.c
===================================================================
--- teem/trunk/src/unrrdu/affine.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/affine.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -43,24 +43,23 @@
airArray *mop;
unsigned int ai, nn;
- hestOptAdd(&opt, NULL, "minIn", airTypeOther, 1, 1, &minIn, NULL,
- "Lower end of input value range.", NULL, NULL, nrrdHestIter);
- hestOptAdd(&opt, NULL, "in", airTypeOther, 1, 1, &in, NULL, "Input value.", NULL, NULL,
- nrrdHestIter);
- hestOptAdd(&opt, NULL, "maxIn", airTypeOther, 1, 1, &maxIn, NULL,
- "Upper end of input value range.", NULL, NULL, nrrdHestIter);
- hestOptAdd(&opt, NULL, "minOut", airTypeOther, 1, 1, &minOut, NULL,
- "Lower end of output value range.", NULL, NULL, nrrdHestIter);
- hestOptAdd(&opt, NULL, "maxOut", airTypeOther, 1, 1, &maxOut, NULL,
- "Upper end of output value range.", NULL, NULL, nrrdHestIter);
- hestOptAdd(&opt, "t,type", "type", airTypeOther, 1, 1, &type, "default",
- "type to convert all nrrd inputs to, prior to "
- "doing operation. This also determines output type. "
- "By default (not using this option), the types of the input "
- "nrrds are left unchanged.",
- NULL, NULL, &unrrduHestMaybeTypeCB);
- hestOptAdd(&opt, "clamp", "bool", airTypeBool, 1, 1, &clamp, "false",
- "clamp output values to specified output range");
+ hestOptAdd_1_Other(&opt, NULL, "minIn", &minIn, NULL,
+ "Lower end of input value range.", nrrdHestIter);
+ hestOptAdd_1_Other(&opt, NULL, "in", &in, NULL, "Input value.", nrrdHestIter);
+ hestOptAdd_1_Other(&opt, NULL, "maxIn", &maxIn, NULL,
+ "Upper end of input value range.", nrrdHestIter);
+ hestOptAdd_1_Other(&opt, NULL, "minOut", &minOut, NULL,
+ "Lower end of output value range.", nrrdHestIter);
+ hestOptAdd_1_Other(&opt, NULL, "maxOut", &maxOut, NULL,
+ "Upper end of output value range.", nrrdHestIter);
+ hestOptAdd_1_Other(&opt, "t,type", "type", &type, "default",
+ "type to convert all nrrd inputs to, prior to "
+ "doing operation. This also determines output type. "
+ "By default (not using this option), the types of the input "
+ "nrrds are left unchanged.",
+ &unrrduHestMaybeTypeCB);
+ hestOptAdd_1_Bool(&opt, "clamp", "bool", &clamp, "false",
+ "clamp output values to specified output range");
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/axdelete.c
===================================================================
--- teem/trunk/src/unrrdu/axdelete.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/axdelete.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -27,9 +27,7 @@
= (INFO ". Singleton axes have only a single sample along them. "
"The underlying linear ordering of the samples is "
"unchanged, and the information about the other axes is "
- "shifted downwards as needed. As a total hack, if you give "
- "-1 as the axis, this will do a matlab-style \"squeeze\", in which "
- "any and all singleton axes are removed.\n "
+ "shifted downwards as needed.\n "
"* Uses nrrdAxesDelete");
static int
@@ -41,8 +39,12 @@
unsigned axis;
airArray *mop;
- hestOptAdd(&opt, "a,axis", "axis", airTypeInt, 1, 1, &_axis, NULL,
- "dimension (axis index) of the axis to remove");
+ /* really needs to be signed int, because of hack */
+ hestOptAdd_1_Int(&opt, "a,axis", "axis", &_axis, NULL,
+ "dimension (axis index) of the axis to remove. "
+ "As a total hack, if you give -1 as the axis, "
+ "this will do a matlab-style \"squeeze\", in which "
+ "any and all singleton axes are removed.");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/axinfo.c
===================================================================
--- teem/trunk/src/unrrdu/axinfo.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/axinfo.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -38,16 +38,15 @@
double mm[2], spc, sdir[NRRD_SPACE_DIM_MAX];
airArray *mop;
- hestOptAdd(&opt, "a,axes", "ax0", airTypeUInt, 1, -1, &axes, NULL,
- "the one or more axes that should be modified", &axesLen);
- hestOptAdd(&opt, "l,label", "label", airTypeString, 1, 1, &label, "",
- "label to associate with axis");
- hestOptAdd(&opt, "u,units", "units", airTypeString, 1, 1, &units, "",
- "units of measurement");
- mmIdx = hestOptAdd(&opt, "mm,minmax", "min max", airTypeString, 2, 2, mmStr, "nan nan",
- "min and max values along axis");
- spIdx = hestOptAdd(&opt, "sp,spacing", "spacing", airTypeDouble, 1, 1, &spc, "nan",
- "spacing between samples along axis");
+ hestOptAdd_Nv_UInt(&opt, "a,axes", "ax0", 1, -1, &axes, NULL,
+ "the one or more axes that should be modified", &axesLen);
+ hestOptAdd_1_String(&opt, "l,label", "label", &label, "",
+ "label to associate with axis");
+ hestOptAdd_1_String(&opt, "u,units", "units", &units, "", "units of measurement");
+ mmIdx = hestOptAdd_2_String(&opt, "mm,minmax", "min max", mmStr, "nan nan",
+ "min and max values along axis");
+ spIdx = hestOptAdd_1_Double(&opt, "sp,spacing", "spacing", &spc, "nan",
+ "spacing between samples along axis");
/* There used to be a complaint here about how hest doesn't allow
you to learn whether the option was parsed from the supplied
default versus from the command-line itself. That issue has been
@@ -56,19 +55,19 @@
parsing from a string here is still needed here, because here we
need to allow the string that represents "no centering"; this
is a current weakness of airEnumStr.
- hestOptAdd(&opt, "c,center", "center", airTypeEnum, 1, 1, ¢, "unknown",
- "centering of axis: \"cell\" or \"node\"",
- NULL, nrrdCenter);
+ hestOptAdd_1_Enum(&opt, "c,center", "center", ¢, "unknown",
+ "centering of axis: \"cell\" or \"node\"",
+ nrrdCenter);
*/
- hestOptAdd(&opt, "c,center", "center", airTypeString, 1, 1, ¢erStr, "",
- "axis centering: \"cell\" or \"node\". Not using this option "
- "leaves the centering as it is on input");
- hestOptAdd(&opt, "dir,direction", "svec", airTypeString, 1, 1, &_dirStr, "",
- "(NOTE: must quote vector) The \"space direction\": the vector "
- "in space spanned by incrementing (by one) the axis index.");
- hestOptAdd(&opt, "k,kind", "kind", airTypeString, 1, 1, &kindStr, "",
- "axis kind. Not using this option "
- "leaves the kind as it is on input");
+ hestOptAdd_1_String(&opt, "c,center", "center", ¢erStr, "",
+ "axis centering: \"cell\" or \"node\". Not using this option "
+ "leaves the centering as it is on input");
+ hestOptAdd_1_String(&opt, "dir,direction", "svec", &_dirStr, "",
+ "(NOTE: must quote vector) The \"space direction\": the vector "
+ "in space spanned by incrementing (by one) the axis index.");
+ hestOptAdd_1_String(&opt, "k,kind", "kind", &kindStr, "",
+ "axis kind. Not using this option "
+ "leaves the kind as it is on input");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/axinsert.c
===================================================================
--- teem/trunk/src/unrrdu/axinsert.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/axinsert.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -42,25 +42,25 @@
hparm->elideSingleOtherDefault = AIR_FALSE;
OPT_ADD_AXIS(axis, "dimension (axis index) at which to insert the new axis");
- hestOptAdd(&opt, "l,label", "label", airTypeString, 1, 1, &label, "",
- "label to associate with new axis");
- opi = hestOptAdd(&opt, "k,kind", "kind", airTypeEnum, 1, 1, &kind, "stub",
- "axis kind to associate with new axis", NULL, nrrdKind);
- hestOptAdd(&opt, "mm,minmax", "min max", airTypeDouble, 2, 2, mm, "nan nan",
- "min and max values along new axis");
- centOptIdx = hestOptAdd(&opt, "c,center", "center", airTypeEnum, 1, 1, ¢er, "cell",
- "centering of inserted axis: \"cell\" or \"node\"", NULL,
- nrrdCenter);
- hestOptAdd(&opt, "s,size", "size", airTypeUInt, 1, 1, &size, "1",
- "after inserting stub axis, also pad out to some length, "
- "according to the \"-b\" option");
- hestOptAdd(&opt, "b,boundary", "behavior", airTypeOther, 1, 1, &bspec, "bleed",
- "How to handle samples beyond the input bounds:\n "
- "\b\bo \"pad:<val>\": use specified value\n "
- "\b\bo \"bleed\": extend border values outward\n "
- "\b\bo \"mirror\": repeated reflections\n "
- "\b\bo \"wrap\": wrap-around to other side",
- NULL, NULL, nrrdHestBoundarySpec);
+ hestOptAdd_1_String(&opt, "l,label", "label", &label, "",
+ "label to associate with new axis");
+ opi = hestOptAdd_1_Enum(&opt, "k,kind", "kind", &kind, "stub",
+ "axis kind to associate with new axis", nrrdKind);
+ hestOptAdd_2_Double(&opt, "mm,minmax", "min max", mm, "nan nan",
+ "min and max values along new axis");
+ centOptIdx = hestOptAdd_1_Enum(&opt, "c,center", "center", ¢er, "cell",
+ "centering of inserted axis: \"cell\" or \"node\"",
+ nrrdCenter);
+ hestOptAdd_1_UInt(&opt, "s,size", "size", &size, "1",
+ "after inserting stub axis, also pad out to some length, "
+ "according to the \"-b\" option");
+ hestOptAdd_1_Other(&opt, "b,boundary", "behavior", &bspec, "bleed",
+ "How to handle samples beyond the input bounds:\n "
+ "\b\bo \"pad:<val>\": use specified value\n "
+ "\b\bo \"bleed\": extend border values outward\n "
+ "\b\bo \"mirror\": repeated reflections\n "
+ "\b\bo \"wrap\": wrap-around to other side",
+ nrrdHestBoundarySpec);
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/axmerge.c
===================================================================
--- teem/trunk/src/unrrdu/axmerge.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/axmerge.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -35,17 +35,17 @@
hestOpt *opt = NULL;
char *out, *err;
Nrrd *nin, *nout[2];
- int *axes, pret, ni;
- unsigned int ii, jj, axesLen;
+ int pret;
+ unsigned int ni, ii, jj, *axes, axesLen;
airArray *mop;
- hestOptAdd(&opt, "a,axis", "ax0", airTypeInt, 1, -1, &axes, NULL,
- "axis (or axes) to merge. Each axis index identified is the "
- "lower of the pair of axes that will be merged. Saying \"-a 2\" "
- "means to merge axis 2 and axis 3 into axis 2. If multiple "
- "merges are to be done, the indices listed here are for "
- "the axes prior to any merging.",
- &axesLen);
+ hestOptAdd_Nv_UInt(&opt, "a,axis", "ax0", 1, -1, &axes, NULL,
+ "axis (or axes) to merge. Each axis index identified is the "
+ "lower of the pair of axes that will be merged. Saying \"-a 2\" "
+ "means to merge axis 2 and axis 3 into axis 2. If multiple "
+ "merges are to be done, the indices listed here are for "
+ "the axes prior to any merging.",
+ &axesLen);
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
@@ -55,6 +55,7 @@
USAGE_OR_PARSE(_unrrdu_axmergeInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
+ /* make two nout buffers, will alternate between them */
airMopAdd(mop, nout[0] = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
airMopAdd(mop, nout[1] = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
Modified: teem/trunk/src/unrrdu/axsplit.c
===================================================================
--- teem/trunk/src/unrrdu/axsplit.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/axsplit.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -40,9 +40,9 @@
airArray *mop;
OPT_ADD_AXIS(axis, "dimension (axis index) to split at");
- hestOptAdd(&opt, "s,size", "fast, slow sizes", airTypeSize_t, 2, 2, size, NULL,
- "fast and slow axis sizes to produce as result of splitting "
- "given axis.");
+ hestOptAdd_2_Size_t(&opt, "s,size", "fast, slow sizes", size, NULL,
+ "fast and slow axis sizes to produce as result of splitting "
+ "given axis.");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/basinfo.c
===================================================================
--- teem/trunk/src/unrrdu/basinfo.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/basinfo.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -45,34 +45,36 @@
int space, nixkvp;
unsigned int spaceDim, kvpLen, dkeyLen, cIdx, ii;
- hestOptAdd(&opt, "spc,space", "space", airTypeString, 1, 1, &spcStr, "",
- "identify the space (e.g. \"RAS\", \"LPS\") in which the array "
- "conceptually lives, from the nrrdSpace airEnum, which in turn "
- "determines the dimension of the space. Or, use an integer>0 to "
- "give the dimension of a space that nrrdSpace doesn't know about. "
- "By default (not using this option), the enclosing space is "
- "set as unknown.");
- hestOptAdd(&opt, "orig,origin", "origin", airTypeString, 1, 1, &_origStr, "",
- "(NOTE: must quote vector) the origin in space of the array: "
- "the location of the center "
- "of the first sample, of the form \"(x,y,z)\" (or however "
- "many coefficients are needed for the chosen space). Quoting the "
- "vector is needed to stop interpretation from the shell");
+ /* no point in invoking this if no options are used, so even though every option has a
+ default, we refrain from setting hparm->noArgsIsNoProblem */
+ hestOptAdd_1_String(&opt, "spc,space", "space", &spcStr, "",
+ "identify the space (e.g. \"RAS\", \"LPS\") in which the array "
+ "conceptually lives, from the nrrdSpace airEnum, which in turn "
+ "determines the dimension of the space. Or, use an integer>0 to "
+ "give the dimension of a space that nrrdSpace doesn't know about. "
+ "By default (not using this option), the enclosing space is "
+ "set as unknown.");
+ hestOptAdd_1_String(&opt, "orig,origin", "origin", &_origStr, "",
+ "(NOTE: must quote vector) the origin in space of the array: "
+ "the location of the center "
+ "of the first sample, of the form \"(x,y,z)\" (or however "
+ "many coefficients are needed for the chosen space). Quoting the "
+ "vector is needed to stop interpretation from the shell");
/* HEY: copy and paste from unrrdu/make.c */
- hestOptAdd(&opt, "kv,keyvalue", "key/val", airTypeString, 1, -1, &kvp, "",
- "key/value string pairs to be stored in nrrd. Each key/value "
- "pair must be a single string (put it in \"\"s "
- "if the key or the value contain spaces). The format of each "
- "pair is \"<key>:=<value>\", with no spaces before or after "
- "\":=\".",
- &kvpLen);
- hestOptAdd(&opt, "dk,delkey", "key", airTypeString, 1, -1, &dkey, "",
- "keys to be deleted (erased) from key/value pairs", &dkeyLen);
- hestOptAdd(&opt, "xkv,nixkeyvalue", NULL, airTypeBool, 0, 0, &nixkvp, NULL,
- "nix (clear) all key/value pairs");
- cIdx = hestOptAdd(&opt, "c,content", "content", airTypeString, 1, 1, &content, "",
- "Specifies the content string of the nrrd, which is built upon "
- "by many nrrd function to record a history of operations");
+ hestOptAdd_Nv_String(&opt, "kv,keyvalue", "key/val", 1, -1, &kvp, "",
+ "key/value string pairs to be stored in nrrd. Each key/value "
+ "pair must be a single string (put it in \"\"s "
+ "if the key or the value contain spaces). The format of each "
+ "pair is \"<key>:=<value>\", with no spaces before or after "
+ "\":=\".",
+ &kvpLen);
+ hestOptAdd_Nv_String(&opt, "dk,delkey", "key", 1, -1, &dkey, "",
+ "keys to be deleted (erased) from key/value pairs", &dkeyLen);
+ hestOptAdd_Flag(&opt, "xkv,nixkeyvalue", &nixkvp, "nix (clear) all key/value pairs");
+ cIdx = hestOptAdd_1_String(
+ &opt, "c,content", "content", &content, "",
+ "Specifies the content string of the nrrd, which is built upon "
+ "by many nrrd function to record a history of operations");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/ccadj.c
===================================================================
--- teem/trunk/src/unrrdu/ccadj.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/ccadj.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -38,10 +38,10 @@
int pret;
unsigned int conny;
- hestOptAdd(&opt, "c,connect", "connectivity", airTypeUInt, 1, 1, &conny, NULL,
- "what kind of connectivity to use: the number of coordinates "
- "that vary in order to traverse the neighborhood of a given "
- "sample. In 2D: \"1\": 4-connected, \"2\": 8-connected");
+ hestOptAdd_1_UInt(&opt, "c,connect", "connectivity", &conny, NULL,
+ "what kind of connectivity to use: the number of coordinates "
+ "that vary in order to traverse the neighborhood of a given "
+ "sample. In 2D: \"1\": 4-connected, \"2\": 8-connected");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/ccfind.c
===================================================================
--- teem/trunk/src/unrrdu/ccfind.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/ccfind.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -37,22 +37,22 @@
int type, pret;
unsigned int conny;
- hestOptAdd(&opt, "v,values", "filename", airTypeString, 1, 1, &valS, "",
- "Giving a filename here allows you to save out the values "
- "associated with each connect component. This can be used "
- "later with \"ccmerge -d\". By default, no record of the "
- "original CC values is kept.");
- hestOptAdd(&opt, "t,type", "type", airTypeOther, 1, 1, &type, "default",
- "type to use for output, to store the CC ID values. By default "
- "(not using this option), the type used will be the smallest of "
- "uchar, ushort, or int, that can represent all the CC ID values. "
- "Using this option allows one to specify the integral type to "
- "be used.",
- NULL, NULL, &unrrduHestMaybeTypeCB);
- hestOptAdd(&opt, "c,connect", "connectivity", airTypeUInt, 1, 1, &conny, NULL,
- "what kind of connectivity to use: the number of coordinates "
- "that vary in order to traverse the neighborhood of a given "
- "sample. In 2D: \"1\": 4-connected, \"2\": 8-connected");
+ hestOptAdd_1_String(&opt, "v,values", "filename", &valS, "",
+ "Giving a filename here allows you to save out the values "
+ "associated with each connect component. This can be used "
+ "later with \"ccmerge -d\". By default, no record of the "
+ "original CC values is kept.");
+ hestOptAdd_1_Other(&opt, "t,type", "type", &type, "default",
+ "type to use for output, to store the CC ID values. By default "
+ "(not using this option), the type used will be the smallest of "
+ "uchar, ushort, or int, that can represent all the CC ID values. "
+ "Using this option allows one to specify the integral type to "
+ "be used.",
+ &unrrduHestMaybeTypeCB);
+ hestOptAdd_1_UInt(&opt, "c,connect", "connectivity", &conny, NULL,
+ "what kind of connectivity to use: the number of coordinates "
+ "that vary in order to traverse the neighborhood of a given "
+ "sample. In 2D: \"1\": 4-connected, \"2\": 8-connected");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/ccmerge.c
===================================================================
--- teem/trunk/src/unrrdu/ccmerge.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/ccmerge.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -40,36 +40,36 @@
int pret, maxSize, dir, maxNeigh, revalue;
unsigned int conny;
- hestOptAdd(&opt, "d,directed", "dir", airTypeInt, 1, 1, &dir, "0",
- "do value-driven merging. Using (positive) \"1\" says that "
- "dark islands get merged with bright surrounds, while \"-1\" "
- "says the opposite. By default, merging can go either way. ");
- hestOptAdd(&opt, "s,size", "max size", airTypeInt, 1, 1, &maxSize, "0",
- "a cap on the CC size that will be absorbed into its "
- "surround. CCs larger than this are deemed too significant "
- "to mess with. Or, use \"0\" to remove any such restriction "
- "on merging.");
- hestOptAdd(&opt, "n,neighbor", "max # neigh", airTypeInt, 1, 1, &maxNeigh, "1",
- "a cap on the number of neighbors that a CC may have if it is "
- "to be be merged. \"1\" allows only islands to be merged, "
- "\"2\" does merging with bigger of two neighbors, etc, while "
- "\"0\" says that number of neighbors is no constraint");
- hestOptAdd(&opt, "c,connect", "connectivity", airTypeUInt, 1, 1, &conny, NULL,
- "what kind of connectivity to use: the number of coordinates "
- "that vary in order to traverse the neighborhood of a given "
- "sample. In 2D: \"1\": 4-connected, \"2\": 8-connected");
- hestOptAdd(&opt, "revalue", NULL, airTypeInt, 0, 0, &revalue, NULL,
- "If this option is given, then after the merging, the CCs "
- "are re-assigned their original datavalues, as given by "
- "the \"-v\" option");
+ hestOptAdd_1_Int(&opt, "d,directed", "dir", &dir, "0",
+ "do value-driven merging. Using (positive) \"1\" says that "
+ "dark islands get merged with bright surrounds, while \"-1\" "
+ "says the opposite. By default, merging can go either way. ");
+ hestOptAdd_1_Int(&opt, "s,size", "max size", &maxSize, "0",
+ "a cap on the CC size that will be absorbed into its "
+ "surround. CCs larger than this are deemed too significant "
+ "to mess with. Or, use \"0\" to remove any such restriction "
+ "on merging.");
+ hestOptAdd_1_Int(&opt, "n,neighbor", "max # neigh", &maxNeigh, "1",
+ "a cap on the number of neighbors that a CC may have if it is "
+ "to be be merged. \"1\" allows only islands to be merged, "
+ "\"2\" does merging with bigger of two neighbors, etc, while "
+ "\"0\" says that number of neighbors is no constraint");
+ hestOptAdd_1_UInt(&opt, "c,connect", "connectivity", &conny, NULL,
+ "what kind of connectivity to use: the number of coordinates "
+ "that vary in order to traverse the neighborhood of a given "
+ "sample. In 2D: \"1\": 4-connected, \"2\": 8-connected");
+ hestOptAdd_Flag(&opt, "revalue", &revalue,
+ "If this option is given, then after the merging, the CCs "
+ "are re-assigned their original datavalues, as given by "
+ "the \"-v\" option");
OPT_ADD_NIN(nin, "input nrrd");
- hestOptAdd(&opt, "v,values", "values", airTypeOther, 1, 1, &nval, "",
- "result of using \"ccfind -v\", the record of which values "
- "were originally associated with each CC. This is required "
- "for value-directed merging (with non-zero \"-d\" option), "
- "or if the \"-revalue\" option is given, "
- "but is not needed otherwise",
- NULL, NULL, nrrdHestNrrd);
+ hestOptAdd_1_Other(&opt, "v,values", "values", &nval, "",
+ "result of using \"ccfind -v\", the record of which values "
+ "were originally associated with each CC. This is required "
+ "for value-directed merging (with non-zero \"-d\" option), "
+ "or if the \"-revalue\" option is given, "
+ "but is not needed otherwise",
+ nrrdHestNrrd);
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/cmedian.c
===================================================================
--- teem/trunk/src/unrrdu/cmedian.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/cmedian.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -46,36 +46,36 @@
airArray *mop;
float wght;
- hestOptAdd(&opt, "r,radius", "radius", airTypeUInt, 1, 1, &radius, NULL,
- "how big a window to filter over. \"-r 1\" leads to a "
- "3x3 window in an image, and a 3x3x3 window in a volume");
- hestOptAdd(&opt, "mode", NULL, airTypeInt, 0, 0, &mode, NULL,
- "By default, median filtering is done. Using this option "
- "enables mode filtering, in which the most common value is "
- "used as output");
- hestOptAdd(&opt, "b,bins", "num", airTypeUInt, 1, 1, &bins, "256",
- "# of bins in histogram. It is in your interest to minimize "
- "this number, since big histograms mean slower execution "
- "times. 8-bit data needs at most 256 bins.");
- hestOptAdd(&opt, "w,weight", "weight", airTypeFloat, 1, 1, &wght, "1.0",
- "How much higher to preferentially weight samples that are "
- "closer to the center of the window. \"1.0\" weight means that "
- "all samples are uniformly weighted over the window, which "
- "facilitates a simple speed-up. ");
+ hestOptAdd_1_UInt(&opt, "r,radius", "radius", &radius, NULL,
+ "how big a window to filter over. \"-r 1\" leads to a "
+ "3x3 window in an image, and a 3x3x3 window in a volume");
+ hestOptAdd_Flag(&opt, "mode", &mode,
+ "By default, median filtering is done. Using this option "
+ "enables mode filtering, in which the most common value is "
+ "used as output");
+ hestOptAdd_1_UInt(&opt, "b,bins", "num", &bins, "256",
+ "# of bins in histogram. It is in your interest to minimize "
+ "this number, since big histograms mean slower execution "
+ "times. 8-bit data needs at most 256 bins.");
+ hestOptAdd_1_Float(&opt, "w,weight", "weight", &wght, "1.0",
+ "How much higher to preferentially weight samples that are "
+ "closer to the center of the window. \"1.0\" weight means that "
+ "all samples are uniformly weighted over the window, which "
+ "facilitates a simple speed-up. ");
/* FYI: these are weights which are just high enough to preserve
an island of N contiguous high pixels in a row:
1: 7.695
2: 6.160
3: 4.829 (actually only the middle pixel remains */
- hestOptAdd(&opt, "p,pad", NULL, airTypeInt, 0, 0, &pad, NULL,
- "Pad the input (with boundary method \"bleed\"), "
- "and crop the output, so as to "
- "overcome our cheapness and correctly "
- "handle the border. Obviously, this takes more memory.");
- hestOptAdd(&opt, "c,channel", NULL, airTypeInt, 0, 0, &chan, NULL,
- "Slice the input along axis 0, run filtering on all slices, "
- "and join the results back together. This is the way you'd "
- "want to process color (multi-channel) images or volumes.");
+ hestOptAdd_Flag(&opt, "p,pad", &pad,
+ "Pad the input (with boundary method \"bleed\"), "
+ "and crop the output, so as to "
+ "overcome our cheapness and correctly "
+ "handle the border. Obviously, this takes more memory.");
+ hestOptAdd_Flag(&opt, "c,channel", &chan,
+ "Slice the input along axis 0, run filtering on all slices, "
+ "and join the results back together. This is the way you'd "
+ "want to process color (multi-channel) images or volumes.");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/convert.c
===================================================================
--- teem/trunk/src/unrrdu/convert.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/convert.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -44,9 +44,9 @@
OPT_ADD_TYPE(type, "type to convert to", NULL);
OPT_ADD_NIN(nin, "input nrrd");
- hestOptAdd(&opt, "clamp", NULL, airTypeInt, 0, 0, &doClamp, NULL,
- "clamp input values to representable range of values of "
- "output type, to avoid wrap-around problems");
+ hestOptAdd_Flag(&opt, "clamp", &doClamp,
+ "clamp input values to representable range of values of "
+ "output type, to avoid wrap-around problems");
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/crop.c
===================================================================
--- teem/trunk/src/unrrdu/crop.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/crop.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -38,6 +38,10 @@
airArray *mop;
Nrrd *_nbounds;
+ /* one might think this is a candidate for hparm->noArgsIsNoProblem, but really
+ the "-b" option is an alternative to -min,-max: it is not the case that neither
+ one can be used. It is a weakness of hest that we can't say: "either -b, or,
+ both -min and -max, must be set" */
OPT_ADD_BOUND("min,minimum", 0, minOff, "0",
"low corner of bounding box.\n "
"\b\bo <int> gives 0-based index\n "
Modified: teem/trunk/src/unrrdu/dering.c
===================================================================
--- teem/trunk/src/unrrdu/dering.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/dering.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -44,39 +44,38 @@
/* HEY is this needed? (to display -rk and -tk kernels) */
hparm->elideSingleOtherDefault = AIR_FALSE;
- hestOptAdd(&opt, "c,center", "x y", airTypeDouble, 2, 2, center, NULL,
- "center of rings, in index space of fastest two axes");
- hestOptAdd(&opt, "v,verbose", "v", airTypeInt, 1, 1, &verbose, "0", "verbosity level");
- hestOptAdd(&opt, "li,linterp", "bool", airTypeBool, 1, 1, &linterp, "false",
- "whether to use linear interpolation during polar transform");
- hestOptAdd(&opt, "vs,vertseam", "bool", airTypeBool, 1, 1, &vertSeam, "false",
- "whether to dering left and right sides separately "
- "(requires an even value for -tn thetanum)");
- hestOptAdd(&opt, "tn,thetanum", "# smpls", airTypeUInt, 1, 1, &thetaNum, "20",
- "# of theta samples");
- hestOptAdd(&opt, "rs,radscale", "scale", airTypeDouble, 1, 1, &radScale, "1.0",
- "scaling on radius in polar transform");
- hestOptAdd(&opt, "rk,radiuskernel", "kern", airTypeOther, 1, 1, &rkspec, "gauss:3,4",
- "kernel for high-pass filtering along radial direction", NULL, NULL,
- nrrdHestKernelSpec);
- hestOptAdd(&opt, "tk,thetakernel", "kern", airTypeOther, 1, 1, &tkspec, "box",
- "kernel for blurring along theta direction.", NULL, NULL,
- nrrdHestKernelSpec);
- hestOptAdd(&opt, "cp,clampperc", "lo hi", airTypeDouble, 2, 2, clampPerc, "0.0 0.0",
- "when clamping values as part of ring estimation, the "
- "clamping range is set to exclude this percent of values "
- "from the low and high end of the data range");
- hestOptAdd(&opt, "m,mask", "mask", airTypeOther, 1, 1, &nmask, "",
- "optional: after deringing, output undergoes a lerp, "
- "parameterized by this array, from the background value "
- "(via \"-b\") where mask=0 to the original deringing "
- "output where mask=1. This lerp is effectively the same "
- "as a \"unu 3op lerp\", so this should either be match the "
- "input in size, or match its slices along the slowest axis.",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "b,back", "val", airTypeDouble, 1, 1, &backval, "0.0",
- "when using a mask (\"-m\"), the background value to "
- "lerp with.");
+ hestOptAdd_2_Double(&opt, "c,center", "x y", center, NULL,
+ "center of rings, in index space of fastest two axes");
+ hestOptAdd_1_Int(&opt, "v,verbose", "v", &verbose, "0", "verbosity level");
+ hestOptAdd_1_Bool(&opt, "li,linterp", "bool", &linterp, "false",
+ "whether to use linear interpolation during polar transform");
+ hestOptAdd_1_Bool(&opt, "vs,vertseam", "bool", &vertSeam, "false",
+ "whether to dering left and right sides separately "
+ "(requires an even value for -tn thetanum)");
+ hestOptAdd_1_UInt(&opt, "tn,thetanum", "# smpls", &thetaNum, "20",
+ "# of theta samples");
+ hestOptAdd_1_Double(&opt, "rs,radscale", "scale", &radScale, "1.0",
+ "scaling on radius in polar transform");
+ hestOptAdd_1_Other(&opt, "rk,radiuskernel", "kern", &rkspec, "gauss:3,4",
+ "kernel for high-pass filtering along radial direction",
+ nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&opt, "tk,thetakernel", "kern", &tkspec, "box",
+ "kernel for blurring along theta direction.", nrrdHestKernelSpec);
+ hestOptAdd_2_Double(&opt, "cp,clampperc", "lo hi", clampPerc, "0.0 0.0",
+ "when clamping values as part of ring estimation, the "
+ "clamping range is set to exclude this percent of values "
+ "from the low and high end of the data range");
+ hestOptAdd_1_Other(&opt, "m,mask", "mask", &nmask, "",
+ "optional: after deringing, output undergoes a lerp, "
+ "parameterized by this array, from the background value "
+ "(via \"-b\") where mask=0 to the original deringing "
+ "output where mask=1. This lerp is effectively the same "
+ "as a \"unu 3op lerp\", so this should either be match the "
+ "input in size, or match its slices along the slowest axis.",
+ nrrdHestNrrd);
+ hestOptAdd_1_Double(&opt, "b,back", "val", &backval, "0.0",
+ "when using a mask (\"-m\"), the background value to "
+ "lerp with.");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/dhisto.c
===================================================================
--- teem/trunk/src/unrrdu/dhisto.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/dhisto.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -38,20 +38,19 @@
airArray *mop;
double max;
- hestOptAdd(&opt, "h,height", "height", airTypeUInt, 1, 1, &size, NULL,
- "height of output image (horizontal size is determined by "
- "number of bins in input histogram).");
- hestOptAdd(&opt, "nolog", NULL, airTypeInt, 0, 0, &nolog, NULL,
- "do not show the log-scaled histogram with decade tick-marks");
- hestOptAdd(&opt, "notick", NULL, airTypeInt, 0, 0, ¬ick, NULL,
- "do not draw the log decade tick marks");
- hestOptAdd(&opt, "max,maximum", "max # hits", airTypeDouble, 1, 1, &max, "nan",
- "constrain the top of the drawn histogram to be at this "
- "number of hits. This will either scale the drawn histogram "
- "downward or clip its top, depending on whether the given max "
- "is higher or lower than the actual maximum bin count. By "
- "not using this option (the default), the actual maximum bin "
- "count is used");
+ hestOptAdd_1_UInt(&opt, "h,height", "height", &size, NULL,
+ "height of output image (horizontal size is determined by "
+ "number of bins in input histogram).");
+ hestOptAdd_Flag(&opt, "nolog", &nolog,
+ "do not show the log-scaled histogram with decade tick-marks");
+ hestOptAdd_Flag(&opt, "notick", ¬ick, "do not draw the log decade tick marks");
+ hestOptAdd_1_Double(&opt, "max,maximum", "max # hits", &max, "nan",
+ "constrain the top of the drawn histogram to be at this "
+ "number of hits. This will either scale the drawn histogram "
+ "downward or clip its top, depending on whether the given max "
+ "is higher or lower than the actual maximum bin count. By "
+ "not using this option (the default), the actual maximum bin "
+ "count is used");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/dice.c
===================================================================
--- teem/trunk/src/unrrdu/dice.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/dice.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -42,26 +42,26 @@
OPT_ADD_AXIS(axis, "axis to slice along");
OPT_ADD_NIN(nin, "input nrrd");
- hestOptAdd(&opt, "s,start", "start", airTypeUInt, 1, 1, &start, "0",
- "integer value to start numbering with");
- hestOptAdd(&opt, "ff,format", "form", airTypeString, 1, 1, &ftmpl, "",
- "a printf-style format to use for generating all "
- "filenames. Use this to override the number of characters "
- "used to represent the slice position, or the file format "
- "of the output, e.g. \"-ff %03d.ppm\" for 000.ppm, "
- "001.ppm, etc. By default (not using this option), slices "
- "are saved in NRRD format (or PNM or PNG where possible) "
- "with shortest possible filenames.");
+ hestOptAdd_1_UInt(&opt, "s,start", "start", &start, "0",
+ "integer value to start numbering with");
+ hestOptAdd_1_String(&opt, "ff,format", "form", &ftmpl, "",
+ "a printf-style format to use for generating all "
+ "filenames. Use this to override the number of characters "
+ "used to represent the slice position, or the file format "
+ "of the output, e.g. \"-ff %03d.ppm\" for 000.ppm, "
+ "001.ppm, etc. By default (not using this option), slices "
+ "are saved in NRRD format (or PNM or PNG where possible) "
+ "with shortest possible filenames.");
/* the fact that we're using unsigned int instead of size_t is
its own kind of sanity check */
- hestOptAdd(&opt, "l,limit", "max#", airTypeUInt, 1, 1, &sanity, "9999",
- "a sanity check on how many slice files should be saved "
- "out, to prevent accidentally dicing the wrong axis "
- "or the wrong array. Can raise this value if needed.");
- hestOptAdd(&opt, "o,output", "prefix", airTypeString, 1, 1, &base, NULL,
- "output filename prefix (excluding info set via \"-ff\"), "
- "basically to set path of output files (so be sure to end "
- "with \"/\".");
+ hestOptAdd_1_UInt(&opt, "l,limit", "max#", &sanity, "9999",
+ "a sanity check on how many slice files should be saved "
+ "out, to prevent accidentally dicing the wrong axis "
+ "or the wrong array. Can raise this value if needed.");
+ hestOptAdd_1_String(&opt, "o,output", "prefix", &base, NULL,
+ "output filename prefix (excluding info set via \"-ff\"), "
+ "basically to set path of output files (so be sure to end "
+ "with \"/\".");
mop = airMopNew();
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
Modified: teem/trunk/src/unrrdu/diff.c
===================================================================
--- teem/trunk/src/unrrdu/diff.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/diff.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -42,21 +42,20 @@
char explain[AIR_STRLEN_LARGE + 1];
mop = airMopNew();
- hestOptAdd(&opt, NULL, "ninA", airTypeOther, 1, 1, &ninA, NULL, "First input nrrd.",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, NULL, "ninB", airTypeOther, 1, 1, &ninB, NULL, "Second input nrrd.",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "eps,epsilon", "eps", airTypeDouble, 1, 1, &epsilon, "0.0",
- "threshold for allowable difference in values in "
- "data values");
- hestOptAdd(&opt, "q,quiet", NULL, airTypeInt, 0, 0, &quiet, NULL,
- "be quiet (like regular diff), so that nothing is printed "
- "if the nrrds are the same");
- hestOptAdd(&opt, "x,exit", NULL, airTypeInt, 0, 0, &exitstat, NULL,
- "use the exit status (like regular diff) to indicate if "
- "there was a significant difference (as if it's an error)");
- hestOptAdd(&opt, "od,onlydata", NULL, airTypeInt, 0, 0, &onlyData, NULL,
- "Compare data values only, excluding array meta-data");
+ hestOptAdd_1_Other(&opt, NULL, "ninA", &ninA, NULL, "First input nrrd.", nrrdHestNrrd);
+ hestOptAdd_1_Other(&opt, NULL, "ninB", &ninB, NULL, "Second input nrrd.",
+ nrrdHestNrrd);
+ hestOptAdd_1_Double(&opt, "eps,epsilon", "eps", &epsilon, "0.0",
+ "threshold for allowable difference in values in "
+ "data values");
+ hestOptAdd_Flag(&opt, "q,quiet", &quiet,
+ "be quiet (like regular diff), so that nothing is printed "
+ "if the nrrds are the same");
+ hestOptAdd_Flag(&opt, "x,exit", &exitstat,
+ "use the exit status (like regular diff) to indicate if "
+ "there was a significant difference (as if it's an error)");
+ hestOptAdd_Flag(&opt, "od,onlydata", &onlyData,
+ "Compare data values only, excluding array meta-data");
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
USAGE_OR_PARSE(_unrrdu_diffInfoL);
Modified: teem/trunk/src/unrrdu/dist.c
===================================================================
--- teem/trunk/src/unrrdu/dist.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/dist.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -44,20 +44,20 @@
double thresh, bias;
airArray *mop;
- hestOptAdd(&opt, "th,thresh", "val", airTypeDouble, 1, 1, &thresh, NULL,
- "threshold value to separate inside from outside");
- hestOptAdd(&opt, "b,bias", "val", airTypeDouble, 1, 1, &bias, "0.0",
- "if non-zero, bias the distance transform by this amount "
- "times the difference in value from the threshold");
- hestOptAdd(&opt, "t,type", "type", airTypeEnum, 1, 1, &typeOut, "float",
- "type to save output in", NULL, nrrdType);
- hestOptAdd(&opt, "sgn", NULL, airTypeInt, 0, 0, &sign, NULL,
- "also compute signed (negative) distances inside objects, "
- "instead of leaving them as zero");
- hestOptAdd(&opt, "inv", NULL, airTypeInt, 0, 0, &invert, NULL,
- "values *below* threshold are considered interior to object. "
- "By default (not using this option), values above threshold "
- "are considered interior. ");
+ hestOptAdd_1_Double(&opt, "th,thresh", "val", &thresh, NULL,
+ "threshold value to separate inside from outside");
+ hestOptAdd_1_Double(&opt, "b,bias", "val", &bias, "0.0",
+ "if non-zero, bias the distance transform by this amount "
+ "times the difference in value from the threshold");
+ hestOptAdd_1_Enum(&opt, "t,type", "type", &typeOut, "float", "type to save output in",
+ nrrdType);
+ hestOptAdd_Flag(&opt, "sgn", &sign,
+ "also compute signed (negative) distances inside objects, "
+ "instead of leaving them as zero");
+ hestOptAdd_Flag(&opt, "inv", &invert,
+ "values *below* threshold are considered interior to object. "
+ "By default (not using this option), values above threshold "
+ "are considered interior. ");
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/fft.c
===================================================================
--- teem/trunk/src/unrrdu/fft.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/fft.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -79,34 +79,34 @@
FILE *fwise;
unsigned int *axes, axesLen;
- hestOptAdd(&opt, NULL, "dir", airTypeEnum, 1, 1, &sign, NULL,
- "forward (\"forw\", \"f\") or backward/inverse "
- "(\"back\", \"b\") transform ",
- NULL, direction_enm);
- hestOptAdd(&opt, "a,axes", "ax0", airTypeUInt, 1, -1, &axes, NULL,
- "the one or more axes that should be transformed", &axesLen);
- hestOptAdd(&opt, "pr,planrigor", "pr", airTypeEnum, 1, 1, &rigor, "est",
- "rigor with which fftw plan is constructed. Options include:\n "
- "\b\bo \"e\", \"est\", \"estimate\": only an estimate\n "
- "\b\bo \"m\", \"meas\", \"measure\": standard amount of "
- "measurements of system properties\n "
- "\b\bo \"p\", \"pat\", \"patient\": slower, more measurements\n "
- "\b\bo \"x\", \"ex\", \"exhaustive\": slowest, most measurements",
- NULL, nrrdFFTWPlanRigor);
- hestOptAdd(&opt, "r,rescale", "bool", airTypeBool, 1, 1, &rescale, "true",
- "scale fftw output (by sqrt(1/N)) so that forward and backward "
- "transforms will get back to original values");
- hestOptAdd(&opt, "w,wisdom", "filename", airTypeString, 1, 1, &wispath, "",
- "A filename here is used to read in fftw wisdom (if the file "
- "exists already), and is used to save out updated wisdom "
- "after the transform. By default (not using this option), "
- "no wisdom is read or saved. Note: no wisdom is gained "
- "(that is, learned by FFTW) with planning rigor \"estimate\".");
+ hestOptAdd_1_Enum(&opt, NULL, "dir", &sign, NULL,
+ "forward (\"forw\", \"f\") or backward/inverse "
+ "(\"back\", \"b\") transform ",
+ direction_enm);
+ hestOptAdd_Nv_UInt(&opt, "a,axes", "ax0", 1, -1, &axes, NULL,
+ "the one or more axes that should be transformed", &axesLen);
+ hestOptAdd_1_Enum(&opt, "pr,planrigor", "pr", &rigor, "est",
+ "rigor with which fftw plan is constructed. Options include:\n "
+ "\b\bo \"e\", \"est\", \"estimate\": only an estimate\n "
+ "\b\bo \"m\", \"meas\", \"measure\": standard amount of "
+ "measurements of system properties\n "
+ "\b\bo \"p\", \"pat\", \"patient\": slower, more measurements\n "
+ "\b\bo \"x\", \"ex\", \"exhaustive\": slowest, most measurements",
+ nrrdFFTWPlanRigor);
+ hestOptAdd_1_Bool(&opt, "r,rescale", "bool", &rescale, "true",
+ "scale fftw output (by sqrt(1/N)) so that forward and backward "
+ "transforms will get back to original values");
+ hestOptAdd_1_String(&opt, "w,wisdom", "filename", &wispath, "",
+ "A filename here is used to read in fftw wisdom (if the file "
+ "exists already), and is used to save out updated wisdom "
+ "after the transform. By default (not using this option), "
+ "no wisdom is read or saved. Note: no wisdom is gained "
+ "(that is, learned by FFTW) with planning rigor \"estimate\".");
OPT_ADD_NIN(_nin, "input nrrd");
- hestOptAdd(&opt, "ri,realinput", NULL, airTypeInt, 0, 0, &realInput, NULL,
- "input is real-valued, so insert new length-2 axis 0 "
- "and set complex component to 0.0. Axes to transform "
- "(indicated by \"-a\") will be incremented accordingly.");
+ hestOptAdd_Flag(&opt, "ri,realinput", &realInput,
+ "input is real-valued, so insert new length-2 axis 0 "
+ "and set complex component to 0.0. Axes to transform "
+ "(indicated by \"-a\") will be incremented accordingly.");
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/gamma.c
===================================================================
--- teem/trunk/src/unrrdu/gamma.c 2023-07-13 22:59:01 UTC (rev 7094)
+++ teem/trunk/src/unrrdu/gamma.c 2023-07-13 23:01:51 UTC (rev 7095)
@@ -41,21 +41,21 @@
int pret, blind8BitRange, srgb, forward, E;
NrrdRange *range;
- hestOptAdd(&opt, "g,gamma", "gamma", airTypeString, 1, 1, &GammaS, NULL,
- "gamma > 1.0 brightens; gamma < 1.0 darkens. "
- "Negative gammas invert values (like in xv). "
- "Or, can used \"srgb\" for ~2.2 gamma of sRGB encoding, or "
- "\"1/srgb\" for ~0.455 gamma of inverse sRGB encoding");
- hestOptAdd(&opt, "min,minimum", "value", airTypeDouble, 1, 1, &min, "nan",
- "Value to implicitly map to 0.0 prior to calling pow(). "
- "Defaults to lowest value found in input nrrd.");
- hestOptAdd(&opt, "max,maximum", "value", airTypeDouble, 1, 1, &max, "nan",
- "Value to implicitly map to 1.0 prior to calling pow(). "
- "Defaults to highest value found in input nrrd.");
- hestOptAdd(&opt, "blind8", "bool", airTypeBool, 1, 1, &blind8BitRange,
- nrrdStateBlind8BitRange ? "true" : "false",
- "Whether to know the range of 8-bit data blindly "
- "(uchar is always [0,255], signed char is [-128,127]).");
+ hestOptAdd_1_String(&opt, "g,gamma", "gamma", &GammaS, NULL,
+ "gamma > 1.0 brightens; gamma < 1.0 darkens. "
+ "Negative gammas invert values (like in xv). "
+ "Or, can used \"srgb\" for ~2.2 gamma of sRGB encoding, or "
+ "\"1/srgb\" for ~0.455 gamma of inverse sRGB encoding");
+ hestOptAdd_1_Double(&opt, "min,minimum", "value", &min, "nan",
+ "Value to implicitly map to 0.0 prior to calling pow(). "
+ "Defaults to lowest value found in input nrrd.");
+ hestOptAdd_1_Double(&opt, "max,maximum", "value", &max, "nan",
+ "Value to implicitly map to 1.0 prior to calling pow(). "
+ "Defaults to highest value found in input nrrd.");
+ hestOpt...
[truncated message content] |
|
From: <kin...@us...> - 2023-07-13 22:59:03
|
Revision: 7094
http://sourceforge.net/p/teem/code/7094
Author: kindlmann
Date: 2023-07-13 22:59:01 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
make USAGE macro play better with hestParm->noArgsIsNoProblem
Modified Paths:
--------------
teem/trunk/src/unrrdu/privateUnrrdu.h
Modified: teem/trunk/src/unrrdu/privateUnrrdu.h
===================================================================
--- teem/trunk/src/unrrdu/privateUnrrdu.h 2023-07-13 22:46:18 UTC (rev 7093)
+++ teem/trunk/src/unrrdu/privateUnrrdu.h 2023-07-13 22:59:01 UTC (rev 7094)
@@ -225,7 +225,7 @@
** don't use this macro) had already been this way.
*/
#define USAGE(INFO) \
- if (!argc) { \
+ if (!argc && !hparm->noArgsIsNoProblem) { \
hestInfo(stdout, me, (INFO), hparm); \
hestUsage(stdout, opt, me, hparm); \
hestGlossary(stdout, opt, hparm); \
@@ -267,7 +267,11 @@
/* Its gotten too annoying to always get this glossary; */ \
/* unu <cmd> --help will print it. */ \
/* hestGlossary(stderr, opt, hparm); */ \
- fprintf(stderr, "\nFor more info: \"%s\" or \"%s ... --help\"\n", me, me); \
+ if (hparm && hparm->noArgsIsNoProblem) { \
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me); \
+ } else { \
+ fprintf(stderr, "\nFor more info: \"%s\" or \"%s --help\"\n", me, me); \
+ } \
} \
airMopError(mop); \
return 1; \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 22:46:28
|
Revision: 7093
http://sourceforge.net/p/teem/code/7093
Author: kindlmann
Date: 2023-07-13 22:46:18 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
updating hest usage, and exploting hparm->noArgsIsNoProblem and either isatty(STDIN_FILENO) or nrrdHestNrrdNoTTY to gracefully handle being invoked with no args, while not being piped to
Modified Paths:
--------------
teem/trunk/src/unrrdu/block.c
teem/trunk/src/unrrdu/ccsettle.c
teem/trunk/src/unrrdu/cksum.c
teem/trunk/src/unrrdu/dnorm.c
teem/trunk/src/unrrdu/grid.c
teem/trunk/src/unrrdu/head.c
teem/trunk/src/unrrdu/minmax.c
teem/trunk/src/unrrdu/unorient.c
teem/trunk/src/unrrdu/unquantize.c
Modified: teem/trunk/src/unrrdu/block.c
===================================================================
--- teem/trunk/src/unrrdu/block.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/block.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -42,11 +42,9 @@
airArray *mop;
int pret;
- /* if we gave a default for this, then there it would fine to have
- no command-line arguments whatsoever, and then the user would not
- know how to get the basic usage information */
- hestOptAdd(&opt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input nrrd", NULL, NULL,
- nrrdHestNrrd);
+ /* nrrdHestNrrdNoTTY simplifies this, just like unquantize and unorient */
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_Other(&opt, "i", "nin", &nin, "-", "input nrrd", nrrdHestNrrdNoTTY);
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/ccsettle.c
===================================================================
--- teem/trunk/src/unrrdu/ccsettle.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/ccsettle.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -35,12 +35,13 @@
int pret;
mop = airMopNew();
- hestOptAdd(&opt, "i,input", "nin", airTypeOther, 1, 1, &nin, NULL, "input nrrd", NULL,
- NULL, nrrdHestNrrd);
- hestOptAdd(&opt, "v,values", "filename", airTypeString, 1, 1, &valS, "",
- "Giving a filename here allows you to save out the mapping "
- "from new (settled) values to old values, in the form of a "
- "1-D lookup table");
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_Other(&opt, "i,input", "nin", &nin, "-",
+ "input nrrd. By default try to read from stdin", nrrdHestNrrdNoTTY);
+ hestOptAdd_1_String(&opt, "v,values", "filename", &valS, "",
+ "Giving a filename here allows you to save out the mapping "
+ "from new (settled) values to old values, in the form of a "
+ "1-D lookup table");
OPT_ADD_NOUT(out, "output nrrd");
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
Modified: teem/trunk/src/unrrdu/cksum.c
===================================================================
--- teem/trunk/src/unrrdu/cksum.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/cksum.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -22,6 +22,8 @@
#include "unrrdu.h"
#include "privateUnrrdu.h"
+#include <unistd.h> /* for isatty() and STDIN_FILENO */
+
#define INFO "Compute 32-bit CRC of nrrd data (same as via \"cksum\")"
static const char *_unrrdu_cksumInfoL
= (INFO ". Unlike other commands, this doesn't produce a nrrd. It only "
@@ -37,6 +39,11 @@
char stmp[AIR_STRLEN_SMALL + 1], ends[AIR_STRLEN_SMALL + 1];
size_t nn;
+ if (!strcmp("-", inS) && isatty(STDIN_FILENO)) {
+ biffAddf(me, "declining to try reading Nrrd from stdin as tty (terminal)");
+ return 1;
+ }
+
mop = airMopNew();
airMopAdd(mop, nrrd = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
if (nrrdLoad(nrrd, inS, NULL)) {
@@ -59,36 +66,49 @@
hestOpt *opt = NULL;
char *err, **inS;
airArray *mop;
- int pret, endian, printend;
+ int pret, endian, printend, okay;
unsigned int ni, ninLen;
mop = airMopNew();
- hestOptAdd(&opt, "en,endian", "end", airTypeEnum, 1, 1, &endian,
- airEnumStr(airEndian, airMyEndian()),
- "Endianness in which to compute CRC; \"little\" for Intel and "
- "friends; \"big\" for everyone else. "
- "Defaults to endianness of this machine",
- NULL, airEndian);
- hestOptAdd(&opt, "pen,printendian", "bool", airTypeBool, 1, 1, &printend, "false",
- "whether or not to indicate after the CRC value the endianness "
- "with which the CRC was computed; doing so clarifies "
- "that the CRC result depends on endianness and may remove "
- "confusion in comparing results on platforms of different "
- "endianness");
- hestOptAdd(&opt, NULL, "nin1", airTypeString, 1, -1, &inS, NULL, "input nrrd(s)",
- &ninLen);
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_Enum(&opt, "en,endian", "end", &endian,
+ airEnumStr(airEndian, airMyEndian()),
+ "Endianness in which to compute CRC; \"little\" for Intel and "
+ "friends; \"big\" for everyone else. "
+ "Defaults to endianness of this machine",
+ airEndian);
+ hestOptAdd_1_Bool(&opt, "pen,printendian", "bool", &printend, "false",
+ "whether or not to indicate after the CRC value the endianness "
+ "with which the CRC was computed; doing so clarifies "
+ "that the CRC result depends on endianness and may remove "
+ "confusion in comparing results on platforms of different "
+ "endianness");
+ hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, "-",
+ "input nrrd(s). By default tries to read from stdin", &ninLen);
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
USAGE_OR_PARSE(_unrrdu_cksumInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
+ /* HEY "okay" logic copied from head.c */
+ okay = AIR_FALSE;
for (ni = 0; ni < ninLen; ni++) {
if (unrrdu_cksumDoit(me, inS[ni], endian, printend, stdout)) {
airMopAdd(mop, err = biffGetDone(me), airFree, airMopAlways);
fprintf(stderr, "%s: trouble with \"%s\":\n%s", me, inS[ni], err);
/* continue working on the remaining files */
+ } else {
+ okay = AIR_TRUE;
}
}
+ if (!okay) {
+ /* none of the given files could be read; something is wrong */
+ if (ninLen > 1) {
+ fprintf(stderr, "\n%s: Unable to read any file\n", me);
+ }
+ hestUsage(stderr, opt, me, hparm);
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me);
+ }
airMopOkay(mop);
return 0;
Modified: teem/trunk/src/unrrdu/dnorm.c
===================================================================
--- teem/trunk/src/unrrdu/dnorm.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/dnorm.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -45,27 +45,28 @@
hestOpt *opt = NULL;
char *err;
airArray *mop;
-
- hestOptAdd(&opt, "h,header", NULL, airTypeInt, 0, 0, &headerOnly, NULL,
- "output header of nrrd file only, not the data itself");
- hestOptAdd(&opt, "v,version", "version", airTypeEnum, 1, 1, &version, "alpha",
- "what version of canonical meta-data to convert to; "
- "\"alpha\" is what has been used for Diderot until at least "
- "2016",
- NULL, nrrdMetaDataCanonicalVersion);
- hestOptAdd(&opt, "to", NULL, airTypeInt, 0, 0, &trivialOrient, NULL,
- "(*t*rivial *o*rientation) "
- "even if the input nrrd comes with full orientation or "
- "per-axis min-max info, ignore it and instead assert the "
- "identity mapping between index and world space");
- hestOptAdd(&opt, "rc,recenter", NULL, airTypeInt, 0, 0, &recenter, NULL,
- "re-locate output spaceOrigin so that field is centered "
- "around origin of space coordinates");
- hestOptAdd(&opt, "sp,spacing", "scl", airTypeDouble, 1, 1, &newSpacing, "1.0",
- "when having to contrive orientation information and there's "
- "no per-axis min/max or spacing, this is the sample spacing "
- "to assert");
- OPT_ADD_NIN(nin, "input image");
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_Flag(&opt, "h,header", &headerOnly,
+ "output header of nrrd file only, not the data itself");
+ hestOptAdd_1_Enum(&opt, "v,version", "version", &version, "alpha",
+ "what version of canonical meta-data to convert to; "
+ "\"alpha\" is what has been used for Diderot until at least "
+ "2016",
+ nrrdMetaDataCanonicalVersion);
+ hestOptAdd_Flag(&opt, "to", &trivialOrient,
+ "(*t*rivial *o*rientation) "
+ "even if the input nrrd comes with full orientation or "
+ "per-axis min-max info, ignore it and instead assert the "
+ "identity mapping between index and world space");
+ hestOptAdd_Flag(&opt, "rc,recenter", &recenter,
+ "re-locate output spaceOrigin so that field is centered "
+ "around origin of space coordinates");
+ hestOptAdd_1_Double(&opt, "sp,spacing", "scl", &newSpacing, "1.0",
+ "when having to contrive orientation information and there's "
+ "no per-axis min/max or spacing, this is the sample spacing "
+ "to assert");
+ hestOptAdd_1_Other(&opt, "i,input", "nin", &nin, "-",
+ "input image. By default reads from stdin", nrrdHestNrrdNoTTY);
OPT_ADD_NOUT(outS, "output filename");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/grid.c
===================================================================
--- teem/trunk/src/unrrdu/grid.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/grid.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -22,6 +22,8 @@
#include "unrrdu.h"
#include "privateUnrrdu.h"
+#include <unistd.h> /* for isatty() and STDIN_FILENO */
+
static int /* Biff: 1 */
gridGen(Nrrd *nout, int typeOut, const Nrrd *nin, int psz, int psg) {
static const char me[] = "gridGen";
@@ -151,20 +153,16 @@
Nrrd *nin, *nout;
int typeOut, psz, psg;
NrrdIoState *nio;
-
- hestOptAdd(&opt, "i,input", "nin", airTypeString, 1, 1, &inS, NULL,
- "input nrrd. That this argument is required instead of "
- "optional, as with most unu commands, is a quirk caused by the "
- "need to have \"unu grid\" generate usage info, combined "
- "with the fact that the other arguments have sensible "
- "defaults");
- hestOptAdd(&opt, "ps", NULL, airTypeInt, 0, 0, &psz, NULL,
- "instead of the default behavior of flattening all but the "
- "fastest axis, preserve the sizes of axes, so that the output "
- "is more like that of the input");
- hestOptAdd(&opt, "pg", NULL, airTypeInt, 0, 0, &psg, NULL,
- "(overrides -ps) generate a 2D array that represents "
- "the sampling grid in the way that \"gprobe -pg\" understands");
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_String(&opt, "i,input", "nin", &inS, "-",
+ "input nrrd. By default reads from stdin");
+ hestOptAdd_Flag(&opt, "ps", &psz,
+ "instead of the default behavior of flattening all but the "
+ "fastest axis, preserve the sizes of axes, so that the output "
+ "is more like that of the input");
+ hestOptAdd_Flag(&opt, "pg", &psg,
+ "(overrides -ps) generate a 2D array that represents "
+ "the sampling grid in the way that \"gprobe -pg\" understands");
OPT_ADD_TYPE(typeOut, "type of output", "double");
OPT_ADD_NOUT(outS, "output nrrd");
@@ -174,6 +172,15 @@
USAGE_OR_PARSE(_unrrdu_gridInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
+ if (!strcmp("-", inS) && isatty(STDIN_FILENO)) {
+ fprintf(stderr, "%s: declining to try reading Nrrd from stdin as tty (terminal)\n/",
+ me);
+ hestUsage(stderr, opt, me, hparm);
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me);
+ airMopError(mop);
+ return 1;
+ }
+
nio = nrrdIoStateNew();
airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways);
nin = nrrdNew();
Modified: teem/trunk/src/unrrdu/head.c
===================================================================
--- teem/trunk/src/unrrdu/head.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/head.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -22,6 +22,8 @@
#include "unrrdu.h"
#include "privateUnrrdu.h"
+#include <unistd.h> /* for isatty() and STDIN_FILENO */
+
#define INFO "Print header of one or more nrrd files"
static const char *_unrrdu_headInfoL
= (INFO ". The value of this is simply to print the contents of nrrd "
@@ -32,14 +34,18 @@
"* Uses nrrdOneLine");
static int /* Biff: 1 */
-unrrdu_headDoit(const char *me, NrrdIoState *nio, char *inS, FILE *fout) {
+unrrdu_headDoit(const char *me, NrrdIoState *nio, const char *inS, FILE *fout) {
airArray *mop;
unsigned int len;
FILE *fin;
+ if (!strcmp("-", inS) && isatty(STDIN_FILENO)) {
+ biffAddf(me, "declining to try reading Nrrd from stdin as tty (terminal)");
+ return 1;
+ }
mop = airMopNew();
if (!(fin = airFopen(inS, stdin, "rb"))) {
- biffAddf(me, "%s: couldn't fopen(\"%s\",\"rb\"): %s\n", me, inS, strerror(errno));
+ biffAddf(me, "couldn't fopen(\"%s\",\"rb\"): %s\n", inS, strerror(errno));
airMopError(mop);
return 1;
}
@@ -46,17 +52,17 @@
airMopAdd(mop, fin, (airMopper)airFclose, airMopAlways);
if (nrrdOneLine(&len, nio, fin)) {
- biffAddf(me, "%s: error getting first line of file \"%s\"", me, inS);
+ biffAddf(me, "error getting first line of file \"%s\"", inS);
airMopError(mop);
return 1;
}
if (!len) {
- biffAddf(me, "%s: immediately hit EOF\n", me);
+ biffAddf(me, "immediately hit EOF\n");
airMopError(mop);
return 1;
}
if (!(nrrdFormatNRRD->contentStartsLike(nio))) {
- biffAddf(me, "%s: first line (\"%s\") isn't a nrrd magic\n", me, nio->line);
+ biffAddf(me, "first line (\"%s\") isn't a nrrd magic\n", nio->line);
airMopError(mop);
return 1;
}
@@ -85,12 +91,13 @@
char *err, **inS;
NrrdIoState *nio;
airArray *mop;
- int pret;
+ int pret, okay;
unsigned int ni, ninLen;
mop = airMopNew();
- hestOptAdd(&opt, NULL, "nin1", airTypeString, 1, -1, &inS, NULL, "input nrrd(s)",
- &ninLen);
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, "-",
+ "input nrrd(s). By default tries to read from stdin", &ninLen);
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
USAGE_OR_PARSE(_unrrdu_headInfoL);
@@ -99,6 +106,7 @@
nio = nrrdIoStateNew();
airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways);
+ okay = AIR_FALSE;
for (ni = 0; ni < ninLen; ni++) {
if (ninLen > 1) {
fprintf(stdout, "==> %s <==\n", inS[ni]);
@@ -107,11 +115,22 @@
airMopAdd(mop, err = biffGetDone(me), airFree, airMopAlways);
fprintf(stderr, "%s: trouble reading from \"%s\":\n%s", me, inS[ni], err);
/* continue working on the remaining files */
+ } else {
+ /* processed at least one file ok */
+ okay = AIR_TRUE;
}
if (ninLen > 1 && ni < ninLen - 1) {
fprintf(stdout, "\n");
}
}
+ if (!okay) {
+ /* none of the given files could be read; something is wrong */
+ if (ninLen > 1) {
+ fprintf(stderr, "\n%s: Unable to read from any file\n", me);
+ }
+ hestUsage(stderr, opt, me, hparm);
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me);
+ }
airMopOkay(mop);
return 0;
Modified: teem/trunk/src/unrrdu/minmax.c
===================================================================
--- teem/trunk/src/unrrdu/minmax.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/minmax.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -22,6 +22,8 @@
#include "unrrdu.h"
#include "privateUnrrdu.h"
+#include <unistd.h> /* for isatty() and STDIN_FILENO */
+
#define INFO "Print out min and max values in one or more nrrds"
static const char *_unrrdu_minmaxInfoL
= (INFO ". Unlike other commands, this doesn't produce a nrrd. It only "
@@ -36,6 +38,11 @@
NrrdRange *range;
airArray *mop;
+ if (!strcmp("-", inS) && isatty(STDIN_FILENO)) {
+ biffAddf(me, "declining to try reading Nrrd from stdin as tty (terminal)");
+ return 1;
+ }
+
mop = airMopNew();
airMopAdd(mop, nrrd = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
if (nrrdLoad(nrrd, inS, NULL)) {
@@ -80,11 +87,12 @@
hestOpt *opt = NULL;
char *err, **inS;
airArray *mop;
- int pret, blind8BitRange, singleLine;
+ int pret, blind8BitRange, singleLine, okay;
unsigned int ni, ninLen;
#define B8DEF "false"
mop = airMopNew();
+ hparm->noArgsIsNoProblem = AIR_TRUE;
hestOptAdd_1_Bool(&opt, "blind8", "bool", &blind8BitRange,
B8DEF, /* NOTE: not using nrrdStateBlind8BitRange here
for consistency with previous behavior */
@@ -103,12 +111,14 @@
"and max, possibly followed by the single word \"non-existent\" if and "
"only if there were non-existent values. If there are multiple inputs, "
"the input filename is printed first on the per-input single line.");
- hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, NULL, "input nrrd(s)", &ninLen);
+ hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, "-", "input nrrd(s)", &ninLen);
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
USAGE_OR_PARSE(_unrrdu_minmaxInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
+ /* HEY "okay" logic copied from head.c */
+ okay = AIR_FALSE;
for (ni = 0; ni < ninLen; ni++) {
if (ninLen > 1) {
if (singleLine) {
@@ -121,11 +131,22 @@
airMopAdd(mop, err = biffGetDone(me), airFree, airMopAlways);
fprintf(stderr, "%s: trouble with \"%s\":\n%s", me, inS[ni], err);
/* continue working on the remaining files */
+ } else {
+ /* processed at least one file ok */
+ okay = AIR_TRUE;
}
if (ninLen > 1 && ni < ninLen - 1 && !singleLine) {
fprintf(stdout, "\n");
}
}
+ if (!okay) {
+ /* none of the given files could be read; something is wrong */
+ if (ninLen > 1) {
+ fprintf(stderr, "\n%s: Unable to read data from any file\n", me);
+ }
+ hestUsage(stderr, opt, me, hparm);
+ fprintf(stderr, "\nFor more info: \"%s --help\"\n", me);
+ }
airMopOkay(mop);
return 0;
Modified: teem/trunk/src/unrrdu/unorient.c
===================================================================
--- teem/trunk/src/unrrdu/unorient.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/unorient.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -35,14 +35,22 @@
int setMinsFromOrigin;
airArray *mop;
- /* if we gave a default for this, then there it would fine to have
- no command-line arguments whatsoever, and then the user would not
- know how to get the basic usage information */
- hestOptAdd(&opt, "i,input", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input nrrd "
- "(sorry, can't use usual default of \"-\" for stdin "
- "because of hest quirk)",
- NULL, NULL, nrrdHestNrrd);
+ /*
+ * with new nrrdHestNrrdNoTTY, can let "-" be default input as normal; no more need
+ * for this awkwardness:
+ *
+ * / * if we gave a default for this, then there it would fine to have
+ * no command-line arguments whatsoever, and then the user would not
+ * know how to get the basic usage information * /
+ * hestOptAdd(&opt, "i,input", "nin", airTypeOther, 1, 1, &nin, NULL,
+ * "input nrrd "
+ * "(sorry, can't use usual default of \"-\" for stdin "
+ * "because of hest quirk)",
+ * NULL, NULL, nrrdHestNrrd);
+ */
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_Other(&opt, "i,input", "nin", &nin, "-",
+ "input nrrd. By default reads from stdin", nrrdHestNrrdNoTTY);
hestOptAdd_Flag(&opt, "smfo", &setMinsFromOrigin,
"set some axis mins based on space origin (hack)");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/unquantize.c
===================================================================
--- teem/trunk/src/unrrdu/unquantize.c 2023-07-13 22:28:30 UTC (rev 7092)
+++ teem/trunk/src/unrrdu/unquantize.c 2023-07-13 22:46:18 UTC (rev 7093)
@@ -38,14 +38,19 @@
double oldMin, oldMax;
airArray *mop;
- /* mandatory arg so that "unu unquantize" produces usage info */
- hestOptAdd(&opt, "i,input", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input nrrd. That this argument is required instead of "
- "optional, as with most unu commands, is a quirk caused by the "
- "need to have \"unu unquantize\" generate usage info, combined "
- "with the fact that all the other arguments have sensible "
- "defaults",
- NULL, NULL, nrrdHestNrrd);
+ /*
+ * with new nrrdHestNrrdNoTTY, can let "-" be default input as normal; no more need
+ * for this awkwardness:
+ * hestOptAdd(&opt, "i,input", "nin", airTypeOther, 1, 1, &nin, NULL,
+ * "input nrrd. That this argument is required instead of "
+ * "optional, as with most unu commands, is a quirk caused by the "
+ * "need to have \"unu unquantize\" generate usage info, combined "
+ * "with the fact that all the other arguments have sensible "
+ * "defaults",
+ * NULL, NULL, nrrdHestNrrd);
+ */
+ hparm->noArgsIsNoProblem = AIR_TRUE;
+ hestOptAdd_1_Other(&opt, "i,input", "nin", &nin, "-", "input nrrd", nrrdHestNrrdNoTTY);
hestOptAdd_1_Double(&opt, "min,minimum", "value", &oldMin, "nan",
"Lowest value prior to quantization. Defaults to "
"nin->oldMin if it exists, otherwise 0.0");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 22:28:31
|
Revision: 7092
http://sourceforge.net/p/teem/code/7092
Author: kindlmann
Date: 2023-07-13 22:28:30 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
API NEW: nrrdHestNrrdNoTTY for parsing a Nrrd via hest callbacks (hestCB), but with the restriction that - does not work as a synonym for stdin if stdin is a terminal: we only want to try to read from files being piped in. This enables some LONG-wanted functionality in unu, wherein the -i input can default to -, while still allowing 'unu cmd' to trigger some usage info
Modified Paths:
--------------
teem/trunk/src/nrrd/hestNrrd.c
teem/trunk/src/nrrd/nrrd.h
Modified: teem/trunk/src/nrrd/hestNrrd.c
===================================================================
--- teem/trunk/src/nrrd/hestNrrd.c 2023-07-13 21:46:17 UTC (rev 7091)
+++ teem/trunk/src/nrrd/hestNrrd.c 2023-07-13 22:28:30 UTC (rev 7092)
@@ -22,52 +22,86 @@
#include "nrrd.h"
#include "privateNrrd.h"
+#include <unistd.h> /* for isatty() and STDIN_FILENO */
+
/* ---------------------------- Nrrd ----------------------------- */
/*
-** _nrrdHestNrrdParse()
-**
-** Converts a filename into a nrrd for the sake of hest.
-** There is no HestMaybeNrrdParse because this already does that:
-** when we get an empty string, we give back a NULL pointer, and
-** that is just fine
+_nrrdHestNrrdParseOkTTY() and _nrrdHestNrrdParseNoTTY ()
+
+Converts a filename into a nrrd for the sake of hest.
+There is no HestMaybeNrrdParse because this already does that:
+when we get an empty string, we give back a NULL pointer, and
+that is just fine
*/
+
static int
-_nrrdHestNrrdParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
- static const char me[] = "_nrrdHestNrrdParse";
+parserBoth(void *ptr,
+ const char *filename,
+ char err[AIR_STRLEN_HUGE + 1],
+ const char *me,
+ int disallowTTY) {
char *nerr;
Nrrd **nrrdP;
airArray *mop;
- if (!(ptr && str)) {
+ if (!(ptr && filename)) {
sprintf(err, "%s: got NULL pointer", me);
return 1;
}
nrrdP = (Nrrd **)ptr;
- if (airStrlen(str)) {
+ *nrrdP = NULL;
+ if (airStrlen(filename)) {
+ if (disallowTTY && !strcmp("-", filename) && isatty(STDIN_FILENO)) {
+ sprintf(err, "%s: declining to try reading Nrrd from stdin as tty (terminal)", me);
+ return 1;
+ }
mop = airMopNew();
*nrrdP = nrrdNew();
airMopAdd(mop, *nrrdP, (airMopper)nrrdNuke, airMopOnError);
- if (nrrdLoad(*nrrdP, str, NULL)) {
+ /* else no concerns about filename being "-" and stdin being a terminal */
+ if (nrrdLoad(*nrrdP, filename, NULL)) {
airMopAdd(mop, nerr = biffGetDone(NRRD), airFree, airMopOnError);
airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
+ *nrrdP = NULL;
return (strstr(err, "EOF") ? 2 : 1);
}
airMopOkay(mop);
- } else {
- /* they gave us an empty string, we give back no nrrd,
- but its not an error condition */
- *nrrdP = NULL;
}
+ /* else they gave us an empty string filename, so we give back no nrrd,
+ and its not an error condition */
return 0;
}
-static const hestCB _nrrdHestNrrd = {sizeof(Nrrd *), "nrrd", _nrrdHestNrrdParse,
+static int
+parserOkTTY(void *ptr, const char *filename, char err[AIR_STRLEN_HUGE + 1]) {
+ return parserBoth(ptr,
+ filename,
+ err,
+ "_nrrdHestNrrdParse", /* mimic old name */
+ AIR_FALSE /* not disallowing TTY */);
+}
+
+static int
+parserNoTTY(void *ptr, const char *filename, char err[AIR_STRLEN_HUGE + 1]) {
+ return parserBoth(ptr,
+ filename,
+ err,
+ "_nrrdHestNrrdParse(NoTTY)",
+ AIR_TRUE /* yes disallow TTY */);
+}
+
+static const hestCB _nrrdHestNrrd = {sizeof(Nrrd *), "nrrd", parserOkTTY,
(airMopper)nrrdNuke};
const hestCB *const nrrdHestNrrd = &_nrrdHestNrrd;
+static const hestCB _nrrdHestNrrdNoTTY = {sizeof(Nrrd *), "nrrd", parserNoTTY,
+ (airMopper)nrrdNuke};
+
+const hestCB *const nrrdHestNrrdNoTTY = &_nrrdHestNrrdNoTTY;
+
/* ------------------------ NrrdKernelSpec -------------------------- */
static int
Modified: teem/trunk/src/nrrd/nrrd.h
===================================================================
--- teem/trunk/src/nrrd/nrrd.h 2023-07-13 21:46:17 UTC (rev 7091)
+++ teem/trunk/src/nrrd/nrrd.h 2023-07-13 22:28:30 UTC (rev 7092)
@@ -1098,6 +1098,7 @@
/******** things useful with hest */
/* hestNrrd.c */
NRRD_EXPORT const hestCB *const nrrdHestNrrd;
+NRRD_EXPORT const hestCB *const nrrdHestNrrdNoTTY;
NRRD_EXPORT const hestCB *const nrrdHestKernelSpec;
NRRD_EXPORT const hestCB *const nrrdHestBoundarySpec;
NRRD_EXPORT const hestCB *const nrrdHestIter;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 21:46:20
|
Revision: 7091
http://sourceforge.net/p/teem/code/7091
Author: kindlmann
Date: 2023-07-13 21:46:17 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
oops left in a debugging printf
Modified Paths:
--------------
teem/trunk/src/hest/parseHest.c
Modified: teem/trunk/src/hest/parseHest.c
===================================================================
--- teem/trunk/src/hest/parseHest.c 2023-07-13 21:27:52 UTC (rev 7090)
+++ teem/trunk/src/hest/parseHest.c 2023-07-13 21:46:17 UTC (rev 7091)
@@ -873,7 +873,9 @@
/* if not using the default, we're done with this option */
if (!udflt[op]) continue;
prms[op] = airStrdup(opt[op].dflt);
- fprintf(stderr, "!%s: prms[%d] = |%s|\n", me, op, prms[op]);
+ if (parm->verbosity) {
+ printf("%s: prms[%d] = |%s|\n", me, op, prms[op]);
+ }
if (prms[op]) {
airMopAdd(mop, prms[op], airFree, airMopAlways);
airOneLinify(prms[op]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 21:27:54
|
Revision: 7090
http://sourceforge.net/p/teem/code/7090
Author: kindlmann
Date: 2023-07-13 21:27:52 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
updating hest usage, and clarifying usage info
Modified Paths:
--------------
teem/trunk/src/unrrdu/data.c
Modified: teem/trunk/src/unrrdu/data.c
===================================================================
--- teem/trunk/src/unrrdu/data.c 2023-07-13 21:20:35 UTC (rev 7089)
+++ teem/trunk/src/unrrdu/data.c 2023-07-13 21:27:52 UTC (rev 7090)
@@ -28,7 +28,7 @@
"stand-alone decoder, in case this Teem build lacks an optional "
"data encoding required for a given nrrd file. Caveats: "
"Will start copying characters from the datafile "
- "to output file until EOF is hit, so this won't work "
+ "to stdout until EOF is hit, so this won't work "
"correctly if the datafile has extraneous content at the end. Will "
"skip lines (as per \"line skip:\" header field) if needed, but can only "
"skip bytes (as per \"byte skip:\") if the encoding is NOT a compression. "
@@ -49,7 +49,7 @@
int car, pret;
mop = airMopNew();
- hestOptAdd(&opt, NULL, "nin", airTypeString, 1, 1, &inS, NULL, "input nrrd");
+ hestOptAdd_1_String(&opt, NULL, "nin", &inS, NULL, "input nrrd");
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
USAGE_OR_PARSE(_unrrdu_dataInfoL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 21:20:37
|
Revision: 7089
http://sourceforge.net/p/teem/code/7089
Author: kindlmann
Date: 2023-07-13 21:20:35 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
Some bug fixes related to updating "unu head":
* in extractUnflagged(): test for getting min # of parms for
variable parm option was in the wrong place: should be inside
test that some # of parms were given on the command-line
(so that an unflagged variable parm option can take them from default)
* in _hestDefaults(): since r1005 2002-10-03 the test for whether
enough parms were supplied by default was incorrectly contingent on
hestParm->elideMultipleEmptyStringDefault, even though that option
only controls the generation of usage info. wtf.
* lots of changes of "!%s ..." to "%s ..." since the former is
intended just for transient debugging
Modified Paths:
--------------
teem/trunk/src/hest/parseHest.c
Modified: teem/trunk/src/hest/parseHest.c
===================================================================
--- teem/trunk/src/hest/parseHest.c 2023-07-13 16:26:32 UTC (rev 7088)
+++ teem/trunk/src/hest/parseHest.c 2023-07-13 21:20:35 UTC (rev 7089)
@@ -145,7 +145,7 @@
}
/* else not a show-stopper argument */
if (parm->verbosity) {
- printf("!%s:________ newArgc = %d, oldArgc = %d -> \"%s\"\n", me, newArgc, oldArgc,
+ printf("%s:________ newArgc = %d, oldArgc = %d -> \"%s\"\n", me, newArgc, oldArgc,
oldArgv[oldArgc]);
printArgv(newArgc, newArgv, " ");
}
@@ -181,7 +181,7 @@
oldArgc++;
if (parm->verbosity) {
printArgv(newArgc, newArgv, " ");
- printf("!%s: ^^^^^^^ newArgc = %d, oldArgc = %d\n", me, newArgc, oldArgc);
+ printf("%s: ^^^^^^^ newArgc = %d, oldArgc = %d\n", me, newArgc, oldArgc);
}
}
newArgv[newArgc] = NULL;
@@ -475,9 +475,9 @@
numOpts = hestOptNum(opt);
if (parm->verbosity)
- printf("!%s: (a) looking for flag |%s| in numOpts=%d options\n", me, flag, numOpts);
+ printf("%s: (a) looking for flag |%s| in numOpts=%d options\n", me, flag, numOpts);
for (op = 0; op < numOpts; op++) {
- if (parm->verbosity) printf("!%s: op = %d\n", me, op);
+ if (parm->verbosity) printf("%s: op = %d\n", me, op);
if (!opt[op].flag) continue;
if (strchr(opt[op].flag, parm->multiFlagSep)) {
strcpy(copy, opt[op].flag);
@@ -598,21 +598,21 @@
int a, np, flag, endflag, numOpts, op;
a = 0;
- if (parm->verbosity) printf("!%s: *argcP = %d\n", me, *argcP);
+ if (parm->verbosity) printf("%s: *argcP = %d\n", me, *argcP);
while (a <= *argcP - 1) {
if (parm->verbosity) {
- printf("!%s: ----------------- a = %d -> argv[a] = %s\n", me, a, argv[a]);
+ printf("%s: ----------------- a = %d -> argv[a] = %s\n", me, a, argv[a]);
}
flag = whichFlag(opt, argv[a], parm);
- if (parm->verbosity) printf("!%s: A: a = %d -> flag = %d\n", me, a, flag);
+ if (parm->verbosity) printf("%s: A: a = %d -> flag = %d\n", me, a, flag);
if (!(0 <= flag)) {
/* not a flag, move on */
a++;
- if (parm->verbosity) printf("!%s: !(0 <= %d), so: continue\n", me, flag);
+ if (parm->verbosity) printf("%s: !(0 <= %d), so: continue\n", me, flag);
continue;
}
/* see if we can associate some parameters with the flag */
- if (parm->verbosity) printf("!%s: flag = %d; any parms?\n", me, flag);
+ if (parm->verbosity) printf("%s: flag = %d; any parms?\n", me, flag);
np = 0;
endflag = 0;
while (np < _hestMax(opt[flag].max) /* */
@@ -620,7 +620,7 @@
&& -1 == (endflag = whichFlag(opt, argv[a + np + 1], parm))) {
np++;
if (parm->verbosity)
- printf("!%s: np --> %d with flag = %d; endflag = %d\n", me, np, flag, endflag);
+ printf("%s: np --> %d with flag = %d; endflag = %d\n", me, np, flag, endflag);
}
/* we stopped because we got the max number of parameters, or
because we hit the end of the command line, or
@@ -629,7 +629,7 @@
we stopped because of whichFlag()'s return value,
endflag has been set to that return value */
if (parm->verbosity)
- printf("!%s: B: stopped with np = %d; flag = %d; endflag = %d\n", me, np, flag,
+ printf("%s: B: stopped with np = %d; flag = %d; endflag = %d\n", me, np, flag,
endflag);
if (np < (int)opt[flag].min) { /* HEY scrutinize casts */
/* didn't get minimum number of parameters */
@@ -655,7 +655,7 @@
}
nprm[flag] = np;
if (parm->verbosity) {
- printf("!%s:________ a=%d, *argcP = %d -> flag = %d\n", me, a, *argcP, flag);
+ printf("%s:________ a=%d, *argcP = %d -> flag = %d\n", me, a, *argcP, flag);
printArgv(*argcP, argv, " ");
}
/* lose the flag argument */
@@ -674,8 +674,8 @@
}
if (parm->verbosity) {
printArgv(*argcP, argv, " ");
- printf("!%s:^^^^^^^^ *argcP = %d\n", me, *argcP);
- printf("!%s: prms[%d] = %s\n", me, flag, prms[flag] ? prms[flag] : "(null)");
+ printf("%s:^^^^^^^^ *argcP = %d\n", me, *argcP);
+ printf("%s: prms[%d] = %s\n", me, flag, prms[flag] ? prms[flag] : "(null)");
}
}
@@ -715,20 +715,20 @@
return 0;
}
if (parm->verbosity) {
- printf("!%s numOpts %d != unflag1st %d: have some (of %d) unflagged options\n", me,
+ printf("%s numOpts %d != unflag1st %d: have some (of %d) unflagged options\n", me,
numOpts, unflag1st, numOpts);
}
for (unflagVar = unflag1st; unflagVar != numOpts;
unflagVar = _hestNextUnflagged(unflagVar + 1, opt, numOpts)) {
- if ((int)opt[unflagVar].min
- < _hestMax(opt[unflagVar].max)) /* HEY scrutinize casts */
+ if (AIR_INT(opt[unflagVar].min) < _hestMax(opt[unflagVar].max)) {
break;
+ }
}
/* now, if there is a variable parameter unflagged opt, unflagVar is its
index in opt[], or else unflagVar is numOpts */
if (parm->verbosity) {
- printf("!%s unflagVar %d\n", me, unflagVar);
+ printf("%s unflagVar %d\n", me, unflagVar);
}
/* grab parameters for all unflagged opts before opt[t] */
@@ -735,7 +735,7 @@
for (op = _hestNextUnflagged(0, opt, numOpts); op < unflagVar;
op = _hestNextUnflagged(op + 1, opt, numOpts)) {
if (parm->verbosity) {
- printf("!%s op = %d; unflagVar = %d\n", me, op, unflagVar);
+ printf("%s op = %d; unflagVar = %d\n", me, op, unflagVar);
}
np = opt[op].min; /* min == max */
if (!(np <= *argcP)) {
@@ -777,26 +777,30 @@
/* now we grab the parameters of the sole variable parameter unflagged opt,
if it exists (unflagVar < numOpts) */
if (parm->verbosity) {
- printf("!%s (still here) unflagVar %d vs numOpts %d\n", me, unflagVar, numOpts);
+ printf("%s (still here) unflagVar %d vs numOpts %d (nvp %d)\n", me, unflagVar,
+ numOpts, nvp);
}
if (unflagVar < numOpts) {
if (parm->verbosity) {
- printf("!%s unflagVar=%d: min, nvp, max = %d %d %d\n", me, unflagVar,
+ printf("%s unflagVar=%d: min, nvp, max = %d %d %d\n", me, unflagVar,
opt[unflagVar].min, nvp, _hestMax(opt[unflagVar].max));
}
/* we'll do error checking for unexpected args later */
nvp = AIR_MIN(nvp, _hestMax(opt[unflagVar].max));
- if (nvp < (int)opt[unflagVar].min) { /* HEY scrutinize casts */
- sprintf(err, "%sdidn't get minimum of %d arg%s for %s (got %d)", ME,
- opt[unflagVar].min, opt[unflagVar].min > 1 ? "s" : "",
- identStr(ident, opt + unflagVar, parm, AIR_TRUE), nvp);
- return 1;
- }
if (nvp) {
unsigned int gotp = 0;
+ /* pre-2023: this check used to be done regardless of nvp, but that incorrectly
+ triggered this error message when there were zero given parms, but the default
+ could have supplied them */
+ if (nvp < AIR_INT(opt[unflagVar].min)) {
+ sprintf(err, "%sdidn't get minimum of %d arg%s for %s (got %d)", ME,
+ opt[unflagVar].min, opt[unflagVar].min > 1 ? "s" : "",
+ identStr(ident, opt + unflagVar, parm, AIR_TRUE), nvp);
+ return 1;
+ }
prms[unflagVar] = extractToStr(argcP, argv, 0, nvp, &gotp, parm);
if (parm->verbosity) {
- printf("!%s extracted %u to new string |%s| (*argcP now %d)\n", me, gotp,
+ printf("%s extracted %u to new string |%s| (*argcP now %d)\n", me, gotp,
prms[unflagVar], *argcP);
}
airMopAdd(pmop, prms[unflagVar], airFree, airMopAlways);
@@ -845,23 +849,31 @@
default. In either case, nprm[op] will be zero, and in both cases,
we need to use the default information. */
udflt[op] = (0 == nprm[op]);
- /*
- fprintf(stderr, "%s nprm[%d] = %u --> udflt[%d] = %d\n", me,
- op, nprm[op], op, udflt[op]);
- */
+ /* fprintf(stderr, "%s nprm[%d] = %u --> udflt[%d] = %d\n", me,
+ * op, nprm[op], op, udflt[op]); */
break;
case 5:
/* -------- multiple optional parameters -------- */
- /* we'll use the default if the flag didn't appear (if there is a
- flag) Otherwise, if nprm[op] is zero, then the user is saying,
- I want zero parameters */
- udflt[op] = opt[op].flag && !appr[op];
+ /* we'll use the default if there is a flag and it didn't appear,
+ Otherwise (with a flagged option), if nprm[op] is zero, we'll use the default
+ if user has given zero parameters, yet the the option requires at least one.
+ If an unflagged option can have zero parms, and user has given zero parms,
+ then we don't use the default */
+ udflt[op] = (opt[op].flag
+ ? !appr[op] /* option is flagged and flag didn't appear */
+ /* else: option is unflagged, and there were no given parms,
+ and yet the option requires at least one parm */
+ : !nprm[op] && opt[op].min >= 1);
+ /* fprintf(stderr,
+ * "!%s: opt[%d].flag = %d; appr[op] = %d; nprm[op] = %d; opt[op].min = %d "
+ * "--> udflt[op] = %d\n",
+ * me, op, !!opt[op].flag, appr[op], nprm[op], opt[op].min, udflt[op]); */
break;
}
/* if not using the default, we're done with this option */
if (!udflt[op]) continue;
prms[op] = airStrdup(opt[op].dflt);
- /* fprintf(stderr, "%s: prms[%d] = |%s|\n", me, op, prms[op]); */
+ fprintf(stderr, "!%s: prms[%d] = |%s|\n", me, op, prms[op]);
if (prms[op]) {
airMopAdd(mop, prms[op], airFree, airMopAlways);
airOneLinify(prms[op]);
@@ -868,19 +880,23 @@
tmpS = airStrdup(prms[op]);
nprm[op] = airStrntok(tmpS, " ");
airFree(tmpS);
- /* printf("!%s: nprm[%d] in default = %u\n", me, op, nprm[op]); */
- if ((int)opt[op].min < _hestMax(opt[op].max)) { /* HEY scrutinize casts */
- if (!(AIR_IN_CL((int)opt[op].min, (int)nprm[op],
- _hestMax(opt[op].max)) /* HEY scrutinize casts */
- || (airTypeString == opt[op].type
- && parm->elideMultipleEmptyStringDefault))) {
+ }
+ /* fprintf(stderr,
+ * "!%s: after default; nprm[%d] = %u; varparm = %d (min %d vs max %d)\n", me,
+ * op, nprm[op], AIR_INT(opt[op].min) < _hestMax(opt[op].max),
+ * ((int)opt[op].min), _hestMax(opt[op].max)); */
+ if (AIR_INT(opt[op].min) < _hestMax(opt[op].max)) {
+ if (!AIR_IN_CL(AIR_INT(opt[op].min), AIR_INT(nprm[op]), _hestMax(opt[op].max))) {
+ if (-1 == opt[op].max) {
+ sprintf(err, "%s# parameters (in default) for %s is %d, but need %d or more",
+ ME, identStr(ident, opt + op, parm, AIR_TRUE), nprm[op], opt[op].min);
+ } else {
sprintf(err,
- "%s# parameters (in default) for %s is %d, "
- "but need between %d and %d",
+ "%s# parameters (in default) for %s is %d, but need between %d and %d",
ME, identStr(ident, opt + op, parm, AIR_TRUE), nprm[op], opt[op].min,
_hestMax(opt[op].max));
- return 1;
}
+ return 1;
}
}
}
@@ -1263,8 +1279,8 @@
}
}
if (parm->verbosity) {
- printf("!%s: nprm[%d] = %u\n", me, op, nprm[op]);
- printf("!%s: new array (size %u*%u) is at 0x%p\n", me, nprm[op],
+ printf("%s: nprm[%d] = %u\n", me, op, nprm[op]);
+ printf("%s: new array (size %u*%u) is at 0x%p\n", me, nprm[op],
(unsigned int)size, *((void **)vP));
}
if (*((void **)vP)) {
@@ -1454,7 +1470,7 @@
argc = argr + _argc - nrf;
if (PARM->verbosity) {
- printf("!%s: nrf = %d; argr = %d; _argc = %d --> argc = %d\n", me, nrf, argr, _argc,
+ printf("%s: nrf = %d; argr = %d; _argc = %d --> argc = %d\n", me, nrf, argr, _argc,
argc);
}
argv = AIR_CALLOC(argc + 1, char *);
@@ -1548,7 +1564,7 @@
}
/* -------- now, the actual parsing of values */
- if (PARM->verbosity) printf("%s: #### calling hestSetValues\n", me);
+ if (PARM->verbosity) printf("%s: #### calling setValues\n", me);
/* this will also set hestOpt->parmStr */
ret = setValues(prms, udflt, nprm, appr, opt, err, PARM, mop);
if (ret) {
@@ -1556,7 +1572,7 @@
return ret;
}
- if (PARM->verbosity) printf("%s: #### hestSetValues done!\n", me);
+ if (PARM->verbosity) printf("%s: #### setValues done!\n", me);
#undef PARM
parseEnd:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 16:26:37
|
Revision: 7088
http://sourceforge.net/p/teem/code/7088
Author: kindlmann
Date: 2023-07-13 16:26:32 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
fixed use of hestOptAdd_1_Enum
Modified Paths:
--------------
teem/trunk/src/bin/overrgb.c
Modified: teem/trunk/src/bin/overrgb.c
===================================================================
--- teem/trunk/src/bin/overrgb.c 2023-07-13 12:27:54 UTC (rev 7087)
+++ teem/trunk/src/bin/overrgb.c 2023-07-13 16:26:32 UTC (rev 7088)
@@ -100,7 +100,7 @@
"intent in the sRGB chunk of the PNG file format. Can be "
"absolute, relative, perceptual, saturation, or none. This is "
"independent of using \"srgb\" as the -g gamma",
- NULL, nrrdFormatPNGsRGBIntent);
+ nrrdFormatPNGsRGBIntent);
hestOptAdd_3_Double(&hopt, "b", "background", back, "0 0 0",
"background color to composite against; white is "
"1 1 1, not 255 255 255.");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-13 12:27:58
|
Revision: 7087
http://sourceforge.net/p/teem/code/7087
Author: kindlmann
Date: 2023-07-13 12:27:54 +0000 (Thu, 13 Jul 2023)
Log Message:
-----------
updated hest usage
Modified Paths:
--------------
teem/trunk/src/bin/deconv.c
teem/trunk/src/bin/emap.c
teem/trunk/src/bin/gprobe.c
teem/trunk/src/bin/ilk.c
teem/trunk/src/bin/miter.c
teem/trunk/src/bin/mrender.c
teem/trunk/src/bin/overrgb.c
teem/trunk/src/bin/pprobe.c
teem/trunk/src/bin/qbert.c
teem/trunk/src/bin/spots.c
teem/trunk/src/bin/talkweb.c
teem/trunk/src/bin/ungantry.c
teem/trunk/src/bin/vprobe.c
Modified: teem/trunk/src/bin/deconv.c
===================================================================
--- teem/trunk/src/bin/deconv.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/deconv.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -57,29 +57,27 @@
airMopAdd(mop, hparm, AIR_CAST(airMopper, hestParmFree), airMopAlways);
hparm->elideSingleOtherType = AIR_TRUE;
hparm->respectDashDashHelp = AIR_TRUE;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input volume", NULL,
- NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL,
- "\"kind\" of volume (\"scalar\", \"vector\", "
- "\"tensor\", or \"dwi\")",
- NULL, NULL, meetHestGageKind);
- hestOptAdd(&hopt, "k00", "kernel", airTypeOther, 1, 1, &ksp, NULL,
- "convolution kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "mi", "max # iters", airTypeUInt, 1, 1, &maxIter, "100",
- "maximum number of iterations with which to compute the "
- "deconvolution");
- hestOptAdd(&hopt, "e", "epsilon", airTypeDouble, 1, 1, &epsilon, "0.00000001",
- "convergence threshold");
- hestOptAdd(&hopt, "s", "step", airTypeDouble, 1, 1, &step, "1.0",
- "scaling of value update");
- hestOptAdd(&hopt, "t", "type", airTypeOther, 1, 1, &otype, "default",
- "type to save output as. By default (not using this option), "
- "the output type is the same as the input type",
- NULL, NULL, &unrrduHestMaybeTypeCB);
- hestOptAdd(&hopt, "sep", "bool", airTypeBool, 1, 1, &separ, "false",
- "use fast separable deconvolution instead of brain-dead "
- "brute-force iterative method");
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-", "output volume");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, NULL, "input volume", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "k", "kind", &kind, NULL,
+ "\"kind\" of volume (\"scalar\", \"vector\", "
+ "\"tensor\", or \"dwi\")",
+ meetHestGageKind);
+ hestOptAdd_1_Other(&hopt, "k00", "kernel", &ksp, NULL, "convolution kernel",
+ nrrdHestKernelSpec);
+ hestOptAdd_1_UInt(&hopt, "mi", "max # iters", &maxIter, "100",
+ "maximum number of iterations with which to compute the "
+ "deconvolution");
+ hestOptAdd_1_Double(&hopt, "e", "epsilon", &epsilon, "0.00000001",
+ "convergence threshold");
+ hestOptAdd_1_Double(&hopt, "s", "step", &step, "1.0", "scaling of value update");
+ hestOptAdd_1_Other(&hopt, "t", "type", &otype, "default",
+ "type to save output as. By default (not using this option), "
+ "the output type is the same as the input type",
+ &unrrduHestMaybeTypeCB);
+ hestOptAdd_1_Bool(&hopt, "sep", "bool", &separ, "false",
+ "use fast separable deconvolution instead of brain-dead "
+ "brute-force iterative method");
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output volume");
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, deconvInfo, AIR_TRUE, AIR_TRUE,
AIR_TRUE);
airMopAdd(mop, hopt, AIR_CAST(airMopper, hestOptFree), airMopAlways);
Modified: teem/trunk/src/bin/emap.c
===================================================================
--- teem/trunk/src/bin/emap.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/emap.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -45,8 +45,8 @@
char *outS, *errS, *debugS;
airArray *mop;
float amb[3], *linfo, *debug, *map, vscl;
- unsigned li, ui, vi;
- int qn, bits, method, doerr;
+ unsigned int li, ui, vi, bits;
+ int qn, method, doerr;
limnLight *light;
limnCamera *cam;
double u, v, r, w, V2W[9], diff, WW[3], VV[3];
@@ -59,35 +59,34 @@
hparm->respectDashDashHelp = AIR_TRUE;
cam = limnCameraNew();
airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways);
- hestOptAdd(&hopt, "i", "nlight", airTypeOther, 1, 1, &nlight, NULL,
- "input nrrd containing light information", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "b", "# bits", airTypeInt, 1, 1, &bits, "16",
- "number of bits to use for normal quantization, "
- "between 8 and 16 inclusive. ");
- hestOptAdd(&hopt, "amb", "ambient RGB", airTypeFloat, 3, 3, amb, "0 0 0",
- "ambient light color");
- hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from, "1 0 0",
- "position of camera, used to determine view vector");
- hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0",
- "camera look-at point, used to determine view vector");
- hestOptAdd(&hopt, "up", "up vector", airTypeDouble, 3, 3, cam->up, "0 0 1",
- "camera pseudo-up vector, used to determine view coordinates");
- hestOptAdd(&hopt, "rh", NULL, airTypeInt, 0, 0, &(cam->rightHanded), NULL,
- "use a right-handed UVN frame (V points down)");
- hestOptAdd(&hopt, "vs", "view-dir scaling", airTypeFloat, 1, 1, &vscl, "1",
- "scaling along view-direction of location of "
- "view-space lights");
- hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, NULL,
- "file to write output envmap to");
- hestOptAdd(&hopt, "d", "filename", airTypeString, 1, 1, &debugS, "",
- "Use this option to save out (to the given filename) a rendering "
- "of the front (on the left) and back (on the right) of a sphere "
- "as shaded with the new environment map. U increases "
- "right-ward, V increases downward. The back sphere half is "
- "rendered as though the front half was removed");
- hestOptAdd(&hopt, "err", NULL, airTypeInt, 0, 0, &doerr, NULL,
- "If using \"-d\", make the image represent the error between the "
- "real and quantized vector");
+ hestOptAdd_1_Other(&hopt, "i", "nlight", &nlight, NULL,
+ "input nrrd containing light information", nrrdHestNrrd);
+ hestOptAdd_1_UInt(&hopt, "b", "# bits", &bits, "16",
+ "number of bits to use for normal quantization, "
+ "between 8 and 16 inclusive. ");
+ hestOptAdd_3_Float(&hopt, "amb", "ambient RGB", amb, "0 0 0", "ambient light color");
+ hestOptAdd_3_Double(&hopt, "fr", "from point", cam->from, "1 0 0",
+ "position of camera, used to determine view vector");
+ hestOptAdd_3_Double(&hopt, "at", "at point", cam->at, "0 0 0",
+ "camera look-at point, used to determine view vector");
+ hestOptAdd_3_Double(&hopt, "up", "up vector", cam->up, "0 0 1",
+ "camera pseudo-up vector, used to determine view coordinates");
+ hestOptAdd_Flag(&hopt, "rh", &(cam->rightHanded),
+ "use a right-handed UVN frame (V points down)");
+ hestOptAdd_1_Float(&hopt, "vs", "view-dir scaling", &vscl, "1",
+ "scaling along view-direction of location of "
+ "view-space lights");
+ hestOptAdd_1_String(&hopt, "o", "filename", &outS, NULL,
+ "file to write output envmap to");
+ hestOptAdd_1_String(&hopt, "d", "filename", &debugS, "",
+ "Use this option to save out (to the given filename) a rendering "
+ "of the front (on the left) and back (on the right) of a sphere "
+ "as shaded with the new environment map. U increases "
+ "right-ward, V increases downward. The back sphere half is "
+ "rendered as though the front half was removed");
+ hestOptAdd_Flag(&hopt, "err", &doerr,
+ "If using \"-d\", make the image represent the error between the "
+ "real and quantized vector");
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, emapInfo, AIR_TRUE, AIR_TRUE,
AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
@@ -122,7 +121,7 @@
method = limnQN8octa;
break;
default:
- fprintf(stderr, "%s: requested #bits (%d) not in valid range [8,16]\n", me, bits);
+ fprintf(stderr, "%s: requested #bits (%u) not in valid range [8,16]\n", me, bits);
airMopError(mop);
return 1;
}
Modified: teem/trunk/src/bin/gprobe.c
===================================================================
--- teem/trunk/src/bin/gprobe.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/gprobe.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -272,64 +272,65 @@
airMopAdd(mop, hparm, AIR_CAST(airMopper, hestParmFree), airMopAlways);
hparm->elideSingleOtherType = AIR_TRUE;
hparm->respectDashDashHelp = AIR_TRUE;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input volume", NULL,
- NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL,
- "\"kind\" of volume (\"scalar\", \"vector\", "
- "\"tensor\", or \"dwi\")",
- NULL, NULL, meetHestGageKind);
- hestOptAdd(&hopt, "v", "verbosity", airTypeInt, 1, 1, &verbose, "1",
- "verbosity level");
- hestOptAdd(&hopt, "q", "query", airTypeString, 1, 1, &whatS, NULL,
- "the quantity (scalar, vector, or matrix) to learn by probing");
- hestOptAdd(&hopt, "gmc", "min gradmag", airTypeDouble, 1, 1, &gmc, "0.0",
- "For curvature-based queries, use zero when gradient "
- "magnitude is below this");
- hestOptAdd(&hopt, "ofs", "ofs", airTypeInt, 0, 0, &orientationFromSpacing, NULL,
- "If only per-axis spacing is available, use that to "
- "contrive full orientation info");
- hestOptAdd(&hopt, "seed", "N", airTypeUInt, 1, 1, &seed, "42",
- "RNG seed; mostly for debugging");
- hestOptAdd(&hopt, "c", "bool", airTypeBool, 1, 1, &clamp, "false",
- "clamp positions as part of probing");
- hestOptAdd(&hopt, "ev", "thresh val", airTypeDouble, 2, 2, edgeFracInfo, "1 0",
- "if using position clamping (with \"-c true\"), the fraction "
- "of values invented for the kernel support, or \"edge frac\" "
- "is saved per probe (0 means kernel support was entirely within "
- "data; 1 means everything was invented). "
- "If this frac exceeds the first \"thresh\" "
- "value given here, then the saved value for the probe will be "
- "the second value \"val\" given here");
- hestOptAdd(&hopt, "zz", "bool", airTypeBool, 1, 1, &zeroZ, "false",
- "enable \"zeroZ\" behavior in gage that partially "
- "implements working with 3D images as if they are 2D");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, NULL, "input volume", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "k", "kind", &kind, NULL,
+ "\"kind\" of volume (\"scalar\", \"vector\", "
+ "\"tensor\", or \"dwi\")",
+ meetHestGageKind);
+ hestOptAdd_1_Int(&hopt, "v", "verbosity", &verbose, "1", "verbosity level");
+ hestOptAdd_1_String(&hopt, "q", "query", &whatS, NULL,
+ "the quantity (scalar, vector, or matrix) to learn by probing");
+ hestOptAdd_1_Double(&hopt, "gmc", "min gradmag", &gmc, "0.0",
+ "For curvature-based queries, use zero when gradient "
+ "magnitude is below this");
+ hestOptAdd_Flag(&hopt, "ofs", &orientationFromSpacing,
+ "If only per-axis spacing is available, use that to "
+ "contrive full orientation info");
+ hestOptAdd_1_UInt(&hopt, "seed", "N", &seed, "42", "RNG seed; mostly for debugging");
+ hestOptAdd_1_Bool(&hopt, "c", "bool", &clamp, "false",
+ "clamp positions as part of probing");
+ hestOptAdd_2_Double(&hopt, "ev", "thresh val", edgeFracInfo, "1 0",
+ "if using position clamping (with \"-c true\"), the fraction "
+ "of values invented for the kernel support, or \"edge frac\" "
+ "is saved per probe (0 means kernel support was entirely within "
+ "data; 1 means everything was invented). "
+ "If this frac exceeds the first \"thresh\" "
+ "value given here, then the saved value for the probe will be "
+ "the second value \"val\" given here");
+ hestOptAdd_1_Bool(&hopt, "zz", "bool", &zeroZ, "false",
+ "enable \"zeroZ\" behavior in gage that partially "
+ "implements working with 3D images as if they are 2D");
- hestOptAdd(&hopt, "k00", "kern00", airTypeOther, 1, 1, &k00, "tent",
- "kernel for gageKernel00", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k11", "kern11", airTypeOther, 1, 1, &k11, "cubicd:1,0",
- "kernel for gageKernel11", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k22", "kern22", airTypeOther, 1, 1, &k22, "cubicdd:1,0",
- "kernel for gageKernel22", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "rn", NULL, airTypeInt, 0, 0, &renorm, NULL,
- "renormalize kernel weights at each new sample location. "
- "\"Accurate\" kernels don't need this; doing it always "
- "makes things go slower");
+ hestOptAdd_1_Other(&hopt, "k00", "kern00", &k00, "tent", "kernel for gageKernel00",
+ nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k11", "kern11", &k11, "cubicd:1,0",
+ "kernel for gageKernel11", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k22", "kern22", &k22, "cubicdd:1,0",
+ "kernel for gageKernel22", nrrdHestKernelSpec);
+ hestOptAdd_Flag(&hopt, "rn", &renorm,
+ "renormalize kernel weights at each new sample location. "
+ "\"Accurate\" kernels don't need this; doing it always "
+ "makes things go slower");
nsi = 0;
- nonSbpOpi[nsi++] = hestOptAdd(&hopt, "ssn", "SS #", airTypeUInt, 1, 1, &numSS, "0",
- "how many scale-space samples to evaluate, or, "
- "0 to turn-off all scale-space behavior");
- nonSbpOpi[nsi++] = hestOptAdd(&hopt, "ssr", "scale range", airTypeDouble, 2, 2,
- rangeSS, "nan nan", "range of scales in scale-space");
- nonSbpOpi[nsi++] = hestOptAdd(&hopt, "ssu", NULL, airTypeInt, 0, 0, &uniformSS, NULL,
- "do uniform samples along sigma, and not (by default) "
- "samples according to the effective diffusion scale");
- nonSbpOpi[nsi++] = hestOptAdd(&hopt, "sso", NULL, airTypeInt, 0, 0, &optimSS, NULL,
- "if not using \"-ssu\", use pre-computed optimal "
- "sigmas when possible");
- nonSbpOpi[nsi++] = hestOptAdd(&hopt, "kssb", "kernel", airTypeOther, 1, 1, &kSSblur,
- "dgauss:1,5", "blurring kernel, to sample scale space",
- NULL, NULL, nrrdHestKernelSpec);
+ nonSbpOpi[nsi++] /* */
+ = hestOptAdd_1_UInt(&hopt, "ssn", "SS #", &numSS, "0",
+ "how many scale-space samples to evaluate, or, "
+ "0 to turn-off all scale-space behavior");
+ nonSbpOpi[nsi++] /* */
+ = hestOptAdd_2_Double(&hopt, "ssr", "scale range", rangeSS, "nan nan",
+ "range of scales in scale-space");
+ nonSbpOpi[nsi++] /* */
+ = hestOptAdd_Flag(&hopt, "ssu", &uniformSS,
+ "do uniform samples along sigma, and not (by default) "
+ "samples according to the effective diffusion scale");
+ nonSbpOpi[nsi++] /* */
+ = hestOptAdd_Flag(&hopt, "sso", &optimSS,
+ "if not using \"-ssu\", use pre-computed optimal "
+ "sigmas when possible");
+ nonSbpOpi[nsi++] /* */
+ = hestOptAdd_1_Other(&hopt, "kssb", "kernel", &kSSblur, "dgauss:1,5",
+ "blurring kernel, to sample scale space", nrrdHestKernelSpec);
if (nsi != NON_SBP_OPT_NUM) {
fprintf(stderr, "%s: PANIC nsi %u != %u", me, nsi, NON_SBP_OPT_NUM);
exit(1);
@@ -341,56 +342,55 @@
/* These two options are needed even if sbp is used, because they are *not*
part of the gageStackBlurParm. In meet, this info is handled by the
extraFlag/extraParm construct, which is not available here */
- hestOptAdd(&hopt, "ssnd", NULL, airTypeInt, 0, 0, &normdSS, NULL,
- "normalize derivatives by scale");
- hestOptAdd(&hopt, "ssnb", "bias", airTypeDouble, 1, 1, &biasSS, "0.0",
- "bias on scale-based derivative normalization");
+ hestOptAdd_Flag(&hopt, "ssnd", &normdSS, "normalize derivatives by scale");
+ hestOptAdd_1_Double(&hopt, "ssnb", "bias", &biasSS, "0.0",
+ "bias on scale-based derivative normalization");
- hestOptAdd(&hopt, "ssf", "SS read/save format", airTypeString, 1, 1, &stackFnameFormat,
- "",
- "printf-style format (including a \"%u\") for the "
- "filenames from which to read "
- "pre-blurred volumes computed for the stack, if they "
- "exist and match the stack parameters, and where to save "
- "them if they had to be re-computed. Leave this as empty "
- "string to disable this.");
+ hestOptAdd_1_String(&hopt, "ssf", "SS read/save format", &stackFnameFormat, "",
+ "printf-style format (including a \"%u\") for the "
+ "filenames from which to read "
+ "pre-blurred volumes computed for the stack, if they "
+ "exist and match the stack parameters, and where to save "
+ "them if they had to be re-computed. Leave this as empty "
+ "string to disable this.");
- hestOptAdd(&hopt, "kssr", "kernel", airTypeOther, 1, 1, &kSS, "hermite",
- "kernel for reconstructing from scale space samples", NULL, NULL,
- nrrdHestKernelSpec);
- hestOptAdd(&hopt, "sit", "sit", airTypeBool, 1, 1, &scaleIsTau, "false",
- "in some places, scale should be interpreted as tau, not "
- "sigma. Currently limited to grid probing (via \"-pg\")");
+ hestOptAdd_1_Other(&hopt, "kssr", "kernel", &kSS, "hermite",
+ "kernel for reconstructing from scale space samples",
+ nrrdHestKernelSpec);
+ hestOptAdd_1_Bool(&hopt, "sit", "sit", &scaleIsTau, "false",
+ "in some places, scale should be interpreted as tau, not "
+ "sigma. Currently limited to grid probing (via \"-pg\")");
- hestOptAdd(&hopt, "s", "sclX sclY sxlZ", airTypeDouble, 3, 3, scale, "1 1 1",
- "scaling factor for resampling on each axis "
- "(>1.0: supersampling); use \"-ssp\" (and \"-psi\") "
- "to specify scale position of sampling");
- hestOptAdd(&hopt, "ssp", "pos", airTypeDouble, 1, 1, &posSS, "0",
- "when using scale-space, scale-position at which to probe");
- hestOptAdd(&hopt, "pg", "nrrd", airTypeOther, 1, 1, &_ngrid, "",
- "overrides \"-s\": "
- "2-D nrrd which specifies origin and direction vectors "
- "for sampling grid",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "pi", "nrrd", airTypeOther, 1, 1, &_npos, "",
- "overrides \"-pg\": probes at this list of 3-vec or "
- "4-vec positions",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "pp", "pos", airTypeDouble, 3, 4, &pntPos, "nan nan nan",
- "overrides \"-pi\": only sample at this specified point", &pntPosNum);
- hestOptAdd(&hopt, "eps", "epsilon", airTypeDouble, 1, 1, &eps, "0",
- "if non-zero, and if query is a scalar, and if using \"pp\" "
- "to query at a single point, then do epsilon offset probes "
- "to calculate discrete differences, to find the numerical "
- "gradient and hessian (for debugging)");
- hestOptAdd(&hopt, "psi", "p", airTypeBool, 1, 1, &probeSpaceIndex, "false",
- "whether the probe location specification (by any of "
- "the four previous flags) are in index space");
+ hestOptAdd_3_Double(&hopt, "s", "sclX sclY sxlZ", scale, "1 1 1",
+ "scaling factor for resampling on each axis "
+ "(>1.0: supersampling); use \"-ssp\" (and \"-psi\") "
+ "to specify scale position of sampling");
+ hestOptAdd_1_Double(&hopt, "ssp", "pos", &posSS, "0",
+ "when using scale-space, scale-position at which to probe");
+ hestOptAdd_1_Other(&hopt, "pg", "nrrd", &_ngrid, "",
+ "overrides \"-s\": "
+ "2-D nrrd which specifies origin and direction vectors "
+ "for sampling grid",
+ nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "pi", "nrrd", &_npos, "",
+ "overrides \"-pg\": probes at this list of 3-vec or "
+ "4-vec positions",
+ nrrdHestNrrd);
+ hestOptAdd_Nv_Double(&hopt, "pp", "pos", 3, 4, &pntPos, "nan nan nan",
+ "overrides \"-pi\": only sample at this specified point",
+ &pntPosNum);
+ hestOptAdd_1_Double(&hopt, "eps", "epsilon", &eps, "0",
+ "if non-zero, and if query is a scalar, and if using \"pp\" "
+ "to query at a single point, then do epsilon offset probes "
+ "to calculate discrete differences, to find the numerical "
+ "gradient and hessian (for debugging)");
+ hestOptAdd_1_Bool(&hopt, "psi", "p", &probeSpaceIndex, "false",
+ "whether the probe location specification (by any of "
+ "the four previous flags) are in index space");
- hestOptAdd(&hopt, "t", "type", airTypeEnum, 1, 1, &otype, "float",
- "type of output volume", NULL, nrrdType);
- hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-", "output volume");
+ hestOptAdd_1_Enum(&hopt, "t", "type", &otype, "float", "type of output volume",
+ nrrdType);
+ hestOptAdd_1_String(&hopt, "o", "nout", &outS, "-", "output volume");
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, probeInfo, AIR_TRUE, AIR_TRUE,
AIR_TRUE);
airMopAdd(mop, hopt, AIR_CAST(airMopper, hestOptFree), airMopAlways);
Modified: teem/trunk/src/bin/ilk.c
===================================================================
--- teem/trunk/src/bin/ilk.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/ilk.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -68,62 +68,62 @@
(which may be a hest bug) */
hparm->columns = AIR_MAX(59, wsz.ws_col - 2);
- hestOptAdd(&hopt, "i", "image", airTypeOther, 1, 1, &nin, "-", "input image", NULL,
- NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "0", "origin", airTypeOther, 1, 1, &origInfo, "p:0,0",
- "where to location (0,0) prior to applying transforms.\n "
- "\b\bo \"u:<float>,<float>\" locate origin in a unit box "
- "[0,1]x[0,1] which covers the original image\n "
- "\b\bo \"p:<float>,<float>\" locate origin at a particular "
- "pixel location, in the index space of the image",
- NULL, NULL, mossHestOrigin);
- hestOptAdd(&hopt, "t", "xform0", airTypeOther, 1, -1, &matList, NULL,
- "transform(s) to apply to image. Transforms "
- "are applied in the order in which they appear.\n "
- "\b\bo \"identity\": no geometric transform, just resampling\n "
- "\b\bo \"translate:x,y\": shift image by vector (x,y), as "
- "measured in pixels\n "
- "\b\bo \"rotate:ang\": rotate CCW by ang degrees\n "
- "\b\bo \"scale:xs,ys\": scale by xs in X, and ys in Y\n "
- "\b\bo \"shear:fix,amnt\": shear by amnt, keeping fixed "
- "the pixels along a direction <fix> degrees from the X axis\n "
- "\b\bo \"flip:ang\": flip along axis an angle <ang> degrees from "
- "the X axis\n "
- "\b\bo \"a,b,tx,c,d,ty\": specify the transform explicitly "
- "in row-major order (opposite of PostScript) ",
- &matListLen, NULL, mossHestTransform);
- hestOptAdd(&hopt, "k", "kernel", airTypeOther, 1, 1, &ksp, "cubic:0,0.5",
- "reconstruction kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "min", "xMin yMin", airTypeDouble, 2, 2, min, "nan nan",
- "lower bounding corner of output image. Default (by not "
- "using this option) is the lower corner of input image. ");
- hestOptAdd(&hopt, "max", "xMax yMax", airTypeDouble, 2, 2, max, "nan nan",
- "upper bounding corner of output image. Default (by not "
- "using this option) is the upper corner of input image. ");
- hestOptAdd(&hopt, "b", "boundary", airTypeEnum, 1, 1, &bound, "bleed",
- "what to do when sampling outside original image.\n "
- "\b\bo \"bleed\": copy values at image border outward\n "
- "\b\bo \"wrap\": do wrap-around on image locations\n "
- "\b\bo \"pad\": use a given background value (via \"-bg\")",
- NULL, nrrdBoundary);
- bkgIdx = hestOptAdd(&hopt, "bg", "bg0 bg1", airTypeDouble, 1, -1, &_bkg, "nan",
- "background color to use with boundary behavior \"pad\". "
- "Defaults to all zeroes.",
- &_bkgLen);
- hestOptAdd(&hopt, "s", "xSize ySize", airTypeOther, 2, 2, scale, "x1 x1",
- "For each axis, information about how many samples in output:\n "
- "\b\bo \"x<float>\": number of output samples is some scaling of "
- " the number input of samples; multiplied by <float>\n "
- "\b\bo \"<int>\": specify exact number of samples",
- NULL, NULL, &unrrduHestScaleCB);
- hestOptAdd(&hopt, "a", "avg #", airTypeUInt, 1, 1, &avgNum, "0",
- "number of averages (if there there is only one "
- "rotation as transform)");
- hestOptAdd(&hopt, "db", "x y", airTypeInt, 2, 2, debug, "-1 -1",
- "if both non-negative, turn on verbose debugging for this output "
- "image pixel");
- hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, "-",
- "file to write output nrrd to");
+ hestOptAdd_1_Other(&hopt, "i", "image", &nin, "-", "input image", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "0", "origin", &origInfo, "p:0,0",
+ "where to location (0,0) prior to applying transforms.\n "
+ "\b\bo \"u:<float>,<float>\" locate origin in a unit box "
+ "[0,1]x[0,1] which covers the original image\n "
+ "\b\bo \"p:<float>,<float>\" locate origin at a particular "
+ "pixel location, in the index space of the image",
+ mossHestOrigin);
+ hestOptAdd_Nv_Other(&hopt, "t", "xform0", 1, -1, &matList, NULL,
+ "transform(s) to apply to image. Transforms "
+ "are applied in the order in which they appear.\n "
+ "\b\bo \"identity\": no geometric transform, just resampling\n "
+ "\b\bo \"translate:x,y\": shift image by vector (x,y), as "
+ "measured in pixels\n "
+ "\b\bo \"rotate:ang\": rotate CCW by ang degrees\n "
+ "\b\bo \"scale:xs,ys\": scale by xs in X, and ys in Y\n "
+ "\b\bo \"shear:fix,amnt\": shear by amnt, keeping fixed "
+ "the pixels along a direction <fix> degrees from the X axis\n "
+ "\b\bo \"flip:ang\": flip along axis an angle <ang> degrees from "
+ "the X axis\n "
+ "\b\bo \"a,b,tx,c,d,ty\": specify the transform explicitly "
+ "in row-major order (opposite of PostScript) ",
+ &matListLen, mossHestTransform);
+ hestOptAdd_1_Other(&hopt, "k", "kernel", &ksp, "cubic:0,0.5", "reconstruction kernel",
+ nrrdHestKernelSpec);
+ hestOptAdd_2_Double(&hopt, "min", "xMin yMin", min, "nan nan",
+ "lower bounding corner of output image. Default (by not "
+ "using this option) is the lower corner of input image. ");
+ hestOptAdd_2_Double(&hopt, "max", "xMax yMax", max, "nan nan",
+ "upper bounding corner of output image. Default (by not "
+ "using this option) is the upper corner of input image. ");
+ hestOptAdd_1_Enum(&hopt, "b", "boundary", &bound, "bleed",
+ "what to do when sampling outside original image.\n "
+ "\b\bo \"bleed\": copy values at image border outward\n "
+ "\b\bo \"wrap\": do wrap-around on image locations\n "
+ "\b\bo \"pad\": use a given background value (via \"-bg\")",
+ nrrdBoundary);
+ bkgIdx
+ = hestOptAdd_Nv_Double(&hopt, "bg", "bg0 bg1", 1, -1, &_bkg, "nan",
+ "background color to use with boundary behavior \"pad\". "
+ "Defaults to all zeroes.",
+ &_bkgLen);
+ hestOptAdd_2_Other(&hopt, "s", "xSize ySize", scale, "x1 x1",
+ "For each axis, information about how many samples in output:\n "
+ "\b\bo \"x<float>\": number of output samples is some scaling of "
+ " the number input of samples; multiplied by <float>\n "
+ "\b\bo \"<int>\": specify exact number of samples",
+ &unrrduHestScaleCB);
+ hestOptAdd_1_UInt(&hopt, "a", "avg #", &avgNum, "0",
+ "number of averages (if there there is only one "
+ "rotation as transform)");
+ hestOptAdd_2_Int(&hopt, "db", "x y", debug, "-1 -1",
+ "if both non-negative, turn on verbose debugging for this output "
+ "image pixel");
+ hestOptAdd_1_String(&hopt, "o", "filename", &outS, "-",
+ "file to write output nrrd to");
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, ilkInfo, AIR_TRUE, AIR_TRUE,
AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/bin/miter.c
===================================================================
--- teem/trunk/src/bin/miter.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/miter.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -54,80 +54,79 @@
hparm->respectDashDashHelp = AIR_TRUE;
hparm->respFileEnable = AIR_TRUE;
hparm->elideMultipleNonExistFloatDefault = AIR_TRUE;
- hestOptAdd(&hopt, "i", "nsin", airTypeOther, 1, 1, &(muu->nsin), "",
- "input scalar volume to render", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "vi", "nvin", airTypeOther, 1, 1, &(muu->nvin), "",
- "input vector volume to render", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "ti", "ntin", airTypeOther, 1, 1, &(muu->ntin), "",
- "input tensor volume to render", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "txf", "nin", airTypeOther, 1, -1, &(muu->ntxf), NULL,
- "one or more transfer functions", &(muu->ntxfNum), NULL, nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "i", "nsin", &(muu->nsin), "",
+ "input scalar volume to render", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "vi", "nvin", &(muu->nvin), "",
+ "input vector volume to render", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "ti", "ntin", &(muu->ntin), "",
+ "input tensor volume to render", nrrdHestNrrd);
+ hestOptAdd_Nv_Other(&hopt, "txf", "nin", 1, -1, &(muu->ntxf), NULL,
+ "one or more transfer functions", &(muu->ntxfNum), nrrdHestNrrd);
limnHestCameraOptAdd(&hopt, muu->hctx->cam, NULL, "0 0 0", "0 0 1", NULL, NULL, NULL,
"nan nan", "nan nan", "20");
- hestOptAdd(&hopt, "offfr", NULL, airTypeInt, 0, 0, &offfr, NULL,
- "the given eye point (\"-fr\") is to be interpreted "
- "as an offset from the at point.");
- hestOptAdd(&hopt, "ffr", "fake from", airTypeDouble, 3, 3, &(muu->fakeFrom),
- "nan nan nan",
- "eye point to use for view-dependent transfer functions. "
- "By default (not using this option), the point used is the "
- "normally specified camera eye point.");
- hestOptAdd(&hopt, "turn", "angle", airTypeDouble, 1, 1, &turn, "0.0",
- "angle (degrees) by which to rotate the from point around "
- "true up, for making stereo pairs. Positive means move "
- "towards positive U (the right)");
- hestOptAdd(&hopt, "am", "ambient", airTypeFloat, 3, 3, muu->lit->amb, "1 1 1",
- "ambient light color");
- hestOptAdd(&hopt, "ld", "light pos", airTypeFloat, 3, 3, muu->lit->_dir[0], "0 0 -1",
- "view space light position (extended to infinity)");
- hestOptAdd(&hopt, "is", "image size", airTypeInt, 2, 2, muu->hctx->imgSize, "256 256",
- "image dimensions");
- hestOptAdd(&hopt, "iss", "scale", airTypeFloat, 1, 1, &isScale, "1.0",
- "scaling of image size (from \"is\")");
- hestOptAdd(&hopt, "ads", "ka kd ks", airTypeFloat, 3, 3, ads, "0.1 0.6 0.3",
- "phong components");
+ hestOptAdd_Flag(&hopt, "offfr", &offfr,
+ "the given eye point (\"-fr\") is to be interpreted "
+ "as an offset from the at point.");
+ hestOptAdd_3_Double(&hopt, "ffr", "fake from", muu->fakeFrom, "nan nan nan",
+ "eye point to use for view-dependent transfer functions. "
+ "By default (not using this option), the point used is the "
+ "normally specified camera eye point.");
+ hestOptAdd_1_Double(&hopt, "turn", "angle", &turn, "0.0",
+ "angle (degrees) by which to rotate the from point around "
+ "true up, for making stereo pairs. Positive means move "
+ "towards positive U (the right)");
+ hestOptAdd_3_Float(&hopt, "am", "ambient", muu->lit->amb, "1 1 1",
+ "ambient light color");
+ hestOptAdd_3_Float(&hopt, "ld", "light pos", muu->lit->_dir[0], "0 0 -1",
+ "view space light position (extended to infinity)");
+ hestOptAdd_2_UInt(&hopt, "is", "image size", muu->hctx->imgSize, "256 256",
+ "image dimensions");
+ hestOptAdd_1_Float(&hopt, "iss", "scale", &isScale, "1.0",
+ "scaling of image size (from \"is\")");
+ hestOptAdd_3_Float(&hopt, "ads", "ka kd ks", ads, "0.1 0.6 0.3", "phong components");
+ /* mite_at could be float or double */
hestOptAdd(&hopt, "sp", "spec pow", mite_at, 1, 1, &(muu->rangeInit[miteRangeSP]),
"30", "phong specular power");
- hestOptAdd(&hopt, "k00", "kernel", airTypeOther, 1, 1, &(muu->ksp[gageKernel00]),
- "tent", "value reconstruction kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k11", "kernel", airTypeOther, 1, 1, &(muu->ksp[gageKernel11]),
- "cubicd:1,0", "first derivative kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k22", "kernel", airTypeOther, 1, 1, &(muu->ksp[gageKernel22]),
- "cubicdd:1,0", "second derivative kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "ss", "shading spec", airTypeString, 1, 1, &shadeStr,
- "phong:gage(scalar:n)", "how to do shading");
- hestOptAdd(&hopt, "ns", "normal spec", airTypeString, 1, 1, &normalStr, "",
- "\"normal\" to use for those miteVal's that need one");
- hestOptAdd(&hopt, "side", "normal side", airTypeInt, 1, 1, &(muu->normalSide), "1",
- "how to interpret gradients as normals:\n "
- "\b\bo \"1\": normal points to lower values (higher == "
- "more \"inside\")\n "
- "\b\bo \"0\": \"two-sided\": dot-products are abs()'d\n "
- "\b\bo \"-1\": normal points to higher values (lower == "
- "more \"inside\")");
- hestOptAdd(&hopt, "rn", NULL, airTypeBool, 0, 0, &renorm, NULL,
- "renormalize kernel weights at each new sample location. "
- "\"Accurate\" kernels don't need this; doing it always "
- "makes things go slower");
- hestOptAdd(&hopt, "gmc", "min gradmag", airTypeDouble, 1, 1, &gmc, "0.0",
- "For curvature-based transfer functions, set curvature to "
- "zero when gradient magnitude is below this");
- hestOptAdd(&hopt, "step", "size", airTypeDouble, 1, 1, &(muu->rayStep), "0.01",
- "step size along ray in world space");
- hestOptAdd(&hopt, "ref", "size", airTypeDouble, 1, 1, &(muu->refStep), "0.01",
- "\"reference\" step size (world space) for doing "
- "opacity correction in compositing");
- hestOptAdd(&hopt, "vp", "verbose pixel", airTypeInt, 2, 2, verbPix, "-1 -1",
- "pixel for which to turn on verbose messages");
- hestOptAdd(&hopt, "n1", "near1", airTypeDouble, 1, 1, &(muu->opacNear1), "0.99",
- "opacity close enough to 1.0 to terminate ray");
- hestOptAdd(&hopt, "nt", "# threads", airTypeInt, 1, 1, &(muu->hctx->numThreads), "1",
- (airThreadCapable
- ? "number of threads hoover should use"
- : "if pthreads where enabled in this Teem build, this is how "
- "you would control the number of threads hoover should use"));
- hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, NULL,
- "file to write output nrrd to");
+ hestOptAdd_1_Other(&hopt, "k00", "kernel", &(muu->ksp[gageKernel00]), "tent",
+ "value reconstruction kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k11", "kernel", &(muu->ksp[gageKernel11]), "cubicd:1,0",
+ "first derivative kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k22", "kernel", &(muu->ksp[gageKernel22]), "cubicdd:1,0",
+ "second derivative kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_String(&hopt, "ss", "shading spec", &shadeStr, "phong:gage(scalar:n)",
+ "how to do shading");
+ hestOptAdd_1_String(&hopt, "ns", "normal spec", &normalStr, "",
+ "\"normal\" to use for those miteVal's that need one");
+ hestOptAdd_1_Int(&hopt, "side", "normal side", &(muu->normalSide), "1",
+ "how to interpret gradients as normals:\n "
+ "\b\bo \"1\": normal points to lower values (higher == "
+ "more \"inside\")\n "
+ "\b\bo \"0\": \"two-sided\": dot-products are abs()'d\n "
+ "\b\bo \"-1\": normal points to higher values (lower == "
+ "more \"inside\")");
+ hestOptAdd_Flag(&hopt, "rn", &renorm,
+ "renormalize kernel weights at each new sample location. "
+ "\"Accurate\" kernels don't need this; doing it always "
+ "makes things go slower");
+ hestOptAdd_1_Double(&hopt, "gmc", "min gradmag", &gmc, "0.0",
+ "For curvature-based transfer functions, set curvature to "
+ "zero when gradient magnitude is below this");
+ hestOptAdd_1_Double(&hopt, "step", "size", &(muu->rayStep), "0.01",
+ "step size along ray in world space");
+ hestOptAdd_1_Double(&hopt, "ref", "size", &(muu->refStep), "0.01",
+ "\"reference\" step size (world space) for doing "
+ "opacity correction in compositing");
+ hestOptAdd_2_Int(&hopt, "vp", "verbose pixel", verbPix, "-1 -1",
+ "pixel for which to turn on verbose messages");
+ hestOptAdd_1_Double(&hopt, "n1", "near1", &(muu->opacNear1), "0.99",
+ "opacity close enough to 1.0 to terminate ray");
+ hestOptAdd_1_UInt(&hopt, "nt", "# threads", &(muu->hctx->numThreads), "1",
+ (airThreadCapable
+ ? "number of threads hoover should use"
+ : "if pthreads where enabled in this Teem build, this is how "
+ "you would control the number of threads hoover should use"));
+ hestOptAdd_1_String(&hopt, "o", "filename", &outS, NULL,
+ "file to write output nrrd to");
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, miteInfo, AIR_TRUE, AIR_TRUE,
AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/bin/mrender.c
===================================================================
--- teem/trunk/src/bin/mrender.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/mrender.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -460,54 +460,55 @@
uu = mrendUserNew();
airMopAdd(mop, uu, (airMopper)mrendUserNix, airMopAlways);
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &(uu->nin), NULL,
- "input nrrd to render", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &(uu->kind), NULL,
- "\"kind\" of volume (\"scalar\", \"vector\", or \"tensor\")", NULL, NULL,
- meetHestGageKind);
+ hestOptAdd_1_Other(&hopt, "i", "nin", &(uu->nin), NULL, "input nrrd to render",
+ nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "k", "kind", &(uu->kind), NULL,
+ "\"kind\" of volume (\"scalar\", \"vector\", or \"tensor\")",
+ meetHestGageKind);
limnHestCameraOptAdd(&hopt, uu->hctx->cam, NULL, "0 0 0", "0 0 1", NULL, NULL, NULL,
"nan nan", "nan nan", "20");
- hestOptAdd(&hopt, "offfr", NULL, airTypeInt, 0, 0, &offfr, NULL,
- "the given eye point (\"-fr\") is to be interpreted "
- "as an offset from the at point.");
- hestOptAdd(&hopt, "turn", "angle", airTypeDouble, 1, 1, &turn, "0.0",
- "angle (degrees) by which to rotate the from point around "
- "true up, for making stereo pairs. Positive means move "
- "towards positive U (the right)");
- hestOptAdd(&hopt, "is", "image size", airTypeInt, 2, 2, uu->hctx->imgSize, "256 256",
- "image dimensions");
- hestOptAdd(&hopt, "iss", "scale", airTypeFloat, 1, 1, &isScale, "1.0",
- "scaling of image size (from \"is\")");
- hestOptAdd(&hopt, "k00", "kernel", airTypeOther, 1, 1, &(uu->ksp[gageKernel00]),
- "tent", "value reconstruction kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k11", "kernel", airTypeOther, 1, 1, &(uu->ksp[gageKernel11]),
- "cubicd:1,0", "first derivative kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k22", "kernel", airTypeOther, 1, 1, &(uu->ksp[gageKernel22]),
- "cubicdd:1,0", "second derivative kernel", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "rn", NULL, airTypeBool, 0, 0, &renorm, NULL,
- "renormalize kernel weights at each new sample location. "
- "\"Accurate\" kernels don't need this; doing it always "
- "makes things go slower");
- hestOptAdd(&hopt, "q", "query", airTypeString, 1, 1, &whatS, NULL,
- "the quantity (scalar, vector, or matrix) to learn by probing");
- hestOptAdd(&hopt, "m", "measure", airTypeEnum, 1, 1, &(uu->measr), NULL,
- "how to collapse list of ray samples into one scalar. " NRRD_MEASURE_DESC,
- NULL, nrrdMeasure);
- hestOptAdd(&hopt, "gmc", "min gradmag", airTypeDouble, 1, 1, &gmc, "0.0",
- "For curvature-related queries, set answer to zero when "
- "gradient magnitude is below this");
- hestOptAdd(&hopt, "fn", "from nan", airTypeDouble, 1, 1, &(uu->fromNaN), "nan",
- "When histo-based measures generate NaN answers, the "
- "value that should be substituted for NaN.");
- hestOptAdd(&hopt, "step", "size", airTypeDouble, 1, 1, &(uu->rayStep), "0.01",
- "step size along ray in world space");
- hestOptAdd(&hopt, "nt", "# threads", airTypeInt, 1, 1, &(uu->hctx->numThreads), "1",
- "number of threads hoover should use");
- hestOptAdd(&hopt, "vp", "img coords", airTypeInt, 2, 2, &(uu->verbPixel), "-1 -1",
- "pixel coordinates for which to turn on all verbose "
- "debugging messages, or \"-1 -1\" to disable this.");
- hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &(uu->outS), "-",
- "file to write output nrrd to. Defaults to stdout (\"-\").");
+ hestOptAdd_Flag(&hopt, "offfr", &offfr,
+ "the given eye point (\"-fr\") is to be interpreted "
+ "as an offset from the at point.");
+ hestOptAdd_1_Double(&hopt, "turn", "angle", &turn, "0.0",
+ "angle (degrees) by which to rotate the from point around "
+ "true up, for making stereo pairs. Positive means move "
+ "towards positive U (the right)");
+ hestOptAdd_2_UInt(&hopt, "is", "image size", uu->hctx->imgSize, "256 256",
+ "image dimensions");
+ hestOptAdd_1_Float(&hopt, "iss", "scale", &isScale, "1.0",
+ "scaling of image size (from \"is\")");
+ hestOptAdd_1_Other(&hopt, "k00", "kernel", &(uu->ksp[gageKernel00]), "tent",
+ "value reconstruction kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k11", "kernel", &(uu->ksp[gageKernel11]), "cubicd:1,0",
+ "first derivative kernel", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k22", "kernel", &(uu->ksp[gageKernel22]), "cubicdd:1,0",
+ "second derivative kernel", nrrdHestKernelSpec);
+ hestOptAdd_Flag(&hopt, "rn", &renorm,
+ "renormalize kernel weights at each new sample location. "
+ "\"Accurate\" kernels don't need this; doing it always "
+ "makes things go slower");
+ hestOptAdd_1_String(&hopt, "q", "query", &whatS, NULL,
+ "the quantity (scalar, vector, or matrix) to learn by probing");
+ hestOptAdd_1_Enum(&hopt, "m", "measure", &(uu->measr), NULL,
+ "how to collapse list of "
+ "ray samples into one scalar. " NRRD_MEASURE_DESC,
+ nrrdMeasure);
+ hestOptAdd_1_Double(&hopt, "gmc", "min gradmag", &gmc, "0.0",
+ "For curvature-related queries, set answer to zero when "
+ "gradient magnitude is below this");
+ hestOptAdd_1_Double(&hopt, "fn", "from nan", &(uu->fromNaN), "nan",
+ "When histo-based measures generate NaN answers, the "
+ "value that should be substituted for NaN.");
+ hestOptAdd_1_Double(&hopt, "step", "size", &(uu->rayStep), "0.01",
+ "step size along ray in world space");
+ hestOptAdd_1_UInt(&hopt, "nt", "# threads", &(uu->hctx->numThreads), "1",
+ "number of threads hoover should use");
+ hestOptAdd_2_Int(&hopt, "vp", "img coords", uu->verbPixel, "-1 -1",
+ "pixel coordinates for which to turn on all verbose "
+ "debugging messages, or \"-1 -1\" to disable this.");
+ hestOptAdd_1_String(&hopt, "o", "filename", &(uu->outS), "-",
+ "file to write output nrrd to. Defaults to stdout (\"-\").");
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, info, AIR_TRUE, AIR_TRUE,
Modified: teem/trunk/src/bin/overrgb.c
===================================================================
--- teem/trunk/src/bin/overrgb.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/overrgb.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -78,37 +78,36 @@
hparm = hestParmNew();
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
hparm->respectDashDashHelp = AIR_TRUE;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input nrrd to composite", NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "c", "contrast", airTypeDouble, 1, 1, &contr, "0.0",
- "contrast to apply to RGB values, before gamma. \"0.0\" "
- "means no change, \"1.0\" means thresholding, \"-1.0\" "
- "means a complete washout.");
- hestOptAdd(&hopt, "cfp", "fixed point", airTypeDouble, 1, 1, &cfp, "0.5",
- "component level that doesn't change with contrast");
- hestOptAdd(&hopt, "g", "gamma", airTypeString, 1, 1, &gammaS, "1.0",
- "gamma to apply to image data, after contrast. Can be "
- "a number (<1 to darken >1 to brighten) or the string "
- "\"srgb\" to apply the roughly 2.2 gamma associated "
- "with sRGB (see https://en.wikipedia.org/wiki/SRGB). ");
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, NULL, "input nrrd to composite",
+ nrrdHestNrrd);
+ hestOptAdd_1_Double(&hopt, "c", "contrast", &contr, "0.0",
+ "contrast to apply to RGB values, before gamma. \"0.0\" "
+ "means no change, \"1.0\" means thresholding, \"-1.0\" "
+ "means a complete washout.");
+ hestOptAdd_1_Double(&hopt, "cfp", "fixed point", &cfp, "0.5",
+ "component level that doesn't change with contrast");
+ hestOptAdd_1_String(&hopt, "g", "gamma", &gammaS, "1.0",
+ "gamma to apply to image data, after contrast. Can be "
+ "a number (<1 to darken >1 to brighten) or the string "
+ "\"srgb\" to apply the roughly 2.2 gamma associated "
+ "with sRGB (see https://en.wikipedia.org/wiki/SRGB). ");
srgbIdx = /* HEY copied to unrrdu/quantize.c */
- hestOptAdd(&hopt, "srgb", "intent", airTypeEnum, 1, 1, &srgb, "none",
- /* the default is "none" for backwards compatibility: until now
- Teem's support of PNG hasn't handled the sRGB intent, so
- we shouldn't start using it without being asked */
- "If saving to PNG (when supported), how to set the rendering "
- "intent in the sRGB chunk of the PNG file format. Can be "
- "absolute, relative, perceptual, saturation, or none. This is "
- "independent of using \"srgb\" as the -g gamma",
- NULL, nrrdFormatPNGsRGBIntent);
- hestOptAdd(&hopt, "b", "background", airTypeDouble, 3, 3, back, "0 0 0",
- "background color to composite against; white is "
- "1 1 1, not 255 255 255.");
- hestOptAdd(&hopt, "bi", "nbg", airTypeOther, 1, 1, &_nbg, "",
- "8-bit RGB background image to composite against", NULL, NULL,
- nrrdHestNrrd);
- hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, NULL,
- "file to write output PPM image to");
+ hestOptAdd_1_Enum(&hopt, "srgb", "intent", &srgb, "none",
+ /* the default is "none" for backwards compatibility: until now
+ Teem's support of PNG hasn't handled the sRGB intent, so
+ we shouldn't start using it without being asked */
+ "If saving to PNG (when supported), how to set the rendering "
+ "intent in the sRGB chunk of the PNG file format. Can be "
+ "absolute, relative, perceptual, saturation, or none. This is "
+ "independent of using \"srgb\" as the -g gamma",
+ NULL, nrrdFormatPNGsRGBIntent);
+ hestOptAdd_3_Double(&hopt, "b", "background", back, "0 0 0",
+ "background color to composite against; white is "
+ "1 1 1, not 255 255 255.");
+ hestOptAdd_1_Other(&hopt, "bi", "nbg", &_nbg, "",
+ "8-bit RGB background image to composite against", nrrdHestNrrd);
+ hestOptAdd_1_String(&hopt, "o", "filename", &outS, NULL,
+ "file to write output PPM image to");
hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, overInfo, AIR_TRUE, AIR_TRUE,
AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
Modified: teem/trunk/src/bin/pprobe.c
===================================================================
--- teem/trunk/src/bin/pprobe.c 2023-07-13 11:59:58 UTC (rev 7086)
+++ teem/trunk/src/bin/pprobe.c 2023-07-13 12:27:54 UTC (rev 7087)
@@ -82,76 +82,74 @@
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
hparm->elideSingleOtherType = AIR_TRUE;
hparm->respectDashDashHelp = AIR_TRUE;
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL, "input volume", NULL,
- NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL,
- "\"kind\" of volume (\"scalar\", \"vector\", or \"tensor\")", NULL, NULL,
- meetHestGageKind);
- hestOptAdd(&hopt, "p", "x y z", airTypeFloat, 3, 3, pos, NULL,
- "the position in space at which to probe");
- hestOptAdd(&hopt, "wsp", NULL, airTypeInt, 0, 0, &worldSpace, NULL,
- "if using this option, position (\"-p\") will be in world "
- "space, instead of index space (the default)");
- hestOptAdd(&hopt, "pi", "lpld in", airTypeOther, 1, 1, &lpld, "",
- "input polydata (overrides \"-p\")", NULL, NULL, limnHestPolyDataLMPD);
- hestOptAdd(&hopt, "pl", "x y z s", airTypeFloat, 4, 4, lineInfo, "0 0 0 0",
- "probe along line, instead of at point. "
- "The \"-p\" three coords are the line start point. "
- "If \"s\" is zero, (x,y,z) is the line end point. "
- "If \"s\" is non-zero, (x,y,z) is the line direction, "
- "which is scaled to have length \"s\", "
- "and then used as the step between line samples. ");
- hestOptAdd(&hopt, "pln", "num", airTypeUInt, 1, 1, &lineStepNum, "0",
- "if non-zero, number of steps of probing to do along line, "
- "which overrides \"-p\" and \"-pi\"");
- hestOptAdd(&hopt, "v", "verbosity", airTypeInt, 1, 1, &verbose, "1",
- "verbosity level");
- hestOptAdd(&hopt, "q", "query", airTypeString, 1, 1, &whatS, NULL,
- "the quantity (scalar, vector, or matrix) to learn by probing");
- hestOptAdd(&hopt, "eps", "epsilon", airTypeDouble, 1, 1, &eps, "0",
- "if non-zero, and if query is a scalar, epsilon around probe "
- "location where we will do discrete differences to find the "
- "gradient and hessian (for debugging)");
- hestOptAdd(&hopt, "k00", "kern00", airTypeOther, 1, 1, &k00, "tent",
- "kernel for gageKernel00", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k11", "kern11", airTypeOther, 1, 1, &k11, "cubicd:1,0",
- "kernel for gageKernel11", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k22", "kern22", airTypeOther, 1, 1, &k22, "cubicdd:1,0",
- "kernel for gageKernel22", NULL, NULL, nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "i", "nin", &nin, NULL, "input volume", nrrdHestNrrd);
+ hestOptAdd_1_Other(&hopt, "k", "kind", &kind, NULL,
+ "\"kind\" of volume (\"scalar\", \"vector\", or \"tensor\")",
+ meetHestGageKind);
+ hestOptAdd_3_Float(&hopt, "p", "x y z", pos, NULL,
+ "the position in space at which to probe");
+ hestOptAdd_Flag(&hopt, "wsp", &worldSpace,
+ "if using this option, position (\"-p\") will be in world "
+ "space, instead of index space (the default)");
+ hestOptAdd_1_Other(&hopt, "pi", "lpld in", &lpld, "",
+ "input polydata (overrides \"-p\")", limnHestPolyDataLMPD);
+ hestOptAdd_4_Float(&hopt, "pl", "x y z s", lineInfo, "0 0 0 0",
+ "probe along line, instead of at point. "
+ "The \"-p\" three coords are the line start point. "
+ "If \"s\" is zero, (x,y,z) is the line end point. "
+ "If \"s\" is non-zero, (x,y,z) is the line direction, "
+ "which is scaled to have length \"s\", "
+ "and then used as the step between line samples. ");
+ hestOptAdd_1_UInt(&hopt, "pln", "num", &lineStepNum, "0",
+ "if non-zero, number of steps of probing to do along line, "
+ "which overrides \"-p\" and \"-pi\"");
+ hestOptAdd_1_Int(&hopt, "v", "verbosity", &verbose, "1", "verbosity level");
+ hestOptAdd_1_String(&hopt, "q", "query", &whatS, NULL,
+ "the quantity (scalar, vector, or matrix) to learn by probing");
+ hestOptAdd_1_Double(&hopt, "eps", "epsilon", &eps, "0",
+ "if non-zero, and if query is a scalar, epsilon around probe "
+ "location where we will do discrete differences to find the "
+ "gradient and hessian (for debugging)");
+ hestOptAdd_1_Other(&hopt, "k00", "kern00", &k00, "tent", /* */
+ "kernel for gageKernel00", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k11", "kern11", &k11, "cubicd:1,0",
+ "kernel for gageKernel11", nrrdHestKernelSpec);
+ hestOptAdd_1_Other(&hopt, "k22", "kern22", &k22, "cubicdd:1,0",
+ "kernel for gageKernel22", nrrdHestKernelSpec);
- hestOptAdd(&hopt, "ssn", "SS #", airTypeUInt, 1, 1, &numSS, "0",
- "how many scale-space samples to evaluate, or, "
- "0 to turn-off all scale-space behavior");
- hestOptAdd(&hopt, "ssr", "scale range", airTypeDouble, 2, 2, rangeSS, "nan nan",
- "range of scales in scale-space");
- hestOptAdd(&hopt, "sss", "scale save path", airTypeString, 1, 1, &stackSavePath, "",
- "give a non-empty path string (like \"./\") to save out "
- "the pre-blurred volumes computed for the stack");
- hestOptAdd(&hopt, "ssp", "SS pos", airTypeDouble, 1, 1, &posSS, "0",
- "position at which to sample in scale-space");
- hestOptAdd(&hopt, "kssblur", "kernel", airTypeOther, 1, 1, &kSSblur, "dgauss:1,5",
- "blurring kernel, to sample scale space", NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "kss", "kernel", airTypeOther, 1, 1, &kSS, "tent",
- "kernel for reconstructing from scale space samples", NULL, NULL,
- nrrdHestKernelSpec);
- hestOptAdd(&hopt, "ssnd", "ssnd", airTypeInt, 1, 1, &SSnormd, "0",
- "enable derivative normalization based on scale space");
- hestOptAdd(&hopt, "ssu", NULL, airTypeInt, 0, 0, &SSuniform, NULL,
- "do uniform samples along sigma, and not (by default) "
- "samples according to the logarithm of diffusion time");
+ hestOptAdd_1_UInt(&hopt, "ssn", "SS #", &numSS, "0",
+ "how many scale-space samples to evaluate, or, "
+ "0 to turn-off all scale-space behavior");
+ hestOptAdd_2_Double(&hopt, "ssr", "scale range", rangeSS, "nan nan",
+ "range of scales in scale-space");
+ hestOptAdd_1_String(&hopt, "sss", "scale save path", &stackSavePath, "",
+ "give a non-empty path string (like \"./\") to save out "
+ "the pre-blurred volumes computed for the stack");
+ hestOptAdd_1_Doubl...
[truncated message content] |