Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /benchmarks/programs/ridge3d/bmark-teem.c
ViewVC logotype

Annotation of /benchmarks/programs/ridge3d/bmark-teem.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1582 - (view) (download) (as text)

1 : glk 1582 #include <stdio.h>
2 :     #include <math.h>
3 :     #include "teem/nrrd.h"
4 :     #include "teem/gage.h"
5 :     #include "teem/ell.h"
6 :    
7 :     int
8 :     inside(double pos[3]) {
9 :     if(pos[0] < -0.5 || pos[0] > 175.5) return 0;
10 :     if(pos[1] < -0.5 || pos[1] > 186.5) return 0;
11 :     if(pos[2] < -0.5 || pos[2] > 189.5) return 0;
12 :     return 1;
13 :     }
14 :    
15 :     int main (int argc, const char *argv[]) {
16 :     hestOpt *hopt=NULL;
17 :     hestParm *hparm;
18 :     airArray *mop;
19 :     const char *me;
20 :    
21 :     #define DATA_IN_STR "../../data/lungcrop.nrrd"
22 :     unsigned int gridPoints, stepsMax;
23 :     Nrrd *nin, *nout, *npos;
24 :     char *err, *outS;
25 :     float epsilon;
26 :    
27 :     mop = airMopNew();
28 :     hparm = hestParmNew();
29 :     airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
30 :     nout = nrrdNew();
31 :     airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
32 :    
33 :     hparm->noArgsIsNoProblem = AIR_TRUE;
34 :     me = argv[0];
35 :     hestOptAdd(&hopt, "gridSize", "grid points", airTypeUInt, 1, 1,
36 :     &gridPoints, "120",
37 :     "number of points along volume edge");
38 :     hestOptAdd(&hopt, "stepsMax", "# iters", airTypeUInt, 1, 1,
39 :     &stepsMax, "20",
40 :     "# iterations allowed for feature detection");
41 :     hestOptAdd(&hopt, "epsilon", "convg", airTypeFloat, 1, 1,
42 :     &epsilon, "0.005", "convergence threshold");
43 :    
44 :     hestParseOrDie(hopt, argc-1, argv+1, hparm,
45 :     me, "ridge3d", AIR_TRUE, AIR_TRUE, AIR_TRUE);
46 :     airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
47 :     airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
48 :    
49 :     nin = nrrdNew();
50 :     airMopAdd(mop, nin, (airMopper)nrrdNuke, airMopAlways);
51 :     if (nrrdLoad(nin, DATA_IN_STR, NULL)) {
52 :     airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
53 :     fprintf(stderr, "Trouble reading:\n%s", err);
54 :     airMopError(mop);
55 :     return 1;
56 :     }
57 :    
58 :     gageContext *ctx;
59 :     gagePerVolume *pvl;
60 :     double kparm[NRRD_KERNEL_PARMS_NUM] = {0.0};
61 :     ctx = gageContextNew();
62 :     airMopAdd(mop, ctx, (airMopper)gageContextNix, airMopAlways);
63 :     pvl = gagePerVolumeNew(ctx, nin, gageKindScl);
64 :     if (gagePerVolumeAttach(ctx, pvl)
65 :     || gageKernelSet(ctx, gageKernel00, nrrdKernelBSpline3, kparm)
66 :     || gageKernelSet(ctx, gageKernel11, nrrdKernelBSpline3D, kparm)
67 :     || gageKernelSet(ctx, gageKernel22, nrrdKernelBSpline3DD, kparm)
68 :     || gageQueryItemOn(ctx, pvl, gageSclGradVec)
69 :     || gageQueryItemOn(ctx, pvl, gageSclHessian)
70 :     || gageUpdate(ctx)) {
71 :     airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
72 :     fprintf(stderr, "Trouble setting up gage context:\n%s", err);
73 :     airMopError(mop);
74 :     return 1;
75 :     }
76 :    
77 :     npos = nrrdNew();
78 :     airMopAdd(mop, npos, (airMopper)nrrdNuke, airMopAlways);
79 :    
80 :     int ui, vi, wi;
81 :     float xx, yy, zz;
82 :    
83 :     airMopOkay(mop);
84 :     return 0;
85 :     }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0