From: <kin...@us...> - 2013-06-20 04:01:08
|
Revision: 5912 http://sourceforge.net/p/teem/code/5912 Author: kindlmann Date: 2013-06-20 04:01:05 +0000 (Thu, 20 Jun 2013) Log Message: ----------- adding pullFlagZeroZ, pullFlag.zeroZ, and puller -zz Modified Paths: -------------- teem/trunk/src/bin/puller.c teem/trunk/src/pull/actionPull.c teem/trunk/src/pull/parmPull.c teem/trunk/src/pull/pointPull.c teem/trunk/src/pull/popcntl.c teem/trunk/src/pull/pull.h Modified: teem/trunk/src/bin/puller.c =================================================================== --- teem/trunk/src/bin/puller.c 2013-06-20 03:56:30 UTC (rev 5911) +++ teem/trunk/src/bin/puller.c 2013-06-20 04:01:05 UTC (rev 5912) @@ -712,7 +712,7 @@ int energyFromStrength, nixAtVolumeEdgeSpace, constraintBeforeSeedThresh, binSingle, liveThresholdOnInit, permuteOnRebin, noPopCntlWithZeroAlpha, useBetaForGammaLearn, restrictiveAddToBins, noAdd, unequalShapesAllow, - popCntlEnoughTest; + popCntlEnoughTest, zeroZ; int verbose; int interType, allowCodimension3Constraints, scaleIsTau, useHalton, pointPerVoxel; @@ -830,6 +830,8 @@ "butter:16,0.8", "windowing to create locality with additive " "scale-space interaction (\"-int add\")", NULL, NULL, pullHestEnergySpec); + hestOptAdd(&hopt, "zz", "bool", airTypeBool, 1, 1, &zeroZ, "false", + "always constrain Z=0, to process 2D images"); hestOptAdd(&hopt, "efs", "bool", airTypeBool, 1, 1, &energyFromStrength, "false", "whether or not strength contributes to particle-image energy"); @@ -1076,6 +1078,7 @@ pctx = pullContextNew(); airMopAdd(mop, pctx, (airMopper)pullContextNix, airMopAlways); if (pullVerboseSet(pctx, verbose) + || pullFlagSet(pctx, pullFlagZeroZ, zeroZ) || pullFlagSet(pctx, pullFlagEnergyFromStrength, energyFromStrength) || pullFlagSet(pctx, pullFlagNixAtVolumeEdgeSpace, nixAtVolumeEdgeSpace) || pullFlagSet(pctx, pullFlagConstraintBeforeSeedThresh, Modified: teem/trunk/src/pull/actionPull.c =================================================================== --- teem/trunk/src/pull/actionPull.c 2013-06-20 03:56:30 UTC (rev 5911) +++ teem/trunk/src/pull/actionPull.c 2013-06-20 04:01:05 UTC (rev 5912) @@ -1102,6 +1102,9 @@ biffAddf(PULL, "%s: trouble", me); return 1; } + if (task->pctx->flag.zeroZ) { + point->pos[2] = 0; + } return 0; } @@ -1121,7 +1124,8 @@ if (task->pctx->pointNum > _PULL_PROGRESS_POINT_NUM_MIN && !task->pctx->flag.binSingle && task->pctx->progressBinMod - && 0 == myBinIdx % task->pctx->progressBinMod) { + && 0 == myBinIdx % task->pctx->progressBinMod + && task->pctx->verbose) { printf("."); fflush(stdout); } point = myBin->point[myPointIdx]; Modified: teem/trunk/src/pull/parmPull.c =================================================================== --- teem/trunk/src/pull/parmPull.c 2013-06-20 03:56:30 UTC (rev 5911) +++ teem/trunk/src/pull/parmPull.c 2013-06-20 04:01:05 UTC (rev 5912) @@ -83,6 +83,7 @@ flag->allowCodimension3Constraints = AIR_FALSE; flag->scaleIsTau = AIR_FALSE; flag->startSkipsPoints = AIR_FALSE; /* must be false by default */ + flag->zeroZ = AIR_FALSE; return; } @@ -325,6 +326,9 @@ case pullFlagStartSkipsPoints: pctx->flag.startSkipsPoints = flag; break; + case pullFlagZeroZ: + pctx->flag.zeroZ = flag; + break; default: biffAddf(me, "%s: sorry, flag %d valid but not handled?", me, which); return 1; Modified: teem/trunk/src/pull/pointPull.c =================================================================== --- teem/trunk/src/pull/pointPull.c 2013-06-20 03:56:30 UTC (rev 5911) +++ teem/trunk/src/pull/pointPull.c 2013-06-20 04:01:05 UTC (rev 5912) @@ -690,6 +690,9 @@ iPos[k] = vidx[k] + pctx->initParm.jitter*(airDrandMT_r(rng)-0.5); } gageShapeItoW(seedShape, point->pos, iPos); + if (pctx->flag.zeroZ) { + point->pos[2] = 0.0; + } if (0 && _pullVerbose) { printf("!%s: pointIdx %u -> vidx %u %u %u (%u)\n" @@ -873,6 +876,9 @@ } } _pullUnitToWorld(pctx, scaleVol, point->pos, rpos); + if (pctx->flag.zeroZ) { + point->pos[2] = 0.0; + } /* verbo = (AIR_ABS(-0.246015 - point->pos[0]) < 0.1 && AIR_ABS(-144.78 - point->pos[0]) < 0.1 && @@ -976,6 +982,9 @@ /* Copy nrrd point into pullPoint */ ELL_4V_COPY(point->pos, posData + 4*pointIdx); + if (pctx->flag.zeroZ) { + point->pos[2] = 0.0; + } /* if (AIR_ABS(247.828 - point->pos[0]) < 0.1 && Modified: teem/trunk/src/pull/popcntl.c =================================================================== --- teem/trunk/src/pull/popcntl.c 2013-06-20 03:56:30 UTC (rev 5911) +++ teem/trunk/src/pull/popcntl.c 2013-06-20 04:01:05 UTC (rev 5912) @@ -70,12 +70,17 @@ if (point->neighPointNum && task->pctx->targetDim && task->pctx->flag.popCntlEnoughTest) { - unsigned int plenty; - plenty = (1 == task->pctx->targetDim + unsigned int plenty, tardim; + tardim = task->pctx->targetDim; + if (task->pctx->flag.zeroZ && tardim > 1) { + /* GLK unsure of tardim == 1 logic here */ + tardim -= 1; + } + plenty = (1 == tardim ? 3 - : (2 == task->pctx->targetDim + : (2 == tardim ? 7 - : (3 == task->pctx->targetDim + : (3 == tardim ? 13 /* = 1 + 12 = 1 + coordination number of 3D sphere packing */ : 0 /* shouldn't get here */))); @@ -126,6 +131,9 @@ /* we had no neighbors, have to pretend like we did */ airNormalRand_r(noffavg + 0, noffavg + 1, task->rng); airNormalRand_r(noffavg + 2, noffavg + 3, task->rng); + if (!task->pctx->flag.zeroZ) { + noffavg[2] = 0; + } if (!task->pctx->haveScale) { noffavg[3] = 0; } Modified: teem/trunk/src/pull/pull.h =================================================================== --- teem/trunk/src/pull/pull.h 2013-06-20 03:56:30 UTC (rev 5911) +++ teem/trunk/src/pull/pull.h 2013-06-20 04:01:05 UTC (rev 5912) @@ -802,6 +802,10 @@ /* pullStart should skip initializing the points */ pullFlagStartSkipsPoints, + /* constrain the third world-space coordinate ("z") to be zero, at all + times, so that pull can be used to process 2D images */ + pullFlagZeroZ, + pullFlagLast }; @@ -818,7 +822,8 @@ binSingle, allowCodimension3Constraints, scaleIsTau, - startSkipsPoints; + startSkipsPoints, + zeroZ; } pullFlag; /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |