IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 19, 2006, 4:58:42 PM (20 years ago)
Author:
Paul Price
Message:

Working, I think

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageOptions.c

    r5976 r6064  
    1717    options->doAstrom = false;          // Astrometry
    1818    // Overscan options
    19     options->overscanBins = 1;          // Number of pixels per bin for overscan
    20     options->overscanStats = NULL;      // Statistics for overscan
    21     options->overscanFit = NULL;        // Overscan fit (polynomial or spline)
    22     options->overscanFitType = PM_FIT_NONE; // Fit type for overscan
    23     options->overscanMode = PM_OVERSCAN_NONE; // Axis for overscan
     19    options->overscan = NULL;           // Overscan options
     20    bool overscanSingle = false;        // A single value for entire overscan?
     21    pmFit overscanFit = PM_FIT_NONE;    // Fit type for overscan
     22    int overscanOrder = 0;              // Order for overscan fit
     23    psStats *overscanStats = NULL;      // Statistics for overscan
    2424    // Non-linearity options
    2525    options->nonLinearType = 0;         // Type of non-linearity data (vector, string or metadata)
     
    2828    // Various others
    2929    options->imageLoadDepth = PP_LOAD_NONE; // No load depth specified yet
     30
    3031
    3132    bool mdStatus = false;              // Result of MD lookup
     
    122123    // XXX EAM : we should abort on invalid options. default options?
    123124    if (psMetadataLookupBool(NULL, config->recipe, "OVERSCAN")) {
    124         // XXX EAM : does 'overscanMode = NONE' mean doOverscan = false?
    125125        options->doOverscan = true;
    126         psString mode = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.MODE");
    127         if (! strcasecmp(mode, "INDIVIDUAL")) {
    128             options->overscanMode = PM_OVERSCAN_EDGE;
    129         } else if (! strcasecmp(mode, "ALL")) {
    130             options->overscanMode = PM_OVERSCAN_ALL;
    131         } else if (strcasecmp(mode, "NONE")) {
    132             psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.MODE (%s) is not one of NONE, INDIVIDUAL, or ALL:"
    133                      " assuming NONE.\n", mode);
    134         }
     126
     127        // Do the overscan as a single value?
     128        overscanSingle = psMetadataLookupBool(NULL, config->recipe, "OVERSCAN.SINGLE");
     129
     130        // How do we fit it?
    135131        psString fit = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.FIT");
    136132        if (! strcasecmp(fit, "POLYNOMIAL")) {
    137             options->overscanFitType = PM_FIT_POLYNOMIAL;
    138             int order = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER"); // Order of polynomial fit
    139             options->overscanFit = psPolynomial1DAlloc(order, PS_POLYNOMIAL_ORD);
     133            overscanFit = PM_FIT_POLY_ORD;
     134            overscanOrder = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER");
     135        } else if (! strcasecmp(fit, "CHEBYSHEV")) {
     136            overscanFit = PM_FIT_POLY_CHEBY;
     137            overscanOrder = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER");
    140138        } else if (! strcasecmp(fit, "SPLINE")) {
    141             options->overscanFit = NULL;
    142             options->overscanFitType = PM_FIT_SPLINE;
    143             // int order = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER"); // Order of polynomial fit
    144             // XXX : not in psLib yet : options->overscanFit = psSpline1DAlloc();
     139            overscanFit = PM_FIT_SPLINE;
    145140        } else if (strcasecmp(fit, "NONE")) {
    146141            psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) is not one of NONE, POLYNOMIAL, or SPLINE:"
    147142                     " assuming NONE.\n", fit);
    148143        }
    149         options->overscanBins = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.BIN");
    150         if (options->overscanBins <= 0) {
    151             psErrorStackPrint(stderr, "OVERSCAN.BIN (%d) is non-positive --- assuming 1.\n", options->overscanBins);
    152             options->overscanBins = 1;
    153         }
     144
    154145        psString stat = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.STAT");
    155146        if (! strcasecmp(stat, "MEAN")) {
    156             options->overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     147            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    157148        } else if (! strcasecmp(stat, "MEDIAN")) {
    158             options->overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
     149            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
    159150        } else {
    160151            psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) is not one of MEAN, MEDIAN: assuming MEAN\n", stat);
    161             options->overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     152            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    162153        }
     154
     155        // Fill in the options
     156        options->overscan = pmOverscanOptionsAlloc(overscanSingle, overscanFit, overscanOrder, overscanStats);
    163157    }
    164158
Note: See TracChangeset for help on using the changeset viewer.