IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20568 for trunk/psModules


Ignore:
Timestamp:
Nov 6, 2008, 2:07:23 PM (18 years ago)
Author:
Paul Price
Message:

Adding parameter 'stride' to control the size of convolution patches (in pmSubtractionConvolve). Previously we have made this the (full) size of the kernel, but there's no reason why it can't be bigger. Making this value larger means the kernel doesn't have to be generated as often.

Location:
trunk/psModules/src/imcombine
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmStackReject.c

    r20505 r20568  
    126126
    127127psPixels *pmStackReject(const psPixels *in, int numCols, int numRows, float threshold, float poorFrac,
    128                         const psArray *subRegions, const psArray *subKernels)
     128                        int stride, const psArray *subRegions, const psArray *subKernels)
    129129{
    130130    PS_ASSERT_PIXELS_NON_NULL(in, NULL);
     
    168168        psRegion *region = subRegions->data[i]; // Region of interest
    169169        pmSubtractionKernels *kernels = subKernels->data[i]; // Kernel of interest
    170         if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, 0, 0, 1.0, NAN,
     170        if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, stride, 0, 0, 1.0, NAN,
    171171                                   region, kernels, false, true)) {
    172172            psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i);
  • trunk/psModules/src/imcombine/pmStackReject.h

    r19345 r20568  
    1313                        float threshold, ///< Threshold on convolved image, 0..1
    1414                        float poorFrac, ///< Fraction for "poor"
     15                        int stride,     ///< Size of convolution patches
    1516                        const psArray *regions, ///< Array of image regions for image
    1617                        const psArray *kernels ///< Array of kernel parameters for each region
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r20561 r20568  
    10881088
    10891089bool pmSubtractionConvolve(pmReadout *out1, pmReadout *out2, const pmReadout *ro1, const pmReadout *ro2,
    1090                            psImage *subMask, psMaskType maskBad, psMaskType maskPoor, float poorFrac,
    1091                            float sysError, const psRegion *region, const pmSubtractionKernels *kernels,
    1092                            bool doBG, bool useFFT)
     1090                           psImage *subMask, int stride, psMaskType maskBad, psMaskType maskPoor,
     1091                           float poorFrac, float sysError, const psRegion *region,
     1092                           const pmSubtractionKernels *kernels, bool doBG, bool useFFT)
    10931093{
    10941094    int numCols = 0, numRows = 0;       // Image dimensions
     
    11241124        PS_ASSERT_IMAGE_SIZE(subMask, numCols, numRows, false);
    11251125    }
     1126    PS_ASSERT_INT_NONNEGATIVE(stride, false);
     1127    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(poorFrac, 0.0, false);
     1128    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(poorFrac, 1.0, false);
     1129    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(sysError, 0.0, false);
     1130    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(sysError, 1.0, false);
    11261131    if (region && psRegionIsNaN(*region)) {
    11271132        psString string = psRegionToString(*region);
     
    12121217
    12131218    int size = kernels->size;           // Half-size of kernel
    1214     int fullSize = 2 * size + 1;        // Full size of kernel
    12151219
    12161220    // Get region for convolution: [xMin:xMax,yMin:yMax]
     
    12361240    psImageConvolveSetThreads(false);
    12371241
    1238     for (int j = yMin; j < yMax; j += fullSize) {
    1239         int ySubMax = PS_MIN(j + fullSize, yMax); // Range for subregion of interest
    1240         for (int i = xMin; i < xMax; i += fullSize) {
    1241             int xSubMax = PS_MIN(i + fullSize, xMax); // Range for subregion of interest
     1242    if (stride == 0) {
     1243        // Use the full size of the kernel
     1244        stride = 2 * size + 1;
     1245    }
     1246
     1247    for (int j = yMin; j < yMax; j += stride) {
     1248        int ySubMax = PS_MIN(j + stride, yMax); // Range for subregion of interest
     1249        for (int i = xMin; i < xMax; i += stride) {
     1250            int xSubMax = PS_MIN(i + stride, xMax); // Range for subregion of interest
    12421251
    12431252            psRegion *subRegion = psRegionAlloc(i, xSubMax, j, ySubMax); // Bounds of subtraction
  • trunk/psModules/src/imcombine/pmSubtraction.h

    r20505 r20568  
    66 * @author GLG, MHPCC
    77 *
    8  * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2008-11-01 03:36:01 $
     8 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2008-11-07 00:03:18 $
    1010 * Copyright 2004-207 Institute for Astronomy, University of Hawaii
    1111 */
     
    103103                           const pmReadout *ro2, // Input image 2
    104104                           psImage *subMask, ///< Subtraction mask (or NULL)
     105                           int stride,  ///< Size of convolution patches
    105106                           psMaskType maskBad, ///< Mask value to give bad pixels
    106107                           psMaskType maskPoor, ///< Mask value to give poor pixels
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r20505 r20568  
    9292
    9393bool pmSubtractionMatch(pmReadout *conv1, pmReadout *conv2, const pmReadout *ro1, const pmReadout *ro2,
    94                         int footprint, float regionSize, float stampSpacing, float threshold,
     94                        int footprint, int stride, float regionSize, float stampSpacing, float threshold,
    9595                        const psArray *sources, const char *stampsName,
    9696                        pmSubtractionKernelsType type, int size, int spatialOrder,
     
    139139
    140140    PS_ASSERT_INT_NONNEGATIVE(footprint, false);
     141    PS_ASSERT_INT_NONNEGATIVE(stride, false);
    141142    // regionSize can be just about anything (except maybe negative, but it can be NAN)
    142143    PS_ASSERT_FLOAT_LARGER_THAN(stampSpacing, 0.0, false);
     
    396397
    397398            psTrace("psModules.imcombine", 2, "Convolving...\n");
    398             if (!pmSubtractionConvolve(conv1, conv2, ro1, ro2, subMask, maskBad, maskPoor, poorFrac,
     399            if (!pmSubtractionConvolve(conv1, conv2, ro1, ro2, subMask, stride, maskBad, maskPoor, poorFrac,
    399400                                       sysError, region, kernels, true, useFFT)) {
    400401                psError(PS_ERR_UNKNOWN, false, "Unable to convolve image.");
  • trunk/psModules/src/imcombine/pmSubtractionMatch.h

    r20505 r20568  
    1616                        // Stamp parameters
    1717                        int footprint,  ///< Stamp half-size
     18                        int stride,     ///< Size for convolution patches
    1819                        float regionSize, ///< Typical size of iso-kernel regions
    1920                        float stampSpacing, ///< Typical spacing between stamps
Note: See TracChangeset for help on using the changeset viewer.