IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2008, 5:10:17 PM (18 years ago)
Author:
Paul Price
Message:

Merging pap_branch_080328 so we can use the modernised version of ppMerge.

File:
1 edited

Legend:

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

    r17009 r17228  
    33#endif
    44
     5#include <stdio.h>
     6#include <string.h>
    57#include <pslib.h>
    68
    79#include "pmReadoutStack.h"
    810
     11psImage *pmReadoutAnalysisImage(pmReadout *readout, // Readout containing image
     12                                const char *name, // Name of image in analysis metadata
     13                                int numCols, int numRows, // Expected size of image
     14                                psElemType type, // Expected type of image
     15                                double init // Initial value
     16    )
     17{
     18    PS_ASSERT_PTR_NON_NULL(readout, false);
     19    PS_ASSERT_STRING_NON_EMPTY(name, false);
     20
     21    bool mdok;                          // Status of MD lookup
     22    psImage *image = psMetadataLookupPtr(&mdok, readout->analysis, name);
     23    if (!image) {
     24        image = psImageAlloc(numCols, numRows, type);
     25        psMetadataAddImage(readout->analysis, PS_LIST_TAIL, name, 0, "Analysis image from " __FILE__, image);
     26        psImageInit(image, init);
     27        return image;
     28    }
     29    if (image->numCols != numCols || image->numRows != numRows) {
     30        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Analysis image %s has incorrect size (%dx%d vs %dx%d)",
     31                name, image->numCols, image->numRows, numCols, numRows);
     32        return NULL;
     33    }
     34    if (image->type.type != type) {
     35        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Analysis image %s has incorrect type (%x vs %x)",
     36                name, image->type.type, type);
     37        return NULL;
     38    }
     39    return psMemIncrRefCounter(image);
     40}
    941
    1042bool pmReadoutUpdateSize(pmReadout *readout, int minCols, int minRows,
Note: See TracChangeset for help on using the changeset viewer.