IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18556


Ignore:
Timestamp:
Jul 15, 2008, 10:26:37 AM (18 years ago)
Author:
eugene
Message:

re-org and cleanup of the mask bits to make it consistent with the pmConfigMaskSetBits concepts; ensure mark and mask are correctly used and supplied to psphot

Location:
trunk/ppImage/src
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/Makefile.am

    r16084 r18556  
    2929        ppImageReplaceBackground.c \
    3030        ppImageDefineFile.c \
     31        ppImageSetMaskBits.c \
    3132        ppImageFileCheck.c \
    3233        ppImageVersion.c \
     
    5859        ppImageReplaceBackground.c \
    5960        ppImageDefineFile.c \
     61        ppImageSetMaskBits.c \
    6062        ppImageFileCheck.c \
    6163        ppImageVersion.c \
  • trunk/ppImage/src/ppImage.h

    r16084 r18556  
    5656    // make values for abstract concepts of masking
    5757    psMaskType maskValue;               // apply this bit-mask to choose masked bits
     58    psMaskType markValue;               // apply this bit-mask to choose masked bits
    5859    psMaskType satMask;                 // Mask value to give saturated pixels
    5960    psMaskType badMask;                 // Mask value to give bad pixels
     
    101102// Determine what type of camera, and initialise
    102103ppImageOptions *ppImageParseCamera(pmConfig *config);
     104bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options);
    103105
    104106// Loop over the input
     
    134136bool ppImageMosaicFPA (pmConfig *config, const ppImageOptions *options,
    135137                       const char *outFile, const char *inFile);
     138
     139bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options);
    136140
    137141void ppImageFileCheck (pmConfig *config);
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r17218 r18556  
    7474    if (options->doShutter) {
    7575        pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER");
    76         if (!pmShutterCorrectionApply(input, shutter, pmConfigMask("FLAT", config))) {
     76        if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) {
    7777            return false;
    7878        }
  • trunk/ppImage/src/ppImageLoop.c

    r16249 r18556  
    6262                    continue;
    6363                }
     64
     65                // XXX set the options->*Mask values here (after the mask images have been loaded
     66                // and before any of the value are used)
     67                if (!ppImageSetMaskBits (config, options))
     68                    ESCAPE ("Unable to set bit masks");
    6469
    6570                // perform the detrend analysis
  • trunk/ppImage/src/ppImageMetadataStats.c

    r16249 r18556  
    1313        return true;
    1414    }
    15 
    16     psMaskType maskVal = options->satMask | options->badMask | options->maskValue;
    1715
    1816    // Extract statistics from the last output fpa
     
    5048    pmFPAview *view = pmFPAviewAlloc(0);
    5149
    52     if (!ppStatsMetadata(stats, output->fpa, view, maskVal, config)) {
     50    if (!ppStatsMetadata(stats, output->fpa, view, options->maskValue, config)) {
    5351        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image.");
    5452        psFree(view);
  • trunk/ppImage/src/ppImageMosaic.c

    r13901 r18556  
    3232            in->name, out->name, in->xBin, in->yBin, out->xBin, out->yBin);
    3333
    34     // XXX mosaic the chip, making a deep copy.  this has the side effect of making the
    35     // output image products pure trimmed images, but also increases the memory footprint.
     34    // Mosaic the chip, making a deep copy.  This has the side effect of making the output
     35    // image products pure trimmed images, but also increases the memory footprint.
    3636    status = pmChipMosaic(outChip, inChip, true, options->blankMask);
    3737    return status;
  • trunk/ppImage/src/ppImageOptions.c

    r17688 r18556  
    5050
    5151    // default flags for various activities
    52     options->maskValue       = 0x00;    // Default mask value
    53     options->satMask         = 0x00;    // Saturated pixels
    54     options->badMask         = 0x00;    // Bad pixels
    55     options->flatMask        = 0x00;    // Bad flat pixels
    56     options->blankMask       = 0x00;    // Blank (no data, cell gap) pixels
     52    options->maskValue       = 0x00;    // Default mask value (used to skip / ignore pixels)
     53    options->satMask         = 0x00;    // Saturated pixels (supplied to pmReadoutGenerateMask)
     54    options->badMask         = 0x00;    // Bad (low) pixels (supplied to pmReadoutGenerateMask)
     55    options->flatMask        = 0x00;    // Bad flat pixels (supplied to pmFlatField)
     56    options->blankMask       = 0x00;    // Blank (no data, cell gap) pixels (supplied to pmChipMosaic, pmFPAMosaic)
     57    options->markValue       = 0x00;    // A safe bit for internal marking
    5758
    5859    // Non-linearity default options
     
    190191    options->doWeightBuild = psMetadataLookupBool(NULL, recipe, "WEIGHT.BUILD");
    191192
    192     // Mask recipe options
     193    // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
    193194    options->doMask = psMetadataLookupBool(NULL, recipe, "MASK");
    194     const char *masks = psMetadataLookupStr(&status, recipe, "MASK.VALUE");
    195     if (status) {
    196         options->maskValue = pmConfigMask(masks, config);
    197     }
    198     options->satMask = pmConfigMask("SAT", config);
    199     options->badMask = pmConfigMask("BAD", config);
    200     options->flatMask = pmConfigMask("FLAT", config);
    201     options->blankMask = pmConfigMask("BLANK", config);
    202     // XXX should it be an error for these to not exist?
    203195
    204196    options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS");
  • trunk/ppImage/src/ppImageParseCamera.c

    r18422 r18556  
    2020    }
    2121
    22     // if MASK or WEIGHT was supplied on command line, bind files to 'input'
     22    // if MASK or WEIGHT was supplied on command line, bind files to 'input'.
    2323    // the mask and weight will be mosaicked with the image
    2424    pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "PPIMAGE.INPUT.MASK");
     
    2727        return NULL;
    2828    }
    29     if (inputMask && inputMask->type != PM_FPA_FILE_MASK) {
     29    if (inputMask) {
     30      if (inputMask->type != PM_FPA_FILE_MASK) {
    3031        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.MASK is not of type MASK");
    3132        return NULL;
     33      }
    3234    }
    3335
     
    6668    }
    6769    if (options->doMask) {
     70
    6871        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
    6972            psError (PS_ERR_IO, false, "Can't find a mask image source");
     
    7174            return NULL;
    7275        }
    73         // Need to read the names of bit masks from the mask header and set them in the recipe
     76        // XXX have ppImageDefineFile return the pmFPAfile?
     77        pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK");
     78        psAssert (mask, "mask not defined?  not possible!");
     79
     80        // Need to read the names of bit masks from the mask header and set them in the
     81        // recipe.  If we are loading this from the detrend db, this action will happen
     82        // when the file is resolved.
     83        if (!mask->detrend) {
     84            // XXX need to load the mask bit names from one of the headers
     85            // this grabs the first available hdu : no guarantee that it will be valid, though
     86            pmHDU *hdu = pmHDUGetFirst (mask->fpa);
     87            if (!hdu) {
     88                psError(PS_ERR_IO, true, "no valid HDU for PPIMAGE.INPUT.MASK");
     89                return NULL;
     90            }
     91            // XXX is this consistent with the pmConfigMaskReadHeader call above?
     92            if (!pmConfigMaskReadHeader (config, hdu->header)) {
     93                psError(PS_ERR_IO, false, "error in mask bits");
     94                return NULL;
     95            }
     96        }
    7497    }
    7598    if (options->doShutter) {
  • trunk/ppImage/src/ppImagePixelStats.c

    r14000 r18556  
    99
    1010    bool mdok;              // Status of MD lookup
    11 
    12     psMaskType maskVal = options->satMask | options->badMask | options->maskValue;
    1311
    1412    // loop over the cells/readouts for this chip
     
    4846        }
    4947
    50         if (!ppStatsPixels(stats, output->fpa, view, maskVal, config)) {
     48        if (!ppStatsPixels(stats, output->fpa, view, options->maskValue, config)) {
    5149            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image.");
    5250            psFree (view);
  • trunk/ppImage/src/ppImageReplaceBackground.c

    r18255 r18556  
    4040    psAssert (replaceSkyMode != MODE_NONE, "replace sky mode not defined");
    4141
    42     // define the mask value to be used in ppImage
    43     psMaskType maskVal  = options->satMask | options->badMask | options->flatMask | options->blankMask;
     42    // XXX Should this be options->maskValue or & ~options->satMask? the latter will leave saturated pixels high
     43    // psMaskType maskVal  = options->maskValue & ~options->satMask;
     44    psMaskType maskVal  = options->maskValue;
    4445
    4546    pmFPAfile *modelFile = NULL;
  • trunk/ppImage/src/ppImageStats.c

    r14000 r18556  
    5757            }
    5858
    59             if (!ppStatsFPA(stats, output->fpa, view,
    60                          options->satMask | options->badMask | options->maskValue,
    61                          config)) {
     59            if (!ppStatsFPA(stats, output->fpa, view, options->maskValue, config)) {
    6260                psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image.");
    6361                psFree(view);
Note: See TracChangeset for help on using the changeset viewer.