IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33243 for trunk/ppImage/src


Ignore:
Timestamp:
Feb 10, 2012, 6:07:30 PM (14 years ago)
Author:
watersc1
Message:

Implementation of PATTERN.CONTINUITY correction, which replaces the PATTERN.CELL correction and ensures that the cell-to-cell variations are minimized, and that background fitting code has a smooth background to work with. Includes ippconfig files to enable this by default across all of GPC1. Tested, and memory leaks fixed.

Location:
trunk/ppImage/src
Files:
4 edited

Legend:

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

    r30655 r33243  
    4040    bool doPatternRow;                  // Row pattern correction
    4141    bool doPatternCell;                 // Cell pattern correction
     42    bool doPatternContinuity;           // Cell continuity correction
    4243    bool doFringe;                      // Fringe subtraction
    4344    bool doPhotom;                      // Source identification and photometry
     
    109110    psStatsOptions patternCellMean;        // Statistic for mean
    110111
     112  int patternContinuityEdgeWidth;        // Size of box to use for edge matching.
     113 
    111114    int remnanceSize;                   // Size for remnance detection
    112115    float remnanceThresh;               // Threshold for remnance detection
  • trunk/ppImage/src/ppImageDetrendPattern.c

    r31066 r33243  
    1818    pmCell *cell = NULL;
    1919
    20     assert(options->doPatternRow || options->doPatternCell); // do not call if not needed
     20    assert(options->doPatternRow || options->doPatternCell || options->doPatternContinuity); // do not call if not needed
    2121    assert(inputView->chip != -1);
    2222    assert(inputView->cell == -1);
     
    4040        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_ROW")) {
    4141          psLogMsg("ppImage", PS_LOG_INFO, "Not performing row pattern correction as it has already been done.");
    42           goto pattern_cell;
     42          goto pattern_continuity;
    4343        }
    4444
     
    9898    }
    9999
     100 pattern_continuity:
     101
     102    // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
     103
     104    if (options->doPatternContinuity) {
     105        int numCells = chip->cells->n;       // Number of cells
     106        psVector *tweak = psVectorAlloc(numCells, PS_TYPE_U8); // Tweak cell?
     107        pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
     108        *view = *inputView;
     109
     110        pmHDU *hdu = pmHDUFromChip(chip);
     111        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_CON")) {
     112          psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction as it has already been done.");
     113          goto pattern_cell;
     114        }
     115
     116        for (int i = 0; i < chip->cells->n; i++) {
     117            view->cell = i;
     118
     119            pmCell *cell = chip->cells->data[i]; // Cell of interest
     120
     121            if (cell->readouts->n > 1) {
     122                psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction on video cell.");
     123                continue;
     124            }
     125
     126            bool doPattern = false;
     127            if (!doPatternForView(&doPattern, config, chip, view, RECIPE_NAME, "PATTERN.CONTINUITY.SUBSET")) {
     128                ESCAPE(false, "Unable to determine whether row pattern matching should be applied.");
     129            }
     130            if (doPattern) {
     131                tweak->data.U8[i] = 0xFF;
     132            }
     133        }
     134
     135        // Tweak the cells
     136        if (!pmPatternContinuity(chip, tweak, options->patternCellBG, options->patternCellMean,
     137                                 options->maskValue, options->darkMask,options->patternContinuityEdgeWidth)) {
     138            psFree(tweak);
     139            psFree(view);
     140            return false;
     141        }
     142        psFree(tweak);
     143        psFree(view);
     144
     145        psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CON",PS_META_REPLACE,"PATTERN.CONTINUITY correction applied",true);
     146    }
     147
    100148 pattern_cell:
    101 
    102     // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
    103 
     149   
    104150    if (options->doPatternCell) {
    105151        int numCells = chip->cells->n;       // Number of cells
     
    131177                tweak->data.U8[i] = 0xFF;
    132178            }
    133 
    134179        }
    135180
  • trunk/ppImage/src/ppImageLoop.c

    r30655 r33243  
    170170
    171171        // Apply the pattern correction
    172         if (options->doPatternRow || options->doPatternCell) {
     172        if (options->doPatternRow || options->doPatternCell || options->doPatternContinuity) {
    173173          if (!ppImageDetrendPatternApply(config,chip,view,options)) {
    174174            ESCAPE("Unable to apply pattern corrections");
  • trunk/ppImage/src/ppImageOptions.c

    r31066 r33243  
    3434    options->doPatternRow    = false;   // Row pattern correction
    3535    options->doPatternCell   = false;   // Cell pattern correction
     36    options->doPatternContinuity = false; // Cell continuity correction
    3637    options->doFringe        = false;   // Fringe subtraction
    3738    options->doPhotom        = false;   // Source identification and photometry
     
    253254    options->doPatternRow = psMetadataLookupBool(NULL, recipe, "PATTERN.ROW");
    254255    options->doPatternCell = psMetadataLookupBool(NULL, recipe, "PATTERN.CELL");
     256    options->doPatternContinuity = psMetadataLookupBool(NULL, recipe, "PATTERN.CONTINUITY");
    255257
    256258    options->doMaskStats = psMetadataLookupBool(NULL, recipe, "MASK.STATS");
     
    408410    }
    409411
     412    if (psMetadataLookup(format, "PATTERN.CONTINUITY.WIDTH")) {
     413      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, format, "PATTERN.CONTINUITY.WIDTH");
     414    }
     415    else {
     416      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, recipe, "PATTERN.CONTINUITY.WIDTH");
     417    }
     418   
    410419
    411420    // Remnance options
Note: See TracChangeset for help on using the changeset viewer.