LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
afw
11.0-2-g04d2804
src
math
detail
convCpuGpuShared.cc
Go to the documentation of this file.
1
// -*- LSST-C++ -*-
2
3
/*
4
* LSST Data Management System
5
* Copyright 2008, 2009, 2010 LSST Corporation.
6
*
7
* This product includes software developed by the
8
* LSST Project (http://www.lsst.org/).
9
*
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the LSST License Statement and
21
* the GNU General Public License along with this program. If not,
22
* see <http://www.lsstcorp.org/LegalNotices/>.
23
*/
24
38
#include "boost/cstdint.hpp"
39
40
#include "
lsst/pex/exceptions.h
"
41
#include "
lsst/afw/image/MaskedImage.h
"
42
#include "
lsst/afw/math/Kernel.h
"
43
#include "
lsst/afw/math/detail/Convolve.h
"
44
#include "
lsst/afw/math/detail/ConvCpuGpuShared.h
"
45
46
namespace
afwImage =
lsst::afw::image
;
47
namespace
mathDetail = lsst::afw::math::detail;
48
49
/*
50
* Assert that the dimensions of convolvedImage, inImage and kernel are compatible with convolution.
51
*
52
* @throw lsst::pex::exceptions::InvalidParameterError if convolvedImage dimensions != inImage dim.
53
* @throw lsst::pex::exceptions::InvalidParameterError if inImage smaller than kernel in width or h.
54
* @throw lsst::pex::exceptions::InvalidParameterError if kernel width or height < 1
55
*
56
* @note Same as assertDimensionsOK in basicConvolve.cc, copy-pasted
57
*/
58
template
<
typename
OutImageT,
typename
InImageT>
59
void
mathDetail::assertDimensionsOK
(
60
OutImageT
const
&convolvedImage,
61
InImageT
const
&inImage,
62
lsst::afw::math::Kernel
const
&kernel
63
) {
64
if
(convolvedImage.getDimensions() != inImage.getDimensions()) {
65
std::ostringstream os;
66
os <<
"convolvedImage dimensions = ( "
67
<< convolvedImage.getWidth() <<
", "
<< convolvedImage.getHeight()
68
<<
") != ("
<< inImage.getWidth() <<
", "
<< inImage.getHeight() <<
") = inImage dimensions"
;
69
throw
LSST_EXCEPT
(pexExcept::InvalidParameterError, os.str());
70
}
71
if
(inImage.getWidth() < kernel.
getWidth
() || inImage.getHeight() < kernel.
getHeight
()) {
72
std::ostringstream os;
73
os <<
"inImage dimensions = ( "
74
<< inImage.getWidth() <<
", "
<< inImage.getHeight()
75
<<
") smaller than ("
<< kernel.
getWidth
() <<
", "
<< kernel.
getHeight
()
76
<<
") = kernel dimensions in width and/or height"
;
77
throw
LSST_EXCEPT
(pexExcept::InvalidParameterError, os.str());
78
}
79
if
((kernel.
getWidth
() < 1) || (kernel.
getHeight
() < 1)) {
80
std::ostringstream os;
81
os <<
"kernel dimensions = ( "
82
<< kernel.
getWidth
() <<
", "
<< kernel.
getHeight
()
83
<<
") smaller than (1, 1) in width and/or height"
;
84
throw
LSST_EXCEPT
(pexExcept::InvalidParameterError, os.str());
85
}
86
}
87
88
/*
89
* Explicit instantiation
90
*/
92
#define IMAGE(PIXTYPE) afwImage::Image<PIXTYPE>
93
#define MASKEDIMAGE(PIXTYPE) afwImage::MaskedImage<PIXTYPE, afwImage::MaskPixel, afwImage::VariancePixel>
94
#define NL
/* */
95
// Instantiate Image or MaskedImage versions
96
#define INSTANTIATE_IM_OR_MI(IMGMACRO, OUTPIXTYPE, INPIXTYPE) \
97
template void mathDetail::assertDimensionsOK( \
98
IMGMACRO(OUTPIXTYPE) const &convolvedImage, \
99
IMGMACRO(INPIXTYPE) const &inImage, \
100
lsst::afw::math::Kernel const &kernel \
101
);
102
103
// Instantiate both Image and MaskedImage versions
104
#define INSTANTIATE(OUTPIXTYPE, INPIXTYPE) \
105
INSTANTIATE_IM_OR_MI(IMAGE, OUTPIXTYPE, INPIXTYPE) \
106
INSTANTIATE_IM_OR_MI(MASKEDIMAGE, OUTPIXTYPE, INPIXTYPE)
107
108
INSTANTIATE
(
double
,
double
)
109
INSTANTIATE
(
double
,
float
)
110
INSTANTIATE
(
double
,
int
)
111
INSTANTIATE
(
double
, boost::uint16_t)
112
INSTANTIATE
(
float
,
float
)
113
INSTANTIATE
(
float
,
int
)
114
INSTANTIATE
(
float
, boost::uint16_t)
115
INSTANTIATE
(
int
,
int
)
116
INSTANTIATE
(boost::uint16_t, boost::uint16_t)
Convolve.h
Convolution support.
Kernel.h
Declare the Kernel class and subclasses.
exceptions.h
Include files required for standard LSST Exception handling.
INSTANTIATE
#define INSTANTIATE(MATCH)
Definition:
makeMatchStatistics.cc:100
ConvCpuGpuShared.h
CPU and GPU convolution shared code.
lsst::afw::math::Kernel::getHeight
int getHeight() const
Return the Kernel's height.
Definition:
Kernel.h:247
image
table::Key< table::Array< Kernel::Pixel > > image
Definition:
FixedKernel.cc:117
lsst::afw::math::Kernel::getWidth
int getWidth() const
Return the Kernel's width.
Definition:
Kernel.h:240
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Definition:
Exception.h:46
lsst::afw::math::detail::assertDimensionsOK
void assertDimensionsOK(OutImageT const &convolvedImage, InImageT const &inImage, lsst::afw::math::Kernel const &kernel)
Definition:
convCpuGpuShared.cc:59
MaskedImage.h
Implementation of the Class MaskedImage.
lsst::afw::math::Kernel
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition:
Kernel.h:134
Generated on Thu Sep 24 2015 02:29:17 for LSSTApplications by
1.8.5