IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23257


Ignore:
Timestamp:
Mar 10, 2009, 3:20:25 PM (17 years ago)
Author:
bills
Message:

adapt to some changes in the supporting code

File:
1 edited

Legend:

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

    r21156 r23257  
    88static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue);
    99static void writeImages(streakFiles *sf, bool exciseImageCube);
    10 static bool replicateOutputs(streakFiles *sfiles);
    1110
    1211int
     
    252251        // image data directly from psFits
    253252        readImage(sf->inImage, sf->extnum, sf->stage, false);
     253       
     254        // astrom struct is only needed for raw stage, and only the chip to cell parameters are used
     255        sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, NULL, NULL, false,
     256            sf->inImage->header, sf->inImage->numCols, sf->inImage->numRows);
    254257    }
    255258    sf->outImage->header = (psMetadata*) psMemIncrRefCounter(sf->inImage->header);
     
    264267    if (sf->inImage->image) {
    265268        setupImageRefs(sf->outImage, sf->recImage, sf->inImage, sf->extnum, exciseAll);
     269    } else if (sf->inImage->imagecube) {
     270        // Image cubes should have been excised in the destreaking process
     271        streaksExit("unexpected imagecube found", PS_EXIT_CONFIG_ERROR);
    266272    }  else {
    267         // Image cubes are handeled specially
     273        return false;
    268274    }
    269275
     
    285291    if (sf->inMask) {
    286292        readImage(sf->inMask, sf->extnum, sf->stage, true);
    287         sf->outMask->header = (psMetadata*) psMemIncrRefCounter(sf->inMask->header);
    288         if (sf->recMask) {
    289             sf->recMask->header = (psMetadata*) psMemIncrRefCounter(sf->inMask->header);
    290         }
    291         setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, exciseAll);
    292         if (sf->outChMask) {
    293             sf->outChMask->header = (psMetadata *) psMemIncrRefCounter(sf->outMask->header);
    294             sf->outChMask->image = (psImage *) psMemIncrRefCounter(sf->outMask->image);
    295             if (sf->recChMask) {
    296                 sf->recChMask->header = (psMetadata *) psMemIncrRefCounter(sf->recMask->header);
    297                 sf->recChMask->image = (psImage *) psMemIncrRefCounter(sf->recMask->image);
    298             }
    299         }
     293        if (sf->outMask) {
     294            sf->outMask->header = (psMetadata*) psMemIncrRefCounter(sf->inMask->header);
     295            if (sf->recMask) {
     296                sf->recMask->header = (psMetadata*) psMemIncrRefCounter(sf->inMask->header);
     297            }
     298            setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, exciseAll);
     299            if (sf->outChMask) {
     300                sf->outChMask->header = (psMetadata *) psMemIncrRefCounter(sf->outMask->header);
     301                sf->outChMask->image = (psImage *) psMemIncrRefCounter(sf->outMask->image);
     302                if (sf->recChMask) {
     303                    sf->recChMask->header = (psMetadata *) psMemIncrRefCounter(sf->recMask->header);
     304                    sf->recChMask->image = (psImage *) psMemIncrRefCounter(sf->recMask->image);
     305                }
     306            }
    300307
    301308#ifdef STREAKS_COMPRESS_OUTPUT
    302         // XXX: see note above
    303         copyFitsOptions(sf->outMask, sf->recMask, sf->inMask);
    304         psFitsSetCompression(sf->outMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
    305         if (sf->recMask) {
    306             psFitsSetCompression(sf->recMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
    307         }
    308         if (sf->outChMask) {
    309             copyFitsOptions(sf->outChMask, sf->recChMask, sf->inMask);
    310             psFitsSetCompression(sf->outChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
    311             if (sf->recChMask) {
    312                 psFitsSetCompression(sf->recChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
    313             }
    314         }
     309            // XXX: see note above
     310            copyFitsOptions(sf->outMask, sf->recMask, sf->inMask);
     311            psFitsSetCompression(sf->outMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     312            if (sf->recMask) {
     313                psFitsSetCompression(sf->recMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     314            }
     315            if (sf->outChMask) {
     316                copyFitsOptions(sf->outChMask, sf->recChMask, sf->inMask);
     317                psFitsSetCompression(sf->outChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     318                if (sf->recChMask) {
     319                    psFitsSetCompression(sf->recChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0);
     320                }
     321            }
    315322#endif
     323        }
    316324    }
    317325
     
    396404    }
    397405}
    398 
    399 // for any of the outputs that are stored in Nebulous set their extended attributes
    400 // and replicate the files
    401 
    402 static bool
    403 replicateOutputs(streakFiles *sfiles)
    404 {
    405     bool status = false;
    406 
    407     // XXX: TODO: need a nebGetXatrr function, but there isn't one
    408     // another option would be to take the number of copies to be
    409     // created as an option. That way the system could decide
    410     // whether to replicate anything other than raw Image files
    411     void *xattr = NULL;
    412 
    413     if (!replicate(sfiles->outImage, xattr)) {
    414         psError(PM_ERR_SYS, false, "failed to replicate outImage.");
    415         return false;
    416     }
    417 
    418 #ifdef notyet
    419     // XXX: don't replicate mask and weight images until we can look up
    420     // the input's xattr. There may be a perl program that can getXattr
    421     if (sfiles->outMask) {
    422         // get xattr from input to see if we need to replicate
    423         if (!replicate(sfiles->outMask, xattr)) {
    424             psError(PM_ERR_SYS, false, "failed to replicate outImage.");
    425             return false;
    426         }
    427     }
    428     if (sfiles->outWeight) {
    429         // get xattr from input to see if we need to replicate
    430         if (!replicate(sfiles->outWeight, xattr)) {
    431             psError(PM_ERR_SYS, false, "failed to replicate outImage.");
    432             return false;
    433         }
    434     }
    435 #endif
    436 
    437     return true;
    438 }
    439 
    440 
Note: See TracChangeset for help on using the changeset viewer.