IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 2, 2007, 4:28:24 PM (19 years ago)
Author:
Paul Price
Message:

Adding function pmSubtractionOrder (choice of name is probably not the best) to determine which of the two images under consideration should be convolved to match the other. Originally was doing this by solving for a RING kernel of width 1, going both ways, and comparing the deviations for each. However, when doing stacks this didn't work (convolving the wider fake Gaussian image gave smaller deviations than convolving the narrower input image), so have settled on measuring the second moments for each stamp, and using the ratio of moments between the two images to determine which is wider; this seems to work for both subtracting and stacking images. In the process, plugged a few memory leaks, and added code to support convolving either way (or both ways; this will be useful when it comes time to code the dual convolution algorithm).

File:
1 edited

Legend:

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

    r15325 r15443  
    66 * @author GLG, MHPCC
    77 *
    8  * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2007-10-17 02:45:40 $
     8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2007-11-03 02:28:24 $
    1010 *
    1111 * Copyright 2004-207 Institute for Astronomy, University of Hawaii
     
    1616
    1717#include <pslib.h>
    18 #include "pmSubtractionKernels.h"
    19 #include "pmSubtractionStamps.h"
     18
     19#include <pmHDU.h>
     20#include <pmFPA.h>
     21#include <pmSubtractionKernels.h>
     22#include <pmSubtractionStamps.h>
    2023
    2124/// @addtogroup imcombine Image Combinations
    2225/// @{
    2326
     27/// Mask values for the subtraction mask
    2428typedef enum {
    25     PM_SUBTRACTION_MASK_CLEAR     = 0x00, // No masking
    26     PM_SUBTRACTION_MASK_REF       = 0x01, // Reference image is bad
    27     PM_SUBTRACTION_MASK_INPUT     = 0x02, // Input image is bad
    28     PM_SUBTRACTION_MASK_CONVOLVE  = 0x04, // If convolved, would be bad
    29     PM_SUBTRACTION_MASK_FOOTPRINT = 0x08, // Bad pixel within the stamp footprint
    30     PM_SUBTRACTION_MASK_BORDER    = 0x10, // Image border
    31     PM_SUBTRACTION_MASK_REJ       = 0x20, // Previously tried as a stamp, and rejected
     29    PM_SUBTRACTION_MASK_CLEAR       = 0x00, // No masking
     30    PM_SUBTRACTION_MASK_BAD_1       = 0x01, // Image 1 is bad
     31    PM_SUBTRACTION_MASK_BAD_2       = 0x02, // Image 2 is bad
     32    PM_SUBTRACTION_MASK_CONVOLVE_1  = 0x04, // If image 1 is convolved, would be bad
     33    PM_SUBTRACTION_MASK_CONVOLVE_2  = 0x08, // If image 2 is convolved, would be bad
     34    PM_SUBTRACTION_MASK_FOOTPRINT_1 = 0x10, // Bad pixel within the stamp footprint of image 1
     35    PM_SUBTRACTION_MASK_FOOTPRINT_2 = 0x20, // Bad pixel within the stamp footprint of image 2
     36    PM_SUBTRACTION_MASK_BORDER      = 0x40, // Image border
     37    PM_SUBTRACTION_MASK_REJ         = 0x80, // Previously tried as a stamp, and rejected
    3238} pmSubtractionMasks;
    3339
     
    4551bool pmSubtractionConvolveStamp(pmSubtractionStamp *stamp, ///< Stamp to convolve
    4652                                const pmSubtractionKernels *kernels, ///< Kernel parameters
    47                                 int footprint ///< Half-size of region over which to calculate equation
     53                                int footprint, ///< Half-size of region over which to calculate equation
     54                                pmSubtractionMode mode ///< Mode for subtraction (which to convolve)
    4855    );
    4956
     
    5158bool pmSubtractionCalculateEquation(pmSubtractionStampList *stamps, ///< Stamps
    5259                                    const pmSubtractionKernels *kernels, ///< Kernel parameters
    53                                     int footprint ///< Half-size of region over which to calculate equation
     60                                    int footprint, ///< Half-size of region over which to calculate equation
     61                                    pmSubtractionMode mode ///< Mode for subtraction (which to convolve)
    5462                                    );
    5563
     
    5967                                     );
    6068
     69/// Calculate deviations
     70psVector *pmSubtractionCalculateDeviations(pmSubtractionStampList *stamps, ///< Stamps
     71                                           const psVector *solution, ///< Solution vector
     72                                           int footprint, ///< Half-size of stamp
     73                                           const pmSubtractionKernels *kernels, ///< Kernel parameters
     74                                           pmSubtractionMode mode ///< Mode for subtraction
     75    );
     76
    6177/// Reject stamps
    6278int pmSubtractionRejectStamps(pmSubtractionStampList *stamps, ///< Stamps
     79                              const psVector *deviations, ///< Deviations for each stamp
    6380                              psImage *subMask, ///< Subtraction mask
    64                               const psVector *solution, ///< Solution vector
    65                               int footprint, ///< Region to mask if stamp is bad
    6681                              float sigmaRej, ///< Number of RMS deviations above zero at which to reject
    67                               const pmSubtractionKernels *kernels ///< Kernel parameters
     82                              int footprint ///< Half-size of stamp
    6883    );
    6984
     
    8196
    8297/// Convolve image in preparation for subtraction
    83 bool pmSubtractionConvolve(psImage **outImage, ///< Output image
    84                            psImage **outWeight, ///< Output weight map (or NULL)
    85                            psImage **outMask, ///< Output mask (or NULL)
    86                            const psImage *inImage, ///< Input image
    87                            const psImage *inWeight, ///< Input weight map (or NULL)
     98bool pmSubtractionConvolve(pmReadout *out, ///< Output image
     99                           const pmReadout *ro1, // Input image 1
     100                           const pmReadout *ro2, // Input image 2
    88101                           const psImage *subMask, ///< Subtraction mask (or NULL)
    89102                           psMaskType blank, ///< Mask value for blank regions
     
    91104                           const psVector *solution, ///< The solution vector
    92105                           const pmSubtractionKernels *kernels, ///< Kernel parameters
     106                           pmSubtractionMode mode, ///< Mode for subtraction
    93107                           bool useFFT  ///< Use Fast Fourier Transform for the convolution?
    94108    );
Note: See TracChangeset for help on using the changeset viewer.