IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 11, 2013, 4:50:12 PM (13 years ago)
Author:
watersc1
Message:

Changes that should not conflict with the trunk. This is the camera stage background continuity and the pattern.median example code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20130211/ppImage/src/ppImageDetrendPattern.c

    r33243 r35149  
    1818    pmCell *cell = NULL;
    1919
    20     assert(options->doPatternRow || options->doPatternCell || options->doPatternContinuity); // do not call if not needed
     20    assert(options->doPatternMedian || options->doPatternRow ||
     21           options->doPatternCell || options->doPatternContinuity); // do not call if not needed
    2122    assert(inputView->chip != -1);
    2223    assert(inputView->cell == -1);
     
    3536    // chip.
    3637
     38    if (options->doPatternMedian) {
     39      //      bool status;
     40      int numCells = chip->cells->n;       // Number of cells
     41      psVector *tweak = psVectorAlloc(numCells, PS_TYPE_U8); // Tweak cell?
     42      //      pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
     43      pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
     44     
     45
     46      pmHDU *hdu = pmHDUFromChip(chip);
     47      if (psMetadataLookupBool(NULL,hdu->header, "PTRN_MED")) {
     48        psLogMsg("ppImage", PS_LOG_INFO, "Not performing median pattern correction as it has already been done.");
     49        goto pattern_row;
     50      }
     51      for (int i = 0; i < chip->cells->n; i++) {
     52        view->cell = i;
     53       
     54        pmCell *cell = chip->cells->data[i]; // Cell of interest
     55       
     56        if (cell->readouts->n > 1) {
     57          psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction on video cell.");
     58          continue;
     59        }
     60       
     61        bool doPattern = false;
     62        if (!doPatternForView(&doPattern, config, chip, view, RECIPE_NAME, "PATTERN.CONTINUITY.SUBSET")) {
     63          ESCAPE(false, "Unable to determine whether row pattern matching should be applied.");
     64        }
     65        if (doPattern) {
     66          tweak->data.U8[i] = 0xFF;
     67        }
     68      }
     69     
     70      // Tweak the cells
     71      if (!pmPatternMedian(chip, tweak, options->patternCellBG, options->patternCellMean,
     72                           options->maskValue, options->darkMask,true,true)) {
     73        psFree(tweak);
     74        psFree(view);
     75        return false;
     76      }
     77      psFree(tweak);
     78      psFree(view);
     79     
     80      psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_MED",PS_META_REPLACE,"PATTERN.MEDIAN correction applied",true);
     81     
     82    }
     83 pattern_row:
    3784    if (options->doPatternRow) {
    3885        bool status;
Note: See TracChangeset for help on using the changeset viewer.