Changeset 26118 for trunk/psModules/src/imcombine
- Timestamp:
- Nov 12, 2009, 5:20:46 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmStack.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmStack.c
r26076 r26118 35 35 36 36 //#define TESTING // Enable test output 37 //#define TEST_X 3122-1 // x coordinate to examine 38 //#define TEST_Y 1028-1 // y coordinate to examine 37 //#define TEST_X 2148-1 // x coordinate to examine 38 //#define TEST_Y 248-1 // y coordinate to examine 39 //#define TEST_RADIUS 0 // Radius to examine 39 40 40 41 … … 230 231 { 231 232 #ifdef TESTING 232 if ( x == TEST_X && y == TEST_Y) {233 fprintf(stderr, "Marking image %d for inspection\n", source);233 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 234 fprintf(stderr, "Marking image %d, pixel %d,%d for inspection\n", source, x, y); 234 235 } 235 236 #endif … … 252 253 { 253 254 #ifdef TESTING 254 if ( x == TEST_X && y == TEST_Y) {255 fprintf(stderr, "Marking pixel image %d for rejection\n", source);255 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 256 fprintf(stderr, "Marking pixel image %d, pixel %d,%d for rejection\n", source, x, y); 256 257 } 257 258 #endif … … 344 345 345 346 #ifdef TESTING 346 if ( x == TEST_X && y == TEST_Y) {347 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 347 348 for (int i = 0; i < numGood; i++) { 348 fprintf(stderr, "Input %d (%" PRIu16 "): %f %f (%f) %f %d\n",349 i, pixelSources->data.U16[i], pixelData->data.F32[i], pixelVariances->data.F32[i],349 fprintf(stderr, "Input %d, pixel %d,%d (%" PRIu16 "): %f %f (%f) %f %d\n", 350 i, x, y, pixelSources->data.U16[i], pixelData->data.F32[i], pixelVariances->data.F32[i], 350 351 addVariance->data.F32[i], pixelWeights->data.F32[i], pixelSuspects->data.U8[i]); 351 352 } … … 379 380 // Nothing to combine: it's bad 380 381 #ifdef TESTING 381 if ( x == TEST_X && y == TEST_Y) {382 fprintf(stderr, "No inputs to combine, pixel is bad.\n");382 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 383 fprintf(stderr, "No inputs to combine, pixel %d,%d is bad.\n", x, y); 383 384 } 384 385 #endif … … 388 389 // Accept the single pixel unless we have to be safe 389 390 if (!safe) { 390 #ifdef TESTING391 if (x == TEST_X && y == TEST_Y) {392 fprintf(stderr, "Single input to combine, safety off.\n");393 }394 #endif395 391 imageValue = pixelData->data.F32[0]; 396 392 if (variance) { … … 398 394 } 399 395 maskValue = 0; 396 #ifdef TESTING 397 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 398 fprintf(stderr, "Single input to combine, safety off, pixel %d,%d --> %f\n", 399 x, y, imageValue); 400 } 401 #endif 400 402 } 401 403 #ifdef TESTING 402 else if ( x == TEST_X && y == TEST_Y) {403 fprintf(stderr, "Single input to combine, safety on, pixel is bad.\n");404 else if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 405 fprintf(stderr, "Single input to combine, safety on, pixel %d,%d is bad.\n", x, y); 404 406 } 405 407 #endif … … 415 417 maskValue = 0; 416 418 #ifdef TESTING 417 if (x == TEST_X && y == TEST_Y) { 418 fprintf(stderr, "Two inputs to combine using unsafe --> %f %f\n", mean, var); 419 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 420 fprintf(stderr, "Two inputs to combine using unsafe, pixel %d,%d --> %f %f\n", 421 x, y, mean, var); 419 422 } 420 423 #endif … … 423 426 #ifdef TESTING 424 427 else { 425 if ( x == TEST_X && y == TEST_Y) {426 fprintf(stderr, "Two inputs to combine, safety on, pixel is bad\n");428 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 429 fprintf(stderr, "Two inputs to combine, safety on, pixel %d,%d is bad\n", x, y); 427 430 } 428 431 } … … 440 443 maskValue = 0; 441 444 #ifdef TESTING 442 if ( x == TEST_X && y == TEST_Y) {443 fprintf(stderr, "Combined inputs : %f %f\n", mean, var);445 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 446 fprintf(stderr, "Combined inputs, pixel %d,%d --> %f %f\n", x, y, mean, var); 444 447 } 445 448 #endif … … 485 488 486 489 #ifdef TESTING 487 if ( x == TEST_X && y == TEST_Y) {490 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 488 491 fprintf(stderr, "Testing pixel %d,%d: %d %f %f %f %d %d\n", 489 492 x, y, numIter, rej, sys, olympic, useVariance, safe); … … 513 516 // Correct variance for comparison against weighted mean including itself 514 517 float compare = 1.0 - pixelWeights->data.F32[i] / sumWeights; 515 if ( x == TEST_X && y == TEST_Y) {516 fprintf(stderr, "Variance %d (%d) : %f %f %f\n", i, pixelSources->data.U16[i],517 pixelVariances->data.F32[i], sysVar, compare);518 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 519 fprintf(stderr, "Variance %d (%d), pixel %d,%d: %f %f %f\n", i, pixelSources->data.U16[i], 520 x, y, pixelVariances->data.F32[i], sysVar, compare); 518 521 } 519 522 #endif … … 556 559 } 557 560 #ifdef TESTING 558 if ( x == TEST_X && y == TEST_Y) {559 fprintf(stderr, "Flagged both pixels(%f > %f x %f\n)",560 diff, rej, sqrtf(sigma2));561 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 562 fprintf(stderr, "Flagged both inputs for pixel %d,%d (%f > %f x %f\n)", 563 x, y, diff, rej, sqrtf(sigma2)); 561 564 } 562 565 #endif … … 591 594 592 595 #ifdef TESTING 593 if ( x == TEST_X && y == TEST_Y) {596 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 594 597 fprintf(stderr, "Diff 0-1: %f %f\n", diff01, err01); 595 598 fprintf(stderr, "Diff 1-2: %f %f\n", diff12, err12); … … 671 674 olympic, buffer->sort); // Median for stack 672 675 #ifdef TESTING 673 if ( x == TEST_X && y == TEST_Y) {674 fprintf(stderr, "Flag with variance , median = %f\n", median);676 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 677 fprintf(stderr, "Flag with variance pixel %d,%d: median = %f\n", x, y, median); 675 678 } 676 679 #endif … … 679 682 float diff = pixelData->data.F32[j] - median; // Difference from expected 680 683 #ifdef TESTING 681 if ( x == TEST_X && y == TEST_Y) {682 fprintf(stderr, "Testing input %d : %f\n", j, diff);684 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 685 fprintf(stderr, "Testing input %d for pixel %d,%d: %f\n", j, x, y, diff); 683 686 } 684 687 #endif … … 700 703 float limit = rej * stdev; // Rejection limit 701 704 #ifdef TESTING 702 if (x == TEST_X && y == TEST_Y) { 703 fprintf(stderr, "Flag without variance; median = %f, stdev = %f, limit = %f\n", 704 median, stdev, limit); 705 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 706 fprintf(stderr, 707 "Flag without variance pixel %d,%d; median = %f, stdev = %f, limit = %f\n", 708 x, y, median, stdev, limit); 705 709 } 706 710 #endif … … 725 729 if (suspect) { 726 730 #ifdef TESTING 727 if ( x == TEST_X && y == TEST_Y) {728 fprintf(stderr, "Throwing out all suspect pixels \n");731 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 732 fprintf(stderr, "Throwing out all suspect pixels for %d,%d\n", x, y); 729 733 } 730 734 #endif … … 758 762 // Throw out masked pixel 759 763 #ifdef TESTING 760 if ( x == TEST_X && y == TEST_Y) {761 fprintf(stderr, "Throwing out input %d \n", maskIndex);764 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 765 fprintf(stderr, "Throwing out input %d for pixel %d,%d\n", maskIndex, x, y); 762 766 } 763 767 #endif … … 1053 1057 for (int x = minInputCols; x < maxInputCols; x++) { 1054 1058 #ifdef TESTING 1055 if ( x == TEST_X && y == TEST_Y) {1059 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 1056 1060 fprintf(stderr, "Combining pixel %d,%d: %x %x %f %f %f %f %d %d %d\n", 1057 1061 x, y, maskVal, bad, iter, rej, sys, olympic, useVariance, safe, rejection); … … 1062 1066 reject = pixelMapQuery(pixelMap, minInputCols, minInputRows, x, y); 1063 1067 #ifdef TESTING 1064 if ( x == TEST_X && y == TEST_Y) {1065 fprintf(stderr, "Rejected inputs : ");1068 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) { 1069 fprintf(stderr, "Rejected inputs for pixel %d,%d: ", x, y); 1066 1070 if (!reject) { 1067 1071 fprintf(stderr, "<none>\n");
Note:
See TracChangeset
for help on using the changeset viewer.
