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