Changeset 21282
- Timestamp:
- Feb 4, 2009, 10:24:33 AM (17 years ago)
- Location:
- branches/pap_branch_20090128/pswarp/src
- Files:
-
- 4 edited
-
pswarp.h (modified) (2 diffs)
-
pswarpLoop.c (modified) (1 diff)
-
pswarpTransformReadout.c (modified) (3 diffs)
-
pswarpTransformTile.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20090128/pswarp/src/pswarp.h
r20307 r21282 19 19 #define PSWARP_ANALYSIS_VARFACTOR "PSWARP.VARFACTOR" // Name for variance factor in analysis metadata 20 20 #define PSWARP_ANALYSIS_GOODPIX "PSWARP.GOODPIX" // Name for number of good pixels in analysis metadata 21 #define PSWARP_ANALYSIS_COVARIANCES "PSWARP.COVARIANCES" // Name for covariance matrices on analysis MD 21 22 22 23 // a single pswarpMap converts coordinates from one image to a second image … … 53 54 long goodPixels; // Number of good pixels 54 55 int xMin, xMax, yMin, yMax; // Bounds of tile 56 psKernel *covariance; // Covariance matrix 55 57 } pswarpTransformTileArgs; 56 58 -
branches/pap_branch_20090128/pswarp/src/pswarpLoop.c
r21235 r21282 273 273 } 274 274 275 // Set covariance matrix for output 276 { 277 psList *covariances = psMetadataLookupPtr(&mdok, output->analysis, 278 PSWARP_ANALYSIS_COVARIANCES); // Covariance matrices 279 psAssert(covariances, "Should be there"); 280 psArray *covars = psListToArray(covariances); // Array of covariance matrices 281 output->covariance = psImageCovarianceAverage(covars); 282 psFree(covars); 283 psMetadataRemoveKey(output->analysis, PSWARP_ANALYSIS_COVARIANCES); 284 } 285 275 286 if (!pmConceptsAverageCells(outCell, cells, NULL, NULL, false)) { 276 287 psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts."); -
branches/pap_branch_20090128/pswarp/src/pswarpTransformReadout.c
r21235 r21282 26 26 psImageMaskType maskBad = pmConfigMaskGet("BAD.WARP", config); 27 27 psAssert(mdok, "MASK.INPUT was not defined"); 28 29 if (!input->covariance) { 30 input->covariance = psImageCovarianceNone(); 31 } 28 32 29 33 int nThreads = psMetadataLookupS32(&mdok, config->arguments, "NTHREADS"); // Number of threads … … 122 126 int xMin = output->image->numCols, xMax = 0, yMin = output->image->numRows, yMax = 0; // Bounds 123 127 int goodPixels = 0; // total number of good pixels across all tiles 128 psList *covariances = psMetadataLookupPtr(&mdok, output->analysis, 129 PSWARP_ANALYSIS_COVARIANCES); // Collection of covar. matrices 130 if (!covariances) { 131 covariances = psListAlloc(NULL); 132 psMetadataAddList(output->analysis, PS_LIST_TAIL, PSWARP_ANALYSIS_COVARIANCES, 0, 133 "Collection of covariance matrices", covariances); 134 } 124 135 while ((job = psThreadJobGetDone()) != NULL) { 125 136 if (job->args->n < 1) { … … 133 144 yMin = PS_MIN(args->yMin, yMin); 134 145 yMax = PS_MAX(args->yMax, yMax); 146 if (args->covariance) { 147 psListAdd(covariances, PS_LIST_TAIL, args->covariance); 148 } 135 149 } 136 150 psFree(job); -
branches/pap_branch_20090128/pswarp/src/pswarpTransformTile.c
r21235 r21282 8 8 psFree(args->interp); 9 9 psFree(args->region); 10 psFree(args->covariance); 10 11 return; 11 12 } … … 30 31 args->yMin = PS_MAX_S32; 31 32 args->yMax = PS_MIN_S32; 33 args->covariance = NULL; 32 34 33 35 return args; … … 104 106 } 105 107 108 if (goodPixels > 0) { 109 float xOut = 0.5 * (xMin + xMax), yOut = 0.5 * (yMin + yMax); // Position of interest on output 110 double xIn, yIn; // Position of interest on input 111 pswarpMapApply(&xIn, &yIn, map, xOut + 0.5, yOut + 0.5); 112 // XXX Why are we subtracting the *output* col0,row0 from the *input* coordinates? 113 // I expect these are zero, so that it makes no difference, but it's distracting. 114 xIn -= outCol0; 115 yIn -= outRow0; 116 psKernel *kernel = psImageInterpolationKernel(xIn, yIn, args->interp->mode); // Interpolation kernel 117 args->covariance = psImageCovarianceCalculate(kernel, args->output->covariance); 118 psFree(kernel); 119 } 120 106 121 args->goodPixels = goodPixels; 107 122 args->xMin = xMin;
Note:
See TracChangeset
for help on using the changeset viewer.
