IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33378 for trunk/pstamp/src


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

In ppstamp optionally produce a JPEG image

Location:
trunk/pstamp/src
Files:
3 edited

Legend:

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

    r29885 r33378  
    2121    fprintf(stderr, "\n");
    2222    fprintf(stderr, "Optional arguments:\n");
    23     fprintf(stderr, "   [-class_id class_id]     selects class_id (only used with -pixcenter)\n");
    24     fprintf(stderr, "   [-astrom astrom.cmp] :   provide an alternative astrometry calibration\n");
    25     fprintf(stderr, "   [-mask   mk_image] :     mask image\n");
    26     fprintf(stderr, "   [-variance var_image] :  variance image\n");
    27     fprintf(stderr, "   [-no_censor_masked] : do not set masked pixels to NAN\n");
     23    fprintf(stderr, "   [-class_id class_id]  : selects class_id (only used with -pixcenter)\n");
     24    fprintf(stderr, "   [-astrom astrom.cmp]  : provide an alternative astrometry calibration\n");
     25    fprintf(stderr, "   [-mask   mk_image]    : mask image\n");
     26    fprintf(stderr, "   [-variance var_image] : variance image\n");
     27    fprintf(stderr, "   [-stage stage]        : stage of input image (raw, chip, warp, stack, diff)\n");
     28    fprintf(stderr, "   [-write_jpeg]         : write a JPEG  format of the image stamp\n");
     29    // fprintf(stderr, "   [-no_censor_masked]   : do not set masked pixels to NAN\n");
    2830    fprintf(stderr, "\n");
    2931
     
    8486        psArgumentRemove(argnum, &argc, argv);
    8587    }
     88    if ((argnum = psArgumentGet(argc, argv, "-write_jpeg"))) {
     89        psArgumentRemove(argnum, &argc, argv);
     90        options->writeJPEG = true;
     91    } else {
     92        options->writeJPEG = false;
     93    }
    8694
    8795    pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM", "-astrom", "-astromlist");
  • trunk/pstamp/src/ppstampOptions.h

    r29885 r33378  
    1616    psRegion    roi;            // roi in chip coordinates
    1717    bool        censorMasked;
    18 
     18    bool        writeJPEG;
    1919} ppstampOptions;
    2020
  • 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.