IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41382 for trunk/ppImage/src


Ignore:
Timestamp:
Jun 23, 2020, 3:29:09 PM (6 years ago)
Author:
tdeboer
Message:

added procedure to remove pixel NaNing

Location:
trunk/ppImage/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImage.h

    r40453 r41382  
    2828    bool doVarianceBuild;               // Build internal variance map
    2929    bool doApplyBurntool;               // apply burntool correction
     30    bool doApplyPixelZero;              // put to zero pixels underneath mask
    3031    bool doMaskBurntool;                // mask potential burntool trails
    3132    bool doMaskSat;                     // mask saturated pixels
  • trunk/ppImage/src/ppImageOptions.c

    r38233 r41382  
    5353    options->useVideoDark    = false;   // Use video dark if we can?
    5454    options->useVideoMask    = false;   // Use video mask if we can?
     55    options->doApplyPixelZero  = true;   // option for zero'ing pixels under masks
     56
    5557    // output files requested
    5658    options->BaseFITS        = false;   // create output image
     
    234236    options->doMaskBurntool  = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
    235237    options->doApplyBurntool = psMetadataLookupBool(NULL, recipe, "APPLY.BURNTOOL");
     238    //TdB: read in switch for zero'ing pixels under masks
     239    options->doApplyPixelZero = psMetadataLookupBool(NULL, recipe, "APPLY.PIXELZERO");
    236240    options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
    237241    options->doAuxMask       = psMetadataLookupBool(NULL, recipe, "MASK.AUXMASK");
     
    245249        }
    246250    }
     251
    247252
    248253    // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
  • trunk/ppImage/src/ppImageReplaceBackground.c

    r26895 r41382  
    144144    for (int y = 0; y < numRows; y++) {
    145145        for (int x = 0; x < numCols; x++) {
    146             if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
    147                 image->data.F32[y][x] = 0.0;
     146            if(options->doApplyPixelZero) {
     147              if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
     148                  image->data.F32[y][x] = 0.0;
     149              } else {
     150                float value = backData[y][x];
     151                if (!isfinite(value)) {
     152                    image->data.F32[y][x] = NAN;
     153                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask;
     154                } else {
     155                    image->data.F32[y][x] -= value;
     156                }
     157              }
    148158            } else {
    149159                float value = backData[y][x];
     
    154164                    image->data.F32[y][x] -= value;
    155165                }
    156             }
     166            }
    157167        }
    158168    }
     
    162172    for (int y = 0; y < numRows; y++) {
    163173        for (int x = 0; x < numCols; x++) {
    164             if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
    165                 image->data.F32[y][x] = 0.0;
     174            if(options->doApplyPixelZero) {
     175              if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
     176                  image->data.F32[y][x] = 0.0;
     177              } else {
     178                float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelRO->image, binning); // Background value
     179                if (!isfinite(value)) {
     180                    image->data.F32[y][x] = NAN;
     181                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask;
     182                } else {
     183                    image->data.F32[y][x] -= value;
     184                }
     185              }
    166186            } else {
    167187                float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelRO->image, binning); // Background value
Note: See TracChangeset for help on using the changeset viewer.