Changeset 21079 for branches/eam_branch_20081230/psModules/src/imcombine
- Timestamp:
- Jan 1, 2009, 7:13:00 PM (18 years ago)
- Location:
- branches/eam_branch_20081230/psModules/src/imcombine
- Files:
-
- 5 edited
-
pmImageCombine.c (modified) (15 diffs)
-
pmStack.h (modified) (2 diffs)
-
pmSubtraction.h (modified) (2 diffs)
-
pmSubtractionMask.h (modified) (2 diffs)
-
pmSubtractionMatch.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081230/psModules/src/imcombine/pmImageCombine.c
r21072 r21079 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $11 * @date $Date: 200 7-04-04 22:42:48$10 * @version $Revision: 1.12.78.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2009-01-02 05:13:00 $ 12 12 * 13 13 * XXX: pmRejectPixels() has a known bug with the pmImageTransform() call. … … 17 17 */ 18 18 19 // XXX this is somewhat messy and unclear on the masking. 20 19 21 #ifdef HAVE_CONFIG_H 20 22 #include <config.h> … … 53 55 54 56 buffer->pixels = psVectorAlloc(numImages, PS_TYPE_F32); 55 buffer->masks = psVectorAlloc(numImages, PS_TYPE_ MASK);57 buffer->masks = psVectorAlloc(numImages, PS_TYPE_VECTOR_MASK); 56 58 buffer->errors = psVectorAlloc(numImages, PS_TYPE_F32); 57 59 buffer->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV); … … 67 69 const psArray *errors, // Array of input error images 68 70 const psArray *masks, // Array of input masks 69 ps U32maskVal, // Mask value71 psImageMaskType maskVal, // Mask value 70 72 psS32 numIter, // Number of rejection iterations 71 73 psF32 sigmaClip, // Number of standard deviations at which to reject … … 115 117 if (masks) { 116 118 psImage *mask = masks->data[i]; // Mask of interest 117 pixelMasks->data.U8[i] = mask->data.U8[y][x]; 118 } // Set the pixel error data, if necessary 119 pixelMasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal); 120 } 121 // Set the pixel error data, if necessary 119 122 if (errors) { 120 123 psImage *error = errors->data[i]; // Error image of interest … … 128 131 for (int iter = 0; iter < numIter; iter++) { 129 132 // Combine all the pixels, using the specified stat. 130 if (!psVectorStats(stats, pixelData, pixelErrors, pixelMasks, maskVal)) {133 if (!psVectorStats(stats, pixelData, pixelErrors, pixelMasks, 0xff)) { 131 134 combine->data.F32[y][x] = NAN; 132 135 psFree(buffer); … … 148 151 float stdev = stats->sampleStdev; 149 152 for (int i = 0; i < numImages; i++) { 150 if (!(pixelMasks->data. U8[i] & maskVal) &&153 if (!(pixelMasks->data.PS_TYPE_VECTOR_MASK_DATA[i] & 0xff) && 151 154 fabs(pixelData->data.F32[i] - combinedPixel) > sigmaClip * stdev) { 152 155 // Reject pixel as questionable 153 156 numRejects++; 154 pixelMasks->data. U8[i] = maskVal;157 pixelMasks->data.PS_TYPE_IMAGE_MASK_DATA[i] = 0xff; 155 158 if (questionablePixels) { 156 159 // Mark the pixel as questionable … … 191 194 const psArray *errors, ///< Array of input error images 192 195 const psArray *masks, ///< Array of input masks 193 ps U32maskVal, ///< Mask value196 psImageMaskType maskVal, ///< Mask value 194 197 const psPixels *pixels, ///< Pixels to combine 195 198 psS32 numIter, ///< Number of rejection iterations … … 231 234 psImage *mask = masks->data[i]; 232 235 PS_ASSERT_IMAGE_SIZE(mask, numCols, numRows, NULL); 233 PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_ MASK, NULL);236 PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_IMAGE_MASK, NULL); 234 237 } 235 238 } … … 319 322 int num = 0; 320 323 psVector *pixels = psVectorAlloc(8, PS_TYPE_F32); // Array of pixels 321 psVector *mask = psVectorAlloc(8, PS_TYPE_ U8); // Corresponding mask324 psVector *mask = psVectorAlloc(8, PS_TYPE_VECTOR_MASK); // Corresponding mask 322 325 323 326 // Get limits … … 329 332 for (int j = yMin; j <= yMax; j++) { 330 333 for (int i = xMin; i <= xMax; i++) { 331 if ((i != x) && (j != y) && (0 == imageMask->data. U8[j][i])) {334 if ((i != x) && (j != y) && (0 == imageMask->data.PS_TYPE_IMAGE_MASK_DATA[j][i])) { 332 335 pixels->data.F32[num] = image->data.F32[j][i]; 333 mask->data. U8[num] = 0;336 mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 0; 334 337 num++; 335 338 } else { 336 mask->data. U8[num] = 1;339 mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 1; 337 340 } 338 341 } … … 347 350 if ((i != x) && (j != y)) { 348 351 pixels->data.F32[num] = image->data.F32[j][i]; 349 mask->data. U8[num] = 0;352 mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 0; 350 353 num++; 351 354 } else { 352 mask->data. U8[num] = 1;355 mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 1; 353 356 } 354 357 } … … 473 476 for (psS32 i = 0 ; i < image->numRows ; i++) { 474 477 for (psS32 j = 0 ; j < image->numCols ; j++) { 475 imgF32->data.F32[i][j] = (psF32) image->data. U8[i][j];478 imgF32->data.F32[i][j] = (psF32) image->data.PS_TYPE_IMAGE_MASK_DATA[i][j]; 476 479 } 477 480 } … … 518 521 PS_ASSERT_IMAGE_NON_NULL(tmpMask, NULL); 519 522 PS_ASSERT_IMAGE_NON_EMPTY(tmpMask, NULL); 520 PS_ASSERT_IMAGE_TYPE(tmpMask, PS_TYPE_F32, NULL); 523 PS_ASSERT_IMAGE_TYPE(tmpMask, PS_TYPE_F32, NULL); // XXX really F32?? 521 524 PS_ASSERT_IMAGES_SIZE_EQUAL(tmpImage, tmpMask, NULL); 522 525 } … … 571 574 572 575 // 573 // Create a ps U8mask image from the list of cosmic pixels.576 // Create a psImageMaskType mask image from the list of cosmic pixels. 574 577 // 575 578 psImage *maskImage = NULL; -
branches/eam_branch_20081230/psModules/src/imcombine/pmStack.h
r21072 r21079 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $11 * @date $Date: 200 8-11-01 02:59:33$10 * @version $Revision: 1.9.8.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2009-01-02 05:13:00 $ 12 12 * 13 13 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 43 43 bool pmStackCombine(pmReadout *combined,///< Combined readout (output) 44 44 psArray *input, ///< Input array of pmStackData 45 ps MaskType maskVal, ///< Mask value of bad pixels46 ps MaskType bad, ///< Mask value to give rejected pixels45 psImageMaskType maskVal, ///< Mask value of bad pixels 46 psImageMaskType bad, ///< Mask value to give rejected pixels 47 47 int kernelSize, ///< Half-size of the convolution kernel 48 48 int numIter, ///< Number of iterations -
branches/eam_branch_20081230/psModules/src/imcombine/pmSubtraction.h
r20568 r21079 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-11-07 00:03:18$8 * @version $Revision: 1.34.6.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-02 05:13:00 $ 10 10 * Copyright 2004-207 Institute for Astronomy, University of Hawaii 11 11 */ … … 104 104 psImage *subMask, ///< Subtraction mask (or NULL) 105 105 int stride, ///< Size of convolution patches 106 ps MaskType maskBad, ///< Mask value to give bad pixels107 ps MaskType maskPoor, ///< Mask value to give poor pixels106 psImageMaskType maskBad, ///< Mask value to give bad pixels 107 psImageMaskType maskPoor, ///< Mask value to give poor pixels 108 108 float poorFrac, ///< Fraction for "poor" 109 109 float sysError, ///< Relative systematic error -
branches/eam_branch_20081230/psModules/src/imcombine/pmSubtractionMask.h
r21072 r21079 7 7 psImage *pmSubtractionMask(const psImage *refMask, ///< Mask for the reference image (will be convolved) 8 8 const psImage *inMask, ///< Mask for the input image, or NULL 9 ps MaskType maskVal, ///< Value to mask out9 psImageMaskType maskVal, ///< Value to mask out 10 10 int size, ///< Half-size of the kernel (pmSubtractionKernels.size) 11 11 int footprint, ///< Half-size of the kernel footprint … … 19 19 psImage *mask, ///< Mask (or NULL) 20 20 int size, ///< Kernel half-size 21 ps MaskType blank ///< Mask value for blank regions21 psImageMaskType blank ///< Mask value for blank regions 22 22 ); 23 23 -
branches/eam_branch_20081230/psModules/src/imcombine/pmSubtractionMatch.h
r20568 r21079 40 40 float rej, ///< Rejection threshold 41 41 float sysError, ///< Relative systematic error 42 ps MaskType maskVal, ///< Value to mask for input43 ps MaskType maskBad, ///< Mask for output bad pixels44 ps MaskType maskPoor, ///< Mask for output poor pixels42 psImageMaskType maskVal, ///< Value to mask for input 43 psImageMaskType maskBad, ///< Mask for output bad pixels 44 psImageMaskType maskPoor, ///< Mask for output poor pixels 45 45 float poorFrac, ///< Fraction for "poor" 46 46 float badFrac, ///< Maximum fraction of bad input pixels to accept
Note:
See TracChangeset
for help on using the changeset viewer.
