lsst.afw  13.0-73-gb2a4e38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SpanSet.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2016 AURA/LSST.
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 <https://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #ifndef LSST_AFW_GEOM_SPANSET_H
26 #define LSST_AFW_GEOM_SPANSET_H
27 
28 #include <vector>
29 #include <algorithm>
30 #include <functional>
31 #include <memory>
32 #include <utility>
33 #include "lsst/pex/exceptions.h"
34 #include "lsst/afw/geom/Span.h"
35 #include "lsst/afw/geom/Box.h"
36 #include "lsst/afw/image/Mask.h"
40 #include "lsst/afw/image/Image.h"
42 
43 namespace lsst {
44 namespace afw {
45 namespace geom {
46 namespace details {
47 
48 /* Functor object to be used with fromMask function
49  */
50 template <typename T>
52 public:
53  bool operator()(T pixelValue) { return pixelValue != 0; }
54 };
55 
56 } // end lsst::afw::geom::details
57 
64 enum class Stencil { CIRCLE, BOX, MANHATTAN };
65 
75 class SpanSet : public afw::table::io::PersistableFacade<lsst::afw::geom::SpanSet>,
77 public:
78  typedef std::vector<Span>::const_iterator const_iterator;
79  typedef std::vector<Span>::size_type size_type;
80  typedef Span value_type;
81  typedef value_type const &const_reference;
82 
83  // Expose properties of the underlying vector containing spans such that the
84  // SpanSet can be considered a container.
85  // Return the constant versions as SpanSets should be immutable
86  const_iterator begin() const { return _spanVector.cbegin(); }
87  const_iterator end() const { return _spanVector.cend(); }
88  const_iterator cbegin() const { return _spanVector.cbegin(); }
89  const_iterator cend() const { return _spanVector.cend(); }
90  const_reference front() const { return const_cast<geom::Span &>(_spanVector.front()); }
91  const_reference back() const { return const_cast<geom::Span &>(_spanVector.back()); }
92  size_type size() const { return _spanVector.size(); }
93  bool empty() const { return _spanVector.empty(); }
94 
99  SpanSet();
100 
105  explicit SpanSet(Box2I const &box);
106 
120  template <typename iter>
121  SpanSet(iter begin, iter end, bool normalize = true) : _spanVector(begin, end) {
122  // Return a null SpanSet if spanVector is 0
123  if (_spanVector.size() == 0) {
124  _bbox = geom::Box2I();
125  _area = 0;
126  } else {
127  if (normalize) {
128  _runNormalize();
129  }
130  _initialize();
131  }
132  }
133 
145  explicit SpanSet(std::vector<Span> const &vec, bool normalize = true);
146 
158  explicit SpanSet(std::vector<Span> &&vec, bool normalize = true);
159 
160  // Explicitly delete copy and move constructors
161  SpanSet(SpanSet const &other) = delete;
162  SpanSet(SpanSet &&other) = delete;
163 
164  // Define class methods
167  size_type getArea() const;
168 
171  Box2I getBBox() const;
172 
180  bool isContiguous() const;
181 
187  std::shared_ptr<SpanSet> shiftedBy(int x, int y) const;
188 
193  std::shared_ptr<SpanSet> shiftedBy(Extent2I const &offset) const;
194 
199  std::shared_ptr<SpanSet> clippedTo(Box2I const &box) const;
200 
205  std::shared_ptr<SpanSet> transformedBy(LinearTransform const &t) const;
206 
211  std::shared_ptr<SpanSet> transformedBy(AffineTransform const &t) const;
212 
217  std::shared_ptr<SpanSet> transformedBy(XYTransform const &t) const;
218 
223  bool overlaps(SpanSet const &other) const;
224 
229  bool contains(SpanSet const &other) const;
230 
235  bool contains(Point2I const &point) const;
236 
239  Point2D computeCentroid() const;
240 
244 
253  std::shared_ptr<SpanSet> dilated(int r, Stencil s = Stencil::CIRCLE) const;
254 
261  std::shared_ptr<SpanSet> dilated(SpanSet const &other) const;
262 
271  std::shared_ptr<SpanSet> eroded(int r, Stencil s = Stencil::CIRCLE) const;
272 
279  std::shared_ptr<SpanSet> eroded(SpanSet const &other) const;
280 
295  template <typename Pixel, int inN, int inC>
296  ndarray::Array<typename std::remove_const<Pixel>::type, inN - 1, inN - 1> flatten(
297  ndarray::Array<Pixel, inN, inC> const &input, Point2I const &xy0 = Point2I()) const {
298  // Populate a lower dimensional array with the values from input taken at the points of SpanSet
299  auto outputShape = ndarray::concatenate(ndarray::makeVector(getArea()),
300  input.getShape().template last<inN - 2>());
301  ndarray::Array<typename std::remove_const<Pixel>::type, inN - 1, inN - 1> outputArray =
302  ndarray::allocate(outputShape);
303  outputArray.deep() = 0;
304  flatten(outputArray, input, xy0);
305  return outputArray;
306  }
307 
327  template <typename PixelIn, typename PixelOut, int inA, int outC, int inC>
328  void flatten(ndarray::Array<PixelOut, inA - 1, outC> const &output,
329  ndarray::Array<PixelIn, inA, inC> const &input, Point2I const &xy0 = Point2I()) const {
330  auto ndAssigner = [](Point2I const &point,
331  typename details::FlatNdGetter<PixelOut, inA - 1, outC>::Reference out,
332  typename details::ImageNdGetter<PixelIn, inA, inC>::Reference in) { out = in; };
333  // Populate array output with values from input at positions given by SpanSet
334  applyFunctor(ndAssigner, ndarray::ndFlat(output), ndarray::ndImage(input, xy0));
335  }
336 
350  template <typename Pixel, int inA, int inC>
351  ndarray::Array<typename std::remove_const<Pixel>::type, inA + 1, inA + 1> unflatten(
352  ndarray::Array<Pixel, inA, inC> const &input) const {
353  // Create a higher dimensional array the size of the bounding box and extra dimensions of input.
354  // Populate values from input, placed at locations corresponding to SpanSet, offset by the
355  // lower corner of the bounding box
356  auto existingShape = input.getShape();
357  typename decltype(existingShape)::Element height = _bbox.getHeight();
358  typename decltype(existingShape)::Element width = _bbox.getWidth();
359  auto outputShape = ndarray::concatenate(ndarray::makeVector(height, width),
360  input.getShape().template last<inA - 1>());
361  ndarray::Array<typename std::remove_const<Pixel>::type, inA + 1, inA + 1> outputArray =
362  ndarray::allocate(outputShape);
363  outputArray.deep() = 0;
364  unflatten(outputArray, input, Point2I(_bbox.getMinX(), _bbox.getMinY()));
365  return outputArray;
366  }
367 
387  template <typename PixelIn, typename PixelOut, int inA, int outC, int inC>
388  void unflatten(ndarray::Array<PixelOut, inA + 1, outC> const &output,
389  ndarray::Array<PixelIn, inA, inC> const &input, Point2I const &xy0 = Point2I()) const {
390  // Populate 2D ndarray output with values from input, at locations defined by SpanSet, optionally
391  // offset by xy0
392  auto ndAssigner = [](Point2I const &point,
394  typename details::FlatNdGetter<PixelIn, inA, inC>::Reference in) { out = in; };
395  applyFunctor(ndAssigner, ndarray::ndImage(output, xy0), ndarray::ndFlat(input));
396  }
397 
405  template <typename ImageT>
407  auto copyFunc = [](lsst::afw::geom::Point2I const &point, ImageT const &srcPix, ImageT &destPix) {
408  destPix = srcPix;
409  };
410  applyFunctor(copyFunc, src, dest);
411  }
412 
422  template <typename ImageT, typename MaskT, typename VarT>
425  auto copyFunc = [](lsst::afw::geom::Point2I const &point, ImageT const &srcPix, MaskT const &srcMask,
426  VarT const &srcVar, ImageT &destPix, MaskT &destMask, VarT &destVar) {
427  destPix = srcPix;
428  destMask = srcMask;
429  destVar = srcVar;
430  };
431  applyFunctor(copyFunc, *(src.getImage()), *(src.getMask()), *(src.getVariance()), *(dest.getImage()),
432  *(dest.getMask()), *(dest.getVariance()));
433  }
434 
448  template <typename ImageT>
449  void setImage(image::Image<ImageT> &image, ImageT val, geom::Box2I const &region = geom::Box2I(),
450  bool doClip = false) const;
451 
497  template <typename Functor, typename... Args>
498  // Normally std::forward would be used with a universal reference, however
499  // this function does not use one because without std::forward the
500  // compiler is forced to keep any r-value references alive for the
501  // duration of the function call
502  void applyFunctor(Functor &&func, Args &&... args) const {
503  /* Use a variadic template to take a functor object, and an arbitrary number
504  of parameters. For each of the arguments, construct a Getter class using
505  a function (makeGetter) which is overloaded to all the types applyFunctorImpl
506  supports: Images, MaskedImages, Exposures, ndarrays, numeric values, and
507  iterators. The functor and the getters are then passed to the implementation of
508  applyFunctor where the values of the input arguments are intelligently
509  generated at each point in SpanSet, and passed to the functor object for evaluation.
510  */
511  applyFunctorImpl(func, details::makeGetter(args)...);
512  }
513 
521  template <typename T>
522  void setMask(lsst::afw::image::Mask<T> &target, T bitmask) const;
523 
531  template <typename T>
532  void clearMask(lsst::afw::image::Mask<T> &target, T bitmask) const;
533 
534  // SpanSet functions
539  std::shared_ptr<SpanSet> intersect(SpanSet const &other) const;
540 
548  template <typename T>
549  std::shared_ptr<SpanSet> intersect(image::Mask<T> const &other, T bitmask) const;
550 
556  std::shared_ptr<SpanSet> intersectNot(SpanSet const &other) const;
557 
566  template <typename T>
567  std::shared_ptr<SpanSet> intersectNot(image::Mask<T> const &other, T bitmask) const;
568 
573  std::shared_ptr<SpanSet> union_(SpanSet const &other) const;
574 
582  template <typename T>
583  std::shared_ptr<SpanSet> union_(image::Mask<T> const &other, T bitmask) const;
584 
585  // Comparison Operators
586 
591  bool operator==(SpanSet const &other) const;
592 
593  /* Compute inequality between two SpanSets
594  *
595  * @param other The SpanSet for which inequality will be computed
596  */
597  bool operator!=(SpanSet const &other) const;
598 
608  static std::shared_ptr<geom::SpanSet> fromShape(int r, Stencil s = Stencil::CIRCLE,
609  Point2I offset = Point2I());
610 
615  static std::shared_ptr<geom::SpanSet> fromShape(geom::ellipses::Ellipse const &ellipse);
616 
633  template <typename T, typename UnaryPredicate = details::AnyBitSetFunctor<T>>
634  static std::shared_ptr<geom::SpanSet> fromMask(
635  image::Mask<T> const &mask, UnaryPredicate comparator = details::AnyBitSetFunctor<T>()) {
636  std::vector<Span> tempVec;
637  std::size_t startValue{0};
638  bool started = false;
639  auto const maskArray = mask.getArray();
640  auto const minPoint = mask.getBBox().getMin();
641  auto dimensions = maskArray.getShape();
642  for (size_t y = 0; y < dimensions[0]; ++y) {
643  startValue = 0;
644  started = false;
645  for (size_t x = 0; x < dimensions[1]; ++x) {
646  // If a new span has not been started, and a given x matches the functor condition
647  // start a new span
648  if (comparator(maskArray[y][x]) && !started) {
649  started = true;
650  startValue = x;
651  }
652  // If a span has been started, and the functor condition is false, that means the
653  // Span being created should be stopped, and appended to the Span vector
654  // Offset the x, y position by the minimum point of the mask
655  else if (started && !comparator(maskArray[y][x])) {
656  tempVec.push_back(
657  Span(y + minPoint.getY(), startValue + minPoint.getX(), x - 1 + minPoint.getX()));
658  started = false;
659  }
660  // If this is the last value in the Span's x range (dimension minux one), and started
661  // is still true that means the last value does not evaluate false in the functor
662  // and should be included in the Span under construction. The Span should be completed
663  // and added to the Span Vector before the next span is concidered.
664  // offset the x, y position by the minimum point of the mask
665  if (started && x == dimensions[1] - 1) {
666  tempVec.push_back(
667  Span(y + minPoint.getY(), startValue + minPoint.getX(), x + minPoint.getX()));
668  }
669  }
670  }
671 
672  // construct a SpanSet from the spans determined above
673  return std::make_shared<SpanSet>(std::move(tempVec));
674  }
675 
685  template <typename T>
686  static std::shared_ptr<geom::SpanSet> fromMask(image::Mask<T> const &mask, T bitmask) {
687  return fromMask(mask, [bitmask](T const &bitPattern) { return bitPattern & bitmask; });
688  }
689 
692  std::vector<std::shared_ptr<geom::SpanSet>> split() const;
693 
694  bool isPersistable() const override { return true; }
695 
700  std::shared_ptr<geom::SpanSet> findEdgePixels() const;
701 
702 private:
703  /* Returns the name used by the persistence layer to identify the SpanSet class
704  */
705  std::string getPersistenceName() const override;
706 
707  /* Return a string corresponding to the python module that SpanSets lives in
708  */
709  inline std::string getPythonModule() const override { return "lsst.afw.geom"; }
710 
711  /* Writes the representation of the class out to an output archive
712  */
713  void write(OutputArchiveHandle &handle) const override;
714 
715  /* A class which is used by the persistence layer to restore SpanSets from an archive
716  */
717  friend class SpansSetFactory;
718 
719  /* A function to combine overlapping Spans in a SpanSet into a single Span
720  */
721  void _runNormalize();
722 
723  /* Initializes the SpanSet class. Contains code that is common to multiple constructors
724  */
725  void _initialize();
726 
727  /* Label Spans according to contiguous group. If the SpanSet is contiguous, all Spans will be labeled 1.
728  * If there is more than one group each group will receive a label one higher than the previous.
729  */
730  void _label(geom::Span const &spn, std::vector<std::size_t> &labelVector, std::size_t currentLabel) const;
731  std::pair<std::vector<std::size_t>, std::size_t> _makeLabels() const;
732 
733  std::shared_ptr<SpanSet> makeShift(int x, int y) const;
734 
735  template <typename F, typename... T>
736  void applyFunctorImpl(F &&f, T... args) const {
737  /* Implementation for applying functors, loop over each of the spans, and then
738  * each point. Use the get method in the getters to fetch the value and pass
739  * the point, and the values to the functor
740  */
741  // make sure that the SpanSet is within the bounds of functor arguments
742  details::variadicBoundChecker(_bbox, _area, args...);
743  for (auto const &spn : _spanVector) {
744  // Set the current span in the getter, useful for optimizing value lookups
745  details::variadicSpanSetter(spn, args...);
746  for (int x = spn.getX0(); x <= spn.getX1(); ++x) {
747  Point2I point(x, spn.getY());
748  f(point, args.get()...);
750  }
751  }
752  }
753 
754  // Vector to hold the Spans contained in the SpanSet
755  std::vector<Span> _spanVector;
756 
757  // Box that is large enough to bound all pixels in the SpanSet
758  Box2I _bbox;
759 
760  // Number of pixels in the SpanSet
761  std::size_t _area;
762 };
763 }
764 }
765 } // Close namespace lsst::afw::geom
766 
767 #endif // LSST_AFW_GEOM_SPANSET_H
An ellipse core with quadrupole moments as parameters.
Definition: Quadrupole.h:47
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:44
std::shared_ptr< geom::SpanSet > findEdgePixels() const
Select pixels within the SpanSet which touch its edge.
void variadicSpanSetter(Span const spn, T &x)
const_iterator cend() const
Definition: SpanSet.h:89
std::shared_ptr< SpanSet > shiftedBy(int x, int y) const
Return a new SpanSet shifted by specified amount.
Stencil
An enumeration class which describes the shapes.
Definition: SpanSet.h:64
const_iterator end() const
Definition: SpanSet.h:87
static std::shared_ptr< geom::SpanSet > fromShape(int r, Stencil s=Stencil::CIRCLE, Point2I offset=Point2I())
Factory function for creating SpanSets from a Stencil.
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:993
void clearMask(lsst::afw::image::Mask< T > &target, T bitmask) const
Unset a Mask at pixels defined by the SpanSet.
static std::shared_ptr< geom::SpanSet > fromMask(image::Mask< T > const &mask, UnaryPredicate comparator=details::AnyBitSetFunctor< T >())
Create a SpanSet from a mask.
Definition: SpanSet.h:634
A compact representation of a collection of pixels.
Definition: SpanSet.h:75
A range of pixels within one row of an Image.
Definition: Span.h:55
void setImage(image::Image< ImageT > &image, ImageT val, geom::Box2I const &region=geom::Box2I(), bool doClip=false) const
Set the values of an Image at points defined by the SpanSet.
void flatten(ndarray::Array< PixelOut, inA-1, outC > const &output, ndarray::Array< PixelIn, inA, inC > const &input, Point2I const &xy0=Point2I()) const
Reduce the pixel dimensionality from 2 to 1 of an array at points given by SpanSet.
Definition: SpanSet.h:328
typename ndarray::Array< T, N, C >::Reference::Reference Reference
typename ndarray::Array< T, inA, inC >::Reference Reference
geom::Box2I getBBox(ImageOrigin origin=PARENT) const
Definition: Image.h:456
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:960
bool contains(SpanSet const &other) const
Check if a SpanSet instance entirely contains another SpanSet.
bool overlaps(SpanSet const &other) const
Specifies if this SpanSet overlaps with another SpanSet.
void copyImage(image::Image< ImageT > const &src, image::Image< ImageT > &dest)
Copy contents of source Image into destination image at the positions defined in the SpanSet...
Definition: SpanSet.h:406
static std::shared_ptr< geom::SpanSet > fromMask(image::Mask< T > const &mask, T bitmask)
Create a SpanSet from a mask.
Definition: SpanSet.h:686
std::shared_ptr< SpanSet > clippedTo(Box2I const &box) const
Return a new SpanSet which has all pixel values inside specified box.
ndarray::Array< typename std::remove_const< Pixel >::type, inA+1, inA+1 > unflatten(ndarray::Array< Pixel, inA, inC > const &input) const
Expand an array by one spatial dimension at points given by SpanSet.
Definition: SpanSet.h:351
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:972
std::shared_ptr< SpanSet > eroded(int r, Stencil s=Stencil::CIRCLE) const
Perform a set erosion, and return a new object.
void applyFunctor(Functor &&func, Args &&...args) const
Apply functor on individual elements from the supplied parameters.
Definition: SpanSet.h:502
An integer coordinate rectangle.
Definition: Box.h:55
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:73
void copyMaskedImage(image::MaskedImage< ImageT, MaskT, VarT > const &src, image::MaskedImage< ImageT, MaskT, VarT > &dest)
Copy contents of source MaskedImage into destination image at the positions defined in the SpanSet...
Definition: SpanSet.h:423
A 2D linear coordinate transformation.
value_type const & const_reference
Definition: SpanSet.h:81
size_type getArea() const
Return the number of pixels in the SpanSet.
bool empty() const
Definition: SpanSet.h:93
bool operator==(SpanSet const &other) const
Compute equality between two SpanSets.
const_iterator begin() const
Definition: SpanSet.h:86
bool operator!=(SpanSet const &other) const
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:83
An affine coordinate transformation consisting of a linear transformation and an offset.
int getMinY() const
Definition: Box.h:125
friend class SpansSetFactory
Definition: SpanSet.h:717
An ellipse defined by an arbitrary BaseCore and a center point.
Definition: Ellipse.h:51
geom::Box2I const & _bbox
Definition: fits_io_mpl.h:84
Box2I getBBox() const
Return a new integer box which is the minimum size to contain the pixels.
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:81
details::FlatNdGetter< T, inA, inB > ndFlat(ndarray::Array< T, inA, inB > const &array)
Marks a ndarray to be interpreted as a 1D vector when applying a functor from a SpanSet.
const_reference back() const
Definition: SpanSet.h:91
FlatNdGetter< T, inA, inC > makeGetter(FlatNdGetter< T, inA, inC > &getter)
int getMinX() const
Definition: Box.h:124
std::shared_ptr< SpanSet > intersectNot(SpanSet const &other) const
Determine the common points between a SpanSet and the logical inverse of a second SpanSet and return ...
SpanSet(iter begin, iter end, bool normalize=true)
Construct a SpanSet from an iterator.
Definition: SpanSet.h:121
ndarray::Array< typename std::remove_const< Pixel >::type, inN-1, inN-1 > flatten(ndarray::Array< Pixel, inN, inC > const &input, Point2I const &xy0=Point2I()) const
Reduce the pixel dimensionality from 2 to 1 of an array at points given by SpanSet.
Definition: SpanSet.h:296
void variadicBoundChecker(Box2I const box, int area, T const &x)
double x
const_iterator cbegin() const
Definition: SpanSet.h:88
std::shared_ptr< SpanSet > intersect(SpanSet const &other) const
Determine the common points between two SpanSets, and create a new SpanSet.
details::ImageNdGetter< T, inA, inB > ndImage(ndarray::Array< T, inA, inB > const &array, afwGeom::Point2I xy0=afwGeom::Point2I())
Marks a ndarray to be interpreted as an image when applying a functor from a SpanSet.
std::shared_ptr< SpanSet > union_(SpanSet const &other) const
Create a new SpanSet that contains all points from two SpanSets.
void unflatten(ndarray::Array< PixelOut, inA+1, outC > const &output, ndarray::Array< PixelIn, inA, inC > const &input, Point2I const &xy0=Point2I()) const
Expand an array by one spatial dimension at points given by SpanSet.
Definition: SpanSet.h:388
int getWidth() const
Definition: Box.h:154
ellipses::Quadrupole computeShape() const
Compute the shape parameters for the distribution of points in the SpanSet.
afw::table::Key< afw::table::Array< MaskPixelT > > mask
SpanSet()
Default constructor.
std::vector< Span >::const_iterator const_iterator
Definition: SpanSet.h:78
int getHeight() const
Definition: Box.h:155
std::vector< Span >::size_type size_type
Definition: SpanSet.h:79
bool isPersistable() const override
Return true if this particular object can be persisted using afw::table::io.
Definition: SpanSet.h:694
Virtual base class for 2D transforms.
Definition: XYTransform.h:46
afw::table::Key< afw::table::Array< ImagePixelT > > image
void setMask(lsst::afw::image::Mask< T > &target, T bitmask) const
Set a Mask at pixels defined by the SpanSet.
const_reference front() const
Definition: SpanSet.h:90
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:107
std::shared_ptr< SpanSet > dilated(int r, Stencil s=Stencil::CIRCLE) const
Perform a set dilation operation, and return a new object.
bool isContiguous() const
Defines if the SpanSet is simply contiguous.
Point2D computeCentroid() const
Compute the point about which the SpanSet&#39;s first moment is zero.
Point< int, 2 > Point2I
Definition: Point.h:270
Abstract base class for function objects.
Definition: Functor.h:50
std::shared_ptr< SpanSet > transformedBy(LinearTransform const &t) const
Return a new SpanSet who&#39;s pixels are the product of applying the specified transformation.
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:173
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:486
std::vector< std::shared_ptr< geom::SpanSet > > split() const
Split a discontinuous SpanSet into multiple SpanSets which are contiguous.
size_type size() const
Definition: SpanSet.h:92