IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 28, 2009, 2:33:51 PM (17 years ago)
Author:
Paul Price
Message:

Changing pmReadout.weight to variance. Adding pmReadout.covariance which will carry around a covariance pseudo-matrix, allowing us to calculate the pixel-to-pixel variance. pmReadout.covariance now exists and is set, but no mechanism yet to read/write, or use it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_20090128/psModules/src/camera/pmReadoutStack.c

    r21183 r21211  
    1212// XXX should it be an error for the image to exist?
    1313psImage *pmReadoutSetAnalysisImage(pmReadout *readout, // Readout containing image
    14                                    const char *name, // Name of image in analysis metadata
    15                                    int numCols, int numRows, // Expected size of image
    16                                    psElemType type, // Expected type of image
    17                                    double init // Initial value
     14                                   const char *name, // Name of image in analysis metadata
     15                                   int numCols, int numRows, // Expected size of image
     16                                   psElemType type, // Expected type of image
     17                                   double init // Initial value
    1818    )
    1919{
     
    2424
    2525    if (!psMetadataAddImage(readout->analysis, PS_LIST_TAIL, name, 0, "Analysis image from " __FILE__, image)) {
    26         psAbort ("analysis image already exists");
     26        psAbort ("analysis image already exists");
    2727    }
    2828    psImageInit(image, init);
     
    3535// XXX not sure why this should call psMemIncrRefCounter
    3636psImage *pmReadoutGetAnalysisImage(pmReadout *readout, // Readout containing image
    37                                    const char *name       // Name of image in analysis metadata
     37                                   const char *name       // Name of image in analysis metadata
    3838    )
    3939{
     
    7878
    7979// XXX for the moment, use col0, row0, numCols, numRows supplied from the outside
    80 bool pmReadoutStackDefineOutput(pmReadout *readout, int col0, int row0, int numCols, int numRows, bool mask, bool weight, psImageMaskType blank)
     80bool pmReadoutStackDefineOutput(pmReadout *readout, int col0, int row0, int numCols, int numRows, bool mask, bool variance, psImageMaskType blank)
    8181{
    8282    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    9292
    9393    if (mask) {
    94         // XXX is this an error?
     94        // XXX is this an error?
    9595        if (readout->mask) return false;
    96         readout->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK);
    97         psImageInit(readout->mask, blank);
    98     }
    99 
    100     if (weight) {
    101         // XXX is this an error?
    102         if (readout->weight) return false;
    103         readout->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    104         psImageInit(readout->weight, NAN);
     96        readout->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK);
     97        psImageInit(readout->mask, blank);
     98    }
     99
     100    if (variance) {
     101        // XXX is this an error?
     102        if (readout->variance) return false;
     103        readout->variance = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     104        psImageInit(readout->variance, NAN);
    105105    }
    106106
     
    162162
    163163bool pmReadoutUpdateSize(pmReadout *readout, int minCols, int minRows,
    164                          int numCols, int numRows, bool mask, bool weight,
     164                         int numCols, int numRows, bool mask, bool variance,
    165165                         psImageMaskType blank)
    166166{
     
    203203    }
    204204
    205     if (weight) {
    206         if (!readout->weight) {
    207             readout->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    208             psImageInit(readout->weight, NAN);
    209         }
    210         if (readout->weight->numCols < numCols || readout->weight->numRows < numRows) {
    211             psImage *newWeight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    212             psImageInit(newWeight, NAN);
    213             psImageOverlaySection(newWeight, readout->weight, readout->col0, readout->row0, "=");
    214             psFree(readout->weight);
    215             readout->weight = newWeight;
     205    if (variance) {
     206        if (!readout->variance) {
     207            readout->variance = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     208            psImageInit(readout->variance, NAN);
     209        }
     210        if (readout->variance->numCols < numCols || readout->variance->numRows < numRows) {
     211            psImage *newVariance = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     212            psImageInit(newVariance, NAN);
     213            psImageOverlaySection(newVariance, readout->variance, readout->col0, readout->row0, "=");
     214            psFree(readout->variance);
     215            readout->variance = newVariance;
    216216        }
    217217    }
Note: See TracChangeset for help on using the changeset viewer.