IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 27, 2004, 1:16:51 PM (22 years ago)
Author:
gusciora
Message:

Added an errors argument to the psVectorStats() call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmReadoutCombine.c

    r2829 r2832  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-27 20:14:29 $
     7 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-27 23:16:51 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020p_psDetermineNumBits(data): This routine takes an enum psStatsOptions as an
    2121argument and returns the number of non-zero bits.
    22  
    23 XXX: Use static vectors.
    2422 *****************************************************************************/
    25 psStatsOptions p_psDetermineNumBits(psStatsOptions data)
     23psStatsOptions DetermineNumBits(psStatsOptions data)
    2624{
    2725    psS32 i;
     
    3836}
    3937
     38/******************************************************************************
     39p_psDetermineNumBits(data): This routine takes an enum psStatsOptions as an
     40argument and returns the number of non-zero bits.
     41 
     42XXX: Must add support for S16 and S32 types.  F32 currently supported.
     43 *****************************************************************************/
    4044psImage *pmReadoutCombine(psImage *output,
    4145                          const psList *inputs,
     
    5256    if (zero != NULL) {
    5357        PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL);
     58        //        PS_VECTOR_CHECK_TYPE_S16_S32_F32(zero, NULL);
    5459    }
    5560    if (scale != NULL) {
    5661        PS_VECTOR_CHECK_TYPE(scale, PS_TYPE_F32, NULL);
     62        //        PS_VECTOR_CHECK_TYPE_S16_S32_F32(scale, NULL);
    5763    }
    5864    if ((zero != NULL) && (scale != NULL)) {
    5965        PS_VECTOR_CHECK_TYPE_EQUAL(zero, scale, NULL);
    60         // XXX: Currently only type F32 is implemented.
    6166        // PS_VECTOR_CHECK_TYPE_S16_S32_F32(scale, NULL);
    6267    }
     
    7580    psElemType outputType = PS_TYPE_F32;
    7681
    77     if (1 < p_psDetermineNumBits(params->stats->options)) {
     82    if (1 < DetermineNumBits(params->stats->options)) {
    7883        psError(PS_ERR_UNKNOWN, true,
    7984                "Multiple statistical options have been requested.\n");
     
    9297    //     output->row0 + output->numRows
    9398    // to determine if the output image actually stores that pixel.  A similar
    94     // thing is done for the minimul row and column.
     99    // thing is done for the minimum row and column.
    95100    //
    96101    tmpInput = (psListElem *) inputs->head;
     
    120125
    121126    // We ensure that the zero vector is of the proper size.
    122 
    123127    if (zero != NULL) {
    124128        PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL);
     
    166170
    167171        if ((output->col0 > minInputCols) || (output->row0 > minInputRows)) {
    168             //XXX ERROR "Output image offset is larger then input image offset.\n");
     172            psError(PS_ERR_UNKNOWN, true,
     173                    "Output image offset is larger then input image offset.\n");
    169174            return(NULL);
    170175        }
     
    172177
    173178    psVector *tmpPixels = psVectorAlloc(numInputs, PS_TYPE_F32);
     179    psVector *tmpPixelErrors = psVectorAlloc(numInputs, PS_TYPE_F32);
    174180    psVector *tmpPixelMask = psVectorAlloc(numInputs, PS_TYPE_U8);
    175181    psVector *tmpPixelMaskNKeep = psVectorAlloc(numInputs, PS_TYPE_U8);
     
    266272            }
    267273
    268             // XXX: Still waiting on clarification of the algorithm.
    269             #define SOME_FUNC(X, SIGMA) ((X))
    270             if ((gain > 0.0) && (readnoise >= 0.0))
    271             {
     274            if ((gain > 0.0) && (readnoise >= 0.0)) {
    272275                psF32 x;
    273276                psF32 sigma;
     
    286289                        sigma = PS_SQRT_F32((readnoise*readnoise) + gain * x) / gain;
    287290
    288                         tmpPixels->data.F32[r]= SOME_FUNC(x, sigma);
     291                        tmpPixelErrors->data.F32[r] = sigma;
     292                        tmpPixels->data.F32[r]= x;
    289293                    }
    290294                } else {
     
    304308                        sigma = PS_SQRT_F32((readnoise*readnoise) + (gain * sigma)) / gain;
    305309
    306                         tmpPixels->data.F32[r]= SOME_FUNC(x, sigma);
    307                     }
    308                 }
     310                        tmpPixelErrors->data.F32[r] = sigma;
     311                        tmpPixels->data.F32[r]= x;
     312                    }
     313                }
     314                // Calculate the specified statistic on the stack of pixels.
     315                stats = psVectorStats(stats,
     316                                      tmpPixels,
     317                                      tmpPixelErrors,
     318                                      tmpPixelMaskNKeep,
     319                                      1);
    309320            } else {
    310321                if (scale != NULL) {
     
    320331                    }
    321332                }
    322             }
    323 
    324             // Calculate the specified statistic on the stack of pixels.
    325             stats = psVectorStats(stats,
    326                                   tmpPixels,
    327                                   NULL,
    328                                   tmpPixelMaskNKeep,
    329                                   1);
     333
     334                // Calculate the specified statistic on the stack of pixels.
     335                stats = psVectorStats(stats,
     336                                      tmpPixels,
     337                                      NULL,
     338                                      tmpPixelMaskNKeep,
     339                                      1);
     340            }
     341
    330342
    331343            // Set the pixel value in the output image to the stat value.
    332344            double statValue;
    333345            if (!p_psGetStatValue(stats, &statValue)) {
    334                 //XXX ERROR: "Could not determine stats value.\n"
     346                psError(PS_ERR_UNKNOWN, true, "Could not determine stats value.\n");
    335347                return(NULL);
    336348            } else {
     
    341353
    342354    psFree(tmpPixels);
     355    psFree(tmpPixelErrors);
    343356    psFree(tmpPixelMask);
    344357    psFree(tmpPixelMaskNKeep);
Note: See TracChangeset for help on using the changeset viewer.