Changeset 18430
- Timestamp:
- Jul 6, 2008, 6:23:02 PM (18 years ago)
- Location:
- branches/eam_branch_20080706
- Files:
-
- 1 added
- 9 edited
-
ppImage/src/ppImageLoop.c (modified) (1 diff)
-
ppImage/src/ppImageMetadataStats.c (modified) (1 diff)
-
ppImage/src/ppImageMosaic.c (modified) (1 diff)
-
ppImage/src/ppImageOptions.c (modified) (2 diffs)
-
ppImage/src/ppImageParseCamera.c (modified) (4 diffs)
-
ppImage/src/ppImagePixelStats.c (modified) (1 diff)
-
ppImage/src/ppImageReplaceBackground.c (modified) (1 diff)
-
ppImage/src/ppImageSetMaskBits.c (added)
-
psModules/src/camera/pmFPAfileIO.c (modified) (1 diff)
-
psModules/src/config/pmConfigMask.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080706/ppImage/src/ppImageLoop.c
r16249 r18430 62 62 continue; 63 63 } 64 65 // XXX set the options->*Mask values here (after the mask images have been loaded 66 // and before any of the value are used) 67 ppImageSetMaskBits (config, options); 64 68 65 69 // perform the detrend analysis -
branches/eam_branch_20080706/ppImage/src/ppImageMetadataStats.c
r16249 r18430 14 14 } 15 15 16 // XXX should this be just options->maskValue?? I think so... 16 17 psMaskType maskVal = options->satMask | options->badMask | options->maskValue; 17 18 -
branches/eam_branch_20080706/ppImage/src/ppImageMosaic.c
r13901 r18430 34 34 // XXX mosaic the chip, making a deep copy. this has the side effect of making the 35 35 // output image products pure trimmed images, but also increases the memory footprint. 36 // XXX I think we should be using options->maskValue 36 37 status = pmChipMosaic(outChip, inChip, true, options->blankMask); 37 38 return status; -
branches/eam_branch_20080706/ppImage/src/ppImageOptions.c
r17688 r18430 191 191 192 192 // Mask recipe options 193 // XXX we cannot set these values here; wait until just before ppImageDetrend 193 194 options->doMask = psMetadataLookupBool(NULL, recipe, "MASK"); 195 196 # if (0) 194 197 const char *masks = psMetadataLookupStr(&status, recipe, "MASK.VALUE"); 195 198 if (status) { … … 201 204 options->blankMask = pmConfigMask("BLANK", config); 202 205 // XXX should it be an error for these to not exist? 206 # endif 203 207 204 208 options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS"); -
branches/eam_branch_20080706/ppImage/src/ppImageParseCamera.c
r18422 r18430 20 20 } 21 21 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'. 23 23 // the mask and weight will be mosaicked with the image 24 24 pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "PPIMAGE.INPUT.MASK"); … … 27 27 return NULL; 28 28 } 29 if (inputMask && inputMask->type != PM_FPA_FILE_MASK) { 29 if (inputMask) { 30 if (inputMask->type != PM_FPA_FILE_MASK) { 30 31 psError(PS_ERR_IO, true, "PPIMAGE.INPUT.MASK is not of type MASK"); 31 32 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 } 32 45 } 33 46 … … 66 79 } 67 80 if (options->doMask) { 81 68 82 if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) { 69 83 psError (PS_ERR_IO, false, "Can't find a mask image source"); … … 71 85 return NULL; 72 86 } 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 } 74 108 } 75 109 if (options->doShutter) { -
branches/eam_branch_20080706/ppImage/src/ppImagePixelStats.c
r14000 r18430 10 10 bool mdok; // Status of MD lookup 11 11 12 // XXX should this be just options->maskValue?? I think so... 12 13 psMaskType maskVal = options->satMask | options->badMask | options->maskValue; 13 14 -
branches/eam_branch_20080706/ppImage/src/ppImageReplaceBackground.c
r18255 r18430 41 41 42 42 // define the mask value to be used in ppImage 43 // XXX should this be just options->maskValue?? I think so... (but it should certainly include flat!) 43 44 psMaskType maskVal = options->satMask | options->badMask | options->flatMask | options->blankMask; 44 45 -
branches/eam_branch_20080706/psModules/src/camera/pmFPAfileIO.c
r18330 r18430 792 792 } 793 793 794 // XXX if we have a mask file, then we need to read the mask bit names 795 // defined for this file 796 if (file->type == PM_FPA_FILE_MASK) { 797 if (!pmConfigMaskReadHeader (config, phu)) { 798 psError(PS_ERR_IO, false, "error in mask bits"); 799 return false; 800 } 801 } 802 794 803 // determine the current format from the header 795 804 // determine camera if not specified already -
branches/eam_branch_20080706/psModules/src/config/pmConfigMask.c
r18425 r18430 40 40 } 41 41 42 // replace the named masks in the recipe with values in the header 42 // replace the named masks in the recipe with values in the header: 43 // replace only the names in the header in the recipe 43 44 void pmConfigMasksReadHeader (pmConfig *config, psMetadata *header) { 44 45 … … 49 50 } 50 51 51 int nMask = 0; 52 int nMask = psMetadataLookupS32 (&status, header, "MSKNUM"); 53 if (!status) { 54 psError(PS_ERR_UNKNOWN, true, "Unable to find MSKNUM in header."); 55 return false; 56 } 52 57 53 psMetadataIterator *iter = psMetadataIteratorAlloc(recipe, PS_LIST_HEAD, NULL); // Iterator58 for (int i = 0; i < nMask; i++) { 54 59 55 psMetadataItem *item; // Item from iteration 56 while ((item = psMetadataGetAndIncrement(iter))) { 60 snprintf (namekey, 64, "MSKNAM%02d", i); 61 snprintf (valuekey, 64, "MSKVAL%02d", i); 57 62 58 if (item->type != PS_DATA_U8) { 59 psWarning("mask recipe entry %s is not a bit value\n", item->name); 60 continue; 63 char *name = psMetadataLookupStr (&status, header, namekey); 64 psU8 bit = psMetadataLookupU8 (&status, header, valuekey); 65 66 // XXX validate that bit is a 2^n value? 67 68 psMetadataItem *item = psMetadataLookup (header, name); 69 if (!item) { 70 psWarning("mask recipe entry %s not in recipe\n", name); 71 psMetadataAddU8 (recipe, PS_LIST_TAIL, name, 0, "Bitmask bit value", bit); 72 } else { 73 item->data.U8 = bit; 61 74 } 62 63 snprintf (namekey, 64, "MSKNAM%02d", nMask);64 snprintf (valuekey, 64, "MSKVAL%02d", nMask);65 66 psMetadataAddStr (header, PS_LIST_TAIL, namekey, 0, "Bitmask bit name", item->name);67 psMetadataAddU8 (header, PS_LIST_TAIL, valuekey, 0, "Bitmask bit value", item->data.U8);68 nMask ++;69 75 } 70 76 71 psMetadataAddU8 (header, PS_LIST_TAIL, "MSKNUM", 0, "Bitmask bit count", nMask);72 77 return true; 73 78 } … … 102 107 } 103 108 104 psMetadataAdd U8(header, PS_LIST_TAIL, "MSKNUM", 0, "Bitmask bit count", nMask);109 psMetadataAddS32 (header, PS_LIST_TAIL, "MSKNUM", 0, "Bitmask bit count", nMask); 105 110 return true; 106 111 }
Note:
See TracChangeset
for help on using the changeset viewer.
