IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16986


Ignore:
Timestamp:
Mar 13, 2008, 12:21:21 PM (18 years ago)
Author:
Paul Price
Message:

Do rejection on the complete list of pixels to inspect, rather than bit-by-bit. This clutters up ppStackLoop a bit more (it needs to be cleaned up, eventually), but makes the stacking actually work.

Location:
trunk/ppStack/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStack.h

    r16693 r16986  
    33
    44#define PPSTACK_RECIPE "PPSTACK"        // Name of the recipe
    5 #define PPSTACK_REJECTED_PIXELS "PPSTACK.PIXELS" // Name of rejected pixels metadata items
     5#define PPSTACK_INSPECT_PIXELS "PPSTACK.PIXELS" // Name of rejected pixels metadata items
    66
    77#include <psmodules.h>
  • trunk/ppStack/src/ppStackLoop.c

    r16865 r16986  
    188188        return false;
    189189    }
     190
     191    float threshold = psMetadataLookupF32(NULL, config->arguments, "THRESHOLD.MASK"); // Threshold for mask deconvolution
    190192
    191193    const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics
     
    449451        // Reset for the second read
    450452        // Extract the rejection lists
    451         psFree(subKernels);
    452         psFree(subRegions);
    453         psArray *rejected = psArrayAlloc(num); // Rejected pixels
     453        psArray *rejected = psArrayAlloc(num); // Pixels to inspect
    454454        for (int i = 0; i < num; i++) {
    455455            pmReadout *ro = readouts->data[i]; // Readout of interest
    456             pmReadoutFreeData(ro);
    457 
    458             psPixels *rejects = NULL;   // Rejection list for this readout
     456            psPixels *inspect = NULL;   // Inspection list for this readout
    459457            psMetadataIterator *iter = psMetadataIteratorAlloc(ro->analysis, PS_LIST_HEAD,
    460                                                                "^" PPSTACK_REJECTED_PIXELS "$"); // Iterator
     458                                                               "^" PPSTACK_INSPECT_PIXELS "$"); // Iterator
    461459            psMetadataItem *item;
    462460            while ((item = psMetadataGetAndIncrement(iter))) {
    463461                psPixels *pixels = item->data.V; // Rejected pixels
    464                 psTrace("ppStack", 5, "Adding %ld rejected pixels to image %d", pixels->n, i);
    465                 rejects = psPixelsConcatenate(rejects, pixels);
     462                psTrace("ppStack", 5, "Adding %ld pixels to inspect to image %d", pixels->n, i);
     463                inspect = psPixelsConcatenate(inspect, pixels);
    466464            }
    467465            psFree(iter);
    468             psTrace("ppStack", 5, "%ld rejected pixels rejected from image %d", rejects->n, i);
    469             psMetadataRemoveKey(ro->analysis, PPSTACK_REJECTED_PIXELS);
    470             rejected->data[i] = rejects;
    471         }
    472 
     466            psMetadataRemoveKey(ro->analysis, PPSTACK_INSPECT_PIXELS);
     467            pmReadoutFreeData(ro);
     468
     469            psTrace("ppStack", 5, "%ld total pixels to inspect from image %d", inspect->n, i);
     470
     471            psPixels *reject = pmStackReject(inspect, NULL, threshold, subRegions->data[i],
     472                                             subKernels->data[i]); // Pixels to reject
     473            psTrace("ppStack", 5, "%ld pixels rejected from image %d", reject->n, i);
     474            rejected->data[i] = reject;
     475        }
     476        psFree(subKernels);
     477        psFree(subRegions);
    473478
    474479        // Read convolutions by chunks
  • trunk/ppStack/src/ppStackReadout.c

    r16943 r16986  
    1212#define WCS_TOLERANCE 0.001             // Tolerance for WCS
    1313
    14 //#define REJECTION_FILES                 // Write rejection mask?
    15 //#define INSPECTION_FILES                // Write inspection mask?
    16 //#define COMBINED_FILES                  // Write combined images?
     14#define REJECTION_FILES                 // Write rejection mask?
     15#define INSPECTION_FILES                // Write inspection mask?
     16#define COMBINED_FILES                  // Write combined images?
    1717
    1818
     
    3636    psMaskType maskBad = psMetadataLookupU8(NULL, config->arguments, "MASK.BAD"); // Value to mask
    3737    psMaskType maskBlank = psMetadataLookupU8(NULL, config->arguments, "MASK.BLANK"); // Mask for blank reg.
    38     float threshold = psMetadataLookupF32(NULL, config->arguments, "THRESHOLD.MASK"); // Threshold for mask deconvolution
     38//    float threshold = psMetadataLookupF32(NULL, config->arguments, "THRESHOLD.MASK"); // Threshold for mask deconvolution
    3939    bool useVariance = psMetadataLookupBool(&mdok, config->arguments, "VARIANCE"); // Use variance for rejection?
    4040    bool safe = psMetadataLookupBool(&mdok, config->arguments, "SAFE"); // Play safe when combining small numbers of pixels?
     
    9999#endif
    100100
    101     // Reject pixels
     101    // Save list of pixels to inspect
    102102    for (int i = 0; i < num; i++) {
    103103        pmStackData *data = stack->data[i]; // Data for this image
    104104        pmReadout *readout = data->readout; // Readout of interest
    105         int col0 = readout->col0, row0 = readout->row0; // Offset for readout
    106         int numCols = readout->image->numCols, numRows = readout->image->numRows; // Size of image
    107 
    108         psRegion *valid = psRegionAlloc(col0, col0 + numCols, row0, row0 + numRows); // Valid region for rej
    109         psPixels *reject = pmStackReject(data->pixels, valid, threshold, regions->data[i],
    110                                          kernels->data[i]); // Pixels to reject
    111         psFree(valid);
    112 
    113         psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PPSTACK_REJECTED_PIXELS,
    114                          PS_DATA_PIXELS | PS_META_DUPLICATE_OK, "Rejected pixels from initial combination",
    115                          reject);
    116         psFree(reject);                 // Drop reference
     105        psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PPSTACK_INSPECT_PIXELS,
     106                         PS_DATA_PIXELS | PS_META_DUPLICATE_OK, "Pixels to inspect from initial combination",
     107                         data->pixels);
    117108    }
    118109
Note: See TracChangeset for help on using the changeset viewer.