IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 28, 2012, 11:56:52 AM (14 years ago)
Author:
bills
Message:

In ppstamp optionally produce a JPEG image

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/ppstampParseCamera.c

    r29379 r33378  
    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, psString stage, bool doMask, bool doWeight, pmFPAfile **pOutput)
    1111{
    1212    pmFPAfile *output;
     
    2222        return false;
    2323    }
     24    *pOutput = output;
    2425
    2526    output->save = true;
     
    3334        outWeight->save = true;
    3435    }
     36
    3537
    3638    return true;
     
    7678       
    7779
    78 
    7980    // XXX: create a filerule for PPSTAMP.ASTROM
    8081    pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM");
     
    9596
    9697    // Set up the output target
    97     if (!setupOutput(config, input, options->stage, doMask, doWeight)) {
     98    pmFPAfile *output;
     99    if (!setupOutput(config, input, options->stage, doMask, doWeight, &output)) {
    98100        psError(PS_ERR_UNKNOWN, false, "Unable to setup output.");
    99101        return false;
    100102    }
    101103
    102     pmFPAfile *chipImage = pmFPAfileDefineChipMosaic(config, input->fpa, "PPSTAMP.CHIP");
     104    pmFPAfile *chipImage = pmFPAfileDefineChipMosaic(config, output->fpa, "PPSTAMP.CHIP");
    103105    if (!chipImage) {
    104106        psError(PS_ERR_IO, false, _("Unable to generate new file from PPSTAMP.CHIP"));
     
    108110        psError(PS_ERR_IO, true, "PPSTAMP.CHIP is not of type IMAGE");
    109111        return NULL;
     112    }
     113
     114    if (options->writeJPEG) {
     115        char *filerule;
     116        // If stage is chip flip the X axis otherwise don't flip.
     117        // XXX: is this the right thing to do?
     118        // Shouldn't the JPEG match the stamp even for chip stage?
     119        if (!options->stage || strcmp(options->stage, "chip")) {
     120            filerule = "PPSTAMP.OUTPUT.JPEG";
     121        } else {
     122            filerule = "PPSTAMP.OUTPUT.JPEG.FLIP";
     123        }
     124        pmFPAfile *jpg = pmFPAfileDefineOutput(config, output->fpa, filerule);
     125        if (!jpg) {
     126            psError(PS_ERR_IO, false, "Unable to generate new file from %s", filerule);
     127            return NULL;
     128        }
     129        if (jpg->type != PM_FPA_FILE_JPEG) {
     130            psError(PS_ERR_IO, true, "%s is not of type JPEG", filerule);
     131            return NULL;
     132        }
     133        jpg->save = true;
    110134    }
    111135
Note: See TracChangeset for help on using the changeset viewer.