lsst.afw
g3a5ebb7d8a+28b83bf6a5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
lsst
afw
detection
HeavyFootprint.h
Go to the documentation of this file.
1
/*
2
* LSST Data Management System
3
* Copyright 2008, 2009, 2010 LSST Corporation.
4
*
5
* This product includes software developed by the
6
* LSST Project (http://www.lsst.org/).
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the LSST License Statement and
19
* the GNU General Public License along with this program. If not,
20
* see <http://www.lsstcorp.org/LegalNotices/>.
21
*/
22
23
#if !defined(LSST_DETECTION_HEAVY_FOOTPRINT_H)
24
#define LSST_DETECTION_HEAVY_FOOTPRINT_H
25
/*
26
* Represent a set of pixels of an arbitrary shape and size, including values
27
* for those pixels; a HeavyFootprint is a Footprint that also not only a
28
* description of a region, but values within that region.
29
*/
30
#include <algorithm>
31
#include <list>
32
#include <cmath>
33
#include <memory>
34
#include "
lsst/afw/detection/Footprint.h
"
35
36
namespace
lsst
{
37
namespace
afw
{
38
namespace
detection
{
39
40
class
HeavyFootprintCtrl
;
41
45
template
<
typename
ImagePixelT,
typename
MaskPixelT =
lsst::afw::image::MaskPixel
,
46
typename
VariancePixelT =
lsst::afw::image::VariancePixel
>
47
class
HeavyFootprint
48
:
public
afw::table::io::PersistableFacade
<HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> >,
49
public
Footprint
{
50
public
:
62
explicit
HeavyFootprint
(
63
Footprint
const
& foot,
64
lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>
const
& mimage,
65
HeavyFootprintCtrl
const
* ctrl =
nullptr
);
66
75
explicit
HeavyFootprint
(
Footprint
const
& foot,
HeavyFootprintCtrl
const
* ctrl =
nullptr
);
76
81
HeavyFootprint
() =
default
;
82
~HeavyFootprint
()
override
=
default
;
83
84
HeavyFootprint
(
HeavyFootprint
const
& other) =
default
;
85
HeavyFootprint
(
HeavyFootprint
&& other) =
default
;
86
87
HeavyFootprint
&
operator=
(
HeavyFootprint
const
&) =
default
;
88
HeavyFootprint
&
operator=
(
HeavyFootprint
&&) =
default
;
89
93
bool
isHeavy
()
const override
{
return
true
; }
94
98
void
insert
(
lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>
& mimage)
const
;
99
105
void
insert
(
lsst::afw::image::Image<ImagePixelT>
&
image
)
const
;
106
107
ndarray::Array<ImagePixelT, 1, 1>
getImageArray
() {
return
_image; }
108
ndarray::Array<MaskPixelT, 1, 1>
getMaskArray
() {
return
_mask; }
109
ndarray::Array<VariancePixelT, 1, 1>
getVarianceArray
() {
return
_variance; }
110
111
ndarray::Array<ImagePixelT const, 1, 1>
getImageArray
()
const
{
return
_image; }
112
ndarray::Array<MaskPixelT const, 1, 1>
getMaskArray
()
const
{
return
_mask; }
113
ndarray::Array<VariancePixelT const, 1, 1>
getVarianceArray
()
const
{
return
_variance; }
114
115
/* Returns the OR of all the mask pixels held in this HeavyFootprint. */
116
MaskPixelT
getMaskBitsSet
()
const
{
117
MaskPixelT maskbits = 0;
118
for
(
typename
ndarray::Array<MaskPixelT, 1, 1>::Iterator i = _mask.begin(); i != _mask.end(); ++i) {
119
maskbits |= *i;
120
}
121
return
maskbits;
122
}
123
128
double
dot
(
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>
const
& other)
const
;
129
130
protected
:
131
class
Factory;
// factory class used for persistence, public only so we can instantiate it in .cc file
132
133
std::string
getPersistenceName
()
const override
;
134
135
void
write
(
OutputArchiveHandle
& handle)
const override
;
136
137
private
:
138
ndarray::Array<ImagePixelT, 1, 1> _image;
139
ndarray::Array<MaskPixelT, 1, 1> _mask;
140
ndarray::Array<VariancePixelT, 1, 1> _variance;
141
};
142
147
template
<
typename
ImagePixelT,
typename
MaskPixelT,
typename
VariancePixelT>
148
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>
makeHeavyFootprint
(
149
Footprint
const
& foot,
150
lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>
const
& img,
151
HeavyFootprintCtrl
const
* ctrl =
nullptr
) {
152
return
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>
(foot, img, ctrl);
153
}
154
160
template
<
typename
ImagePixelT,
typename
MaskPixelT,
typename
VariancePixelT>
161
std::shared_ptr<HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>
>
mergeHeavyFootprints
(
162
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>
const
& h1,
163
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>
const
& h2);
164
}
// namespace detection
165
}
// namespace afw
166
}
// namespace lsst
167
168
#endif
Footprint.h
std::string
lsst::afw::detection::Footprint
Class to describe the properties of a detected object from an image.
Definition
Footprint.h:63
lsst::afw::detection::Footprint::Footprint
Footprint(std::shared_ptr< geom::SpanSet > inputSpans, lsst::geom::Box2I const ®ion=lsst::geom::Box2I())
Constructor for Footprint object.
Definition
Footprint.cc:38
lsst::afw::detection::HeavyFootprintCtrl
A control object for HeavyFootprints.
Definition
FootprintCtrl.h:99
lsst::afw::detection::HeavyFootprint
A set of pixels in an Image, including those pixels' actual values.
Definition
HeavyFootprint.h:49
lsst::afw::detection::HeavyFootprint::getMaskBitsSet
MaskPixelT getMaskBitsSet() const
Definition
HeavyFootprint.h:116
lsst::afw::detection::HeavyFootprint::write
void write(OutputArchiveHandle &handle) const override
Write an instance of a Footprint to an output Archive.
Definition
HeavyFootprint.cc:264
lsst::afw::detection::HeavyFootprint::getImageArray
ndarray::Array< ImagePixelT const, 1, 1 > getImageArray() const
Definition
HeavyFootprint.h:111
lsst::afw::detection::HeavyFootprint::dot
double dot(HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &other) const
Dot product between HeavyFootprints.
Definition
HeavyFootprint.cc:151
lsst::afw::detection::HeavyFootprint::~HeavyFootprint
~HeavyFootprint() override=default
lsst::afw::detection::HeavyFootprint::HeavyFootprint
HeavyFootprint(HeavyFootprint &&other)=default
lsst::afw::detection::HeavyFootprint::HeavyFootprint
HeavyFootprint(Footprint const &foot, lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &mimage, HeavyFootprintCtrl const *ctrl=nullptr)
Create a HeavyFootprint from a regular Footprint and the image that provides the pixel values.
Definition
HeavyFootprint.cc:71
lsst::afw::detection::HeavyFootprint::getMaskArray
ndarray::Array< MaskPixelT, 1, 1 > getMaskArray()
Definition
HeavyFootprint.h:108
lsst::afw::detection::HeavyFootprint::getImageArray
ndarray::Array< ImagePixelT, 1, 1 > getImageArray()
Definition
HeavyFootprint.h:107
lsst::afw::detection::HeavyFootprint::HeavyFootprint
HeavyFootprint(HeavyFootprint const &other)=default
lsst::afw::detection::HeavyFootprint::operator=
HeavyFootprint & operator=(HeavyFootprint &&)=default
lsst::afw::detection::HeavyFootprint::HeavyFootprint
HeavyFootprint()=default
Default constructor for HeavyFootprint.
lsst::afw::detection::HeavyFootprint::getVarianceArray
ndarray::Array< VariancePixelT, 1, 1 > getVarianceArray()
Definition
HeavyFootprint.h:109
lsst::afw::detection::HeavyFootprint::isHeavy
bool isHeavy() const override
Is this a HeavyFootprint (yes!).
Definition
HeavyFootprint.h:93
lsst::afw::detection::HeavyFootprint::getVarianceArray
ndarray::Array< VariancePixelT const, 1, 1 > getVarianceArray() const
Definition
HeavyFootprint.h:113
lsst::afw::detection::HeavyFootprint::insert
void insert(lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage) const
Replace all the pixels in the image with the values in the HeavyFootprint.
Definition
HeavyFootprint.cc:115
lsst::afw::detection::HeavyFootprint::getMaskArray
ndarray::Array< MaskPixelT const, 1, 1 > getMaskArray() const
Definition
HeavyFootprint.h:112
lsst::afw::detection::HeavyFootprint::operator=
HeavyFootprint & operator=(HeavyFootprint const &)=default
lsst::afw::detection::HeavyFootprint::getPersistenceName
std::string getPersistenceName() const override
Return the name correspoinging ot the persistence type.
Definition
HeavyFootprint.cc:259
lsst::afw::image::Image
A class to represent a 2-dimensional array of pixels.
Definition
Image.h:51
lsst::afw::image::MaskedImage
A class to manipulate images, masks, and variance as a single object.
Definition
MaskedImage.h:74
lsst::afw::table::io::PersistableFacade
A CRTP facade class for subclasses of Persistable.
Definition
Persistable.h:176
lsst::afw::table::io::Persistable::OutputArchiveHandle
io::OutputArchiveHandle OutputArchiveHandle
Definition
Persistable.h:108
lsst::afw::detection
Definition
Footprint.h:50
lsst::afw::detection::mergeHeavyFootprints
std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > mergeHeavyFootprints(HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &h1, HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &h2)
Sum the two given HeavyFootprints h1 and h2, returning a HeavyFootprint with the union footprint,...
Definition
HeavyFootprint.cc:128
lsst::afw::detection::makeHeavyFootprint
HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > makeHeavyFootprint(Footprint const &foot, lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &img, HeavyFootprintCtrl const *ctrl=nullptr)
Create a HeavyFootprint with footprint defined by the given Footprint and pixel values from the given...
Definition
HeavyFootprint.h:148
lsst::afw::image
Definition
imageAlgorithm.dox:1
lsst::afw::image::MaskPixel
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
Definition
LsstImageTypes.h:34
lsst::afw::image::VariancePixel
float VariancePixel
default type for MaskedImage variance images
Definition
LsstImageTypes.h:35
lsst::afw
Definition
imageAlgorithm.dox:1
lsst
std::shared_ptr
Generated on
for lsst.afw by
1.17.0