IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2012, 2:49:37 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/pstamp/src/ppstampParseCamera.c

    r29379 r33638  
    88
    99// Set up the ppstamp output Image file
    10 bool setupOutput(pmConfig *config, pmFPAfile *input, psString stage, bool doMask, bool doWeight)
     10bool setupOutput(pmConfig *config, pmFPAfile *input, ppstampOptions *options, bool doMask, bool doWeight, pmFPAfile **pOutput)
    1111{
    12     pmFPAfile *output;
    13    
    14     if (!stage || (strcmp(stage, "diff") != 0)) {
    15         output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT");
     12    if (!options->stage || (strcmp(options->stage, "diff") != 0)) {
     13        if (options->nocompress) {
     14            options->outputFileRule = "PPSTAMP.OUTPUT.NOCOMP";
     15        } else {
     16            options->outputFileRule = "PPSTAMP.OUTPUT";
     17        }
    1618    } else {
    1719        // need special filerule for diff stage image to allow for negative values
    18         output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT.DIFF");
     20        if (options->nocompress) {
     21            options->outputFileRule = "PPSTAMP.OUTPUT.DIFF.NOCOMP";
     22        } else {
     23            options->outputFileRule = "PPSTAMP.OUTPUT.DIFF";
     24        }
    1925    }
     26    pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, options->outputFileRule);
    2027    if (!output) {
    2128        psError(PS_ERR_UNKNOWN, false, "Unable to setup output.");
    2229        return false;
    2330    }
     31    *pOutput = output;
    2432
    2533    output->save = true;
    2634
    2735    if (doMask) {
    28         pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PPSTAMP.OUTPUT.MASK");
     36        char *rule;
     37        if (options->nocompress) {
     38            rule =  "PPSTAMP.OUTPUT.MASK.NOCOMP";
     39        } else {
     40            rule =  "PPSTAMP.OUTPUT.MASK";
     41        }
     42        pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, rule);
    2943        outMask->save = true;
    3044    }
    3145    if (doWeight) {
    32         pmFPAfile *outWeight = pmFPAfileDefineSkycell(config, output->fpa, "PPSTAMP.OUTPUT.VARIANCE");
     46        char *rule;
     47        if (options->nocompress) {
     48            rule =  "PPSTAMP.OUTPUT.VARIANCE.NOCOMP";
     49        } else {
     50            rule =  "PPSTAMP.OUTPUT.VARIANCE";
     51        }
     52        pmFPAfile *outWeight = pmFPAfileDefineSkycell(config, output->fpa, rule);
    3353        outWeight->save = true;
    3454    }
     
    7696       
    7797
    78 
    7998    // XXX: create a filerule for PPSTAMP.ASTROM
    8099    pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM");
     
    95114
    96115    // Set up the output target
    97     if (!setupOutput(config, input, options->stage, doMask, doWeight)) {
     116    pmFPAfile *output;
     117    if (!setupOutput(config, input, options, doMask, doWeight, &output)) {
    98118        psError(PS_ERR_UNKNOWN, false, "Unable to setup output.");
    99119        return false;
     
    110130    }
    111131
     132    if (options->writeJPEG) {
     133        char *filerule = "PPSTAMP.OUTPUT.JPEG";
     134        pmFPAfile *jpg = pmFPAfileDefineSkycell(config, output->fpa, filerule);
     135        if (!jpg) {
     136            psError(PS_ERR_IO, false, "Unable to generate new file from %s", filerule);
     137            return NULL;
     138        }
     139        if (jpg->type != PM_FPA_FILE_JPEG) {
     140            psError(PS_ERR_IO, true, "%s is not of type JPEG", filerule);
     141            return NULL;
     142        }
     143        jpg->save = true;
     144    }
     145
    112146    // XXX: TODO: only do the workaround if the file level is chip, skycells should be fine
    113147    if (!strcmp(config->cameraName, "MEGACAM")) {
Note: See TracChangeset for help on using the changeset viewer.