Changeset 21524 for trunk/ppSub/src/ppSubSetMasks.c
- Timestamp:
- Feb 17, 2009, 2:31:20 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubSetMasks.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubSetMasks.c
r21360 r21524 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02- 06 01:37:17$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-18 00:31:20 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ 12 12 13 #ifdef HAVE_CONFIG_H 14 #include <config.h> 15 #endif 16 17 #include <stdio.h> 18 #include <pslib.h> 19 #include <psmodules.h> 20 #include <psphot.h> 21 13 22 #include "ppSub.h" 14 23 15 /** this function generates (if needed) and sets or updates the masks for both the input and 16 * reference images. this function also has the code for interpolation over bad pixels, but it 17 * is currently if-def-ed out18 */24 bool ppSubSetMasks(pmConfig *config, const pmFPAview *view) 25 { 26 psAssert(config, "Require configuration"); 27 psAssert(view, "Require view"); 19 28 20 bool ppSubSetMasks (pmConfig *config, const pmFPAview *view) { 21 22 psImageMaskType maskValue; 23 psImageMaskType markValue; 24 bool mdok = false; 25 29 psImageMaskType maskValue, markValue; // Mask values 26 30 if (!pmConfigMaskSetBits(&maskValue, &markValue, config)) { 27 31 psError(PS_ERR_UNKNOWN, false, "Unable to determine mask value."); … … 29 33 } 30 34 31 // set the mask bits needed by psphot (in psphot recipe)35 // Set the mask bits needed by psphot (in psphot recipe) 32 36 psphotSetMaskRecipe (config, maskValue, markValue); 33 37 34 38 // Look up recipe values 35 psMetadata *recipe = psMetadataLookupMetadata( &mdok, config->recipes, PPSUB_RECIPE); // Recipe for ppSim39 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 36 40 psAssert(recipe, "We checked this earlier, so it should be here."); 37 41 38 42 psImageMaskType satValue = pmConfigMaskGet("SAT", config); 39 psAssert (satValue, "SAT must be non-zero");43 psAssert(satValue, "SAT must be non-zero"); 40 44 41 45 psImageMaskType badValue = pmConfigMaskGet("BAD", config); 42 psAssert (badValue, "BAD must be non-zero");46 psAssert(badValue, "BAD must be non-zero"); 43 47 44 48 // input images … … 49 53 psImage *reference = refRO->image; // Reference image 50 54 PS_ASSERT_IMAGES_SIZE_EQUAL(input, reference, false); 51 52 // XXX use psImageCopy below to avoid caring about image dimensions 53 int numCols = input->numCols; 54 int numRows = input->numRows; 55 int numCols = input->numCols, numRows = input->numRows; // Size of image 55 56 56 57 // Generate masks if they don't exist … … 78 79 } 79 80 if (!pmReadoutMaskNonfinite(refRO, satValue)) { 80 psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in reference.");81 return false;81 psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in reference."); 82 return false; 82 83 } 83 84 84 #if (0)85 // Look up recipe values86 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim87 psAssert(recipe, "We checked this earlier, so it should be here.");88 85 86 #if 0 87 // Interpolation over bad pixels: this takes a while! 89 88 bool mdok = false; 90 91 89 psString interpModeStr = psMetadataLookupStr(&mdok, recipe, "INTERPOLATION"); // Interpolation mode 92 90 psImageInterpolateMode interpMode = psImageInterpolateModeFromString(interpModeStr); // Interp … … 102 100 // Interpolate over bad pixels, so the bad pixels don't explode 103 101 if (!pmReadoutInterpolateBadPixels(inRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) { 104 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for input image.");105 return false;102 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for input image."); 103 return false; 106 104 } 107 105 if (!pmReadoutInterpolateBadPixels(refRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) { 108 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for reference image.");109 return false;106 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for reference image."); 107 return false; 110 108 } 111 109 maskVal |= maskBad;
Note:
See TracChangeset
for help on using the changeset viewer.
