IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 27, 2010, 11:23:32 AM (16 years ago)
Author:
Paul Price
Message:

Pulling in pattern subtraction enhancements from trunk (rr26682,26692) into Gene's branch. Small conflicts in ippconfig/gpc1/ppImage.config easily resolved.

Location:
branches/eam_branches/20091201
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201

  • branches/eam_branches/20091201/ppImage/src/ppImageDetrendPattern.c

    r25930 r26693  
    55#include "ppImage.h"
    66
    7 #define ESCAPE(MESSAGE) { \
    8   psError(PS_ERR_UNKNOWN, false, MESSAGE); \
    9   psFree(view); \
    10   return false; \
     7#define ESCAPE(MESSAGE) {                               \
     8        psError(PS_ERR_UNKNOWN, false, MESSAGE);        \
     9        psFree(view);                                   \
     10        return false;                                   \
     11    }
     12
     13bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView,
     14                                const ppImageOptions *options)
     15{
     16    pmCell *cell = NULL;
     17
     18    assert (options->doPattern); // do not call if not needed
     19    assert (inputView->chip != -1);
     20    assert (inputView->cell == -1);
     21    assert (inputView->readout == -1);
     22    bool status;
     23    pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
     24
     25    pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
     26    *view = *inputView;
     27
     28    while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {
     29        if (!cell->process || !cell->file_exists) {
     30            continue;
     31        }
     32        if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     33            ESCAPE("load failure for Cell");
     34        }
     35
     36        if (!cell->data_exists) {
     37            continue;
     38        }
     39
     40        if (cell->readouts->n > 1) {
     41            psWarning ("Skipping Video Cell for ppImageDetrendPatternApply");
     42            continue;
     43        }
     44
     45        psMetadataItem *doPattern = pmConfigRecipeValueByView(config, RECIPE_NAME, "PATTERN.SUBSET",
     46                                                              chip->parent, view); // Do we do pattern sub?
     47        if (!doPattern || doPattern->type != PS_DATA_BOOL) {
     48            ESCAPE("Unable to determine whether pattern matching should be applied.");
     49        }
     50        if (!doPattern->data.B) {
     51            fprintf(stderr, "*NOT* DOING PATTERN SUBTRACTION FOR %d,%d\n", view->chip, view->cell);
     52            continue;
     53        }
     54
     55        fprintf(stderr, "DOING PATTERN SUBTRACTION FOR %d,%d\n", view->chip, view->cell);
     56        continue;
     57
     58        // process each of the readouts
     59        pmReadout *readout;         // Readout from cell
     60        while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     61            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     62                ESCAPE("load failure for Readout");
     63            }
     64            if (!readout->data_exists) {
     65                continue;
     66            }
     67
     68            // perfore pattern correction
     69            if (!pmPatternRow(readout, options->patternOrder, options->patternIter, options->patternRej,
     70                              options->patternThresh, options->patternMean, options->patternStdev,
     71                              options->maskValue, options->darkMask)) {
     72                psFree(view);
     73                return(false);
     74            }
     75        }
     76    }
     77
     78    psFree(view);
     79    return(true);
    1180}
    1281
    13 bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView, const ppImageOptions *options) {
    1482
    15  
    16   pmCell *cell = NULL;
    17 
    18   assert (options->doPattern); // do not call if not needed
    19   assert (inputView->chip != -1);
    20   assert (inputView->cell == -1);
    21   assert (inputView->readout == -1);
    22   bool status;
    23   pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
    24  
    25   pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
    26   *view = *inputView;
    27 
    28   while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {
    29     if (!cell->process || !cell->file_exists) {
    30       continue;
    31     }
    32     if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    33       ESCAPE("load failure for Cell");
    34     }
    35 
    36     if (!cell->data_exists) {
    37       continue;
    38     }
    39    
    40     if (cell->readouts->n > 1) {
    41       psWarning ("Skipping Video Cell for ppImageDetrendPatternApply");
    42       continue;
    43     }
    44    
    45     // process each of the readouts
    46     pmReadout *readout;         // Readout from cell
    47     while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
    48       if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    49         ESCAPE("load failure for Readout");
    50       }
    51       if (!readout->data_exists) {
    52         continue;
    53       }
    54 
    55       // perfore pattern correction
    56       if (!pmPatternRow(readout, options->patternOrder, options->patternIter, options->patternRej,
    57                         options->patternThresh, options->patternMean, options->patternStdev,
    58                         options->maskValue, options->darkMask)) {
    59         psFree(view);
    60         return(false);
    61       }
    62     }
    63   }
    64 
    65   psFree(view);
    66   return(true);
    67 }
    68  
    69    
Note: See TracChangeset for help on using the changeset viewer.