IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18475


Ignore:
Timestamp:
Jul 11, 2008, 8:40:35 AM (18 years ago)
Author:
eugene
Message:

overhaul of the mask bit names

Location:
branches/eam_branch_20080706
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080706/ippconfig/cfh12k/ppMerge.config

    r12374 r18475  
    2828        FRACLOW         F32     0.1             # Fraction of low pixels to reject immediately
    2929        NKEEP           S32     5               # Minimum number of pixels in stack to keep
    30         MASKVAL         S32     0xff            # Mask value for input data
    3130        WEIGHTS         BOOL    TRUE            # Use image weights?
    3231        COMBINE         STR     MEAN            # Statistic to use for combination:
  • branches/eam_branch_20080706/ippconfig/lbc_red/ppMerge.config

    r17154 r18475  
    2828        FRACLOW         F32     0.1             # Fraction of low pixels to reject immediately
    2929        NKEEP           S32     5               # Minimum number of pixels in stack to keep
    30         MASKVAL         S32     0xff            # Mask value for input data
    3130        WEIGHTS         BOOL    TRUE            # Use image weights?
    3231        COMBINE         STR     MEAN            # Statistic to use for combination:
  • branches/eam_branch_20080706/ippconfig/recipes/filerules-split.mdc

    r18398 r18475  
    138138PSPHOT.OUT.CMF.SPL      OUTPUT {OUTPUT}.{CHIP.NAME}.cmf          CMF       NONE       CHIP       TRUE      NONE
    139139PSPHOT.OUT.CMF.MEF      OUTPUT {OUTPUT}.cmf                      CMF       NONE       FPA        TRUE      MEF
    140 PSPHOT.PSF.SAVE         OUTPUT {OUTPUT}.psf                      PSF       NONE       CHIP       TRUE      MEF
     140PSPHOT.PSF.SAVE         OUTPUT {OUTPUT}.{CHIP.NAME}.psf          PSF       NONE       CHIP       TRUE      MEF
    141141                                                                                                       
    142142SOURCE.PLOT.MOMENTS     OUTPUT {OUTPUT}.{CHIP.NAME}.mnt.png      KAPA      NONE       CHIP       TRUE      NONE
  • branches/eam_branch_20080706/ippconfig/recipes/masks.config

    r13592 r18475  
    11### Recipe specifying values for various mask concepts
     2
     3# this file defines bit values for various abstract mask concepts.  It
     4# is not necessary for all bit values to be unique.  Note that there
     5# are two main classes: detector-intrinsic and detector-extrinsic
     6# effects.  The former will default to DETECTOR and the latter to
     7# RANGE if those values are not specifed
     8
     9# Note that it is necessary to leave at least a single unassigned bit
     10# for internal marking (or ppImage will complain)
     11
     12# these mask values are used for detector intrinsic effects
     13# BLANK and FLAT will be set to DETECTOR if not specified
     14DETECTOR        U8      0x01            # Generic detector-intrinsic defect
    215BLANK           U8      0x01            # The pixel is blank or has no (valid) data
     16DARK            U8      0x02            # The pixel is not correctable for dark current
    317FLAT            U8      0x02            # The pixel is non-positive in the flat-field
    4 DETECTOR        U8      0x02            # The detector pixel is bad (e.g., bad column, charge trap)
     18
     19# these mask values are used for detector extrinsic effects
     20# SAT and BAD will be set to RANGE if not specified
     21RANGE           U8      0x04            # The pixel is out of range in the image of interest
    522SAT             U8      0x04            # The pixel is saturated in the image of interest
    623BAD             U8      0x04            # The pixel is low in the image of interest
    7 RANGE           U8      0x04            # The pixel is out of range in the image of interest
     24
    825CR              U8      0x08            # The pixel is probably a CR
    9 SUSPECT         U8      0x40            # The pixel is suspected of being bad, but may not be
    10 MARK            U8      0x80            # The pixel is marked as temporarily ignored
     26GHOST           U8      0x08            # The pixel is probably a CR
  • branches/eam_branch_20080706/ippconfig/recipes/ppImage.config

    r18372 r18475  
    1111FLAT             BOOL    TRUE            # Flat-field normalisation
    1212MASK             BOOL    FALSE           # Mask bad pixels
    13 MASK.VALUE       STR     SAT,BAD,DETECTOR # Mask pixels with these attributes
     13
     14# XXX EAM : this is being deprecated
     15# MASK.VALUE       STR     SAT,BAD,DETECTOR # Mask pixels with these attributes
    1416
    1517MASK.BUILD       BOOL    FALSE           # Build internal mask image
  • branches/eam_branch_20080706/ippconfig/recipes/ppMerge.config

    r18253 r18475  
    2020MASK.CHIPSTATS  BOOL    TRUE            # Measure stats for masking by chip (otherwise by readout)?
    2121MASK.GROW       S32     0               # Grow bad pixels by this radius
    22 MASK.GROWVAL    STR     SUSPECT         # Give grown mask pixels this value
    23 MASKVAL         STR     SAT,BAD         # Mask value for input data
     22MASK.SET.VALUE  STR     FLAT            # set this bit in the output mask
     23
    2424COMBINE         STR     CLIPPED         # Statistic to use for combination
    2525MEAN            STR     ROBUST_MEDIAN   # Statistic to use to measure the mean
     
    8383        MASK.BAD        F32     0.2             # Threshold for bad pixels (sigma)
    8484        MASK.MODE       STR     FRACTION        # Mode for identifying bad pixels in the suspect map
     85        MASK.SET.VALUE  STR     DARK            # set this bit in the output mask
    8586END
    8687
     
    9091        MASK.BAD        F32     0.2             # Threshold for bad pixels (sigma)
    9192        MASK.MODE       STR     FRACTION        # Mode for identifying bad pixels in the suspect map
     93        MASK.SET.VALUE  STR     FLAT            # set this bit in the output mask
    9294END
    9395
  • branches/eam_branch_20080706/ippconfig/recipes/ppStats.config

    r17911 r18475  
    33# Options governing statistics
    44SAMPLE          F32     0.1     # Fraction of cell to sample
    5 MASKVAL         STR     SAT,BAD # Mask value to use for statistics
     5
     6# Mask value to use for statistics.  this is only used for stand-alone
     7# operations.  ppStats library calls pass a mask value as needed
     8MASKVAL         STR     SAT,BAD
     9
    610
    711# Define the outputs as MULTI
  • branches/eam_branch_20080706/ippconfig/recipes/psphot.config

    r18275 r18475  
    1515ZERO_POINT                          F32   25.000          # zero point used by DVO
    1616ZERO_PT                             F32   25.000          # zero point used by DVO
    17 
    18 MASKVAL                             STR   SAT,BAD,BLANK   # Mask these types of pixels
    1917
    2018OUTPUT.FORMAT                       STR   PS1_DEV_1
  • branches/eam_branch_20080706/ppMerge/src/ppMergeArguments.c

    r18365 r18475  
    138138    psMetadataAddS32(arguments, PS_LIST_TAIL, "-nkeep",    0, "Minimum number of pixels in stack to keep", 0);
    139139    psMetadataAddBool(arguments, PS_LIST_TAIL, "-weights", 0, "Use image weights in combination?", false);
    140     psMetadataAddStr(arguments, PS_LIST_TAIL, "-maskval",  0, "Mask value for input data", NULL);
     140
     141    // XXX EAM : not clear this should be allowed on the command line.
     142    // psMetadataAddStr(arguments, PS_LIST_TAIL, "-maskval",  0, "Mask value for input data", NULL);
     143
    141144    psMetadataAddStr(arguments, PS_LIST_TAIL, "-combine",  0, "Statistic to use for combination", NULL);
    142145    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mean",     0, "Statistic to use to measure the mean", NULL);
     
    159162    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-mode",     0, "Mode to identify bad pixels", NULL);
    160163    psMetadataAddS32(arguments, PS_LIST_TAIL, "-mask-grow",     0, "Number of pixels to grow final mask", 0);
    161     psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-growval",  0, "Value to give grown mask pixels", NULL);
     164    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-set-valud",0, "Value to set for output mask pixels", NULL);
    162165    psMetadataAddBool(arguments, PS_LIST_TAIL, "-mask-chip",    0, "Measure mask statistics by chip?", false);
    163166
     
    264267    VALUE_ARG_RECIPE_INT("-nkeep",      "NKEEP",    S32, 0);
    265268    VALUE_ARG_RECIPE_BOOL("-weights",   "WEIGHTS");
    266     VALUE_ARG_RECIPE_MASK("-maskval",   "MASKVAL");
     269
     270    // XXX we do not supply this on the command line
     271    // VALUE_ARG_RECIPE_MASK("-maskval",   "MASKVAL");
     272
    267273    VALUE_ARG_RECIPE_STAT("-combine",   "COMBINE");
    268274    VALUE_ARG_RECIPE_STAT("-mean",      "MEAN");
     
    281287    VALUE_ARG_RECIPE_FLOAT("-mask-suspect", "MASK.SUSPECT", F32);
    282288    VALUE_ARG_RECIPE_FLOAT("-mask-bad",     "MASK.BAD",     F32);
    283     VALUE_ARG_RECIPE_INT("-mask-grow",      "MASK.GROW",    S32, -1);
    284     VALUE_ARG_RECIPE_MASK("-mask-growval",  "MASK.GROWVAL");
     289    VALUE_ARG_RECIPE_INT("-mask-grow",      "MASK.GROW",    S32, 0);
     290    VALUE_ARG_RECIPE_STR("-mask-set-value", "MASK.SET.VALUE");
    285291    VALUE_ARG_RECIPE_BOOL("-mask-chip",     "MASK.CHIPSTATS");
    286292
  • branches/eam_branch_20080706/ppMerge/src/ppMergeLoop.c

    r18166 r18475  
    3939    float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels
    4040    int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep
    41     psMaskType maskVal = psMetadataLookupU8(NULL, arguments, "MASKVAL"); // Value to mask
    4241    psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic
    4342    bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); // Use weights?
     
    4948    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y
    5049
     50    // set the mask and mark bit values based on the named masks
     51    psMaskType maskVal;
     52    psMaskType markVal;
     53    if (!pmConfigMaskSetBits (&maskVal, &markVal, config)) {
     54        psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
     55        return false;
     56    }
     57
    5158    pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters
    5259    combination->maskVal = maskVal;
    53     combination->blank = pmConfigMask("BLANK", config);
     60    combination->blank = pmConfigMaskGet("BLANK", config);
    5461    combination->nKeep = nKeep;
    5562    combination->fracHigh = frachigh;
     
    294301            }
    295302
    296             if (!ppStatsFPA(stats, outFPA, view, maskVal | pmConfigMask("BLANK", config), config)) {
     303            if (!ppStatsFPA(stats, outFPA, view, maskVal, config)) {
    297304                psError(PS_ERR_UNKNOWN, true, "Unable to generate stats for image.");
    298305                goto ERROR;
  • branches/eam_branch_20080706/ppMerge/src/ppMergeMask.c

    r18365 r18475  
    1818                      psRandom *rng,    // Random number generator
    1919                      psMetadata *stats // Statistics output
    20                       )
     20    )
    2121{
    2222    assert(config);
     
    2828    psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean
    2929    psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev
    30     psMaskType maskVal = psMetadataLookupU8(NULL, config->arguments, "MASKVAL"); // Value to mask
    3130    int sample = psMetadataLookupS32(NULL, config->arguments, "SAMPLE"); // Size of sample for statistics
    3231    bool chipStats = psMetadataLookupBool(&mdok, config->arguments, "MASK.CHIPSTATS"); // Statistics on chip?
     
    3534    pmMaskIdentifyMode maskMode = psMetadataLookupS32(NULL, config->arguments, "MASK.MODE"); // Mode for identifying bad pixels
    3635    int maskGrow = psMetadataLookupS32(NULL, config->arguments, "MASK.GROW"); // Radius to grow mask
    37     psMaskType maskGrowVal = psMetadataLookupU8(NULL, config->arguments, "MASK.GROWVAL"); // Value for grown mask
    3836
    3937    bool smoothSuspect = psMetadataLookupBool(&mdok, config->arguments, "MASK.SMOOTH.SUSPECT"); // Radius to grow mask
    4038    float smoothScale = psMetadataLookupF32(&mdok, config->arguments, "MASK.SMOOTH.SCALE"); // Radius to grow mask
    4139
     40    psMaskType markVal;
     41    psMaskType maskValRaw;
     42    if (!pmConfigMaskSetBits (&maskValRaw, &markVal, config)) {
     43        psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
     44        return false;
     45    }
     46
     47    char *maskOutName = psMetadataLookupStr (&mdok, config->arguments, "MASK.SET.VALUE");
     48    psMaskType maskValOut = pmConfigMaskGet (maskOutName, config);
     49    if (!maskValOut) {
     50        psError (PS_ERR_UNKNOWN, true, "Undefined output mask bit value");
     51        return false;
     52    }
     53   
    4254    psStats *statistics = psStatsAlloc(meanStat | stdevStat); // Statistics for background
    4355
     
    137149                int x = pixel % numCols;
    138150                int y = pixel / numCols;
    139                 if ((mask && (mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal)) ||
    140                     !isfinite(image->data.F32[y][x]) ||
    141                     (outMask && (outMask->data.PS_TYPE_MASK_DATA[y][x] & maskVal))) {
    142                     continue;
    143                 }
     151                if (mask && (mask->data.PS_TYPE_MASK_DATA[y][x] & maskValRaw)) continue;
     152                if (outMask && (outMask->data.PS_TYPE_MASK_DATA[y][x] & maskValOut)) continue;
     153                if (!isfinite(image->data.F32[y][x])) continue;
    144154
    145155                values->data.F32[valueIndex++] = image->data.F32[y][x];
     
    155165                }
    156166
    157                 if (!pmMaskFlagSuspectPixels(outRO, readout, psStatsGetValue(statistics, meanStat),
    158                                              psStatsGetValue(statistics, stdevStat), maskSuspect, maskVal)) {
     167                float mean = psStatsGetValue(statistics, meanStat);
     168                float stdev = psStatsGetValue(statistics, stdevStat);
     169
     170                // this function increments the count for each suspect pixel in each input plane
     171                // maskValRaw is used to test for valid input pixels
     172                if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) {
    159173                    psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i);
    160174                    psFree(inView);
     
    189203
    190204                pmHDU *hdu = pmHDUFromCell(inCell); // HDU for cell
    191                 if (!hdu || hdu->blankPHU) {
    192                     // No data here
    193                     continue;
    194                 }
     205                if (!hdu || hdu->blankPHU) continue;
     206
    195207                pmReadout *readout = inCell->readouts->data[0]; // Readout of interest
    196208
     
    198210                pmReadout *outRO = pmFPAfileThisReadout(config->files, inView, "PPMERGE.OUTPUT.MASK");
    199211
    200                 if (!pmMaskFlagSuspectPixels(outRO, readout, psStatsGetValue(statistics, meanStat),
    201                                              psStatsGetValue(statistics, stdevStat), maskSuspect, maskVal)) {
     212                float mean = psStatsGetValue(statistics, meanStat);
     213                float stdev = psStatsGetValue(statistics, stdevStat);
     214
     215                if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) {
    202216                    psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i);
    203217                    goto MERGE_MASK_ERROR;
     
    229243    while ((outCell = pmFPAviewNextCell(outView, outFPA, 1))) {
    230244
    231         // skipp inactive cells
     245        // skip inactive cells
    232246        if (!outCell->process) continue;
    233247
    234248        pmHDU *hdu = pmHDUFromCell(outCell); // HDU for cell
    235         if (!hdu || hdu->blankPHU) {
    236             // No data here
    237             continue;
    238         }
     249        if (!hdu || hdu->blankPHU) continue;
    239250
    240251        psTrace("ppMerge", 1, "Getting bad pixels for chip %d cell %d", outView->chip, outView->cell);
     
    250261        }
    251262
    252         if (!pmMaskIdentifyBadPixels(outRO, maskVal, maskBad, maskMode)) {
     263        // set the bad pixels to the value 'maskVal'
     264        if (!pmMaskIdentifyBadPixels(outRO, maskValOut, maskBad, maskMode)) {
    253265            psError(PS_ERR_UNKNOWN, false, "Unable to mask bad pixels");
    254266            goto MERGE_MASK_ERROR;
     
    274286        }
    275287
    276         if (maskGrowVal > 0) {
    277             psImage *grown = psImageGrowMask(NULL, outRO->mask, maskVal, maskGrow, maskGrowVal); // Grown mask
     288        if (maskGrow > 0) {
     289            psImage *grown = psImageGrowMask(NULL, outRO->mask, maskValOut, maskGrow, maskValOut); // Grown mask
    278290            psFree(outRO->mask);
    279291            outRO->mask = grown;
     
    307319            outRO->image = psImageAlloc(outRO->mask->numCols, outRO->mask->numRows, PS_TYPE_F32);
    308320            psImageInit(outRO->image, 1.0);
    309             if (!ppStatsFPA(stats, outRO->parent->parent->parent, outView,
    310                             maskVal | pmConfigMask("BLANK", config), config)) {
     321            if (!ppStatsFPA(stats, outRO->parent->parent->parent, outView, maskValOut, config)) {
    311322                psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to generate stats for image.");
    312323                psFree(outRO);
     
    337348}
    338349
    339 
    340 
    341 
    342 
    343350bool ppMergeMask(pmConfig *config)
    344351{
     
    381388        goto PPMERGE_MASK_ERROR;
    382389    }
     390
     391    // XXX this function should use pmConfigMaskReadHeader () to get the named values defined
     392    // for the input masks.
    383393
    384394    psString outName = ppMergeOutputFile(config); // Name of output file
     
    414424                psListAdd(inChips, PS_LIST_TAIL, chip);
    415425            }
     426
     427            // XXX I need to call pmConfigMaskWriteHeader for the PHU somewhere, after it is created!
     428
    416429            if (!pmConceptsAverageChips(outChip, inChips, true)) {
    417430                psError(PS_ERR_UNKNOWN, false, "Unable to average Chip concepts.");
  • branches/eam_branch_20080706/ppMerge/src/ppMergeScaleZero.c

    r18218 r18475  
    2121    psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean
    2222    psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev
    23     psMaskType maskVal = psMetadataLookupU8(NULL, config->arguments, "MASKVAL"); // Value to mask
    2423    int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); // Size of shutter region
     24
     25    psMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Value to mask
    2526
    2627    psVector *gains = NULL;             // Gains for each cell
  • branches/eam_branch_20080706/ppStats/src/ppStatsFPA.c

    r14010 r18475  
    2121    }
    2222
    23     // Override recipe mask value if one is provided
    24     if (maskVal != 0) {
    25         data->maskVal = maskVal;
    26     }
     23    // Override recipe mask value
     24    data->maskVal = maskVal;
    2725
    2826    if (data->fpa) {
  • branches/eam_branch_20080706/ppStats/src/ppStatsMetadata.c

    r14010 r18475  
    2929    data->doStats = false;
    3030
    31     // Override recipe mask value if one is provided
    32     if (maskVal != 0) {
    33         data->maskVal = maskVal;
    34     }
     31    // Override recipe mask value
     32    data->maskVal = maskVal;
    3533
    3634    if (data->fpa) {
  • branches/eam_branch_20080706/ppStats/src/ppStatsPixels.c

    r14010 r18475  
    2828    data->concepts = psListAlloc(NULL);
    2929
    30     // Override recipe mask value if one is provided
    31     if (maskVal != 0) {
    32         data->maskVal = maskVal;
    33     }
     30    // Override recipe mask value
     31    data->maskVal = maskVal;
    3432
    3533    if (data->fpa) {
  • branches/eam_branch_20080706/ppStats/src/ppStatsSetupFromRecipe.c

    r13999 r18475  
    127127    }
    128128
     129    // set the mask value used for stand-alone analyses.
    129130    if (data->maskVal == 0) {
    130131        const char *names = psMetadataLookupStr(&mdok, recipe, "MASKVAL"); // Names for mask value
    131132        if (mdok) {
    132             data->maskVal = pmConfigMask(names, config);
     133            data->maskVal = pmConfigMaskGet(names, config);
    133134        } else {
    134135            psWarning("MASKVAL in recipe is not of type STR --- retaining default.\n");
Note: See TracChangeset for help on using the changeset viewer.