IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 4, 2009, 12:32:32 PM (17 years ago)
Author:
bills
Message:

When destreaking chip stage images, use replace the mask from the chip
stage with the mask from the camera stage, destreaking them both.
Added program to prepare images for release by insuring that all masked
pixels are set to NAN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksremove.c

    r21042 r21085  
    8585    int totalStreakPixels = 0;
    8686
    87     // Iterate through each component of the input (only one except for raw stage)
     87    // Iterate through each component of the input (there is only one except for raw images)
    8888    do {
    8989        bool exciseImageCube = false;
     
    223223    fprintf(stderr, "\t-remove: remove the original image after processing (requires -replace)\n");
    224224    fprintf(stderr, "\t-keepnonwarped: do not exise pixels that were not part of difference processing\n");
    225     fprintf(stderr, "\t-transparent val: instead of setting exicsed pixel to NAN add val\n");
     225    fprintf(stderr, "\t-transparent val: instead of setting excicsed pixel to NAN add val\n");
     226    fprintf(stderr, "\t-chip_mask MASK.fits: name of mask for chip stage (camera stage mask is passed tih -mask)\n");
    226227
    227228    exit(2);
     
    333334        psArgumentRemove(argnum, &argc, argv);
    334335        bool nebulousMask = IN_NEBULOUS(argv[argnum]);
     336        // This isn't a strict requirement if stage == IPP_STAGE_CHIP
    335337        if (nebulousMask != nebulousImage) {
    336338            psError(PS_ERR_UNKNOWN, true, "mask image must be %snebulous path with %s image path\n",
     
    340342        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.MASK", 0,
    341343                "name of input mask image", argv[argnum]);
     344        psArgumentRemove(argnum, &argc, argv);
     345    }
     346
     347    if ((argnum = psArgumentGet(argc, argv, "-chip_mask"))) {
     348        if (stage != IPP_STAGE_CHIP) {
     349            psError(PS_ERR_UNKNOWN, true, "-chip_mask only allowed at chip stage");
     350            usage();
     351        }
     352        psArgumentRemove(argnum, &argc, argv);
     353        bool nebulousMask = IN_NEBULOUS(argv[argnum]);
     354        if (nebulousMask != nebulousImage) {
     355            psError(PS_ERR_UNKNOWN, true, "chip mask image must be %snebulous path with %s image path\n",
     356                nebulousImage ? "" : "non ", nebulousImage ? "nebulous" : "regular");
     357            usage();
     358        }
     359        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.CHMASK", 0,
     360                "name of input chip mask image", argv[argnum]);
    342361        psArgumentRemove(argnum, &argc, argv);
    343362    }
     
    429448        streaksExit("", PS_EXIT_UNKNOWN_ERROR);
    430449    }
     450    // For the chip level files, copy the WCS from the astrometry file to the header
     451    // XXX: do we want to do this for raw images as well?
    431452    if (sf->stage == IPP_STAGE_CHIP) {
    432         // For the chip level files, copy the WCS from the astrometry file to the header
    433453        if (!sf->bilevelAstrometry) {
    434454            updateAstrometry = true;
     
    481501            pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
    482502        }
    483 
    484503        setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, exciseAll);
     504        if (sf->outChMask) {
     505            sf->outChMask->header = (psMetadata *) psMemIncrRefCounter(sf->outMask->header);
     506            sf->outChMask->image = (psImage *) psMemIncrRefCounter(sf->outMask->image);
     507            if (sf->recChMask) {
     508                sf->recChMask->header = (psMetadata *) psMemIncrRefCounter(sf->recMask->header);
     509                sf->recChMask->image = (psImage *) psMemIncrRefCounter(sf->recMask->image);
     510            }
     511        }
    485512
    486513#ifdef STREAKS_COMPRESS_OUTPUT
     
    490517        if (sf->recMask) {
    491518            psFitsSetCompression(sf->recMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     519        }
     520        if (sf->outChMask) {
     521            copyFitsOptions(sf->outChMask, sf->recChMask, sf->inMask);
     522            psFitsSetCompression(sf->outChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     523            if (sf->recChMask) {
     524                psFitsSetCompression(sf->recChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     525            }
    492526        }
    493527#endif
     
    567601        writeImage(sf->outMask, extname, sf->extnum);
    568602        writeImage(sf->recMask, extname, sf->extnum);
     603        if (sf->stage == IPP_STAGE_CHIP) {
     604            writeImage(sf->outChMask, extname, sf->extnum);
     605            writeImage(sf->recChMask, extname, sf->extnum);
     606        }
    569607    }
    570608    if (sf->outWeight) {
Note: See TracChangeset for help on using the changeset viewer.