IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 17, 2007, 10:58:53 AM (19 years ago)
Author:
Paul Price
Message:

Was getting lots of NANs in unmasked pixels, because the FFT spreads
NANs over the entire iso-kernel subregion. Using new API for
psImageConvolveFFT to pass a mask, which sets the masked pixels to
nominated value.

File:
1 edited

Legend:

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

    r14824 r14867  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-09-12 20:21:41 $
     6 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-09-17 20:58:53 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    360360static void convolveFFT(psImage *target,// Place the result in here
    361361                        const psImage *image, // Image to convolve
     362                        const psImage *mask, // Mask image
    362363                        const psKernel *kernel, // Kernel by which to convolve
    363364                        psRegion region,// Region of interest
     
    371372    // Casting away const so psImageSubset can add the child
    372373    psImage *subImage = psImageSubset((psImage*)image, border); // Subimage to convolve
    373     psImage *convolved = psImageConvolveFFT(subImage, kernel, 0.0); // Convolution
     374    psImage *subMask = psImageSubset((psImage*)mask, border); // Subimage mask
     375    psImage *convolved = psImageConvolveFFT(subImage, subMask, PM_SUBTRACTION_MASK_REF,
     376                                            kernel, 0.0); // Convolution
    374377    psFree(subImage);
    375378
    376379    // Now, we have to chop off the borders, and stick it in where it belongs
    377     psImage *subConv = psImageSubset(convolved, psRegionSet(size, -size,
    378                                                             size, -size)); // Cut off the edges
     380    psImage *subConv = psImageSubset(convolved, psRegionSet(size, -size, size, -size)); // Cut off the edges
    379381    psImage *subTarget = psImageSubset(target, region); // Target for this subregion
    380382    if (background != 0.0) {
     
    443445    PS_ASSERT_KERNEL_NON_NULL(kernel, NULL);
    444446
    445     psImage *conv = psImageConvolveFFT(image->image, kernel, 0.0); // Convolved image
     447    psImage *conv = psImageConvolveFFT(image->image, NULL, 0, kernel, 0.0); // Convolved image
    446448    int x0 = - image->xMin, y0 = - image->yMin; // Position of centre of convolved image
    447449    psKernel *convolved = psKernelAllocFromImage(conv, x0, y0); // Kernel version
     
    11161118                // Use Fast Fourier Transform to do the convolution
    11171119                // This provides a big speed-up for large kernels
    1118                 convolveFFT(convImage, inImage, kernelImage, psRegionSet(i, xSubMax, j, ySubMax),
     1120                convolveFFT(convImage, inImage, subMask, kernelImage, psRegionSet(i, xSubMax, j, ySubMax),
    11191121                            background, size);
    11201122                if (inWeight) {
    1121                     convolveFFT(convWeight, inWeight, kernelWeight, psRegionSet(i, xSubMax, j, ySubMax),
    1122                                 0.0, size);
     1123                    convolveFFT(convWeight, inWeight, subMask, kernelWeight,
     1124                                psRegionSet(i, xSubMax, j, ySubMax), 0.0, size);
    11231125                }
    11241126            } else {
Note: See TracChangeset for help on using the changeset viewer.