Changeset 18556
- Timestamp:
- Jul 15, 2008, 10:26:37 AM (18 years ago)
- Location:
- trunk/ppImage/src
- Files:
-
- 1 added
- 11 edited
-
Makefile.am (modified) (2 diffs)
-
ppImage.h (modified) (3 diffs)
-
ppImageDetrendReadout.c (modified) (1 diff)
-
ppImageLoop.c (modified) (1 diff)
-
ppImageMetadataStats.c (modified) (2 diffs)
-
ppImageMosaic.c (modified) (1 diff)
-
ppImageOptions.c (modified) (2 diffs)
-
ppImageParseCamera.c (modified) (4 diffs)
-
ppImagePixelStats.c (modified) (2 diffs)
-
ppImageReplaceBackground.c (modified) (1 diff)
-
ppImageSetMaskBits.c (added)
-
ppImageStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/Makefile.am
r16084 r18556 29 29 ppImageReplaceBackground.c \ 30 30 ppImageDefineFile.c \ 31 ppImageSetMaskBits.c \ 31 32 ppImageFileCheck.c \ 32 33 ppImageVersion.c \ … … 58 59 ppImageReplaceBackground.c \ 59 60 ppImageDefineFile.c \ 61 ppImageSetMaskBits.c \ 60 62 ppImageFileCheck.c \ 61 63 ppImageVersion.c \ -
trunk/ppImage/src/ppImage.h
r16084 r18556 56 56 // make values for abstract concepts of masking 57 57 psMaskType maskValue; // apply this bit-mask to choose masked bits 58 psMaskType markValue; // apply this bit-mask to choose masked bits 58 59 psMaskType satMask; // Mask value to give saturated pixels 59 60 psMaskType badMask; // Mask value to give bad pixels … … 101 102 // Determine what type of camera, and initialise 102 103 ppImageOptions *ppImageParseCamera(pmConfig *config); 104 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options); 103 105 104 106 // Loop over the input … … 134 136 bool ppImageMosaicFPA (pmConfig *config, const ppImageOptions *options, 135 137 const char *outFile, const char *inFile); 138 139 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options); 136 140 137 141 void ppImageFileCheck (pmConfig *config); -
trunk/ppImage/src/ppImageDetrendReadout.c
r17218 r18556 74 74 if (options->doShutter) { 75 75 pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER"); 76 if (!pmShutterCorrectionApply(input, shutter, pmConfigMask ("FLAT", config))) {76 if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) { 77 77 return false; 78 78 } -
trunk/ppImage/src/ppImageLoop.c
r16249 r18556 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 if (!ppImageSetMaskBits (config, options)) 68 ESCAPE ("Unable to set bit masks"); 64 69 65 70 // perform the detrend analysis -
trunk/ppImage/src/ppImageMetadataStats.c
r16249 r18556 13 13 return true; 14 14 } 15 16 psMaskType maskVal = options->satMask | options->badMask | options->maskValue;17 15 18 16 // Extract statistics from the last output fpa … … 50 48 pmFPAview *view = pmFPAviewAlloc(0); 51 49 52 if (!ppStatsMetadata(stats, output->fpa, view, maskVal, config)) {50 if (!ppStatsMetadata(stats, output->fpa, view, options->maskValue, config)) { 53 51 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 54 52 psFree(view); -
trunk/ppImage/src/ppImageMosaic.c
r13901 r18556 32 32 in->name, out->name, in->xBin, in->yBin, out->xBin, out->yBin); 33 33 34 // XXX mosaic the chip, making a deep copy. this has the side effect of making the35 // outputimage products pure trimmed images, but also increases the memory footprint.34 // Mosaic the chip, making a deep copy. This has the side effect of making the output 35 // image products pure trimmed images, but also increases the memory footprint. 36 36 status = pmChipMosaic(outChip, inChip, true, options->blankMask); 37 37 return status; -
trunk/ppImage/src/ppImageOptions.c
r17688 r18556 50 50 51 51 // default flags for various activities 52 options->maskValue = 0x00; // Default mask value 53 options->satMask = 0x00; // Saturated pixels 54 options->badMask = 0x00; // Bad pixels 55 options->flatMask = 0x00; // Bad flat pixels 56 options->blankMask = 0x00; // Blank (no data, cell gap) pixels 52 options->maskValue = 0x00; // Default mask value (used to skip / ignore pixels) 53 options->satMask = 0x00; // Saturated pixels (supplied to pmReadoutGenerateMask) 54 options->badMask = 0x00; // Bad (low) pixels (supplied to pmReadoutGenerateMask) 55 options->flatMask = 0x00; // Bad flat pixels (supplied to pmFlatField) 56 options->blankMask = 0x00; // Blank (no data, cell gap) pixels (supplied to pmChipMosaic, pmFPAMosaic) 57 options->markValue = 0x00; // A safe bit for internal marking 57 58 58 59 // Non-linearity default options … … 190 191 options->doWeightBuild = psMetadataLookupBool(NULL, recipe, "WEIGHT.BUILD"); 191 192 192 // Mask recipe options 193 // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c) 193 194 options->doMask = psMetadataLookupBool(NULL, recipe, "MASK"); 194 const char *masks = psMetadataLookupStr(&status, recipe, "MASK.VALUE");195 if (status) {196 options->maskValue = pmConfigMask(masks, config);197 }198 options->satMask = pmConfigMask("SAT", config);199 options->badMask = pmConfigMask("BAD", config);200 options->flatMask = pmConfigMask("FLAT", config);201 options->blankMask = pmConfigMask("BLANK", config);202 // XXX should it be an error for these to not exist?203 195 204 196 options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS"); -
trunk/ppImage/src/ppImageParseCamera.c
r18422 r18556 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 } 32 34 } 33 35 … … 66 68 } 67 69 if (options->doMask) { 70 68 71 if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) { 69 72 psError (PS_ERR_IO, false, "Can't find a mask image source"); … … 71 74 return NULL; 72 75 } 73 // Need to read the names of bit masks from the mask header and set them in the recipe 76 // XXX have ppImageDefineFile return the pmFPAfile? 77 pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK"); 78 psAssert (mask, "mask not defined? not possible!"); 79 80 // Need to read the names of bit masks from the mask header and set them in the 81 // recipe. If we are loading this from the detrend db, this action will happen 82 // when the file is resolved. 83 if (!mask->detrend) { 84 // XXX need to load the mask bit names from one of the headers 85 // this grabs the first available hdu : no guarantee that it will be valid, though 86 pmHDU *hdu = pmHDUGetFirst (mask->fpa); 87 if (!hdu) { 88 psError(PS_ERR_IO, true, "no valid HDU for PPIMAGE.INPUT.MASK"); 89 return NULL; 90 } 91 // XXX is this consistent with the pmConfigMaskReadHeader call above? 92 if (!pmConfigMaskReadHeader (config, hdu->header)) { 93 psError(PS_ERR_IO, false, "error in mask bits"); 94 return NULL; 95 } 96 } 74 97 } 75 98 if (options->doShutter) { -
trunk/ppImage/src/ppImagePixelStats.c
r14000 r18556 9 9 10 10 bool mdok; // Status of MD lookup 11 12 psMaskType maskVal = options->satMask | options->badMask | options->maskValue;13 11 14 12 // loop over the cells/readouts for this chip … … 48 46 } 49 47 50 if (!ppStatsPixels(stats, output->fpa, view, maskVal, config)) {48 if (!ppStatsPixels(stats, output->fpa, view, options->maskValue, config)) { 51 49 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 52 50 psFree (view); -
trunk/ppImage/src/ppImageReplaceBackground.c
r18255 r18556 40 40 psAssert (replaceSkyMode != MODE_NONE, "replace sky mode not defined"); 41 41 42 // define the mask value to be used in ppImage 43 psMaskType maskVal = options->satMask | options->badMask | options->flatMask | options->blankMask; 42 // XXX Should this be options->maskValue or & ~options->satMask? the latter will leave saturated pixels high 43 // psMaskType maskVal = options->maskValue & ~options->satMask; 44 psMaskType maskVal = options->maskValue; 44 45 45 46 pmFPAfile *modelFile = NULL; -
trunk/ppImage/src/ppImageStats.c
r14000 r18556 57 57 } 58 58 59 if (!ppStatsFPA(stats, output->fpa, view, 60 options->satMask | options->badMask | options->maskValue, 61 config)) { 59 if (!ppStatsFPA(stats, output->fpa, view, options->maskValue, config)) { 62 60 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 63 61 psFree(view);
Note:
See TracChangeset
for help on using the changeset viewer.
