IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24003


Ignore:
Timestamp:
Apr 29, 2009, 5:21:31 PM (17 years ago)
Author:
Paul Price
Message:

Deal with mask when binning.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSkycell/src/ppSkycellLoop.c

    r24000 r24003  
    201201        psImageInit(image2, 0);
    202202
     203        psImage *mask1 = NULL, *mask2 = NULL; // Binned masks
     204        if (data->masksName) {
     205            mask1 = psImageAlloc(numCols1, numRows1, PS_TYPE_IMAGE_MASK);
     206            mask2 = psImageAlloc(numCols2, numRows2, PS_TYPE_IMAGE_MASK);
     207            psImageInit(mask1, 0xFF);
     208            psImageInit(mask2, 0xFF);
     209        }
     210
    203211        for (int j = 0; j < data->numInputs; j++) {
    204212            if (target->data.S32[j] != i) {
     
    256264            psImageOverlaySection(image1, bin1RO->image, xOffset1, yOffset1, "=");
    257265            psImageOverlaySection(image2, bin2RO->image, xOffset2, yOffset2, "=");
     266            if (data->masksName) {
     267                psImageOverlaySection(mask1, bin1RO->mask, xOffset1, yOffset1, "=");
     268                psImageOverlaySection(mask2, bin2RO->mask, xOffset2, yOffset2, "=");
     269            }
    258270
    259271            psFree(bin1RO);
     
    280292        ro1->image = image1;
    281293        ro2->image = image2;
     294        ro1->mask = mask1;
     295        ro2->mask = mask2;
    282296
    283297        ro1->data_exists = cell1->data_exists = cell1->parent->data_exists = true;
  • trunk/psModules/src/camera/pmFPABin.c

    r21183 r24003  
    2828    int numColsOut = binning->nXruff, numRowsOut = binning->nYruff; // Size of output image
    2929
    30     // Output image
    31     psImage *outImage;
     30
     31    psImage *outImage;                  // Output image
    3232    if (out->image && out->image->numCols >= numColsOut && out->image->numRows >= numRowsOut) {
    3333        outImage = out->image;
    3434    } else {
    3535        outImage = out->image = psImageRecycle(out->image,  numColsOut, numRowsOut, PS_TYPE_F32);
     36    }
     37
     38    psImage *outMask;                   // Output mask
     39    if (out->mask && out->mask->numCols >= numColsOut && out->mask->numRows >= numRowsOut) {
     40        outMask = out->mask;
     41    } else {
     42        outMask = out->mask = psImageRecycle(out->mask,  numColsOut, numRowsOut, PS_TYPE_IMAGE_MASK);
    3643    }
    3744
     
    5865            }
    5966
    60             outImage->data.F32[yOut][xOut] = numPix > 0 ? sum / numPix : NAN;
     67            float imageValue, maskValue;// Values to set
     68            if (numPix > 0) {
     69                imageValue = sum / numPix;
     70                maskValue = 0;
     71            } else {
     72                imageValue = NAN;
     73                maskValue = maskVal;
     74            }
     75            outImage->data.F32[yOut][xOut] = imageValue;
     76            outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
    6177            xStart = xStop;
    6278        }
Note: See TracChangeset for help on using the changeset viewer.