IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 4:31:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

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

    r21183 r21363  
    554554        // We have to do all of the hard work ourselves
    555555        switch (type) {
    556             FILL_IN(U8);
    557             FILL_IN(U16);
    558             FILL_IN(U32);
    559             FILL_IN(U64);
    560             FILL_IN(S8);
    561             FILL_IN(S16);
    562             FILL_IN(S32);
    563             FILL_IN(S64);
    564             FILL_IN(F32);
    565             FILL_IN(F64);
     556            FILL_IN(U8);
     557            FILL_IN(U16);
     558            FILL_IN(U32);
     559            FILL_IN(U64);
     560            FILL_IN(S8);
     561            FILL_IN(S16);
     562            FILL_IN(S32);
     563            FILL_IN(S64);
     564            FILL_IN(F32);
     565            FILL_IN(F64);
    566566          default:
    567567            psAbort("Should never get here.\n");
     
    575575static bool addCell(psArray *images,    // Array of images
    576576                    psArray *masks,     // Array of masks
    577                     psArray *weights,   // Array of weights
     577                    psArray *variances,   // Array of variances
    578578                    psVector *x0,       // Array of X0
    579579                    psVector *y0,       // Array of Y0
     
    604604        images  = psArrayRealloc(images,  index + CELL_LIST_BUFFER);
    605605        masks   = psArrayRealloc(masks,   index + CELL_LIST_BUFFER);
    606         weights = psArrayRealloc(weights, index + CELL_LIST_BUFFER);
     606        variances = psArrayRealloc(variances, index + CELL_LIST_BUFFER);
    607607        x0    = psVectorRealloc(x0,    index+ CELL_LIST_BUFFER);
    608608        y0    = psVectorRealloc(y0,    index+ CELL_LIST_BUFFER);
     
    615615    images->n = index + 1;
    616616    masks->n = index + 1;
    617     weights->n = index + 1;
     617    variances->n = index + 1;
    618618    x0->n = index + 1;
    619619    y0->n = index + 1;
     
    726726    // The images to put into the mosaic
    727727    images->data[index]  = psMemIncrRefCounter(readout->image);
    728     weights->data[index] = psMemIncrRefCounter(readout->weight);
     728    variances->data[index] = psMemIncrRefCounter(readout->variance);
    729729    masks->data[index]   = psMemIncrRefCounter(readout->mask);
    730730
     
    740740static bool chipMosaic(psImage **mosaicImage, // The mosaic image, to be returned
    741741                       psImage **mosaicMask, // The mosaic mask, to be returned
    742                        psImage **mosaicWeights, // The mosaic weights, to be returned
     742                       psImage **mosaicVariances, // The mosaic variances, to be returned
    743743                       int *xBinChip, int *yBinChip, // The binning in x and y, to be returned
    744744                       const pmChip *chip, // Chip to mosaic
     
    749749    assert(mosaicImage);
    750750    assert(mosaicMask);
    751     assert(mosaicWeights);
     751    assert(mosaicVariances);
    752752    assert(xBinChip);
    753753    assert(yBinChip);
     
    756756
    757757    psArray *images = psArrayAlloc(0); // Array of images that will be mosaicked
    758     psArray *weights = psArrayAlloc(0); // Array of weight images to be mosaicked
     758    psArray *variances = psArrayAlloc(0); // Array of variance images to be mosaicked
    759759    psArray *masks = psArrayAlloc(0); // Array of mask images to be mosaicked
    760760    psVector *x0 = psVectorAlloc(0, PS_TYPE_S32); // Origin x coordinates
     
    802802            continue;
    803803        }
    804         allGood &= addCell(images, masks, weights, x0, y0, xBin, yBin, xFlip, yFlip,
     804        allGood &= addCell(images, masks, variances, x0, y0, xBin, yBin, xFlip, yFlip,
    805805                           cell, xBinChip, yBinChip, false, x0Target, y0Target,
    806806                           xParityTarget, yParityTarget);
     
    826826    if (allGood) {
    827827        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
    828         *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
     828        *mosaicVariances = imageMosaic(variances, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
    829829        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, blank);
    830830    }
     
    832832    // Clean up
    833833    psFree(images);
    834     psFree(weights);
     834    psFree(variances);
    835835    psFree(masks);
    836836    psFree(xFlip);
     
    847847static bool fpaMosaic(psImage **mosaicImage, // The mosaic image, to be returned
    848848                      psImage **mosaicMask, // The mosaic mask, to be returned
    849                       psImage **mosaicWeights, // The mosaic weights, to be returned
     849                      psImage **mosaicVariances, // The mosaic variances, to be returned
    850850                      int *xBinFPA, int *yBinFPA, // The binning in x and y, to be returned
    851851                      const pmFPA *fpa,  // FPA to mosaic
     
    857857    assert(mosaicImage);
    858858    assert(mosaicMask);
    859     assert(mosaicWeights);
     859    assert(mosaicVariances);
    860860    assert(xBinFPA);
    861861    assert(yBinFPA);
     
    865865
    866866    psArray *images = psArrayAlloc(0); // Array of images that will be mosaicked
    867     psArray *weights = psArrayAlloc(0); // Array of weight images to be mosaicked
     867    psArray *variances = psArrayAlloc(0); // Array of variance images to be mosaicked
    868868    psArray *masks = psArrayAlloc(0); // Array of mask images to be mosaicked
    869869    psVector *x0 = psVectorAlloc(0, PS_TYPE_S32); // Origin x coordinates
     
    941941                continue;
    942942            }
    943             allGood |= addCell(images, masks, weights, x0, y0, xBin, yBin, xFlip, yFlip,
     943            allGood |= addCell(images, masks, variances, x0, y0, xBin, yBin, xFlip, yFlip,
    944944                               cell, xBinFPA, yBinFPA, true, x0Target, y0Target,
    945945                               xParityTarget, yParityTarget);
     
    960960    if (allGood) {
    961961        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
    962         *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
     962        *mosaicVariances = imageMosaic(variances, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
    963963        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, blank);
    964964    }
     
    966966    // Clean up
    967967    psFree(images);
    968     psFree(weights);
     968    psFree(variances);
    969969    psFree(masks);
    970970    psFree(xFlip);
     
    10251025    psImage *mosaicImage   = NULL;      // The mosaic image
    10261026    psImage *mosaicMask    = NULL;      // The mosaic mask
    1027     psImage *mosaicWeights = NULL;      // The mosaic weights
     1027    psImage *mosaicVariances = NULL;      // The mosaic variances
    10281028
    10291029    // Find the HDU
     
    10511051            }
    10521052        }
    1053         if (hdu->weights) {
    1054             mosaicWeights = psImageSubset(hdu->weights->data[0], bounds);
    1055             if (!mosaicWeights) {
    1056                 psError(PS_ERR_UNKNOWN, false, "Unable to select weight pixels.\n");
     1053        if (hdu->variances) {
     1054            mosaicVariances = psImageSubset(hdu->variances->data[0], bounds);
     1055            if (!mosaicVariances) {
     1056                psError(PS_ERR_UNKNOWN, false, "Unable to select variance pixels.\n");
    10571057                return false;
    10581058            }
     
    10611061        // Case 2 --- we need to mosaic by cut and paste
    10621062        psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n");
    1063         if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source, targetCell, blank)) {
     1063        if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicVariances, &xBin, &yBin, source, targetCell, blank)) {
    10641064            psError(PS_ERR_UNKNOWN, false, "Unable to mosaic cells.\n");
    10651065            return false;
     
    10941094    newReadout->image  = mosaicImage;
    10951095    newReadout->mask   = mosaicMask;
    1096     newReadout->weight = mosaicWeights;
     1096    newReadout->variance = mosaicVariances;
    10971097    psFree(newReadout);                 // Drop reference
    10981098
     
    12621262    psImage *mosaicImage   = NULL;      // The mosaic image
    12631263    psImage *mosaicMask    = NULL;      // The mosaic mask
    1264     psImage *mosaicWeights = NULL;      // The mosaic weights
     1264    psImage *mosaicVariances = NULL;      // The mosaic variances
    12651265
    12661266    // Find the HDU
     
    12751275            mosaicMask = psImageSubset(hdu->masks->data[0], *fpaRegion);
    12761276        }
    1277         if (hdu->weights) {
    1278             mosaicWeights = psImageSubset(hdu->weights->data[0], *fpaRegion);
     1277        if (hdu->variances) {
     1278            mosaicVariances = psImageSubset(hdu->variances->data[0], *fpaRegion);
    12791279        }
    12801280    } else {
    12811281        // Case 2 --- we need to mosaic by cut and paste
    12821282        psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n");
    1283         if (!fpaMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source,
     1283        if (!fpaMosaic(&mosaicImage, &mosaicMask, &mosaicVariances, &xBin, &yBin, source,
    12841284                       targetChip, targetCell, blank)) {
    12851285            psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chips.\n");
     
    13381338    newReadout->image  = mosaicImage;
    13391339    newReadout->mask   = mosaicMask;
    1340     newReadout->weight = mosaicWeights;
     1340    newReadout->variance = mosaicVariances;
    13411341    psFree(newReadout);                 // Drop reference
    13421342
Note: See TracChangeset for help on using the changeset viewer.