Changeset 2857 for trunk/psModules/src/pmSubtractSky.c
- Timestamp:
- Dec 30, 2004, 12:22:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmSubtractSky.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmSubtractSky.c
r2848 r2857 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12- 29 22:44:33$8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-30 22:22:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 106 106 } 107 107 } 108 myStats = psVectorStats(myStats, binVector, NULL, binMask, 1); 108 psStats *rc1 = psVectorStats(myStats, binVector, NULL, binMask, 1); 109 if (rc1 == NULL) { 110 psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation. Returning in image.\n"); 111 return(origImage); 112 } 109 113 psF64 statValue; 110 psBool rc = p_psGetStatValue( myStats, &statValue);114 psBool rc = p_psGetStatValue(rc1, &statValue); 111 115 112 116 if (rc == true) { … … 427 431 (fit != PM_FIT_POLYNOMIAL) && 428 432 (fit != PM_FIT_SPLINE)) { 429 psError(PS_ERR_UNKNOWN, true, "psFit is unallowable (%d) \n", fit);433 psError(PS_ERR_UNKNOWN, true, "psFit is unallowable (%d). Returning in image.\n", fit); 430 434 return(in); 431 435 } … … 436 440 if ((fitSpec == NULL) || 437 441 ((fit == PM_FIT_NONE) || (fit == PM_FIT_SPLINE))) { 442 psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined. Returning in image.\n"); 438 443 return(in); 439 444 } … … 452 457 psLogMsg(__func__, PS_LOG_WARN, "WARNING: Multiple statistical options have been requested.\n"); 453 458 statOptions = getHighestPriorityStatOption(statOptions); 454 459 if (statOptions == -1) { 460 psError(PS_ERR_UNKNOWN, true, "Not allowable stats->option was specified. Returning in image.\n"); 461 return(in); 462 } 455 463 // Save old input "stats" parameter. 456 464 oldStatOptions = stats->options; … … 483 491 // and a mask. 484 492 binnedImage = psImageCopy(binnedImage, origImage, PS_TYPE_F32); 493 if (binnedImage == NULL) { 494 psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL. Returning in image.\n"); 495 return(in); 496 } 497 485 498 if (in->mask != NULL) { 486 499 binnedMaskImage = psImageCopy(binnedMaskImage, in->mask, PS_TYPE_U8); 500 if (binnedMaskImage == NULL) { 501 psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL. Returning in image.\n"); 502 psFree(binnedImage); 503 return(in); 504 } 487 505 } else { 488 506 binnedMaskImage = psImageAlloc(binnedImage->numCols, … … 493 511 } else { 494 512 binnedImage = psImageRebin(NULL, origImage, in->mask, 0, binFactor, stats); 513 if (binnedImage == NULL) { 514 psError(PS_ERR_UNKNOWN, false, "psImageRebin() returned NULL. Returning in image.\n"); 515 return(in); 516 } 495 517 binnedMaskImage = psImageAlloc(binnedImage->numCols, 496 518 binnedImage->numRows, … … 512 534 psF64 binnedStdev; 513 535 psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 514 myStats = psImageStats(myStats, binnedImage, NULL, 0); 515 p_psGetStatValue(myStats, &binnedMean); 536 psStats *rc = psImageStats(myStats, binnedImage, NULL, 0); 537 if (rc == NULL) { 538 psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation. Returning in image.\n"); 539 return(in); 540 } 541 if (false == p_psGetStatValue(rc, &binnedMean)) { 542 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation. Returning in image.\n"); 543 return(in); 544 } 516 545 psTrace(".psModule.pmSubtractSky", 6, 517 546 "binned Mean is %f\n", binnedMean); 518 547 519 548 myStats->options = PS_STAT_SAMPLE_STDEV; 520 myStats = psImageStats(myStats, binnedImage, NULL, 0); 521 p_psGetStatValue(myStats, &binnedStdev); 549 rc = psImageStats(myStats, binnedImage, NULL, 0); 550 if (rc == NULL) { 551 psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation. Returning in image.\n"); 552 return(in); 553 } 554 if (false == p_psGetStatValue(myStats, &binnedStdev)) { 555 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation. Returning in image.\n"); 556 return(in); 557 } 522 558 psFree(myStats); 523 559 psTrace(".psModule.pmSubtractSky", 6, … … 551 587 // Set the pixels in the binned image to that of the polynomial. 552 588 binnedImage = psImageEvalPolynomial(binnedImage, myPoly); 589 if (binnedImage == NULL) { 590 psError(PS_ERR_UNKNOWN, false, "psImageEvalPolynomial() returned NULL. Returning in image.\n"); 591 psFree(binnedMaskImage); 592 if (!((binFactor <= 1) || (stats == NULL))) { 593 psFree(binnedImage); 594 } 595 if (oldStatOptions != 0) { 596 stats->options = statOptions; 597 } 598 return(in); 599 } 553 600 } else { 554 601 psLogMsg(__func__, PS_LOG_WARN, … … 565 612 } else { 566 613 // We shouldn't get here since we check this above. 567 psError(PS_ERR_UNKNOWN, true, "Unallowable fit type."); 614 psError(PS_ERR_UNKNOWN, true, "Unallowable fit type. Returning in image.\n"); 615 psFree(binnedMaskImage); 616 if (!((binFactor <= 1) || (stats == NULL))) { 617 psFree(binnedImage); 618 } 619 if (oldStatOptions != 0) { 620 stats->options = statOptions; 621 } 622 return(in); 568 623 } 569 624
Note:
See TracChangeset
for help on using the changeset viewer.
