#ifndef PM_SUBTRACTION_MATCH_H
#define PM_SUBTRACTION_MATCH_H

#include <pslib.h>

#include "pmHDU.h"
#include "pmFPA.h"
#include "pmSubtractionKernels.h"


bool pmSubtractionMatch(pmReadout *convolved, ///< Output convolved data
                        const pmReadout *reference, ///< Reference data
                        const pmReadout *input, ///< Input data
                        // Stamp parameters
                        int footprint,  ///< Stamp half-size
                        float regionSize, ///< Typical size of iso-kernel regions
                        float stampSpacing, ///< Typical spacing between stamps
                        float threshold, ///< Threshold for stamps
                        const psArray *sources, ///< Sources for stamps
                        const char *stampsName, ///< Filename for stamps
                        float targetWidth, ///< Width of PSF for simulated target
                        // Kernel parameters
                        pmSubtractionKernelsType type, ///< Kernel type
                        int size,       ///< Kernel half-size
                        int order,      ///< Spatial polynomial order
                        const psVector *widths, ///< ISIS Gaussian widths
                        const psVector *orders, ///< ISIS Polynomial orders
                        int inner,      ///< Inner radius for various kernel types
                        int ringsOrder, ///< RINGS polynomial order
                        int binning,    ///< SPAM kernel binning
                        bool optimum,   ///< Search for optimum ISIS kernel?
                        const psVector *optFWHMs, ///< FWHMs for optimum search
                        int optOrder,   ///< Maximum order for optimum search
                        float optThreshold, ///< Threshold for optimum search (0..1)
                        // Operational parameters
                        int iter,       ///< Rejection iterations
                        float rej,      ///< Rejection threshold
                        psMaskType maskBad, ///< Value to mask
                        psMaskType maskBlank ///< Mask for blank region
    );

#endif
