Changeset 21183 for trunk/psModules/src/imcombine/pmImageCombine.c
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmImageCombine.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmImageCombine.c
r12742 r21183 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $11 * @date $Date: 200 7-04-04 22:42:48 $10 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2009-01-27 06:39:38 $ 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;
Note:
See TracChangeset
for help on using the changeset viewer.
