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