Changeset 9616
- Timestamp:
- Oct 17, 2006, 12:17:38 PM (20 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 4 deleted
- 3 edited
-
Makefile.am (modified) (2 diffs)
-
pmFlatFieldErrors.dat (deleted)
-
pmFlatFieldErrors.h (deleted)
-
pmMaskBadPixels.c (modified) (5 diffs)
-
pmMaskBadPixels.h (modified) (1 diff)
-
pmMaskBadPixelsErrors.dat (deleted)
-
pmMaskBadPixelsErrors.h (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/Makefile.am
r9434 r9616 19 19 pkginclude_HEADERS = \ 20 20 pmFlatField.h \ 21 pmFlatFieldErrors.h \22 21 pmFlatNormalize.h \ 23 22 pmFringeStats.h \ 24 pmMaskBadPixelsErrors.h \25 23 pmMaskBadPixels.h \ 26 24 pmNonLinear.h \ … … 31 29 psIOBuffer.h 32 30 33 # pmSubtractSky.c 34 35 EXTRA_DIST = \ 36 pmFlatFieldErrors.dat \ 37 pmMaskBadPixelsErrors.dat 31 # pmSubtractSky.h 38 32 39 33 CLEANFILES = *~ -
trunk/psModules/src/detrend/pmMaskBadPixels.c
r7479 r9616 1 /** @file pmMaskBadPixels.c2 *3 * @brief Given an input image, a bad pixel mask, a corresponding value in the bad pixel mask to mask, a4 * saturation level, and a growing radius, mask in the input image those pixels in the bad pixel mask that5 * match the value to mask.6 *7 * Apply the supplied bad pixel mask readout (mask) to the given science readout (input).8 * The science readout must already have a supplied mask element (use eg. pmReadoutSetMask)9 * The supplied mask image must be of MASK type10 11 * If maskVal is non-zero, all pixels in the mask have any of the same bits sets as maskVal12 * shall have the corresponding bits raised.13 14 * If maskVal is zero, any zero pixels in the mask be OR-ed with PM_MASK_BAD15 16 * Note that the input image and the mask need not be the same size, since the input image may17 * already have been trimmed (following overscan subtraction). The function assumes the pixels18 * originate from the same detector and uses the values of col0,row0 in both the input and the19 * mask to match corresponding pixels.20 21 * In the event that the mask image is too small (i.e., pixels on the input image refer to22 * pixels outside the range of the mask image), the function shall generate an error.23 24 * @author Ross Harman, MHPCC25 * @author Eugene Magnier, IfA26 *27 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $28 * @date $Date: 2006-06-10 02:59:23 $29 *30 * Copyright 2004 IfA, University of Hawaii31 */32 33 1 #if HAVE_CONFIG_H 34 2 #include <config.h> … … 36 4 37 5 #include <stdio.h> 38 #include <math.h> 39 #include <strings.h> 6 #include <pslib.h> 40 7 41 8 #include "pmFPAMaskWeight.h" 42 9 #include "pmMaskBadPixels.h" 43 #include "pmMaskBadPixelsErrors.h"44 10 45 // apply an externally-supplied mask image to the current science image 46 // this function 47 bool pmMaskBadPixels(pmReadout *input, pmReadout *mask, psMaskType maskVal) 11 bool pmMaskBadPixels(pmReadout *input, const pmReadout *mask, psMaskType maskVal) 48 12 { 49 50 int xI;51 int xJ;52 53 13 PS_ASSERT_PTR_NON_NULL(input, false); 54 14 PS_ASSERT_PTR_NON_NULL(input->mask, false); 55 PS_ASSERT_IMAGE_TYPE(input->mask, PS_TYPE_MASK, NULL);15 PS_ASSERT_IMAGE_TYPE(input->mask, PS_TYPE_MASK, false); 56 16 57 17 PS_ASSERT_PTR_NON_NULL(mask, false); 58 18 PS_ASSERT_PTR_NON_NULL(mask->mask, false); 59 PS_ASSERT_IMAGE_TYPE(mask->mask, PS_TYPE_MASK, NULL);19 PS_ASSERT_IMAGE_TYPE(mask->mask, PS_TYPE_MASK, false); 60 20 61 21 psImage *inMask = input->mask; … … 65 25 int colMax = inMask->col0 + inMask->numCols; 66 26 67 if (exMask->row0 > inMask->row0) { 27 if (exMask->row0 > inMask->row0 || exMask->col0 > inMask->col0 || 28 exMask->row0 + exMask->numRows < rowMax || exMask->col0 + exMask->numCols < colMax) { 68 29 psError( PS_ERR_BAD_PARAMETER_SIZE, true, 69 PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE, 70 inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols); 71 return false; 72 } 73 if (exMask->col0 > inMask->col0) { 74 psError( PS_ERR_BAD_PARAMETER_SIZE, true, 75 PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE, 76 inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols); 77 return false; 78 } 79 if (exMask->row0 + exMask->numRows < rowMax) { 80 psError( PS_ERR_BAD_PARAMETER_SIZE, true, 81 PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE, 82 inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols); 83 return false; 84 } 85 if (exMask->col0 + exMask->numCols < colMax) { 86 psError( PS_ERR_BAD_PARAMETER_SIZE, true, 87 PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE, 30 "Input image size exceeds that of mask image: (%d, %d) vs (%d, %d)", 88 31 inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols); 89 32 return false; … … 103 46 // set raised pixels in exMask which are selected by maskVal 104 47 for (int j = 0; j < inMask->numRows; j++) { 105 xJ = j - offRow;48 int xJ = j - offRow; 106 49 for (int i = 0; i < inMask->numCols; i++) { 107 xI = i - offCol;50 int xI = i - offCol; 108 51 inVal[j][i] |= (maskVal & exVal[xJ][xI]); 109 52 } … … 112 55 // set raised pixels in exMask which are selected by maskVal 113 56 for (int j = 0; j < inMask->numRows; j++) { 114 xJ = j - offRow;57 int xJ = j - offRow; 115 58 for (int i = 0; i < inMask->numCols; i++) { 116 xI = i - offCol;59 int xI = i - offCol; 117 60 if (exVal[xJ][xI] == 0) { 118 61 inVal[j][i] |= PM_MASK_BAD; -
trunk/psModules/src/detrend/pmMaskBadPixels.h
r7479 r9616 1 /** @file pmMaskBadPixels.h 2 * 3 * @brief Given an input image, a bad pixel mask, a corresponding value in the bad pixel mask to mask, a 4 * saturation level, and a growing radius, mask in the input image those pixels in the bad pixel mask that 5 * match the value to mask. 6 * 7 * Given an input image, in, a bad pixel mask, a corresponding value in the bad pixel mask to mask in the 8 * input image, maskVal, a saturation level, and a growing radius, pmMaskBadPixels shall mask in the input 9 * image those pixels in the bad pixel mask that match the value to mask. Note that the input image, in, is 10 * modified in-place. All pixels in the mask which satisfy the maskVal shall have their corresponding pixels 11 * masked in the input image, in. All pixels which satisfy the growVal shall have their corresponding 12 * pixels, along with all pixels within the grow radius masked. Pixels which have flux greater than sat shall 13 * also be masked, but not grown. Note that the input image, in, and the mask need not be the same size, 14 * since the input image may already have been trimmed (following overscan subtraction), but the function 15 * shall use the offsets in the image (in->x0 and in->y0) to determine the appropriate offsets to obtain the 16 * correct pixel on the mask. In the event that the mask image is too small (i.e., pixels on the input image 17 * refer to pixels outside the range of the mask image), the function shall generate an error. 18 * 19 * @author Ross Harman, MHPCC 20 * 21 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 22 * @date $Date: 2006-06-10 02:59:23 $ 23 * 24 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 25 */ 1 /// @file pmMaskBadPixels.h 2 /// 3 /// @brief Mask bad pixels 4 /// 5 /// @ingroup Detrend 6 /// 7 /// @author Ross Harman, MHPCC 8 /// @author Eugene Magnier, IfA 9 /// 10 /// @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 11 /// @date $Date: 2006-10-17 22:17:38 $ 12 /// 13 /// Copyright 2004 Institute for Astronomy, University of Hawaii 14 /// 15 26 16 #ifndef PM_MASK_BAD_PIXELS_H 27 17 #define PM_MASK_BAD_PIXELS_H 28 18 29 #include "pslib.h"19 #include <pslib.h> 30 20 #include "pmFPA.h" 31 21 32 /** Execute bad pixels module. 33 * 34 * 35 * @return bool: True or false for success or failure 36 */ 37 38 bool pmMaskBadPixels(pmReadout *input, pmReadout *mask, psMaskType maskVal); 22 /// Applies the bad pixel mask to the input 23 /// 24 /// Pixels marked as bad within the mask are marked as bad within the input image's mask. If maskVal is 25 /// non-zero, all pixels in the mask have any of the same bits sets as maskVal shall have the corresponding 26 /// bits raised. If maskVal is zero, any zero pixels in the mask are OR-ed with PM_MASK_BAD. Position 27 /// offsets (such as due to trimming) between the input and mask are applied so that the same pixels are 28 /// referred to. The science readout must already have a supplied mask element (use eg. pmReadoutSetMask). 29 /// The supplied mask image must be of MASK type 30 bool pmMaskBadPixels(pmReadout *input, ///< Input science image 31 const pmReadout *mask, ///< Mask image to apply 32 psMaskType maskVal ///< Mask value to apply 33 ); 39 34 40 35 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
