IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24483


Ignore:
Timestamp:
Jun 18, 2009, 10:39:29 AM (17 years ago)
Author:
eugene
Message:

adding noiseMap to the APIs for variance generation

Location:
trunk/psModules/src/camera
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAMaskWeight.c

    r24399 r24483  
    199199}
    200200
    201 bool pmReadoutSetVariance(pmReadout *readout, bool poisson)
     201bool pmReadoutSetVariance(pmReadout *readout, const psImage *noiseMap, bool poisson)
    202202{
    203203    PS_ASSERT_PTR_NON_NULL(readout, false);
     204    // check that the noiseMap (if it exists) matches the readout variance size)
    204205
    205206    pmCell *cell = readout->parent;     // The parent cell
     
    240241    }
    241242
    242     // XXX if readnoise is based on an image map, we need to apply it here
    243     readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+",
    244                                            psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32));
     243    // apply a supplied readnoise map (NOTE: in DN, not electrons):
     244    if (noiseMap) {
     245        psImage *rdVar = (psImage*)psBinaryOp(NULL, (const psPtr) noiseMap, "*", (const psPtr) noiseMap);
     246        readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", rdVar);
     247        psFree (rdVar);
     248    } else {
     249        readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32));
     250    }
    245251
    246252    return true;
     
    249255// this function creates the variance pixels, or uses the existing variance pixels.  it will set
    250256// the noise pixel values only if the variance image is not supplied
    251 bool pmReadoutGenerateVariance(pmReadout *readout, bool poisson)
     257bool pmReadoutGenerateVariance(pmReadout *readout, const psImage *noiseMap, bool poisson)
    252258{
    253259    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    293299    readout->variance = variance;
    294300
    295     return pmReadoutSetVariance(readout, poisson);
    296 }
    297 
    298 bool pmReadoutGenerateMaskVariance(pmReadout *readout, psImageMaskType satMask, psImageMaskType badMask, bool poisson)
     301    return pmReadoutSetVariance(readout, noiseMap, poisson);
     302}
     303
     304bool pmReadoutGenerateMaskVariance(pmReadout *readout, psImageMaskType satMask, psImageMaskType badMask, const psImage *noiseMap, bool poisson)
    299305{
    300306    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    303309
    304310    success &= pmReadoutGenerateMask(readout, satMask, badMask);
    305     success &= pmReadoutGenerateVariance(readout, poisson);
     311    success &= pmReadoutGenerateVariance(readout, noiseMap, poisson);
    306312
    307313    return success;
    308314}
    309315
    310 bool pmCellGenerateMaskVariance(pmCell *cell, psImageMaskType satMask, psImageMaskType badMask, bool poisson)
     316bool pmCellGenerateMaskVariance(pmCell *cell, psImageMaskType satMask, psImageMaskType badMask, const psImage *noiseMap, bool poisson)
    311317{
    312318    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    316322    for (int i = 0; i < readouts->n; i++) {
    317323        pmReadout *readout = readouts->data[i]; // The readout
    318         success &= pmReadoutGenerateMaskVariance(readout, poisson, satMask, badMask);
     324        success &= pmReadoutGenerateMaskVariance(readout, satMask, badMask, noiseMap, poisson);
    319325    }
    320326
  • trunk/psModules/src/camera/pmFPAMaskWeight.h

    r21363 r24483  
    5454/// can't be generated.
    5555bool pmReadoutSetVariance(pmReadout *readout, ///< Readout for which to set variance
     56                          const psImage *noiseMap, ///< 2D image of the read noise in DN
    5657                          bool poisson    ///< Include poisson variance (in addition to read noise)?
    5758    );
     
    7273/// with HDU entry).  This is intended for most operations.
    7374bool pmReadoutGenerateVariance(pmReadout *readout, ///< Readout for which to generate variance
     75                          const psImage *noiseMap, ///< 2D image of the read noise in DN
    7476                               bool poisson    ///< Include poisson variance (in addition to read noise)?
    7577    );
     
    8183                                   psImageMaskType sat, ///< Mask value to give saturated pixels
    8284                                   psImageMaskType bad, ///< Mask value to give bad (low) pixels
     85                                   const psImage *noiseMap, ///< 2D image of the read noise in DN
    8386                                   bool poisson ///< Include poisson variance (in addition to read noise)?
    8487    );
     
    9093                                psImageMaskType sat, ///< Mask value to give saturated pixels
    9194                                psImageMaskType bad, ///< Mask value to give bad (low) pixels
     95                                const psImage *noiseMap, ///< 2D image of the read noise in DN
    9296                                bool poisson ///< Include poisson variance (in addition to read noise)?
    9397    );
Note: See TracChangeset for help on using the changeset viewer.