A collection of SpatialCells covering an entire image.
More...
#include <SpatialCell.h>
A collection of SpatialCells covering an entire image.
Definition at line 387 of file SpatialCell.h.
◆ CellList
◆ SpatialCellSet() [1/3]
lsst::afw::math::SpatialCellSet::SpatialCellSet |
( |
lsst::geom::Box2I const & |
region, |
|
|
int |
xSize, |
|
|
int |
ySize = 0 |
|
) |
| |
Constructor.
- Parameters
-
region | Bounding box for image |
xSize | size of cells in the column direction |
ySize | size of cells in the row direction (0: == xSize) |
- Exceptions
-
Definition at line 303 of file SpatialCell.cc.
304 : _region(region), _cellList(
CellList()) {
309 if (xSize <= 0 || ySize <= 0) {
312 (
boost::format(
"Please specify cells that contain pixels, not %dx%d") % xSize % ySize).str());
315 int nx = region.getWidth() / xSize;
316 if (nx * xSize != region.getWidth()) {
320 int ny = region.getHeight() / ySize;
321 if (ny * ySize != region.getHeight()) {
327 int y0 = region.getMinY();
328 for (
int y = 0;
y < ny; ++
y) {
330 int const y1 = (
y == ny - 1) ? region.getMaxY() : y0 + ySize - 1;
331 int x0 = region.getMinX();
332 for (
int x = 0;
x < nx; ++
x) {
334 int const x1 = (
x == nx - 1) ? region.getMaxX() : x0 + xSize - 1;
◆ SpatialCellSet() [2/3]
lsst::afw::math::SpatialCellSet::SpatialCellSet |
( |
SpatialCellSet const & |
| ) |
|
|
default |
◆ SpatialCellSet() [3/3]
◆ ~SpatialCellSet()
virtual lsst::afw::math::SpatialCellSet::~SpatialCellSet |
( |
| ) |
|
|
virtualdefault |
◆ getBBox()
Return the bounding box of the image.
Definition at line 420 of file SpatialCell.h.
◆ getCandidateById()
Return the SpatialCellCandidate with the specified id.
- Parameters
-
id | The desired ID |
noThrow | Return NULL in case of error |
- Exceptions
-
Definition at line 416 of file SpatialCell.cc.
417 for (CellList::iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
429 (
boost::format(
"Unable to find object with ID == %d") %
id).str());
◆ getCellList()
CellList& lsst::afw::math::SpatialCellSet::getCellList |
( |
| ) |
|
|
inline |
Return our SpatialCells.
Definition at line 415 of file SpatialCell.h.
415 {
return _cellList; }
◆ insertCandidate()
Insert a candidate into the correct cell.
Definition at line 361 of file SpatialCell.cc.
362 CellList::iterator pos =
std::find_if(_cellList.
begin(), _cellList.
end(), CellContains(candidate));
364 if (pos == _cellList.
end()) {
366 (
boost::format(
"Unable to insert a candidate at (%.2f, %.2f)") %
367 candidate->getXCenter() % candidate->getYCenter())
371 (*pos)->insertCandidate(candidate);
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ setIgnoreBad()
void lsst::afw::math::SpatialCellSet::setIgnoreBad |
( |
bool |
ignoreBad | ) |
|
Set whether we should omit BAD candidates from candidate list when traversing.
Definition at line 433 of file SpatialCell.cc.
434 for (CellList::iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
435 (*cell)->setIgnoreBad(ignoreBad);
◆ sortCandidates()
void lsst::afw::math::SpatialCellSet::sortCandidates |
( |
| ) |
|
Rearrange the Candidates in all SpatialCells to reflect their current ratings.
Definition at line 374 of file SpatialCell.cc.
375 for (CellList::iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
376 (*cell)->sortCandidates();
◆ visitAllCandidates() [1/2]
void lsst::afw::math::SpatialCellSet::visitAllCandidates |
( |
CandidateVisitor * |
visitor, |
|
|
bool const |
ignoreExceptions = false |
|
) |
| |
Call the visitor's processCandidate method for every Candidate in the SpatialCellSet.
- Parameters
-
visitor | Pass this object to every Candidate |
ignoreExceptions | Ignore any exceptions thrown by the processing |
- See also
- visitCandidates
Definition at line 399 of file SpatialCell.cc.
402 for (CellList::iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
403 (*cell)->visitAllCandidates(visitor, ignoreExceptions,
false);
◆ visitAllCandidates() [2/2]
void lsst::afw::math::SpatialCellSet::visitAllCandidates |
( |
CandidateVisitor * |
visitor, |
|
|
bool const |
ignoreExceptions = false |
|
) |
| const |
Call the visitor's processCandidate method for every Candidate in the SpatialCellSet (const version)
This is the const version of SpatialCellSet::visitAllCandidates
- Parameters
-
visitor | Pass this object to every Candidate |
ignoreExceptions | Ignore any exceptions thrown by the processing |
Definition at line 407 of file SpatialCell.cc.
410 for (CellList::const_iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
411 SpatialCell
const *ccell = cell->get();
412 ccell->visitAllCandidates(visitor, ignoreExceptions,
false);
◆ visitCandidates() [1/2]
void lsst::afw::math::SpatialCellSet::visitCandidates |
( |
CandidateVisitor * |
visitor, |
|
|
int const |
nMaxPerCell = -1 , |
|
|
bool const |
ignoreExceptions = false |
|
) |
| |
Call the visitor's processCandidate method for each Candidate in the SpatialCellSet.
- Parameters
-
visitor | Pass this object to every Candidate |
nMaxPerCell | Visit no more than this many Candidates (<= 0: all) |
ignoreExceptions | Ignore any exceptions thrown by the processing |
- Note
- This is obviously similar to the Design Patterns (Go4) Visitor pattern, but we've simplified the double dispatch (i.e. we don't call a virtual method on SpatialCellCandidate that in turn calls processCandidate(*this), but can be re-defined)
Definition at line 380 of file SpatialCell.cc.
384 for (CellList::iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
385 (*cell)->visitCandidates(visitor, nMaxPerCell, ignoreExceptions,
false);
◆ visitCandidates() [2/2]
void lsst::afw::math::SpatialCellSet::visitCandidates |
( |
CandidateVisitor * |
visitor, |
|
|
int const |
nMaxPerCell = -1 , |
|
|
bool const |
ignoreExceptions = false |
|
) |
| const |
Call the visitor's processCandidate method for each Candidate in the SpatialCellSet (const version)
This is the const version of SpatialCellSet::visitCandidates
- Parameters
-
visitor | Pass this object to every Candidate |
nMaxPerCell | Visit no more than this many Candidates (-ve: all) |
ignoreExceptions | Ignore any exceptions thrown by the processing |
Definition at line 389 of file SpatialCell.cc.
393 for (CellList::const_iterator cell = _cellList.
begin(),
end = _cellList.
end(); cell !=
end; ++cell) {
394 SpatialCell
const *ccell = cell->get();
395 ccell->visitCandidates(visitor, nMaxPerCell, ignoreExceptions,
false);
The documentation for this class was generated from the following files:
- /j/snowflake/release/lsstsw/stack/1a1d771/Linux64/afw/20.0.0/include/lsst/afw/math/SpatialCell.h
- /j/snowflake/release/lsstsw/stack/1a1d771/Linux64/afw/20.0.0/src/math/SpatialCell.cc
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)