Changeset 19243
- Timestamp:
- Aug 27, 2008, 2:12:12 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmStack.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmStack.c
r19241 r19243 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2008-08-2 7 22:31:03$10 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2008-08-28 00:12:12 $ 12 12 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii 13 13 * … … 205 205 return; 206 206 } 207 data->inspect = psPixelsAdd(data->inspect, data->inspect->nalloc, x, y); 207 data->inspect = psPixelsAdd(data->inspect, data->inspect ? data->inspect->nalloc : PIXEL_LIST_BUFFER , 208 x, y); 208 209 return; 209 210 } … … 476 477 // can be identified easily. 477 478 static psArray *pixelMapGenerate(const psArray *input, // Data to stack 478 int numCols, int numRows // Size of (sky) images479 int minCols, int maxCols, int minRows, int maxRows // Bounds of interest 479 480 ) 480 481 { 482 int numCols = maxCols - minCols + 1, numRows = maxRows - minRows + 1; // Size of map 483 481 484 psArray *map = psArrayAlloc(numRows); // The pixel map 482 485 for (int y = 0; y < numRows; y++) { … … 492 495 psPixels *pixels = data->reject; // The rejected pixels 493 496 for (int j = 0; j < pixels->n; j++) { 494 int x = pixels->data[j].x , y = pixels->data[j].y; // Coordinates of interest497 int x = pixels->data[j].x - minCols, y = pixels->data[j].y - minRows; // Coordinates of interest 495 498 if (x < 0 || x >= numCols || y < 0 || y >= numRows) { 496 // psWarning("Bad pixel coordinate: %d,%d --- ignored.", x, y);497 499 continue; 498 500 } … … 513 515 // Query a "pixel map", by returning the list of image indices for a particular pixel. 514 516 static psVector *pixelMapQuery(const psArray *map, // Pixel map 517 int x0, int y0, // Offset into map 515 518 int x, int y // Coordinates of interest 516 519 ) 517 520 { 521 // Adjust for offset 522 x -= x0; 523 y -= y0; 524 518 525 assert(y >= 0 && y < map->n); 519 526 psArray *colMap = map->data[y]; // Columns for that row … … 624 631 psImage *combinedVariance = combined->weight; // Combined variance map 625 632 626 psArray *pixelMap = pixelMapGenerate(input, maxInputCols, maxInputRows); // Map of pixels to source 633 psArray *pixelMap = pixelMapGenerate(input, minInputCols, maxInputCols, 634 minInputRows, maxInputRows); // Map of pixels to source 627 635 psPixels *pixels = NULL; // Total list of pixels, with no duplicates 628 636 for (int i = 0; i < num; i++) { … … 638 646 for (int y = minInputRows; y < maxInputRows; y++) { 639 647 for (int x = minInputCols; x < maxInputCols; x++) { 640 psVector *reject = pixelMapQuery(pixelMap, x, y); // Inspect these images closely 648 psVector *reject = pixelMapQuery(pixelMap, minInputCols, minInputRows, 649 x, y); // Reject these images 641 650 combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors, 642 651 reject, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer); … … 651 660 continue; 652 661 } 653 psVector *reject = pixelMapQuery(pixelMap, x, y); // Inspect these images closely 662 psVector *reject = pixelMapQuery(pixelMap, minInputCols, minInputRows, 663 x, y); // Reject these images 654 664 combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors, 655 665 reject, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);
Note:
See TracChangeset
for help on using the changeset viewer.
