From: <kin...@us...> - 2009-10-26 11:33:21
|
Revision: 4319 http://teem.svn.sourceforge.net/teem/?rev=4319&view=rev Author: kindlmann Date: 2009-10-26 11:33:14 +0000 (Mon, 26 Oct 2009) Log Message: ----------- long overdue simplifications of various binaries that can now use meetHestGageKind as a uniform way of parsing gageKinds with hest Modified Paths: -------------- teem/trunk/src/bin/GNUmakefile teem/trunk/src/bin/deconv.c teem/trunk/src/bin/gprobe.c teem/trunk/src/bin/mrender.c teem/trunk/src/bin/pprobe.c teem/trunk/src/bin/vprobe.c Modified: teem/trunk/src/bin/GNUmakefile =================================================================== --- teem/trunk/src/bin/GNUmakefile 2009-10-26 11:30:32 UTC (rev 4318) +++ teem/trunk/src/bin/GNUmakefile 2009-10-26 11:33:14 UTC (rev 4319) @@ -101,11 +101,11 @@ ungantry.need = $(call meneed,gage nrrd biff hest air) talkweb.need = $(call meneed,nrrd biff hest air) tend.need = $(call meneed,ten limn gage dye unrrdu nrrd ell biff air) -mrender.need = $(call meneed,ten hoover limn gage nrrd biff hest air) -vprobe.need = $(call meneed,ten limn gage nrrd ell biff hest air) -gprobe.need = $(call meneed,ten limn gage nrrd ell biff hest air) -deconv.need = $(call meneed,ten limn gage nrrd ell biff hest air) -pprobe.need = $(call meneed,ten limn gage nrrd ell biff hest air) +mrender.need = $(call meneed,meet ten hoover limn gage nrrd biff hest air) +vprobe.need = $(call meneed,meet ten limn gage nrrd ell biff hest air) +gprobe.need = $(call meneed,meet ten limn gage nrrd ell biff hest air) +deconv.need = $(call meneed,meet ten limn gage nrrd ell biff hest air) +pprobe.need = $(call meneed,meet ten limn gage nrrd ell biff hest air) spots.need = $(call meneed,alan nrrd ell biff hest air) ## Old: "We need some way of expressing the fact that a given binary Modified: teem/trunk/src/bin/deconv.c =================================================================== --- teem/trunk/src/bin/deconv.c 2009-10-26 11:30:32 UTC (rev 4318) +++ teem/trunk/src/bin/deconv.c 2009-10-26 11:33:14 UTC (rev 4319) @@ -28,6 +28,7 @@ #include <teem/nrrd.h> #include <teem/gage.h> #include <teem/ten.h> +#include <teem/meet.h> #define SPACING(spc) (AIR_EXISTS(spc) ? spc: nrrdDefaultSpacing) @@ -40,53 +41,6 @@ (l)[5] = (m)[7], \ (l)[6] = (m)[8] ) -int -probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) { - char me[] = "probeParseKind"; - gageKind **kindP; - - if (!(ptr && str)) { - sprintf(err, "%s: got NULL pointer", me); - return 1; - } - kindP = (gageKind **)ptr; - airToLower(str); - if (!strcmp("scalar", str)) { - *kindP = gageKindScl; - } else if (!strcmp("vector", str)) { - *kindP = gageKindVec; - } else if (!strcmp("tensor", str)) { - *kindP = tenGageKind; - } else if (!strcmp("dwi", str)) { - *kindP = tenDwiGageKindNew(); - } else { - sprintf(err, "%s: not \"scalar\", \"vector\", \"tensor\", or \"dwi\"", me); - return 1; - } - - return 0; -} - -void * -probeParseKindDestroy(void *ptr) { - gageKind *kind; - - if (ptr) { - kind = AIR_CAST(gageKind *, ptr); - if (!strcmp(TEN_DWI_GAGE_KIND_NAME, kind->name)) { - tenDwiGageKindNix(kind); - } - } - return NULL; -} - -hestCB probeKindHestCB = { - sizeof(gageKind *), - "kind", - probeParseKind, - probeParseKindDestroy -}; - char *deconvInfo = ("Does deconvolution. "); int @@ -112,7 +66,7 @@ hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL, "\"kind\" of volume (\"scalar\", \"vector\", " "\"tensor\", or \"dwi\")", - NULL, NULL, &probeKindHestCB); + NULL, NULL, meetHestGageKind); hestOptAdd(&hopt, "k00", "kernel", airTypeOther, 1, 1, &ksp, NULL, "convolution kernel", NULL, NULL, nrrdHestKernelSpec); Modified: teem/trunk/src/bin/gprobe.c =================================================================== --- teem/trunk/src/bin/gprobe.c 2009-10-26 11:30:32 UTC (rev 4318) +++ teem/trunk/src/bin/gprobe.c 2009-10-26 11:33:14 UTC (rev 4319) @@ -28,56 +28,8 @@ #include <teem/nrrd.h> #include <teem/gage.h> #include <teem/ten.h> +#include <teem/meet.h> -int -probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) { - char me[] = "probeParseKind"; - gageKind **kindP; - - if (!(ptr && str)) { - sprintf(err, "%s: got NULL pointer", me); - return 1; - } - kindP = (gageKind **)ptr; - airToLower(str); - if (!strcmp(gageKindScl->name, str)) { - *kindP = gageKindScl; - } else if (!strcmp(gageKindVec->name, str)) { - *kindP = gageKindVec; - } else if (!strcmp(tenGageKind->name, str)) { - *kindP = tenGageKind; - } else if (!strcmp(TEN_DWI_GAGE_KIND_NAME, str)) { - *kindP = tenDwiGageKindNew(); - } else { - sprintf(err, "%s: not \"%s\", \"%s\", \"%s\", or \"%s\"", me, - gageKindScl->name, gageKindVec->name, - tenGageKind->name, TEN_DWI_GAGE_KIND_NAME); - return 1; - } - - return 0; -} - -void * -probeParseKindDestroy(void *ptr) { - gageKind *kind; - - if (ptr) { - kind = AIR_CAST(gageKind *, ptr); - if (!strcmp(TEN_DWI_GAGE_KIND_NAME, kind->name)) { - tenDwiGageKindNix(kind); - } - } - return NULL; -} - -hestCB probeKindHestCB = { - sizeof(gageKind *), - "kind", - probeParseKind, - probeParseKindDestroy -}; - void printans(FILE *file, const double *ans, int len) { int a; @@ -300,7 +252,7 @@ hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL, "\"kind\" of volume (\"scalar\", \"vector\", " "\"tensor\", or \"dwi\")", - NULL, NULL, &probeKindHestCB); + NULL, NULL, meetHestGageKind); hestOptAdd(&hopt, "v", "verbosity", airTypeInt, 1, 1, &verbose, "1", "verbosity level"); hestOptAdd(&hopt, "q", "query", airTypeString, 1, 1, &whatS, NULL, Modified: teem/trunk/src/bin/mrender.c =================================================================== --- teem/trunk/src/bin/mrender.c 2009-10-26 11:30:32 UTC (rev 4318) +++ teem/trunk/src/bin/mrender.c 2009-10-26 11:33:14 UTC (rev 4319) @@ -28,39 +28,8 @@ #include <teem/limn.h> #include <teem/hoover.h> #include <teem/ten.h> +#include <teem/meet.h> -int -probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) { - static const char me[] = "probeParseKind"; - gageKind **kindP; - - if (!(ptr && str)) { - sprintf(err, "%s: got NULL pointer", me); - return 1; - } - kindP = (gageKind **)ptr; - airToLower(str); - if (!strcmp("scalar", str)) { - *kindP = gageKindScl; - } else if (!strcmp("vector", str)) { - *kindP = gageKindVec; - } else if (!strcmp("tensor", str)) { - *kindP = tenGageKind; - } else { - sprintf(err, "%s: not \"scalar\", \"vector\", or \"tensor\"", me); - return 1; - } - - return 0; -} - -hestCB probeKindHestCB = { - sizeof(gageKind *), - "kind", - probeParseKind, - NULL -}; - #define MREND "mrender" char *info = ("A demonstration of hoover, gage, and nrrd measures. " @@ -479,7 +448,7 @@ "input nrrd to render", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &(uu->kind), NULL, "\"kind\" of volume (\"scalar\", \"vector\", or \"tensor\")", - NULL, NULL, &probeKindHestCB); + NULL, NULL, meetHestGageKind); limnHestCameraOptAdd(&hopt, uu->hctx->cam, NULL, "0 0 0", "0 0 1", NULL, NULL, NULL, Modified: teem/trunk/src/bin/pprobe.c =================================================================== --- teem/trunk/src/bin/pprobe.c 2009-10-26 11:30:32 UTC (rev 4318) +++ teem/trunk/src/bin/pprobe.c 2009-10-26 11:33:14 UTC (rev 4319) @@ -27,8 +27,9 @@ #include <teem/hest.h> #include <teem/nrrd.h> #include <teem/gage.h> -#include <teem/ten.h> #include <teem/limn.h> +#include <teem/ten.h> +#include <teem/meet.h> #define SPACING(spc) (AIR_EXISTS(spc) ? spc: nrrdDefaultSpacing) @@ -41,55 +42,6 @@ (l)[5] = (m)[7], \ (l)[6] = (m)[8] ) -int -probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) { - char me[] = "probeParseKind"; - gageKind **kindP; - - if (!(ptr && str)) { - sprintf(err, "%s: got NULL pointer", me); - return 1; - } - kindP = (gageKind **)ptr; - airToLower(str); - if (!strcmp(gageKindScl->name, str)) { - *kindP = gageKindScl; - } else if (!strcmp(gageKindVec->name, str)) { - *kindP = gageKindVec; - } else if (!strcmp(tenGageKind->name, str)) { - *kindP = tenGageKind; - } else if (!strcmp(TEN_DWI_GAGE_KIND_NAME, str)) { - *kindP = tenDwiGageKindNew(); - } else { - sprintf(err, "%s: not \"%s\", \"%s\", \"%s\", or \"%s\"", me, - gageKindScl->name, gageKindVec->name, - tenGageKind->name, TEN_DWI_GAGE_KIND_NAME); - return 1; - } - - return 0; -} - -void * -probeParseKindDestroy(void *ptr) { - gageKind *kind; - - if (ptr) { - kind = AIR_CAST(gageKind *, ptr); - if (!strcmp(TEN_DWI_GAGE_KIND_NAME, kind->name)) { - tenDwiGageKindNix(kind); - } - } - return NULL; -} - -hestCB probeKindHestCB = { - sizeof(gageKind *), - "kind", - probeParseKind, - probeParseKindDestroy -}; - void printans(FILE *file, const double *ans, int len) { int a; @@ -137,7 +89,7 @@ "input volume", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL, "\"kind\" of volume (\"scalar\", \"vector\", or \"tensor\")", - NULL, NULL, &probeKindHestCB); + NULL, NULL, meetHestGageKind); hestOptAdd(&hopt, "p", "x y z", airTypeFloat, 3, 3, pos, NULL, "the position in space at which to probe"); hestOptAdd(&hopt, "wsp", NULL, airTypeInt, 0, 0, &worldSpace, NULL, Modified: teem/trunk/src/bin/vprobe.c =================================================================== --- teem/trunk/src/bin/vprobe.c 2009-10-26 11:30:32 UTC (rev 4318) +++ teem/trunk/src/bin/vprobe.c 2009-10-26 11:33:14 UTC (rev 4319) @@ -28,56 +28,8 @@ #include <teem/nrrd.h> #include <teem/gage.h> #include <teem/ten.h> +#include <teem/meet.h> -int -probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) { - char me[] = "probeParseKind"; - gageKind **kindP; - - if (!(ptr && str)) { - sprintf(err, "%s: got NULL pointer", me); - return 1; - } - kindP = (gageKind **)ptr; - airToLower(str); - if (!strcmp(gageKindScl->name, str)) { - *kindP = gageKindScl; - } else if (!strcmp(gageKindVec->name, str)) { - *kindP = gageKindVec; - } else if (!strcmp(tenGageKind->name, str)) { - *kindP = tenGageKind; - } else if (!strcmp(TEN_DWI_GAGE_KIND_NAME, str)) { - *kindP = tenDwiGageKindNew(); - } else { - sprintf(err, "%s: not \"%s\", \"%s\", \"%s\", or \"%s\"", me, - gageKindScl->name, gageKindVec->name, - tenGageKind->name, TEN_DWI_GAGE_KIND_NAME); - return 1; - } - - return 0; -} - -void * -probeParseKindDestroy(void *ptr) { - gageKind *kind; - - if (ptr) { - kind = AIR_CAST(gageKind *, ptr); - if (!strcmp(TEN_DWI_GAGE_KIND_NAME, kind->name)) { - tenDwiGageKindNix(kind); - } - } - return NULL; -} - -hestCB probeKindHestCB = { - sizeof(gageKind *), - "kind", - probeParseKind, - probeParseKindDestroy -}; - void printans(FILE *file, const double *ans, int len) { int a; @@ -157,7 +109,7 @@ hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL, "\"kind\" of volume (\"scalar\", \"vector\", " "\"tensor\", or \"dwi\")", - NULL, NULL, &probeKindHestCB); + NULL, NULL, meetHestGageKind); hestOptAdd(&hopt, "v", "verbosity", airTypeInt, 1, 1, &verbose, "1", "verbosity level"); hestOptAdd(&hopt, "q", "query", airTypeString, 1, 1, &whatS, NULL, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |