|
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.
|