Changeset 19482
- Timestamp:
- Sep 10, 2008, 5:37:58 PM (18 years ago)
- Location:
- trunk/psModules/src/imcombine
- Files:
-
- 4 edited
-
pmStack.c (modified) (5 diffs)
-
pmStackReject.c (modified) (1 diff)
-
pmSubtraction.c (modified) (2 diffs)
-
pmSubtractionMatch.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmStack.c
r19336 r19482 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2008-09- 03 19:42:54$10 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2008-09-11 03:37:58 $ 12 12 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii 13 13 * … … 309 309 } 310 310 } 311 if (useVariance && safe &&numIter > 0) {311 if (useVariance && numIter > 0) { 312 312 // Use variance to check that the two are consistent 313 313 float diff = pixelData->data.F32[0] - pixelData->data.F32[1]; 314 float sigma2 = pixelVariances->data.F32[0] + pixelVariances->data.F32[1]; 314 float sigma2 = pixelVariances->data.F32[0] * varFactors->data.F32[pixelSources->data.U16[0]] + 315 pixelVariances->data.F32[1] * varFactors->data.F32[pixelSources->data.U16[1]]; 315 316 if (PS_SQR(diff) > PS_SQR(rej) * sigma2) { 316 317 // Not consistent: mark both for inspection … … 341 342 float rej2 = PS_SQR(rej); // Rejection level squared 342 343 for (int i = 0; i < num; i++) { 343 pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[ i];344 pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[pixelSources->data.U16[i]]; 344 345 } 345 346 } … … 348 349 // The clipping that follows is solely to identify suspect pixels. 349 350 // These suspect pixels will be inspected in more detail by other functions. 350 int numClipped = INT_MAX; // Number of pixels clipped per iteration351 int totalClipped = 0; // Total number of pixels clipped351 int numClipped = INT_MAX; // Number of pixels clipped per iteration 352 int totalClipped = 0; // Total number of pixels clipped 352 353 for (int i = 0; i < numIter && numClipped > 0 && num - totalClipped > 2; i++) { 353 354 numClipped = 0; 354 355 float median, stdev; // Median and stdev of the combination, for rejection 355 356 356 if (!combinationMedianStdev(&median, useVariance ? NULL : &stdev, pixelData, pixelMasks, sort)) { 357 if (!combinationMedianStdev(&median, useVariance ? NULL : &stdev, 358 pixelData, pixelMasks, sort)) { 357 359 psWarning("Bad median/stdev at %d,%d", x, y); 358 360 break; 359 361 } 360 362 361 float limit = NAN; // Rejection limit, when rejecting based on data properties 362 if (!useVariance) { 363 limit = rej * stdev; 364 } 363 float limit = rej * stdev; // Rejection limit, when rejecting based on data properties 365 364 366 365 // Mask a pixel for inspection … … 378 377 if (useVariance) { 379 378 // Comparing squares --- cheaper than lots of sqrts 379 // pixelVariances includes the variance factor and the rejection limit, from above 380 380 if (PS_SQR(diff) > pixelVariances->data.F32[j]) { 381 381 MASK_PIXEL_FOR_INSPECTION(); -
trunk/psModules/src/imcombine/pmStackReject.c
r19349 r19482 295 295 } 296 296 297 if (threaded) { 297 // Harvest the jobs 298 if (threaded) { 299 psThreadJob *job; // Job to destroy 300 while ((job = psThreadJobGetDone())) { 301 psFree(job); 302 } 303 298 304 psMutexDestroy(source); 299 305 } 306 300 307 psFree(source); 301 308 bad = psPixelsFromMask(bad, target, PM_STACK_MASK_ALL); -
trunk/psModules/src/imcombine/pmSubtraction.c
r19357 r19482 1141 1141 psMutexLock(subMask); 1142 1142 } 1143 psArrayAdd(args, 1, (psImage*)subMask); // Casting away const1143 psArrayAdd(args, 1, subMask); 1144 1144 if (subMask) { 1145 1145 psMutexUnlock(subMask); … … 1166 1166 } 1167 1167 1168 if (!psThreadPoolWait( true)) {1168 if (!psThreadPoolWait(false)) { 1169 1169 psError(PS_ERR_UNKNOWN, false, "Error waiting for threads."); 1170 1170 return false; 1171 1171 } 1172 1172 1173 if (subMask && threaded) { 1174 psMutexDestroy(subMask); 1173 // We don't rely on psThreadPoolWait to harvest the jobs because the job contains a reference to the 1174 // subMask, which is being changed on a thread, and psThreadPoolWait doesn't know that it needs to be 1175 // locked before freeing. After psThreadPoolWait, however, the jobs are completed, the threads are idle, 1176 // and so there's no need to lock the subMask when we're blowing away the jobs. 1177 if (threaded) { 1178 psThreadJob *job; // Completed job 1179 while ((job = psThreadJobGetDone())) { 1180 psFree(job); 1181 } 1182 1183 if (subMask) { 1184 psMutexDestroy(subMask); 1185 } 1175 1186 } 1176 1187 -
trunk/psModules/src/imcombine/pmSubtractionMatch.c
r19299 r19482 98 98 { 99 99 if (region) { 100 varFactor *= (region->x1 - region->x 1 + 1) * (region->y1 * region->y1+ 1) /100 varFactor *= (region->x1 - region->x0 + 1) * (region->y1 - region->y0 + 1) / 101 101 (ro->image->numCols * ro->image->numRows); 102 102 }
Note:
See TracChangeset
for help on using the changeset viewer.
