38 #include "boost/timer.hpp" 64 template <
typename PixelT>
70 Eigen::MatrixXd M = Eigen::MatrixXd::Zero(rows, cols);
88 Eigen::MatrixXi M = Eigen::MatrixXi::Zero(rows, cols);
117 template <
typename PixelT,
typename BackgroundT>
131 convolutionControl.setDoNormalize(
false);
133 convolutionKernel, convolutionControl);
136 *(convolvedMaskedImage.getImage()) += background;
139 convolvedMaskedImage -= scienceMaskedImage;
143 convolvedMaskedImage *= -1.0;
146 double time = t.elapsed();
147 LOGL_DEBUG(
"TRACE4.ip.diffim.convolveAndSubtract",
148 "Total compute time to convolve and subtract : %.2f s", time);
150 return convolvedMaskedImage;
168 template <
typename PixelT,
typename BackgroundT>
182 convolutionControl.setDoNormalize(
false);
184 convolutionKernel, convolutionControl);
187 *(convolvedMaskedImage.getImage()) += background;
190 *convolvedMaskedImage.getImage() -= *scienceMaskedImage.
getImage();
194 *convolvedMaskedImage.getImage() *= -1.0;
196 convolvedMaskedImage.getMask()->assign(*scienceMaskedImage.
getMask());
197 convolvedMaskedImage.getVariance()->assign(*scienceMaskedImage.
getVariance());
199 double time = t.elapsed();
200 LOGL_DEBUG(
"TRACE4.ip.diffim.convolveAndSubtract",
201 "Total compute time to convolve and subtract : %.2f s", time);
203 return convolvedMaskedImage;
223 #define p_INSTANTIATE_convolveAndSubtract(TEMPLATE_IMAGE_T, TYPE) \ 225 lsst::afw::image::MaskedImage<TYPE> convolveAndSubtract( \ 226 lsst::afw::image::TEMPLATE_IMAGE_T<TYPE> const& templateImage, \ 227 lsst::afw::image::MaskedImage<TYPE> const& scienceMaskedImage, \ 228 lsst::afw::math::Kernel const& convolutionKernel, \ 233 afwImage::MaskedImage<TYPE> convolveAndSubtract( \ 234 lsst::afw::image::TEMPLATE_IMAGE_T<TYPE> const& templateImage, \ 235 lsst::afw::image::MaskedImage<TYPE> const& scienceMaskedImage, \ 236 lsst::afw::math::Kernel const& convolutionKernel, \ 237 lsst::afw::math::Function2<double> const& backgroundFunction, \ 240 #define INSTANTIATE_convolveAndSubtract(TYPE) \ 241 p_INSTANTIATE_convolveAndSubtract(Image, TYPE) \ 242 p_INSTANTIATE_convolveAndSubtract(MaskedImage, TYPE)
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
An include file to include the header files for lsst::ip::diffim.
Eigen::MatrixXi maskToEigenMatrix(lsst::afw::image::Mask< lsst::afw::image::MaskPixel > const &mask)
int getHeight() const
Return the number of rows in the image.
Parameters to control convolution.
lsst::afw::image::MaskedImage< PixelT > convolveAndSubtract(lsst::afw::image::MaskedImage< PixelT > const &templateImage, lsst::afw::image::MaskedImage< PixelT > const &scienceMaskedImage, lsst::afw::math::Kernel const &convolutionKernel, BackgroundT background, bool invert=true)
Execute fundamental task of convolving template and subtracting it from science image.
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Class to accumulate Mask bits.
lsst::geom::Extent2I getDimensions() const
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage's image.
LSST DM logging module built on log4cxx.
A base class for image defects.
Represent a 2-dimensional array of bitmask pixels.
A class to manipulate images, masks, and variance as a single object.
Eigen::MatrixXd imageToEigenMatrix(lsst::afw::image::Image< PixelT > const &img)
Turns a 2-d Image into a 2-d Eigen Matrix.
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, ConvolutionControl const &convolutionControl=ConvolutionControl())
Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image...
#define INSTANTIATE_convolveAndSubtract(TYPE)
Class to calculate difference image statistics.
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage's mask.
int getWidth() const
Return the number of columns in the image.
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
Kernels are used for convolution with MaskedImages and (eventually) Images.
A class to represent a 2-dimensional array of pixels.