IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 6, 2008, 6:23:02 PM (18 years ago)
Author:
eugene
Message:

set mask bits based on recipe and input mask image headers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080706/ppImage/src/ppImageParseCamera.c

    r18422 r18430  
    2020    }
    2121
    22     // if MASK or WEIGHT was supplied on command line, bind files to 'input'
     22    // if MASK or WEIGHT was supplied on command line, bind files to 'input'.
    2323    // the mask and weight will be mosaicked with the image
    2424    pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "PPIMAGE.INPUT.MASK");
     
    2727        return NULL;
    2828    }
    29     if (inputMask && inputMask->type != PM_FPA_FILE_MASK) {
     29    if (inputMask) {
     30      if (inputMask->type != PM_FPA_FILE_MASK) {
    3031        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.MASK is not of type MASK");
    3132        return NULL;
     33      }
     34      // XXX need to load the mask bit names from one of the headers
     35      // this grabs the first available hdu : no guarantee that it will be valid, though
     36      pmHDU *hdu = pmHDUGetFirst (inputMask->fpa);
     37      if (!hdu) {
     38        psError(PS_ERR_IO, true, "no valid HDU for PPIMAGE.INPUT.MASK");
     39        return NULL;
     40      }
     41      if (!pmConfigMaskReadHeader (config, hdu->header)) {
     42        psError(PS_ERR_IO, false, "error in mask bits");
     43        return NULL;
     44      }
    3245    }
    3346
     
    6679    }
    6780    if (options->doMask) {
     81
    6882        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
    6983            psError (PS_ERR_IO, false, "Can't find a mask image source");
     
    7185            return NULL;
    7286        }
    73         // Need to read the names of bit masks from the mask header and set them in the recipe
     87        // XXX have ppImageDefineFile return the pmFPAfile?
     88        pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK");
     89        psAssert (mask, "mask not defined?  not possible!");
     90
     91        // Need to read the names of bit masks from the mask header and set them in the
     92        // recipe.  If we are loading this from the detrend db, this action will happen
     93        // when the file is resolved.
     94        if (!mask->detrend) {
     95            // XXX need to load the mask bit names from one of the headers
     96            // this grabs the first available hdu : no guarantee that it will be valid, though
     97            pmHDU *hdu = pmHDUGetFirst (mask->fpa);
     98            if (!hdu) {
     99                psError(PS_ERR_IO, true, "no valid HDU for PPIMAGE.INPUT.MASK");
     100                return NULL;
     101            }
     102            // XXX is this consistent with the pmConfigMaskReadHeader call above?
     103            if (!pmConfigMaskReadHeader (config, hdu->header)) {
     104                psError(PS_ERR_IO, false, "error in mask bits");
     105                return NULL;
     106            }
     107        }
    74108    }
    75109    if (options->doShutter) {
Note: See TracChangeset for help on using the changeset viewer.