IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 27, 2006, 5:21:19 PM (20 years ago)
Author:
Paul Price
Message:

Changing p_psGetStatsValue over to psStatsSingleOption and psStatsGetValue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmSubtractSky.c

    r7769 r8004  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-06-30 23:59:49 $
     8 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-07-28 03:21:19 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9090requirements change and we might need a custom reBin function.
    9191 *****************************************************************************/
    92 /*
     92#if 0
    9393static psImage *binImage(psImage *origImage,
    9494                         int binFactor,
     
    9696{
    9797    psTrace("SubtractSky.binImage", 4, "Calling binImage(%d)\n", binFactor);
    98  
     98
    9999    if (binFactor <= 0) {
    100100        psLogMsg(__func__, PS_LOG_WARN,
     
    105105        return(origImage);
    106106    }
    107  
     107
    108108    psVector *binVector = psVectorAlloc(binFactor * binFactor, PS_TYPE_F32);
    109109    psVector *binMask = psVectorAlloc(binFactor * binFactor, PS_TYPE_U8);
    110110    psStats *myStats = psStatsAlloc(statOptions);
    111  
     111
    112112    for (psS32 row = 0; row < origImage->numRows ; row+=binFactor) {
    113113        for (psS32 col = 0; col < origImage->numCols ; col+=binFactor) {
     
    134134            psF64 statValue;
    135135            psBool rc = p_psGetStatValue(rc1, &statValue);
    136  
     136
    137137            if (rc == true) {
    138138                origImage->data.F32[row][col] = (psF32) statValue;
     
    147147    psFree(binMask);
    148148    psFree(myStats);
    149  
     149
    150150    psTrace("SubtractSky.binImage", 4, "Exiting binImage(%d)\n", binFactor);
    151151    return(origImage);
    152152}
    153 */
     153#endif
    154154
    155155/******************************************************************************
     
    601601    } else {
    602602        // Determine the mean and standard deviation of the binned image.
    603         psF64 binnedMean;
    604         psF64 binnedStdev;
    605         psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    606         psStats *rc =  psImageStats(myStats, binnedImage, NULL, 0);
    607         if (rc == NULL) {
    608             psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
    609             return(in);
    610         }
    611         if (false == p_psGetStatValue(rc, &binnedMean)) {
    612             psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation.  Returning in image.\n");
    613             return(in);
    614         }
    615         psTrace(".psModule.pmSubtractSky", 6,
    616                 "binned Mean is %f\n", binnedMean);
    617 
    618         myStats->options = PS_STAT_SAMPLE_STDEV;
    619         rc =  psImageStats(myStats, binnedImage, NULL, 0);
    620         if (rc == NULL) {
    621             psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
    622             return(in);
    623         }
    624         if (false == p_psGetStatValue(myStats, &binnedStdev)) {
    625             psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation.  Returning in image.\n");
    626             return(in);
    627         }
     603        psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
     604        if (!psImageStats(myStats, binnedImage, NULL, 0)) {
     605            psError(PS_ERR_UNEXPECTED_NULL, false, "Couldn't get statistics for image.\n");
     606            return NULL;
     607        }
     608        psF64 binnedMean = myStats->sampleMean;
     609        psF64 binnedStdev = myStats->sampleStdev;
    628610        psFree(myStats);
    629611        psTrace(".psModule.pmSubtractSky", 6,
Note: See TracChangeset for help on using the changeset viewer.