lsst.afw  21.0.0-18-g1421380c6+e734d31160
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Friends | List of all members
lsst::afw::geom::SpanSet Class Reference

A compact representation of a collection of pixels. More...

#include <SpanSet.h>

Inheritance diagram for lsst::afw::geom::SpanSet:
lsst::afw::table::io::PersistableFacade< lsst::afw::geom::SpanSet > lsst::afw::table::io::Persistable

Public Types

typedef std::vector< Span >::const_iterator const_iterator
 
typedef std::vector< Span >::size_type size_type
 
typedef Span value_type
 
typedef value_type const & const_reference
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_reference front () const
 
const_reference back () const
 
size_type size () const
 
bool empty () const
 
 SpanSet ()
 Default constructor. More...
 
 SpanSet (lsst::geom::Box2I const &box)
 Construct a SpanSet from a box. More...
 
template<typename iter >
 SpanSet (iter begin, iter end, bool normalize=true)
 Construct a SpanSet from an iterator. More...
 
 SpanSet (std::vector< Span > const &vec, bool normalize=true)
 Construct a SpanSet from a std vector by copying. More...
 
 SpanSet (std::vector< Span > &&vec, bool normalize=true)
 Construct a SpanSet from a std vector from a move. More...
 
 SpanSet (SpanSet const &other)=delete
 
 SpanSet (SpanSet &&other)=delete
 
 ~SpanSet () override=default
 
SpanSetoperator= (SpanSet const &)=default
 
SpanSetoperator= (SpanSet &&other)
 
size_type getArea () const
 Return the number of pixels in the SpanSet. More...
 
lsst::geom::Box2I getBBox () const
 Return a new integer box which is the minimum size to contain the pixels. More...
 
bool isContiguous () const
 Defines if the SpanSet is simply contiguous. More...
 
std::shared_ptr< SpanSetshiftedBy (int x, int y) const
 Return a new SpanSet shifted by specified amount. More...
 
std::shared_ptr< SpanSetshiftedBy (lsst::geom::Extent2I const &offset) const
 Return a new SpanSet shifted by specified amount. More...
 
std::shared_ptr< SpanSetclippedTo (lsst::geom::Box2I const &box) const
 Return a new SpanSet which has all pixel values inside specified box. More...
 
std::shared_ptr< SpanSettransformedBy (lsst::geom::LinearTransform const &t) const
 Return a new SpanSet who's pixels are the product of applying the specified transformation. More...
 
std::shared_ptr< SpanSettransformedBy (lsst::geom::AffineTransform const &t) const
 Return a new SpanSet who's pixels are the product of applying the specified transformation. More...
 
std::shared_ptr< SpanSettransformedBy (TransformPoint2ToPoint2 const &t) const
 Return a new SpanSet who's pixels are the product of applying the specified transformation. More...
 
bool overlaps (SpanSet const &other) const
 Specifies if this SpanSet overlaps with another SpanSet. More...
 
bool contains (SpanSet const &other) const
 Check if a SpanSet instance entirely contains another SpanSet. More...
 
bool contains (lsst::geom::Point2I const &point) const
 Check if a point is contained within the SpanSet instance. More...
 
lsst::geom::Point2D computeCentroid () const
 Compute the point about which the SpanSet's first moment is zero. More...
 
ellipses::Quadrupole computeShape () const
 Compute the shape parameters for the distribution of points in the SpanSet. More...
 
std::shared_ptr< SpanSetdilated (int r, Stencil s=Stencil::CIRCLE) const
 Perform a set dilation operation, and return a new object. More...
 
std::shared_ptr< SpanSetdilated (SpanSet const &other) const
 Perform a set dilation operation, and return a new object. More...
 
std::shared_ptr< SpanSeteroded (int r, Stencil s=Stencil::CIRCLE) const
 Perform a set erosion, and return a new object. More...
 
std::shared_ptr< SpanSeteroded (SpanSet const &other) const
 Perform a set erosion operation, and return a new object. More...
 
template<typename Pixel , int inN, int inC>
ndarray::Array< typename std::remove_const< Pixel >::type, inN - 1, inN - 1 > flatten (ndarray::Array< Pixel, inN, inC > const &input, lsst::geom::Point2I const &xy0=lsst::geom::Point2I()) const
 Reduce the pixel dimensionality from 2 to 1 of an array at points given by SpanSet. More...
 
template<typename PixelIn , typename PixelOut , int inA, int outC, int inC>
void flatten (ndarray::Array< PixelOut, inA - 1, outC > const &output, ndarray::Array< PixelIn, inA, inC > const &input, lsst::geom::Point2I const &xy0=lsst::geom::Point2I()) const
 Reduce the pixel dimensionality from 2 to 1 of an array at points given by SpanSet. More...
 
template<typename Pixel , int inA, int inC>
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. More...
 
template<typename PixelIn , typename PixelOut , int inA, int outC, int inC>
void unflatten (ndarray::Array< PixelOut, inA+1, outC > const &output, ndarray::Array< PixelIn, inA, inC > const &input, lsst::geom::Point2I const &xy0=lsst::geom::Point2I()) const
 Expand an array by one spatial dimension at points given by SpanSet. More...
 
template<typename ImageT >
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. More...
 
template<typename ImageT , typename MaskT , typename VarT >
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. More...
 
template<typename ImageT >
void setImage (image::Image< ImageT > &image, ImageT val, lsst::geom::Box2I const &region=lsst::geom::Box2I(), bool doClip=false) const
 Set the values of an Image at points defined by the SpanSet. More...
 
template<typename Functor , typename... Args>
void applyFunctor (Functor &&func, Args &&... args) const
 Apply functor on individual elements from the supplied parameters. More...
 
template<typename T >
void setMask (lsst::afw::image::Mask< T > &target, T bitmask) const
 Set a Mask at pixels defined by the SpanSet. More...
 
template<typename T >
void clearMask (lsst::afw::image::Mask< T > &target, T bitmask) const
 Unset a Mask at pixels defined by the SpanSet. More...
 
std::shared_ptr< SpanSetintersect (SpanSet const &other) const
 Determine the common points between two SpanSets, and create a new SpanSet. More...
 
template<typename T >
std::shared_ptr< SpanSetintersect (image::Mask< T > const &other, T bitmask) const
 Determine the common points between a SpanSet and a Mask with a given bit pattern. More...
 
std::shared_ptr< SpanSetintersectNot (SpanSet const &other) const
 Determine the common points between a SpanSet and the logical inverse of a second SpanSet and return them in a new SpanSet. More...
 
template<typename T >
std::shared_ptr< SpanSetintersectNot (image::Mask< T > const &other, T bitmask) const
 Determine the common points between a SpanSet and the logical inverse of a Mask for a given bit pattern. More...
 
std::shared_ptr< SpanSetunion_ (SpanSet const &other) const
 Create a new SpanSet that contains all points from two SpanSets. More...
 
template<typename T >
std::shared_ptr< SpanSetunion_ (image::Mask< T > const &other, T bitmask) const
 Determine the union between a SpanSet and a Mask for a given bit pattern. More...
 
bool operator== (SpanSet const &other) const
 Compute equality between two SpanSets. More...
 
bool operator!= (SpanSet const &other) const
 
std::vector< std::shared_ptr< geom::SpanSet > > split () const
 Split a discontinuous SpanSet into multiple SpanSets which are contiguous. More...
 
bool isPersistable () const noexcept override
 Return true if this particular object can be persisted using afw::table::io. More...
 
std::shared_ptr< geom::SpanSetfindEdgePixels () const
 Select pixels within the SpanSet which touch its edge. More...
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object. More...
 

Static Public Member Functions

static std::shared_ptr< geom::SpanSetfromShape (int r, Stencil s=Stencil::CIRCLE, lsst::geom::Point2I offset=lsst::geom::Point2I())
 Factory function for creating SpanSets from a Stencil. More...
 
static std::shared_ptr< geom::SpanSetfromShape (geom::ellipses::Ellipse const &ellipse)
 Factory function for creating SpanSets from an ellipse object. More...
 
template<typename T , typename UnaryPredicate = details::AnyBitSetFunctor<T>>
static std::shared_ptr< geom::SpanSetfromMask (image::Mask< T > const &mask, UnaryPredicate comparator=details::AnyBitSetFunctor< T >())
 Create a SpanSet from a mask. More...
 
template<typename T >
static std::shared_ptr< geom::SpanSetfromMask (image::Mask< T > const &mask, T bitmask)
 Create a SpanSet from a mask. More...
 
static std::shared_ptr< lsst::afw::geom::SpanSetreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< lsst::afw::geom::SpanSetreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< lsst::afw::geom::SpanSetreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory. More...
 
static std::shared_ptr< lsst::afw::geom::SpanSetdynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr. More...
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Friends

class SpansSetFactory
 

Detailed Description

A compact representation of a collection of pixels.

A SpanSet is a collection of Span classes. As each Span encodes a range of pixels on a given row, a SpanSet represents an arbitrary collection of pixels on an image. The SpanSet class also contains mathematical set style operators, for working with the collection of pixels, and helper functions which make use of the area defined to perform localized actions

Definition at line 77 of file SpanSet.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 80 of file SpanSet.h.

◆ const_reference

Definition at line 83 of file SpanSet.h.

◆ OutputArchiveHandle

typedef io::OutputArchiveHandle lsst::afw::table::io::Persistable::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

◆ size_type

Definition at line 81 of file SpanSet.h.

◆ value_type

Definition at line 82 of file SpanSet.h.

Constructor & Destructor Documentation

◆ SpanSet() [1/7]

lsst::afw::geom::SpanSet::SpanSet ( )

Default constructor.

Construct a null SpanSet, with zero size. This is useful as a placeholder

Definition at line 178 of file SpanSet.cc.

◆ SpanSet() [2/7]

lsst::afw::geom::SpanSet::SpanSet ( lsst::geom::Box2I const &  box)
explicit

Construct a SpanSet from a box.

Parameters
boxA integer box that defines the shape for which a span set should be created

Definition at line 181 of file SpanSet.cc.

◆ SpanSet() [3/7]

template<typename iter >
lsst::afw::geom::SpanSet::SpanSet ( iter  begin,
iter  end,
bool  normalize = true 
)
inline

Construct a SpanSet from an iterator.

This constructor accepts the begin and end points of an arbitrary iterator of a container which contains previously created Spans. These Spans are used to construct the SpanSet.

Parameters
beginBeginning iterator of a container of Spans
endEnd iterator of a container of Spans
normalizeControls if the constructor attempts to merge connected or overlapping spans. Defaults to true. Set to false to save computational time when the container is sure to already be normalized.

Definition at line 123 of file SpanSet.h.

◆ SpanSet() [4/7]

lsst::afw::geom::SpanSet::SpanSet ( std::vector< Span > const &  vec,
bool  normalize = true 
)
explicit

Construct a SpanSet from a std vector by copying.

This constructor accepts a standard vector which contains already created Spans. These Spans are copied into the internal container of spans.

Parameters
vecStandard vector containing Spans
normalizeControls if the constructor attempts to merge connected or overlapping spans. Defaults to true. Set to false to save computational time when the container is sure to already be normalized.

Definition at line 193 of file SpanSet.cc.

◆ SpanSet() [5/7]

lsst::afw::geom::SpanSet::SpanSet ( std::vector< Span > &&  vec,
bool  normalize = true 
)
explicit

Construct a SpanSet from a std vector from a move.

This constructor accepts a standard vector r-reference which contains already created Spans. These Spans become the internal container of spans.

Parameters
vecStandard vector containing Spans
normalizeControls if the constructor attempts to merge connected or overlapping spans. Defaults to true. Set to false to save computational time when the container is sure to already be normalized.

Definition at line 207 of file SpanSet.cc.

◆ SpanSet() [6/7]

lsst::afw::geom::SpanSet::SpanSet ( SpanSet const &  other)
delete

◆ SpanSet() [7/7]

lsst::afw::geom::SpanSet::SpanSet ( SpanSet &&  other)
delete

◆ ~SpanSet()

lsst::afw::geom::SpanSet::~SpanSet ( )
overridedefault

Member Function Documentation

◆ applyFunctor()

template<typename Functor , typename... Args>
void lsst::afw::geom::SpanSet::applyFunctor ( Functor &&  func,
Args &&...  args 
) const
inline

Apply functor on individual elements from the supplied parameters.

Use a variadic template to take a functor object, and an arbitrary number of parameters. Parameters may be of type(s) Image, MakedImage, ndarray, numeric value and generic iterators. For most of these types bound checking is done to ensure execution safety, but because a generic iterator can have any behavior, bounds checking is not possible. As such the iterator must be valid for at least the number of pixels contained in the SpanSet. Numeric values are also different in that they will not be iterated but the value will be passed to the functor for each point in the SpanSet.

Because a ndarray can either be interpreted as either a two dimensional image, or a one dimensional vector a user must break the ambiguity by using the functions ndarray::ndImage, or ndarray::ndFlat respectively.

The functor object must operate in-place on any data, no return values are captured. No exceptions are handled, if a functor throws one it will propagate back out of the applyFunctor call, possibly leaving the output array in an incomplete state. The first argument of the functor must be a lsst::geom::Point2I which will be the point in the SpanSet where the operation is occurring. All the remaining arguments to the functor will be individual values generated from the input arguments. For two dimensional types (Image, MaskedImage, ndarray) arguments will be the value taken from the input type at the location given by the SpanSet. I.e. if the SpanSet has the point (2,3) in it, then a 2 dimensional ndarray will have ndarray[2][3] passed to the functor. Thus all SpanSet coordinates must be addressable in two dimensional types. For one dimensional types (ndarray, iterator) arguments will correspond to the value at the location defined by number of pixels which have been iterated over. I.e. if there are 3 pixels defined in the SpanSet a one dimensional ndarray will have the value ndarray[0] passed to the functor on on the first functor call, ndarray[1] passed on the second call, and ndarray[2] passed on the last functor call. The total length of a one dimensional type will be equal to the area of the SpanSet, and therefore the data-type must be at least that length. The order of the parameters supplied to the functor will be the same order as they are passed to the applyFunctor method.

Template Parameters
...ArgsVariadic type specification
Parameters
funcFunctor that is to be applied on each of the values taken from ...args.
...argsVariadic arguments, may be of type Image, MaskedImage, ndarrays, numeric values and iterators. ndarrays must be specified as either image or vector with the ndarray::ndImage or ndarray::ndFlat functions

Definition at line 512 of file SpanSet.h.

◆ back()

const_reference lsst::afw::geom::SpanSet::back ( ) const
inline

Definition at line 93 of file SpanSet.h.

◆ begin()

const_iterator lsst::afw::geom::SpanSet::begin ( ) const
inline

Definition at line 88 of file SpanSet.h.

◆ cbegin()

const_iterator lsst::afw::geom::SpanSet::cbegin ( ) const
inline

Definition at line 90 of file SpanSet.h.

◆ cend()

const_iterator lsst::afw::geom::SpanSet::cend ( ) const
inline

Definition at line 91 of file SpanSet.h.

◆ clearMask()

template<typename T >
void lsst::afw::geom::SpanSet::clearMask ( lsst::afw::image::Mask< T > &  target,
bitmask 
) const

Unset a Mask at pixels defined by the SpanSet.

Template Parameters
Tdata-type of a pixel in the Mask plane
Parameters
[in,out]targetMask in which a bit pattern will be unset
[in]bitmaskThe bit pattern to clear in the mask

Definition at line 940 of file SpanSet.cc.

◆ clippedTo()

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::clippedTo ( lsst::geom::Box2I const &  box) const

Return a new SpanSet which has all pixel values inside specified box.

Parameters
boxInteger box specifying the bounds for which all pixels must be within

Definition at line 440 of file SpanSet.cc.

◆ computeCentroid()

lsst::geom::Point2D lsst::afw::geom::SpanSet::computeCentroid ( ) const

Compute the point about which the SpanSet's first moment is zero.

Definition at line 503 of file SpanSet.cc.

◆ computeShape()

ellipses::Quadrupole lsst::afw::geom::SpanSet::computeShape ( ) const

Compute the shape parameters for the distribution of points in the SpanSet.

Definition at line 522 of file SpanSet.cc.

◆ contains() [1/2]

bool lsst::afw::geom::SpanSet::contains ( lsst::geom::Point2I const &  point) const

Check if a point is contained within the SpanSet instance.

Parameters
pointAn integer point object for which membership is to be tested

Definition at line 493 of file SpanSet.cc.

◆ contains() [2/2]

bool lsst::afw::geom::SpanSet::contains ( SpanSet const &  other) const

Check if a SpanSet instance entirely contains another SpanSet.

Parameters
otherThe SpanSet who's membership is to be tested for

Definition at line 467 of file SpanSet.cc.

◆ copyImage()

template<typename ImageT >
void lsst::afw::geom::SpanSet::copyImage ( image::Image< ImageT > const &  src,
image::Image< ImageT > &  dest 
)
inline

Copy contents of source Image into destination image at the positions defined in the SpanSet.

Template Parameters
ImageTThe pixel type of the Image
Parameters
[in]srcThe Image that pixel values will be taken from
[out]destThe Image where pixels will be copied

Definition at line 416 of file SpanSet.h.

◆ copyMaskedImage()

template<typename ImageT , typename MaskT , typename VarT >
void lsst::afw::geom::SpanSet::copyMaskedImage ( image::MaskedImage< ImageT, MaskT, VarT > const &  src,
image::MaskedImage< ImageT, MaskT, VarT > &  dest 
)
inline

Copy contents of source MaskedImage into destination image at the positions defined in the SpanSet.

Template Parameters
ImageTThe pixel type of the MaskedImage's Image
MaskTThe pixel type of the MaskedImage's Mask
VarTThe Pixel type of the MaskedImage's Variance Image
Parameters
[in]srcThe MaskedImage that pixel values will be taken from
[out]destThe MaskedImage where pixels will be copied

Definition at line 433 of file SpanSet.h.

◆ dilated() [1/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::dilated ( int  r,
Stencil  s = Stencil::CIRCLE 
) const

Perform a set dilation operation, and return a new object.

Dilate a SpanSet with a kernel specified with the stencil parameter

Parameters
rradius of the stencil, the length is inclusive i.e. 3 ranges from -3 to 3
smust be an enumeration of type geom::Stencil. Specifies the shape of the dilation kernel. May be CIRCLE, MANHATTAN, or BOX

Definition at line 545 of file SpanSet.cc.

◆ dilated() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::dilated ( SpanSet const &  other) const

Perform a set dilation operation, and return a new object.

Dilate a SpanSet with a kernel specified by another SpanSet

Parameters
otherA SpanSet which specifies the kernel to use for dilation

Definition at line 552 of file SpanSet.cc.

◆ dynamicCast()

Dynamically cast a shared_ptr.

Dynamically cast a shared pointer and raise on failure.

You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;

Exceptions
lsst::pex::exceptions::LogicErrorif the cast fails

param[in] ptr The pointer to be cast.

Returns
The cast pointer.
Exceptions
lsst::pex::exceptions::TypeErrorIf the dynamic cast fails.

Definition at line 218 of file Persistable.cc.

◆ empty()

bool lsst::afw::geom::SpanSet::empty ( ) const
inline

Definition at line 95 of file SpanSet.h.

◆ end()

const_iterator lsst::afw::geom::SpanSet::end ( ) const
inline

Definition at line 89 of file SpanSet.h.

◆ eroded() [1/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::eroded ( int  r,
Stencil  s = Stencil::CIRCLE 
) const

Perform a set erosion, and return a new object.

Erode a SpanSet with a kernel specified with the stencil parameter

Parameters
rradius of the stencil, the length is inclusive i.e. 3 ranges from -3 to 3
smust be an enumeration of type geom::Stencil. Specifies the shape of the erosion kernel. May be CIRCLE, MANHATTAN, or BOX

Definition at line 573 of file SpanSet.cc.

◆ eroded() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::eroded ( SpanSet const &  other) const

Perform a set erosion operation, and return a new object.

Erode a SpanSet with a kernel specified by another SpanSet

Parameters
otherA SpanSet which specifies the kernel to use for erosion

Definition at line 580 of file SpanSet.cc.

◆ findEdgePixels()

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::findEdgePixels ( ) const

Select pixels within the SpanSet which touch its edge.

Definition at line 412 of file SpanSet.cc.

◆ flatten() [1/2]

template<typename Pixel , int inN, int inC>
ndarray::Array<typename std::remove_const<Pixel>::type, inN - 1, inN - 1> lsst::afw::geom::SpanSet::flatten ( ndarray::Array< Pixel, inN, inC > const &  input,
lsst::geom::Point2I const &  xy0 = lsst::geom::Point2I() 
) const
inline

Reduce the pixel dimensionality from 2 to 1 of an array at points given by SpanSet.

Take values from an array at points defined by SpanSet and use them to populate a new array where the x,y coordinates of the SpanSet have been flattened to one dimension. First two dimensions of the input array must be the h,w which correspond to the SpanSet coordinates. Any number of remaining dimensions is permissible.

Template Parameters
PixelThe datatype for the ndarray
inNThe number of dimensions in the array object
inCNumber of guaranteed row-major contiguous dimensions, starting from the end
Parameters
inputThe ndarray from which the values will be taken
xy0A point object with is used as the origin point for the SpanSet coordinate system

Definition at line 303 of file SpanSet.h.

◆ flatten() [2/2]

template<typename PixelIn , typename PixelOut , int inA, int outC, int inC>
void lsst::afw::geom::SpanSet::flatten ( ndarray::Array< PixelOut, inA - 1, outC > const &  output,
ndarray::Array< PixelIn, inA, inC > const &  input,
lsst::geom::Point2I const &  xy0 = lsst::geom::Point2I() 
) const
inline

Reduce the pixel dimensionality from 2 to 1 of an array at points given by SpanSet.

Take values from an array at points defined by SpanSet and use them to populate a new array where the x,y coordinates of the SpanSet have been flattened to one dimension. First two dimensions of the input array must be the h,w which correspond to the SpanSet coordinates. Any number of remaining dimensions is permissible.

Template Parameters
PixelOutThe data-type for the output ndarray
PixelInThe data-type for the input ndarray
inAThe number of dimensions in the input array
outCNumber of guaranteed row-major contiguous dimensions in the output array, starting from the end
inCNumber of guaranteed row-major contiguous dimensions in the input array, starting from the end
Parameters
[out]outputThe 1d ndarray which will be populated with output parameters, will happen in place
[in]inputThe ndarray from which the values will be taken
[in]xy0A point object which is used as the origin point for the SpanSet coordinate system

Definition at line 336 of file SpanSet.h.

◆ fromMask() [1/2]

template<typename T >
static std::shared_ptr<geom::SpanSet> lsst::afw::geom::SpanSet::fromMask ( image::Mask< T > const &  mask,
bitmask 
)
inlinestatic

Create a SpanSet from a mask.

Create a SpanSet from a Mask at pixels with the specified bit pattern

Template Parameters
TPixel type of the Mask
Parameters
maskmask to convert to a SpanSet
bitmaskbit pattern used to specify which pixel to include

Definition at line 701 of file SpanSet.h.

◆ fromMask() [2/2]

template<typename T , typename UnaryPredicate = details::AnyBitSetFunctor<T>>
static std::shared_ptr<geom::SpanSet> lsst::afw::geom::SpanSet::fromMask ( image::Mask< T > const &  mask,
UnaryPredicate  comparator = details::AnyBitSetFunctor<T>() 
)
inlinestatic

Create a SpanSet from a mask.

Create a SpanSet from a class. The default behavior is to include any pixels which have any bits set. More complex selection/filtering of bit patterns can be done by supplying a comparator function.

Template Parameters
TPixel type of the Mask
FType of the functor
Parameters
maskmask to convert to a SpanSet
comparatorFunctor object to use in the decision to include pixel in SpanSet. Should return true when a given pixel in the mask should be part of the SpanSet, and false otherwise. The functor takes a single value taken from the mask at the pixel under consideration. Defaults to evaluating true if the mask has bits set, and false otherwise.

Definition at line 644 of file SpanSet.h.

◆ fromShape() [1/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::fromShape ( geom::ellipses::Ellipse const &  ellipse)
static

Factory function for creating SpanSets from an ellipse object.

Parameters
ellipseAn ellipse defining the region to create a SpanSet from

Definition at line 716 of file SpanSet.cc.

◆ fromShape() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::fromShape ( int  r,
Stencil  s = Stencil::CIRCLE,
lsst::geom::Point2I  offset = lsst::geom::Point2I() 
)
static

Factory function for creating SpanSets from a Stencil.

Parameters
rradius of the stencil, the length is inclusive i.e. 3 ranges from -3 to 3
smust be an enumeration of type geom::Stencil. Specifies the shape of the newly created SpanSet. May be CIRCLE, MANHATTAN, or BOX
offsetThis function usually creates a SpanSet centered about zero. This parameter is a point2I object which specifies an offset from zero to apply when creating the SpanSet.

Definition at line 689 of file SpanSet.cc.

◆ front()

const_reference lsst::afw::geom::SpanSet::front ( ) const
inline

Definition at line 92 of file SpanSet.h.

◆ getArea()

std::size_t lsst::afw::geom::SpanSet::getArea ( ) const

Return the number of pixels in the SpanSet.

Definition at line 284 of file SpanSet.cc.

◆ getBBox()

lsst::geom::Box2I lsst::afw::geom::SpanSet::getBBox ( ) const

Return a new integer box which is the minimum size to contain the pixels.

Definition at line 287 of file SpanSet.cc.

◆ intersect() [1/2]

template<typename T >
std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::intersect ( image::Mask< T > const &  other,
bitmask 
) const

Determine the common points between a SpanSet and a Mask with a given bit pattern.

Template Parameters
TPixel type of the Mask
Parameters
otherMask with which to calculate intersection
bitmaskThe bit value to consider when intersecting

Definition at line 951 of file SpanSet.cc.

◆ intersect() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::intersect ( SpanSet const &  other) const

Determine the common points between two SpanSets, and create a new SpanSet.

Parameters
otherThe other SpanSet with which to intersect with

Definition at line 721 of file SpanSet.cc.

◆ intersectNot() [1/2]

template<typename T >
std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::intersectNot ( image::Mask< T > const &  other,
bitmask 
) const

Determine the common points between a SpanSet and the logical inverse of a Mask for a given bit pattern.

Parameters
otherMask with which to calculate intersection
bitmaskThe bit value to consider when intersecting
Template Parameters
TPixel type of the Mask

Definition at line 956 of file SpanSet.cc.

◆ intersectNot() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::intersectNot ( SpanSet const &  other) const

Determine the common points between a SpanSet and the logical inverse of a second SpanSet and return them in a new SpanSet.

Parameters
otherThe spanset which will be logically inverted when computing the intersection

Definition at line 746 of file SpanSet.cc.

◆ isContiguous()

bool lsst::afw::geom::SpanSet::isContiguous ( ) const

Defines if the SpanSet is simply contiguous.

If the pixels can be traversed in such a way that every pixel can be reached without going over a pixel not contained in the SpanSet this method will return true. If the SpanSet is disjoint aka the above is not true and there is more than one region, returns false.

Definition at line 374 of file SpanSet.cc.

◆ isPersistable()

bool lsst::afw::geom::SpanSet::isPersistable ( ) const
inlineoverridevirtualnoexcept

Return true if this particular object can be persisted using afw::table::io.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 709 of file SpanSet.h.

◆ operator!=()

bool lsst::afw::geom::SpanSet::operator!= ( SpanSet const &  other) const

Definition at line 684 of file SpanSet.cc.

◆ operator=() [1/2]

SpanSet& lsst::afw::geom::SpanSet::operator= ( SpanSet &&  other)
inline

Definition at line 169 of file SpanSet.h.

◆ operator=() [2/2]

SpanSet& lsst::afw::geom::SpanSet::operator= ( SpanSet const &  )
default

◆ operator==()

bool lsst::afw::geom::SpanSet::operator== ( SpanSet const &  other) const

Compute equality between two SpanSets.

Parameters
otherThe SpanSet for which equality will be computed

Definition at line 679 of file SpanSet.cc.

◆ overlaps()

bool lsst::afw::geom::SpanSet::overlaps ( SpanSet const &  other) const

Specifies if this SpanSet overlaps with another SpanSet.

Parameters
otherA SpanSet for which overlapping comparison will be made

Definition at line 455 of file SpanSet.cc.

◆ readFits() [1/3]

Read an object from an already open FITS object.

Parameters
[in]fitsfileFITS object to read from, already positioned at the desired HDU.

Definition at line 183 of file Persistable.h.

◆ readFits() [2/3]

static std::shared_ptr<lsst::afw::geom::SpanSet > lsst::afw::table::io::PersistableFacade< lsst::afw::geom::SpanSet >::readFits ( fits::MemFileManager manager,
int  hdu = fits::DEFAULT_HDU 
)
inlinestaticinherited

Read an object from a FITS file in memory.

Parameters
[in]managerManager for the memory to read from.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 205 of file Persistable.h.

◆ readFits() [3/3]

static std::shared_ptr<lsst::afw::geom::SpanSet > lsst::afw::table::io::PersistableFacade< lsst::afw::geom::SpanSet >::readFits ( std::string const &  fileName,
int  hdu = fits::DEFAULT_HDU 
)
inlinestaticinherited

Read an object from a regular FITS file.

Parameters
[in]fileNameName of the file to read.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 194 of file Persistable.h.

◆ setImage()

template<typename ImageT >
template void lsst::afw::geom::SpanSet::setImage< double > ( image::Image< ImageT > &  image,
ImageT  val,
lsst::geom::Box2I const &  region = lsst::geom::Box2I(),
bool  doClip = false 
) const

Set the values of an Image at points defined by the SpanSet.

Template Parameters
ImageTThe pixel type of the Image to be set
Parameters
[out]imageThe Image in which pixels will be set
[in]valThe value to set
[in]regionA bounding box limiting the scope of the SpanSet, points defined in the SpanSet which fall outside this box will be ignored if the doClip parameter is set to true, defaults to the bounding box of the image
[in]doClipLimit the copy operation to pixels in the SpanSet that lie within the region parameter defaults to false

Definition at line 906 of file SpanSet.cc.

◆ setMask()

template<typename T >
void lsst::afw::geom::SpanSet::setMask ( lsst::afw::image::Mask< T > &  target,
bitmask 
) const

Set a Mask at pixels defined by the SpanSet.

Template Parameters
Tdata-type of a pixel in the Mask plane
Parameters
[in,out]targetMask in which values will be set
[in]bitmaskThe bit pattern to set in the mask

Definition at line 929 of file SpanSet.cc.

◆ shiftedBy() [1/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::shiftedBy ( int  x,
int  y 
) const

Return a new SpanSet shifted by specified amount.

Parameters
xnumber of pixels to shift in x dimension
ynumber of pixels to shift in y dimension

Definition at line 420 of file SpanSet.cc.

◆ shiftedBy() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::shiftedBy ( lsst::geom::Extent2I const &  offset) const

Return a new SpanSet shifted by specified amount.

Parameters
offsetinteger extent which specifies amount to offset in x and y

Definition at line 425 of file SpanSet.cc.

◆ size()

size_type lsst::afw::geom::SpanSet::size ( ) const
inline

Definition at line 94 of file SpanSet.h.

◆ split()

std::vector< std::shared_ptr< SpanSet > > lsst::afw::geom::SpanSet::split ( ) const

Split a discontinuous SpanSet into multiple SpanSets which are contiguous.

Definition at line 383 of file SpanSet.cc.

◆ transformedBy() [1/3]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::transformedBy ( lsst::geom::AffineTransform const &  t) const

Return a new SpanSet who's pixels are the product of applying the specified transformation.

Parameters
tAn affine transform object which will be used to map the pixels

Definition at line 847 of file SpanSet.cc.

◆ transformedBy() [2/3]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::transformedBy ( lsst::geom::LinearTransform const &  t) const

Return a new SpanSet who's pixels are the product of applying the specified transformation.

Parameters
tA linear transform object which will be used to map the pixels

Definition at line 842 of file SpanSet.cc.

◆ transformedBy() [3/3]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::transformedBy ( TransformPoint2ToPoint2 const &  t) const

Return a new SpanSet who's pixels are the product of applying the specified transformation.

Parameters
tA 2-D transform which will be used to map the pixels

Definition at line 852 of file SpanSet.cc.

◆ unflatten() [1/2]

template<typename Pixel , int inA, int inC>
ndarray::Array<typename std::remove_const<Pixel>::type, inA + 1, inA + 1> lsst::afw::geom::SpanSet::unflatten ( ndarray::Array< Pixel, inA, inC > const &  input) const
inline

Expand an array by one spatial dimension at points given by SpanSet.

Take values from a lower dimensional array and insert them in an output array with one additional dimension at points defined by the SpanSet, offset by the lower left hand corner of the bounding box of the SpanSet. The first two dimensions of the output array will correspond to the y,x dimensions of the SpanSet

Template Parameters
PixelThe data-type for the ndarray
inANumber of dimension of the input array
inCNumber of guaranteed row-major contiguous dimensions, starting from the end
Parameters
inputThe ndarray from which the values will be taken

Definition at line 360 of file SpanSet.h.

◆ unflatten() [2/2]

template<typename PixelIn , typename PixelOut , int inA, int outC, int inC>
void lsst::afw::geom::SpanSet::unflatten ( ndarray::Array< PixelOut, inA+1, outC > const &  output,
ndarray::Array< PixelIn, inA, inC > const &  input,
lsst::geom::Point2I const &  xy0 = lsst::geom::Point2I() 
) const
inline

Expand an array by one spatial dimension at points given by SpanSet.

Take values from a lower dimensional array and insert them in an output array with one additional dimension at points defined by the SpanSet, offset by the lower left hand corner of the bounding box of the SpanSet. The first two dimensions of the output array will correspond to the y,x dimensions of the SpanSet

Template Parameters
PixelOutThe datatype for the output ndarray
PixelInThe datatype for the input ndarray
inANumber of dimensions of the input ndarray
outCNumber of guaranteed row-major contiguous dimensions in the output array, starting from the end
inCNumber of guaranteed row-major contiguous dimensions in the input array, starting from the end
Parameters
[out]outputThe 1d ndarray which will be populated with output parameters, will happen in place
[in]inputThe ndarray from which the values will be taken
[in]xy0A point object with is used as the origin point for the SpanSet coordinate system

Definition at line 397 of file SpanSet.h.

◆ union_() [1/2]

template<typename T >
std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::union_ ( image::Mask< T > const &  other,
bitmask 
) const

Determine the union between a SpanSet and a Mask for a given bit pattern.

Template Parameters
TPixel type of the Mask
Parameters
otherMask with which to calculate intersection
bitmaskThe bit value to consider when intersecting

Definition at line 961 of file SpanSet.cc.

◆ union_() [2/2]

std::shared_ptr< SpanSet > lsst::afw::geom::SpanSet::union_ ( SpanSet const &  other) const

Create a new SpanSet that contains all points from two SpanSets.

Parameters
otherThe SpanSet from which the union will be calculated

Definition at line 828 of file SpanSet.cc.

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager manager,
std::string const &  mode = "w" 
) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 29 of file Persistable.cc.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const &  fileName,
std::string const &  mode = "w" 
) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 24 of file Persistable.cc.

Friends And Related Function Documentation

◆ SpansSetFactory

friend class SpansSetFactory
friend

Definition at line 732 of file SpanSet.h.


The documentation for this class was generated from the following files: