LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Stack.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 
25 /*
26  * Provide functions to stack images
27  *
28  */
29 #include <vector>
30 #include <cassert>
31 #include <memory>
32 
33 #include "lsst/base.h"
34 #include "lsst/pex/exceptions.h"
35 #include "lsst/afw/math/Stack.h"
37 #include "lsst/log/Log.h"
38 
40 
41 namespace {
42  LOG_LOGGER _log = LOG_GET("afw.math.Stack");
43 }
44 
45 namespace lsst {
46 namespace afw {
47 namespace math {
48 
49 namespace {
50 typedef std::vector<WeightPixel> WeightVector; // vector of weights (yes, really)
54 int bitcount(unsigned int x) {
55  int b;
56  for (b = 0; x != 0; x >>= 1) {
57  if (x & 01) {
58  b++;
59  }
60  }
61  return b;
62 }
63 
67 void checkOnlyOneFlag(unsigned int flags) {
68  if (bitcount(flags & ~ERRORS) != 1) {
70  "Requested more than one type of statistic to make the image stack.");
71  }
72 }
73 
77 template <typename ObjectVectorT, typename WeightVectorT>
78 void checkObjectsAndWeights(ObjectVectorT const &objects, WeightVectorT const &wvector) {
79  if (objects.size() == 0) {
80  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one object to stack");
81  }
82 
83  if (!wvector.empty() && wvector.size() != objects.size()) {
85  str(boost::format("Weight vector has different length "
86  "from number of objects to be stacked: %d v. %d") %
87  wvector.size() % objects.size()));
88  }
89 }
90 
91 template <typename ImageT>
92 void checkImageSizes(ImageT const &out, std::vector<std::shared_ptr<ImageT>> const &images) {
93  lsst::geom::Extent2I const &dim = out.getDimensions();
94  for (unsigned int i = 0; i < images.size(); ++i) {
95  if (images[i]->getDimensions() != dim) {
97  (boost::format("Bad dimensions for image %d: %dx%d vs %dx%d") % i %
98  images[i]->getDimensions().getX() % images[i]->getDimensions().getY() %
99  dim.getX() % dim.getY())
100  .str());
101  }
102  }
103 }
104 
105 /* ************************************************************************** *
106  *
107  * stack MaskedImages
108  *
109  * ************************************************************************** */
110 
112 
120 template <typename PixelT, bool isWeighted, bool useVariance>
121 void computeMaskedImageStack(image::MaskedImage<PixelT> &imgStack,
123  Property flags, StatisticsControl const &sctrl, image::MaskPixel const clipped,
125  WeightVector const &wvector = WeightVector()) {
126  // get a list of row_begin iterators
127  typedef typename image::MaskedImage<PixelT>::x_iterator x_iterator;
129  rows.reserve(images.size());
130 
131  MaskedVector<PixelT> pixelSet(images.size()); // a pixel from x,y for each image
132  WeightVector weights; // weights; non-const version
133  //
134  StatisticsControl sctrlTmp(sctrl);
135 
136  if (useVariance) { // weight using the variance image
137  assert(isWeighted);
138  assert(wvector.empty());
139 
140  weights.resize(images.size());
141 
142  sctrlTmp.setWeighted(true);
143  } else if (isWeighted) {
144  weights.assign(wvector.begin(), wvector.end());
145 
146  sctrlTmp.setWeighted(true);
147  }
148  assert(weights.empty() || weights.size() == images.size());
149 
150  // loop over x,y ... the loop over the stack to fill pixelSet
151  // - get the stats on pixelSet and put the value in the output image at x,y
152  for (int y = 0; y != imgStack.getHeight(); ++y) {
153  for (unsigned int i = 0; i < images.size(); ++i) {
154  x_iterator ptr = images[i]->row_begin(y);
155  if (y == 0) {
156  rows.push_back(ptr);
157  } else {
158  rows[i] = ptr;
159  }
160  }
161 
162  for (x_iterator ptr = imgStack.row_begin(y), end = imgStack.row_end(y); ptr != end; ++ptr) {
163  typename MaskedVector<PixelT>::iterator psPtr = pixelSet.begin();
164  WeightVector::iterator wtPtr = weights.begin();
165  for (unsigned int i = 0; i < images.size(); ++rows[i], ++i, ++psPtr, ++wtPtr) {
166  *psPtr = *rows[i];
167  if (useVariance) { // we're weighting using the variance
168  *wtPtr = 1.0 / rows[i].variance();
169  }
170  }
171 
172  Property const eflags = static_cast<Property>(flags | NPOINT | ERRORS | NCLIPPED | NMASKED);
173  Statistics stat = isWeighted ? makeStatistics(pixelSet, weights, eflags, sctrlTmp)
174  : makeStatistics(pixelSet, eflags, sctrlTmp);
175 
176  PixelT variance = ::pow(stat.getError(flags), 2);
177  image::MaskPixel msk(stat.getOrMask());
178  int const npoint = stat.getValue(NPOINT);
179  if (npoint == 0) {
180  msk = sctrlTmp.getNoGoodPixelsMask();
181  } else if (npoint == 1) {
182  /*
183  * you should be using sctrl.setCalcErrorFromInputVariance(true) if you want to avoid
184  * getting a variance of NaN when you only have one input
185  */
186  }
187  // Check to see if any pixels were rejected due to clipping
188  if (stat.getValue(NCLIPPED) > 0) {
189  msk |= clipped;
190  }
191  // Check to see if any pixels were rejected by masking, and apply
192  // any associated masks to the result.
193  if (stat.getValue(NMASKED) > 0) {
194  for (auto const &pair : maskMap) {
195  for (auto pp = pixelSet.begin(); pp != pixelSet.end(); ++pp) {
196  if ((*pp).mask() & pair.first) {
197  msk |= pair.second;
198  break;
199  }
200  }
201  }
202  }
203 
204  *ptr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(flags), msk, variance);
205  }
206  }
207 }
208 template <typename PixelT, bool isWeighted, bool useVariance>
209 void computeMaskedImageStack(image::MaskedImage<PixelT> &imgStack,
211  Property flags, StatisticsControl const &sctrl, image::MaskPixel const clipped,
212  image::MaskPixel const excuse, WeightVector const &wvector = WeightVector()) {
214  maskMap.push_back(std::make_pair(sctrl.getAndMask() & ~excuse, clipped));
215  computeMaskedImageStack<PixelT, isWeighted, useVariance>(imgStack, images, flags, sctrl, clipped, maskMap,
216  wvector);
217 }
219 
220 } // end anonymous namespace
221 
222 template <typename PixelT>
225  StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped,
226  image::MaskPixel excuse) {
227  if (images.size() == 0) {
228  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one image to stack");
229  }
231  new image::MaskedImage<PixelT>(images[0]->getDimensions()));
232  statisticsStack(*out, images, flags, sctrl, wvector, clipped, excuse);
233  return out;
234 }
235 
236 template <typename PixelT>
239  StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped,
241  if (images.size() == 0) {
242  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one image to stack");
243  }
245  new image::MaskedImage<PixelT>(images[0]->getDimensions()));
246  statisticsStack(*out, images, flags, sctrl, wvector, clipped, maskMap);
247  return out;
248 }
249 
250 template <typename PixelT>
253  StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped,
254  image::MaskPixel excuse) {
255  checkObjectsAndWeights(images, wvector);
256  checkOnlyOneFlag(flags);
257  checkImageSizes(out, images);
258 
259  if (sctrl.getWeighted()) {
260  if (wvector.empty()) {
261  return computeMaskedImageStack<PixelT, true, true>(out, images, flags, sctrl, clipped,
262  excuse); // use variance
263  } else {
264  return computeMaskedImageStack<PixelT, true, false>(out, images, flags, sctrl, clipped, excuse,
265  wvector); // use wvector
266  }
267  } else {
268  if (!wvector.empty()) {
269  LOGL_WARN(_log,
270  "Weights passed on to statisticsStack are ignored as sctrl.getWeighted() is False."
271  "Set sctrl.setWeighted(True) for them to be used.");
272  }
273  return computeMaskedImageStack<PixelT, false, false>(out, images, flags, sctrl, clipped, excuse);
274  }
275 }
276 
277 template <typename PixelT>
280  StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped,
282  checkObjectsAndWeights(images, wvector);
283  checkOnlyOneFlag(flags);
284  checkImageSizes(out, images);
285 
286  if (sctrl.getWeighted()) {
287  if (wvector.empty()) {
288  return computeMaskedImageStack<PixelT, true, true>(out, images, flags, sctrl, clipped,
289  maskMap); // use variance
290  } else {
291  return computeMaskedImageStack<PixelT, true, false>(out, images, flags, sctrl, clipped, maskMap,
292  wvector); // use wvector
293  }
294  } else {
295  return computeMaskedImageStack<PixelT, false, false>(out, images, flags, sctrl, clipped, maskMap);
296  }
297 }
298 
299 namespace {
300 /* ************************************************************************** *
301  *
302  * stack Images
303  *
304  * All the work is done in the function comuteImageStack.
305  * A boolean template variable has been used to allow the compiler to generate the different instantiations
306  * to handle cases when we are, or are not, weighting
307  *
308  * ************************************************************************** */
315 template <typename PixelT, bool isWeighted>
316 void computeImageStack(image::Image<PixelT> &imgStack,
318  StatisticsControl const &sctrl, WeightVector const &weights = WeightVector()) {
319  MaskedVector<PixelT> pixelSet(images.size()); // a pixel from x,y for each image
320  StatisticsControl sctrlTmp(sctrl);
321 
322  // set the mask to be an infinite iterator
323  MaskImposter<image::MaskPixel> msk;
324 
325  if (!weights.empty()) {
326  sctrlTmp.setWeighted(true);
327  }
328 
329  // get the desired statistic
330  for (int y = 0; y != imgStack.getHeight(); ++y) {
331  for (int x = 0; x != imgStack.getWidth(); ++x) {
332  for (unsigned int i = 0; i != images.size(); ++i) {
333  (*pixelSet.getImage())(i, 0) = (*images[i])(x, y);
334  }
335 
336  if (isWeighted) {
337  imgStack(x, y) = makeStatistics(pixelSet, weights, flags, sctrlTmp).getValue();
338  } else {
339  imgStack(x, y) = makeStatistics(pixelSet, weights, flags, sctrlTmp).getValue();
340  }
341  }
342  }
343 }
344 
345 } // end anonymous namespace
346 
347 template <typename PixelT>
350  StatisticsControl const &sctrl, WeightVector const &wvector) {
351  if (images.size() == 0) {
352  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one image to stack");
353  }
354  std::shared_ptr<image::Image<PixelT>> out(new image::Image<PixelT>(images[0]->getDimensions()));
355  statisticsStack(*out, images, flags, sctrl, wvector);
356  return out;
357 }
358 
359 template <typename PixelT>
361  Property flags, StatisticsControl const &sctrl, WeightVector const &wvector) {
362  checkObjectsAndWeights(images, wvector);
363  checkOnlyOneFlag(flags);
364  checkImageSizes(out, images);
365 
366  if (wvector.empty()) {
367  return computeImageStack<PixelT, false>(out, images, flags, sctrl);
368  } else {
369  return computeImageStack<PixelT, true>(out, images, flags, sctrl, wvector);
370  }
371 }
372 
373 /* ************************************************************************** *
374  *
375  * stack VECTORS
376  *
377  * ************************************************************************** */
378 
379 namespace {
380 
387 template <typename PixelT, bool isWeighted>
388 std::vector<PixelT> computeVectorStack(
389  std::vector<std::vector<PixelT>> &vectors, Property flags,
390  StatisticsControl const &sctrl, WeightVector const &wvector = WeightVector()) {
391  // create the image to be returned
392  typedef std::vector<PixelT> Vect;
393  Vect vecStack(vectors[0].size(), 0.0);
394 
395  MaskedVector<PixelT> pixelSet(vectors.size()); // values from a given pixel of each image
396 
397  StatisticsControl sctrlTmp(sctrl);
398  // set the mask to be an infinite iterator
399  MaskImposter<image::MaskPixel> msk;
400 
401  if (!wvector.empty()) {
402  sctrlTmp.setWeighted(true);
403  }
404 
405  // collect elements from the stack into the MaskedVector to do stats
406  for (unsigned int x = 0; x < vectors[0].size(); ++x) {
407  typename MaskedVector<PixelT>::iterator psPtr = pixelSet.begin();
408  for (unsigned int i = 0; i < vectors.size(); ++i, ++psPtr) {
409  psPtr.value() = (vectors[i])[x];
410  }
411 
412  if (isWeighted) {
413  (vecStack)[x] = makeStatistics(pixelSet, wvector, flags, sctrlTmp).getValue(flags);
414  } else {
415  (vecStack)[x] = makeStatistics(pixelSet, flags, sctrlTmp).getValue(flags);
416  }
417  }
418 
419  return vecStack;
420 }
421 
422 } // end anonymous namespace
423 
424 template <typename PixelT>
426  std::vector<std::vector<PixelT>> &vectors, Property flags,
427  StatisticsControl const &sctrl, WeightVector const &wvector) {
428  checkObjectsAndWeights(vectors, wvector);
429  checkOnlyOneFlag(flags);
430 
431  if (wvector.empty()) {
432  return computeVectorStack<PixelT, false>(vectors, flags, sctrl);
433  } else {
434  return computeVectorStack<PixelT, true>(vectors, flags, sctrl, wvector);
435  }
436 }
437 
438 /* ************************************************************************ *
439  *
440  * XY row column stacking
441  *
442  * ************************************************************************ */
443 
444 template <typename PixelT>
446  char dimension, StatisticsControl const &sctrl) {
447  int x0 = image.getX0();
448  int y0 = image.getY0();
449  typedef image::MaskedImage<PixelT> MImage;
451 
452  // do each row or column, one at a time
453  // - create a subimage with a bounding box, and get the stats and assign the value to the output image
454  if (dimension == 'x') {
455  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(1, image.getHeight())));
456  int y = y0;
457  typename MImage::y_iterator oEnd = imgOut->col_end(0);
458  for (typename MImage::y_iterator oPtr = imgOut->col_begin(0); oPtr != oEnd; ++oPtr, ++y) {
461  image::Image<PixelT> subImage(image, bbox);
462  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
463  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
464  stat.getError() * stat.getError());
465  }
466 
467  } else if (dimension == 'y') {
468  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(image.getWidth(), 1)));
469  int x = x0;
470  typename MImage::x_iterator oEnd = imgOut->row_end(0);
471  for (typename MImage::x_iterator oPtr = imgOut->row_begin(0); oPtr != oEnd; ++oPtr, ++x) {
474  image::Image<PixelT> subImage(image, bbox);
475  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
476  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
477  stat.getError() * stat.getError());
478  }
479  } else {
481  "Can only run statisticsStack in x or y for single image.");
482  }
483 
484  return imgOut;
485 }
486 
487 template <typename PixelT>
489  Property flags, char dimension,
490  StatisticsControl const &sctrl) {
491  int const x0 = image.getX0();
492  int const y0 = image.getY0();
493  typedef image::MaskedImage<PixelT> MImage;
495 
496  // do each row or column, one at a time
497  // - create a subimage with a bounding box, and get the stats and assign the value to the output image
498  if (dimension == 'x') {
499  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(1, image.getHeight())));
500  int y = 0;
501  typename MImage::y_iterator oEnd = imgOut->col_end(0);
502  for (typename MImage::y_iterator oPtr = imgOut->col_begin(0); oPtr != oEnd; ++oPtr, ++y) {
506  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
507  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
508  stat.getError() * stat.getError());
509  }
510 
511  } else if (dimension == 'y') {
512  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(image.getWidth(), 1)));
513  int x = 0;
514  typename MImage::x_iterator oEnd = imgOut->row_end(0);
515  for (typename MImage::x_iterator oPtr = imgOut->row_begin(0); oPtr != oEnd; ++oPtr, ++x) {
519  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
520  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
521  stat.getError() * stat.getError());
522  }
523  } else {
525  "Can only run statisticsStack in x or y for single image.");
526  }
527 
528  return imgOut;
529 }
530 
531 /*
532  * Explicit Instantiations
533  *
534  */
536 #define INSTANTIATE_STACKS(TYPE) \
537  template std::shared_ptr<image::Image<TYPE>> statisticsStack<TYPE>( \
538  std::vector<std::shared_ptr<image::Image<TYPE>>> & images, Property flags, \
539  StatisticsControl const &sctrl, WeightVector const &wvector); \
540  template void statisticsStack<TYPE>( \
541  image::Image<TYPE> & out, std::vector<std::shared_ptr<image::Image<TYPE>>> & images, \
542  Property flags, StatisticsControl const &sctrl, WeightVector const &wvector); \
543  template std::shared_ptr<image::MaskedImage<TYPE>> statisticsStack<TYPE>( \
544  std::vector<std::shared_ptr<image::MaskedImage<TYPE>>> & images, Property flags, \
545  StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel, \
546  image::MaskPixel); \
547  template std::shared_ptr<image::MaskedImage<TYPE>> statisticsStack<TYPE>( \
548  std::vector<std::shared_ptr<image::MaskedImage<TYPE>>> & images, Property flags, \
549  StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel, \
550  std::vector<std::pair<image::MaskPixel, image::MaskPixel>> const &); \
551  template void statisticsStack<TYPE>(image::MaskedImage<TYPE> & out, \
552  std::vector<std::shared_ptr<image::MaskedImage<TYPE>>> & images, \
553  Property flags, StatisticsControl const &sctrl, \
554  WeightVector const &wvector, image::MaskPixel, image::MaskPixel); \
555  template void statisticsStack<TYPE>( \
556  image::MaskedImage<TYPE> & out, std::vector<std::shared_ptr<image::MaskedImage<TYPE>>> & images, \
557  Property flags, StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel, \
558  std::vector<std::pair<image::MaskPixel, image::MaskPixel>> const &); \
559  template std::vector<TYPE> statisticsStack<TYPE>( \
560  std::vector<std::vector<TYPE>> & vectors, Property flags, \
561  StatisticsControl const &sctrl, WeightVector const &wvector); \
562  template std::shared_ptr<image::MaskedImage<TYPE>> statisticsStack(image::Image<TYPE> const &image, \
563  Property flags, char dimension, \
564  StatisticsControl const &sctrl); \
565  template std::shared_ptr<image::MaskedImage<TYPE>> statisticsStack( \
566  image::MaskedImage<TYPE> const &image, Property flags, char dimension, \
567  StatisticsControl const &sctrl);
568 
569 INSTANTIATE_STACKS(double)
570 INSTANTIATE_STACKS(float)
572 } // namespace math
573 } // namespace afw
574 } // namespace lsst
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
int end
double x
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
afw::table::Key< afw::table::Array< VariancePixelT > > variance
LSST DM logging module built on log4cxx.
#define LOGL_WARN(logger, message...)
Log a warn-level message using a varargs/printf style interface.
Definition: Log.h:536
#define LOG_GET(logger)
Returns a Log object associated with logger.
Definition: Log.h:75
#define LOG_LOGGER
Definition: Log.h:703
uint64_t * ptr
Definition: RangeSet.cc:88
int y
Definition: SpanSet.cc:49
table::Key< int > b
Basic LSST definitions.
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:294
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:296
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:58
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:1084
lsst::afw::image::pixel::Pixel< ImagePixelT, MaskPixelT, VariancePixelT > Pixel
A Pixel in the MaskedImage.
Definition: MaskedImage.h:108
x_iterator row_end(int y) const
Return an x_iterator to the end of the image.
Definition: MaskedImage.cc:636
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
Definition: MaskedImage.cc:626
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:539
Pass parameters to a Statistics object.
Definition: Statistics.h:93
bool getWeighted() const noexcept
Definition: Statistics.h:138
A class to evaluate image statistics.
Definition: Statistics.h:215
double getError(Property const prop=NOTHING) const
Return the error in the desired property (if specified in the constructor)
Definition: Statistics.cc:1058
double getValue(Property const prop=NOTHING) const
Return the value of the desired property (if specified in the constructor)
Definition: Statistics.cc:1056
An integer coordinate rectangle.
Definition: Box.h:55
Reports invalid arguments.
Definition: Runtime.h:66
Reports attempts to exceed implementation-defined length limits for some classes.
Definition: Runtime.h:76
T make_pair(T... args)
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition: Statistics.h:354
Property
control what is calculated
Definition: Statistics.h:63
@ ERRORS
Include errors of requested quantities.
Definition: Statistics.h:65
@ NCLIPPED
number of clipped points
Definition: Statistics.h:81
@ NMASKED
number of masked points
Definition: Statistics.h:82
@ NPOINT
number of sample points
Definition: Statistics.h:66
std::shared_ptr< lsst::afw::image::Image< PixelT > > statisticsStack(std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT >>> &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0))
A function to compute some statistics of a stack of Images.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
A base class for image defects.
T push_back(T... args)
T reserve(T... args)