LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > Class Template Reference

A set of pixels in an Image, including those pixels' actual values. More...

#include <HeavyFootprint.h>

Inheritance diagram for lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >:
lsst::afw::table::io::PersistableFacade< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > lsst::afw::detection::Footprint lsst::daf::base::Citizen lsst::afw::table::io::PersistableFacade< lsst::afw::detection::Footprint > lsst::afw::table::io::Persistable

Classes

class  Factory
 

Public Types

enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback) (const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback) (const Citizen *ptr)
 

Public Member Functions

 HeavyFootprint (Footprint const &foot, lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &mimage, HeavyFootprintCtrl const *ctrl=NULL)
 Create a HeavyFootprint from a regular Footprint and the image that provides the pixel values. More...
 
 HeavyFootprint (Footprint const &foot, HeavyFootprintCtrl const *ctrl=NULL)
 Create a HeavyFootprint from a regular Footprint, allocating space to hold foot.getArea() pixels, but not initializing them. More...
 
 HeavyFootprint ()=default
 Default constructor for HeavyFootprint. More...
 
 ~HeavyFootprint () override=default
 
 HeavyFootprint (HeavyFootprint const &other)=default
 
 HeavyFootprint (HeavyFootprint &&other)=default
 
HeavyFootprintoperator= (HeavyFootprint const &)=default
 
HeavyFootprintoperator= (HeavyFootprint &&)=default
 
bool isHeavy () const override
 Is this a HeavyFootprint (yes!) More...
 
void insert (lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage) const
 Replace all the pixels in the image with the values in the HeavyFootprint. More...
 
void insert (lsst::afw::image::Image< ImagePixelT > &image) const
 Replace all the pixels in the image with the values in the HeavyFootprint. More...
 
ndarray::Array< ImagePixelT, 1, 1 > getImageArray ()
 
ndarray::Array< MaskPixelT, 1, 1 > getMaskArray ()
 
ndarray::Array< VariancePixelT, 1, 1 > getVarianceArray ()
 
ndarray::Array< ImagePixelT const, 1, 1 > getImageArray () const
 
ndarray::Array< MaskPixelT const, 1, 1 > getMaskArray () const
 
ndarray::Array< VariancePixelT const, 1, 1 > getVarianceArray () const
 
MaskPixelT getMaskBitsSet () const
 
double dot (HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &other) const
 Dot product between HeavyFootprints. More...
 
std::shared_ptr< geom::SpanSetgetSpans () const
 Return a shared pointer to the SpanSet. More...
 
void setSpans (std::shared_ptr< geom::SpanSet > otherSpanSet)
 Sets the shared pointer to the SpanSet in the Footprint. More...
 
PeakCataloggetPeaks ()
 Return the Peaks contained in this Footprint. More...
 
const PeakCataloggetPeaks () const
 
std::shared_ptr< PeakRecordaddPeak (float fx, float fy, float value)
 Convenience function to add a peak. More...
 
void sortPeaks (afw::table::Key< float > const &key=afw::table::Key< float >())
 Sort Peaks from most positive value to most negative. More...
 
void setPeakSchema (afw::table::Schema const &peakSchema)
 Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty). More...
 
void setPeakCatalog (PeakCatalog const &otherPeaks)
 Set the peakCatalog to a copy of the supplied catalog. More...
 
std::size_t getArea () const
 Return the number of pixels in this Footprint. More...
 
lsst::geom::Point2D getCentroid () const
 Return the Footprint's centroid. More...
 
geom::ellipses::Quadrupole getShape () const
 Return the Footprint's shape (interpreted as an ellipse) More...
 
void shift (int dx, int dy)
 Shift a Footprint by (dx, dy) More...
 
void shift (lsst::geom::ExtentI const &d)
 Shift a Footprint by a given extent. More...
 
lsst::geom::Box2I getBBox () const
 Return the Footprint's bounding box. More...
 
lsst::geom::Box2I getRegion () const
 Return the corners of the MaskedImage the footprints live in. More...
 
void setRegion (lsst::geom::Box2I const &region)
 Set the corners of the MaskedImage wherein the footprints dwell. More...
 
void clipTo (lsst::geom::Box2I const &bbox)
 Clip the Footprint such that all values lie inside the supplied Bounding Box. More...
 
bool contains (lsst::geom::Point2I const &pix) const
 Tests if a pixel postion falls inside the Footprint. More...
 
std::shared_ptr< Footprinttransform (std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
 Transform the footprint from one WCS to another. More...
 
std::shared_ptr< Footprinttransform (lsst::geom::LinearTransform const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 Return a new Footprint whose pixels are the product of applying the specified transformation. More...
 
std::shared_ptr< Footprinttransform (lsst::geom::AffineTransform const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 Return a new Footprint whose pixels are the product of applying the specified transformation. More...
 
std::shared_ptr< Footprinttransform (geom::TransformPoint2ToPoint2 const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 Return a new Footprint whose pixels are the product of applying the specified transformation. More...
 
bool isPersistable () const noexcept override
 Report if this object is persistable. More...
 
void dilate (int r, geom::Stencil s=geom::Stencil::CIRCLE)
 Dilate the Footprint with a defined kernel. More...
 
void dilate (geom::SpanSet const &other)
 Dilate the Footprint with a defined kernel. More...
 
void erode (int r, geom::Stencil s=geom::Stencil::CIRCLE)
 Erode the Footprint with a defined kernel. More...
 
void erode (geom::SpanSet const &other)
 Erode the Footprint with a defined kernel. More...
 
void removeOrphanPeaks ()
 Remove peaks from the PeakCatalog that fall outside the area of the Footprint. More...
 
bool isContiguous () const
 Reports if the Footprint is simply connected or has multiple components. More...
 
std::vector< std::shared_ptr< Footprint > > split () const
 Split a multi-component Footprint into a vector of contiguous Footprints. More...
 
bool operator== (Footprint const &other) const
 equality operator More...
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. 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< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory. More...
 
static std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > dynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr. More...
 
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory. More...
 
static std::shared_ptr< lsst::afw::detection::FootprintdynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr. More...
 
Census

Provide a list of current Citizens

static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector< const Citizen * > * census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
callbackIDs

Set callback Ids.

The old Id is returned

static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
callbacks

Set the New/Delete callback functions; in each case the previously installed callback is returned.

These callback functions return a value which is Added to the previously registered id.

The default callback functions are called default{New,Delete}Callback; you may want to set a break point in these callbacks from your favourite debugger

static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. More...
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Protected Member Functions

std::string getPersistenceName () const override
 Return the name correspoinging ot the persistence type. More...
 
void write (OutputArchiveHandle &handle) const override
 Write an instance of a Footprint to an output Archive. More...
 
std::string getPythonModule () const override
 Return the python module the object will live in. More...
 

Static Protected Member Functions

static std::unique_ptr< FootprintreadSpanSet (afw::table::BaseCatalog const &, afw::table::io::InputArchive const &)
 Static method used to unpersist the SpanSet member of the Footprint class. More...
 
static void readPeaks (afw::table::BaseCatalog const &, Footprint &)
 Static method used to unpersist the PeakCatalog member of the Footprint class. More...
 

Detailed Description

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
class lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >

A set of pixels in an Image, including those pixels' actual values.

Definition at line 47 of file HeavyFootprint.h.

Member Typedef Documentation

◆ memCallback

typedef memId(* lsst::daf::base::Citizen::memCallback) (const Citizen *ptr)
inherited

Definition at line 61 of file Citizen.h.

◆ memId

typedef unsigned long lsst::daf::base::Citizen::memId
inherited

Type of the block's ID.

Definition at line 58 of file Citizen.h.

◆ memNewCallback

typedef memId(* lsst::daf::base::Citizen::memNewCallback) (const memId cid)
inherited

A function used to register a callback.

Definition at line 60 of file Citizen.h.

◆ OutputArchiveHandle

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

Definition at line 108 of file Persistable.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
magicSentinel 

Definition at line 88 of file Citizen.h.

Constructor & Destructor Documentation

◆ HeavyFootprint() [1/5]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprint ( Footprint const &  foot,
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  mimage,
HeavyFootprintCtrl const *  ctrl = NULL 
)
explicit

Create a HeavyFootprint from a regular Footprint and the image that provides the pixel values.

Parameters
footThe Footprint defining the pixels to set
mimageThe pixel values
ctrlControl how we manipulate HeavyFootprints
Note
the HeavyFootprintCtrl is passed by const* not const& so that we needn't provide a definition in the header.

Definition at line 75 of file HeavyFootprint.cc.

78  : Footprint(foot),
79  _image(ndarray::allocate(ndarray::makeVector(foot.getArea()))),
80  _mask(ndarray::allocate(ndarray::makeVector(foot.getArea()))),
81  _variance(ndarray::allocate(ndarray::makeVector(foot.getArea()))) {
82  HeavyFootprintCtrl ctrl_s = HeavyFootprintCtrl();
83 
84  if (!ctrl) {
85  ctrl = &ctrl_s;
86  }
87 
88  switch (ctrl->getModifySource()) {
90  getSpans()->flatten(_image, mimage.getImage()->getArray(), mimage.getXY0());
91  getSpans()->flatten(_mask, mimage.getMask()->getArray(), mimage.getXY0());
92  getSpans()->flatten(_variance, mimage.getVariance()->getArray(), mimage.getXY0());
93  break;
95  ImagePixelT const ival = ctrl->getImageVal();
96  MaskPixelT const mval = ctrl->getMaskVal();
97  VariancePixelT const vval = ctrl->getVarianceVal();
98 
99  getSpans()->applyFunctor(FlattenWithSetter<ImagePixelT>(ival), ndarray::ndFlat(_image),
100  ndarray::ndImage(mimage.getImage()->getArray(), mimage.getXY0()));
101  getSpans()->applyFunctor(FlattenWithSetter<MaskPixelT>(mval), ndarray::ndFlat(_mask),
102  ndarray::ndImage(mimage.getMask()->getArray(), mimage.getXY0()));
103  getSpans()->applyFunctor(FlattenWithSetter<VariancePixelT>(vval), ndarray::ndFlat(_variance),
104  ndarray::ndImage(mimage.getVariance()->getArray(), mimage.getXY0()));
105  break;
106  }
107  }
108 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
lsst::geom::Point2I getXY0() const
Return the image&#39;s origin.
Definition: MaskedImage.h:1122
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
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.
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
details::ImageNdGetter< T, inA, inB > ndImage(ndarray::Array< T, inA, inB > const &array, lsst::geom::Point2I xy0=lsst::geom::Point2I())
Marks a ndarray to be interpreted as an image when applying a functor from a SpanSet.
Footprint()
Constructor of a empty Footprint object.
Definition: Footprint.h:97

◆ HeavyFootprint() [2/5]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprint ( Footprint const &  foot,
HeavyFootprintCtrl const *  ctrl = NULL 
)
explicit

Create a HeavyFootprint from a regular Footprint, allocating space to hold foot.getArea() pixels, but not initializing them.

This is used when unpersisting a HeavyFootprint.

Parameters
footThe Footprint defining the pixels to set
ctrlControl how we manipulate HeavyFootprints

Definition at line 111 of file HeavyFootprint.cc.

113  : Footprint(foot),
114  _image(ndarray::allocate(ndarray::makeVector(foot.getArea()))),
115  _mask(ndarray::allocate(ndarray::makeVector(foot.getArea()))),
116  _variance(ndarray::allocate(ndarray::makeVector(foot.getArea()))) {}
Footprint()
Constructor of a empty Footprint object.
Definition: Footprint.h:97

◆ HeavyFootprint() [3/5]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprint ( )
default

Default constructor for HeavyFootprint.

Most common use for this will be in combination with the assignment operator

◆ ~HeavyFootprint()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::~HeavyFootprint ( )
overridedefault

◆ HeavyFootprint() [4/5]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprint ( HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &  other)
default

◆ HeavyFootprint() [5/5]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprint ( HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > &&  other)
default

Member Function Documentation

◆ addPeak()

std::shared_ptr< PeakRecord > lsst::afw::detection::Footprint::addPeak ( float  fx,
float  fy,
float  value 
)
inherited

Convenience function to add a peak.

Parameters
fxFloat containing the x position of a peak
fyFloat containing the y position of a peak
valueThe intensity value of the peak

Definition at line 50 of file Footprint.cc.

50  {
52  p->setIx(fx);
53  p->setIy(fy);
54  p->setFx(fx);
55  p->setFy(fy);
56  p->setPeakValue(height);
57  return p;
58 }
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition: Catalog.h:485

◆ census() [1/3]

int lsst::daf::base::Citizen::census ( int  ,
memId  startingMemId = 0 
)
staticinherited

How many active Citizens are there?

Parameters
startingMemIdDon't print Citizens with lower IDs

Definition at line 238 of file Citizen.cc.

240  {
241  if (startingMemId == 0) { // easy
242  ReadGuard guard(citizenLock);
243  return _activeCitizens.size();
244  }
245 
246  int n = 0;
247  ReadGuard guard(citizenLock);
248  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
249  if (cur->first->_CitizenId >= startingMemId) {
250  n++;
251  }
252  }
253 
254  return n;
255 }
T end(T... args)
T size(T... args)
T begin(T... args)

◆ census() [2/3]

void lsst::daf::base::Citizen::census ( std::ostream stream,
memId  startingMemId = 0 
)
staticinherited

Print a list of all active Citizens to stream, sorted by ID.

Parameters
streamstream to print to
startingMemIdDon't print Citizens with lower IDs

Definition at line 259 of file Citizen.cc.

261  {
262  ReadGuard guard(citizenLock);
263 
265 
266  for (std::vector<Citizen const*>::const_iterator citizen = leaks->begin(), end = leaks->end();
267  citizen != end; ++citizen) {
268  if ((*citizen)->getId() >= startingMemId) {
269  stream << (*citizen)->repr() << "\n";
270  }
271  }
272 }
STL class.
STL class.
T begin(T... args)
int end
static const std::vector< const Citizen * > * census()
Return a (newly allocated) std::vector of active Citizens sorted by ID.
Definition: Citizen.cc:287

◆ census() [3/3]

std::vector< dafBase::Citizen const * > const * lsst::daf::base::Citizen::census ( )
staticinherited

Return a (newly allocated) std::vector of active Citizens sorted by ID.

You are responsible for deleting it; or you can say std::unique_ptr<std::vector<Citizen const*> const> leaks(Citizen::census()); and not bother (that becomes std::unique_ptr in C++11)

Definition at line 287 of file Citizen.cc.

287  {
289  ReadGuard guard(citizenLock);
290  vec->reserve(_activeCitizens.size());
291 
292  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
293  vec->push_back(dynamic_cast<Citizen const*>(cur->first));
294  }
295 
296  std::sort(vec->begin(), vec->end(), cmpId);
297 
298  return vec;
299 }
T end(T... args)
T push_back(T... args)
T size(T... args)
STL class.
T begin(T... args)
T sort(T... args)
T reserve(T... args)

◆ clipTo()

void lsst::afw::detection::Footprint::clipTo ( lsst::geom::Box2I const &  bbox)
inherited

Clip the Footprint such that all values lie inside the supplied Bounding Box.

Parameters
bboxInteger box object that defines the boundaries the footprint should be clipped to.

Definition at line 77 of file Footprint.cc.

77  {
78  setSpans(getSpans()->clippedTo(box));
80 }
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:48
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition: Footprint.cc:139

◆ contains()

bool lsst::afw::detection::Footprint::contains ( lsst::geom::Point2I const &  pix) const
inherited

Tests if a pixel postion falls inside the Footprint.

Parameters
pixInteger point object defining the position of a pixel to test

Definition at line 82 of file Footprint.cc.

82 { return getSpans()->contains(pix); }
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117

◆ dilate() [1/2]

void lsst::afw::detection::Footprint::dilate ( int  r,
geom::Stencil  s = geom::Stencil::CIRCLE 
)
inherited

Dilate the Footprint with a defined kernel.

This function enlarges the SpanSet which defines the area of the Footprint by an amount governed by in input kernel

Parameters
rThe radius of the stencil object used to create a dilation kernel
sThe stencil object used to create the dilation kernel

Definition at line 125 of file Footprint.cc.

125 { setSpans(getSpans()->dilated(r, s)); }
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:48
solver_t * s
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117

◆ dilate() [2/2]

void lsst::afw::detection::Footprint::dilate ( geom::SpanSet const &  other)
inherited

Dilate the Footprint with a defined kernel.

This function enlarges the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
otherSpanSet to use as the kernel in dilation

Definition at line 127 of file Footprint.cc.

127 { setSpans(getSpans()->dilated(other)); }
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:48
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
ItemVariant const * other
Definition: Schema.cc:56

◆ dot()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
double lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::dot ( HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &  other) const

Dot product between HeavyFootprints.

The mask and variance planes are ignored.

Definition at line 155 of file HeavyFootprint.cc.

156  {
157  // Coordinated cycling through the iterators while juggling the offsets into the arrays
158  typedef typename ndarray::Array<ImagePixelT const, 1, 1>::Iterator ArrayIter;
159  ArrayIter lhsArray = getImageArray().begin(), rhsArray = rhs.getImageArray().begin();
160  auto lhsIter = getSpans()->begin(), rhsIter = rhs.getSpans()->begin();
161  auto const lhsEnd = getSpans()->end(), rhsEnd = rhs.getSpans()->end();
162  double sum = 0.0;
163  while (lhsIter != lhsEnd && rhsIter != rhsEnd) {
164  geom::Span const &lhsSpan = *lhsIter, rhsSpan = *rhsIter;
165  int const yLhs = lhsSpan.getY(), yRhs = rhsSpan.getY();
166  if (yLhs == yRhs) {
167  int const x0Lhs = lhsSpan.getX0(), x1Lhs = lhsSpan.getX1();
168  int const x0Rhs = rhsSpan.getX0(), x1Rhs = rhsSpan.getX1();
169  int const xMin = std::max(x0Lhs, x0Rhs), xMax = std::min(x1Lhs, x1Rhs);
170  if (xMin <= xMax) {
171  lhsArray += xMin - x0Lhs;
172  rhsArray += xMin - x0Rhs;
173  for (int x = xMin; x <= xMax; ++x, ++lhsArray, ++rhsArray) {
174  sum += (*lhsArray) * (*rhsArray);
175  }
176  // Rewind to the start of the span, for easier sync between spans and arrays
177  lhsArray -= xMax + 1 - x0Lhs;
178  rhsArray -= xMax + 1 - x0Rhs;
179  }
180  if (x1Lhs <= x1Rhs) {
181  lhsArray += lhsSpan.getWidth();
182  ++lhsIter;
183  } else {
184  rhsArray += rhsSpan.getWidth();
185  ++rhsIter;
186  }
187  continue;
188  } else if (yLhs < yRhs) {
189  while (lhsIter != lhsEnd && lhsIter->getY() < yRhs) {
190  lhsArray += lhsIter->getWidth();
191  ++lhsIter;
192  }
193  continue;
194  } else { // yLhs > yRhs
195  while (rhsIter != rhsEnd && rhsIter->getY() < yLhs) {
196  rhsArray += rhsIter->getWidth();
197  ++rhsIter;
198  }
199  continue;
200  }
201  }
202  return sum;
203 }
T min(T... args)
FastFinder::Iterator Iterator
Definition: FastFinder.cc:179
T max(T... args)
double x
ndarray::Array< ImagePixelT, 1, 1 > getImageArray()
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117

◆ dynamicCast() [1/2]

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 18 of file Persistable.cc.

18  {
20  if (!result) {
21  throw LSST_EXCEPT(pex::exceptions::TypeError, "Dynamic pointer cast failed");
22  }
23  return result;
24 }
uint64_t * ptr
Definition: RangeSet.cc:88
py::object result
Definition: schema.cc:418
T dynamic_pointer_cast(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ dynamicCast() [2/2]

template std::shared_ptr< meas::extensions::psfex::PsfexPsf > lsst::afw::table::io::PersistableFacade< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > >::dynamicCast ( std::shared_ptr< Persistable > const &  ptr)
staticinherited

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 18 of file Persistable.cc.

18  {
20  if (!result) {
21  throw LSST_EXCEPT(pex::exceptions::TypeError, "Dynamic pointer cast failed");
22  }
23  return result;
24 }
uint64_t * ptr
Definition: RangeSet.cc:88
py::object result
Definition: schema.cc:418
T dynamic_pointer_cast(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ erode() [1/2]

void lsst::afw::detection::Footprint::erode ( int  r,
geom::Stencil  s = geom::Stencil::CIRCLE 
)
inherited

Erode the Footprint with a defined kernel.

This function reduces the size of the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
rThe radius of the stencil object used to create a erosion kernel
sThe stencil object used to create the erosion kernel

Definition at line 129 of file Footprint.cc.

129  {
130  setSpans(getSpans()->eroded(r, s));
132 }
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:48
solver_t * s
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition: Footprint.cc:139

◆ erode() [2/2]

void lsst::afw::detection::Footprint::erode ( geom::SpanSet const &  other)
inherited

Erode the Footprint with a defined kernel.

This function reduces the size of the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
otherSpanSet to use as the kernel in erosion

Definition at line 134 of file Footprint.cc.

134  {
135  setSpans(getSpans()->eroded(other));
137 }
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:48
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
ItemVariant const * other
Definition: Schema.cc:56
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition: Footprint.cc:139

◆ getArea()

std::size_t lsst::afw::detection::Footprint::getArea ( ) const
inlineinherited

Return the number of pixels in this Footprint.

This function returns the real number of pixels, not the area of the bbox.

Definition at line 175 of file Footprint.h.

175 { return _spans->getArea(); }

◆ getBBox()

lsst::geom::Box2I lsst::afw::detection::Footprint::getBBox ( ) const
inlineinherited

Return the Footprint's bounding box.

Definition at line 210 of file Footprint.h.

210 { return _spans->getBBox(); }

◆ getCentroid()

lsst::geom::Point2D lsst::afw::detection::Footprint::getCentroid ( ) const
inlineinherited

Return the Footprint's centroid.

The centroid is calculated as the mean of the pixel centers

Definition at line 182 of file Footprint.h.

182 { return _spans->computeCentroid(); }

◆ getId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getId ( ) const
inherited

Return the Citizen's ID.

Definition at line 206 of file Citizen.cc.

206 { return _CitizenId; }

◆ getImageArray() [1/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ndarray::Array<ImagePixelT, 1, 1> lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getImageArray ( )
inline

Definition at line 107 of file HeavyFootprint.h.

107 { return _image; }

◆ getImageArray() [2/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ndarray::Array<ImagePixelT const, 1, 1> lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getImageArray ( ) const
inline

Definition at line 111 of file HeavyFootprint.h.

111 { return _image; }

◆ getMaskArray() [1/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ndarray::Array<MaskPixelT, 1, 1> lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getMaskArray ( )
inline

Definition at line 108 of file HeavyFootprint.h.

108 { return _mask; }

◆ getMaskArray() [2/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ndarray::Array<MaskPixelT const, 1, 1> lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getMaskArray ( ) const
inline

Definition at line 112 of file HeavyFootprint.h.

112 { return _mask; }

◆ getMaskBitsSet()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskPixelT lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getMaskBitsSet ( ) const
inline

Definition at line 116 of file HeavyFootprint.h.

116  {
117  MaskPixelT maskbits = 0;
118  for (typename ndarray::Array<MaskPixelT, 1, 1>::Iterator i = _mask.begin(); i != _mask.end(); ++i) {
119  maskbits |= *i;
120  }
121  return maskbits;
122  }
FastFinder::Iterator Iterator
Definition: FastFinder.cc:179

◆ getNextMemId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getNextMemId ( )
staticinherited

Return the memId of the next object to be allocated.

Definition at line 209 of file Citizen.cc.

209 { return _nextMemId(); }

◆ getPeaks() [1/2]

PeakCatalog& lsst::afw::detection::Footprint::getPeaks ( )
inlineinherited

Return the Peaks contained in this Footprint.

The peaks should be ordered by decreasing pixel intensity at the peak position (so the most negative peak appears last). Users that add new Peaks manually are responsible for maintaining this sorting.

Definition at line 131 of file Footprint.h.

131 { return _peaks; }

◆ getPeaks() [2/2]

const PeakCatalog& lsst::afw::detection::Footprint::getPeaks ( ) const
inlineinherited

Definition at line 132 of file Footprint.h.

132 { return _peaks; }

◆ getPersistenceName()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
std::string lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getPersistenceName ( ) const
overrideprotectedvirtual

Return the name correspoinging ot the persistence type.

Reimplemented from lsst::afw::detection::Footprint.

Definition at line 265 of file HeavyFootprint.cc.

265  {
266  return "HeavyFootprint" + ComputeSuffix<ImagePixelT, MaskPixelT, VariancePixelT>::apply();
267 }

◆ getPythonModule()

std::string lsst::afw::detection::Footprint::getPythonModule ( ) const
inlineoverrideprotectedvirtualinherited

Return the python module the object will live in.

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

Definition at line 364 of file Footprint.h.

364 { return "lsst.afw.detection"; }

◆ getRegion()

lsst::geom::Box2I lsst::afw::detection::Footprint::getRegion ( ) const
inlineinherited

Return the corners of the MaskedImage the footprints live in.

Definition at line 215 of file Footprint.h.

215 { return _region; }

◆ getShape()

geom::ellipses::Quadrupole lsst::afw::detection::Footprint::getShape ( ) const
inlineinherited

Return the Footprint's shape (interpreted as an ellipse)

The shape is determined by measuring the moments of the pixel centers about its centroid (cf. getCentroid)

Definition at line 190 of file Footprint.h.

190 { return _spans->computeShape(); }

◆ getSpans()

std::shared_ptr<geom::SpanSet> lsst::afw::detection::Footprint::getSpans ( ) const
inlineinherited

Return a shared pointer to the SpanSet.

Definition at line 117 of file Footprint.h.

117 { return _spans; }

◆ getVarianceArray() [1/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ndarray::Array<VariancePixelT, 1, 1> lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getVarianceArray ( )
inline

Definition at line 109 of file HeavyFootprint.h.

109 { return _variance; }

◆ getVarianceArray() [2/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ndarray::Array<VariancePixelT const, 1, 1> lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::getVarianceArray ( ) const
inline

Definition at line 113 of file HeavyFootprint.h.

113 { return _variance; }

◆ hasBeenCorrupted()

bool lsst::daf::base::Citizen::hasBeenCorrupted ( )
staticinherited

Check all allocated blocks for corruption.

Definition at line 316 of file Citizen.cc.

316  {
317  ReadGuard guard(citizenLock);
318  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
319  if (cur->first->_hasBeenCorrupted()) {
320  return true;
321  }
322  }
323  for (table::iterator cur = _persistentCitizens.begin(); cur != _persistentCitizens.end(); cur++) {
324  if (cur->first->_hasBeenCorrupted()) {
325  return true;
326  }
327  }
328 
329  return false;
330 }
T end(T... args)
T begin(T... args)

◆ init()

int lsst::daf::base::Citizen::init ( )
staticinherited

Called once when the memory system is being initialised.

Definition at line 196 of file Citizen.cc.

196  {
197  volatile int dummy = 1;
198  return dummy;
199 }

◆ insert() [1/2]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::insert ( lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &  mimage) const

Replace all the pixels in the image with the values in the HeavyFootprint.

Definition at line 119 of file HeavyFootprint.cc.

120  {
121  getSpans()->unflatten(mimage.getImage()->getArray(), _image, mimage.getXY0());
122  getSpans()->unflatten(mimage.getMask()->getArray(), _mask, mimage.getXY0());
123  getSpans()->unflatten(mimage.getVariance()->getArray(), _variance, mimage.getXY0());
124 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
lsst::geom::Point2I getXY0() const
Return the image&#39;s origin.
Definition: MaskedImage.h:1122
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117

◆ insert() [2/2]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::insert ( lsst::afw::image::Image< ImagePixelT > &  image) const

Replace all the pixels in the image with the values in the HeavyFootprint.

Parameters
[out]imageImage to set

Definition at line 127 of file HeavyFootprint.cc.

127  {
128  getSpans()->unflatten(image.getArray(), _image, image.getXY0());
129 }
lsst::geom::Point2I getXY0() const
Return the image&#39;s origin.
Definition: ImageBase.h:341
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117

◆ isContiguous()

bool lsst::afw::detection::Footprint::isContiguous ( ) const
inlineinherited

Reports if the Footprint is simply connected or has multiple components.

Definition at line 337 of file Footprint.h.

337 { return getSpans()->isContiguous(); };
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117

◆ isHeavy()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
bool lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::isHeavy ( ) const
inlineoverridevirtual

Is this a HeavyFootprint (yes!)

Reimplemented from lsst::afw::detection::Footprint.

Definition at line 93 of file HeavyFootprint.h.

93 { return true; }

◆ isPersistable()

bool lsst::afw::detection::Footprint::isPersistable ( ) const
inlineoverridevirtualnoexceptinherited

Report if this object is persistable.

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

Definition at line 285 of file Footprint.h.

285 { return true; }

◆ markPersistent()

void lsst::daf::base::Citizen::markPersistent ( void  )
inherited

Mark a Citizen as persistent and not destroyed until process end.

Definition at line 225 of file Citizen.cc.

225  {
226  WriteGuard guard(citizenLock);
227  _persistentCitizens[this] = _activeCitizens[this];
228  _activeCitizens.erase(this);
229 }
T erase(T... args)

◆ operator=() [1/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
HeavyFootprint& lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::operator= ( HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &  )
default

◆ operator=() [2/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
HeavyFootprint& lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::operator= ( HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > &&  )
default

◆ operator==()

bool lsst::afw::detection::Footprint::operator== ( Footprint const &  other) const
inherited

equality operator

Parameters
otherThe Footprint for which equality will be computed

Definition at line 165 of file Footprint.cc.

165  {
166  /* If the peakCatalogs are not the same length the Footprints can't be equal */
167  if (getPeaks().size() != other.getPeaks().size()) {
168  return false;
169  }
170  /* Check that for every peak in the PeakCatalog there is a corresponding peak
171  * in the other, and if not return false
172  */
173  for (auto const& selfPeak : getPeaks()) {
174  bool match = false;
175  for (auto const& otherPeak : other.getPeaks()) {
176  if (selfPeak.getI() == otherPeak.getI() && selfPeak.getF() == otherPeak.getF() &&
177  selfPeak.getPeakValue() == otherPeak.getPeakValue()) {
178  match = true;
179  break;
180  }
181  }
182  if (!match) {
183  return false;
184  }
185  }
186  /* At this point the PeakCatalogs have evaluated true, compare the SpanSets
187  */
188  return *(getSpans()) == *(other.getSpans());
189 }
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
ItemVariant const * other
Definition: Schema.cc:56
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131

◆ readFits() [1/6]

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.

183  {
184  return dynamicCast(Persistable::_readFits(fitsfile));
185  }
static std::shared_ptr< lsst::afw::detection::Footprint > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [2/6]

static std::shared_ptr<HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > lsst::afw::table::io::PersistableFacade< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > >::readFits ( fits::Fits fitsfile)
inlinestaticinherited

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.

183  {
184  return dynamicCast(Persistable::_readFits(fitsfile));
185  }
static std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [3/6]

static std::shared_ptr<HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > lsst::afw::table::io::PersistableFacade< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > >::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.

194  {
195  return dynamicCast(Persistable::_readFits(fileName, hdu));
196  }
static std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [4/6]

static std::shared_ptr<lsst::afw::detection::Footprint > lsst::afw::table::io::PersistableFacade< lsst::afw::detection::Footprint >::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.

194  {
195  return dynamicCast(Persistable::_readFits(fileName, hdu));
196  }
static std::shared_ptr< lsst::afw::detection::Footprint > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [5/6]

static std::shared_ptr<lsst::afw::detection::Footprint > lsst::afw::table::io::PersistableFacade< lsst::afw::detection::Footprint >::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.

205  {
206  return dynamicCast(Persistable::_readFits(manager, hdu));
207  }
static std::shared_ptr< lsst::afw::detection::Footprint > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [6/6]

static std::shared_ptr<HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > lsst::afw::table::io::PersistableFacade< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > >::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.

205  {
206  return dynamicCast(Persistable::_readFits(manager, hdu));
207  }
static std::shared_ptr< HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readPeaks()

void lsst::afw::detection::Footprint::readPeaks ( afw::table::BaseCatalog const &  peakCat,
Footprint loadedFootprint 
)
staticprotectedinherited

Static method used to unpersist the PeakCatalog member of the Footprint class.

Definition at line 302 of file Footprint.cc.

302  {
303  using namespace std::string_literals;
304  if (!peakCat.getSchema().contains(PeakTable::makeMinimalSchema())) {
305  // need to handle an older form of Peak persistence for backwards compatibility
306  afw::table::SchemaMapper mapper(peakCat.getSchema());
307  mapper.addMinimalSchema(PeakTable::makeMinimalSchema());
308  afw::table::Key<float> oldX = peakCat.getSchema()["x"];
309  afw::table::Key<float> oldY = peakCat.getSchema()["y"];
310  afw::table::Key<float> oldPeakValue = peakCat.getSchema()["value"];
311  mapper.addMapping(oldX, "f.x"s);
312  mapper.addMapping(oldY, "f.y"s);
313  mapper.addMapping(oldPeakValue, "peakValue"s);
314  loadedFootprint.setPeakSchema(mapper.getOutputSchema());
315  auto peaks = loadedFootprint.getPeaks();
316  peaks.reserve(peakCat.size());
317  for (auto const& peak : peakCat) {
318  auto newPeak = peaks.addNew();
319  newPeak->assign(peak, mapper);
320  newPeak->setIx(static_cast<int>(newPeak->getFx()));
321  newPeak->setIy(static_cast<int>(newPeak->getFy()));
322  }
323  return;
324  }
325  loadedFootprint.setPeakSchema(peakCat.getSchema());
326  auto& peaks = loadedFootprint.getPeaks();
327  peaks.reserve(peakCat.size());
328  for (auto const& peak : peakCat) {
329  peaks.addNew()->assign(peak);
330  }
331 }
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition: Peak.h:137
solver_t * s
SchemaMapper * mapper
Definition: SchemaMapper.cc:78

◆ readSpanSet()

std::unique_ptr< Footprint > lsst::afw::detection::Footprint::readSpanSet ( afw::table::BaseCatalog const &  catalog,
afw::table::io::InputArchive const &  archive 
)
staticprotectedinherited

Static method used to unpersist the SpanSet member of the Footprint class.

Definition at line 278 of file Footprint.cc.

279  {
280  int fieldCount = catalog.getSchema().getFieldCount();
281  LSST_ARCHIVE_ASSERT(fieldCount == 1 || fieldCount == 3);
282  std::shared_ptr<geom::SpanSet> loadedSpanSet;
283  if (fieldCount == 1) {
284  // This is a new style footprint with a SpanSet as a member, treat accordingly
285  auto const schemaAndKey = spanSetPersistenceHelper();
286  int persistedSpanSetId = catalog.front().get(schemaAndKey.second);
287  loadedSpanSet = std::dynamic_pointer_cast<geom::SpanSet>(archive.get(persistedSpanSetId));
288  } else {
289  // This block is for an old style footprint load.
290  auto const& keys = LegacyFootprintPersistenceHelper::get();
291  std::vector<geom::Span> tempVec;
292  tempVec.reserve(catalog.size());
293  for (auto const& val : catalog) {
294  tempVec.push_back(geom::Span(val.get(keys.spanY), val.get(keys.spanX0), val.get(keys.spanX1)));
295  }
296  loadedSpanSet = std::make_shared<geom::SpanSet>(std::move(tempVec));
297  }
298  auto loadedFootprint = std::unique_ptr<Footprint>(new Footprint(loadedSpanSet));
299  return loadedFootprint;
300 }
ImageT val
Definition: CR.cc:146
T push_back(T... args)
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
T dynamic_pointer_cast(T... args)
T move(T... args)
STL class.
STL class.
Footprint()
Constructor of a empty Footprint object.
Definition: Footprint.h:97
T reserve(T... args)

◆ removeOrphanPeaks()

void lsst::afw::detection::Footprint::removeOrphanPeaks ( )
inherited

Remove peaks from the PeakCatalog that fall outside the area of the Footprint.

Definition at line 139 of file Footprint.cc.

139  {
140  for (auto iter = getPeaks().begin(); iter != getPeaks().end(); ++iter) {
141  if (!getSpans()->contains(lsst::geom::Point2I(iter->getIx(), iter->getIy()))) {
142  iter = getPeaks().erase(iter);
143  --iter;
144  }
145  }
146 }
iterator end()
Iterator access.
Definition: Catalog.h:397
iterator erase(iterator pos)
Erase the record pointed to by pos, and return an iterator the next record.
Definition: Catalog.h:560
T begin(T... args)
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131

◆ repr()

std::string lsst::daf::base::Citizen::repr ( ) const
inherited

Return a string representation of a Citizen.

Definition at line 219 of file Citizen.cc.

219  {
220  return boost::str(boost::format("%d: %08x %s") % _CitizenId % this %
221  lsst::utils::demangleType(_typeName));
222 }
std::string demangleType(std::string const _typeName)
Definition: Demangle.cc:113
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168

◆ setCorruptionCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setCorruptionCallback ( Citizen::memCallback  func)
staticinherited

Set the CorruptionCallback function.

Parameters
funcfunction be called when block is found to be corrupted

Definition at line 391 of file Citizen.cc.

393  {
394  Citizen::memCallback old = _corruptionCallback;
395  _corruptionCallback = func;
396 
397  return old;
398 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:61

◆ setDeleteCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setDeleteCallback ( Citizen::memCallback  func)
staticinherited

Set the DeleteCallback function.

Parameters
funcfunction be called when desired block is deleted

Definition at line 381 of file Citizen.cc.

383  {
384  Citizen::memCallback old = _deleteCallback;
385  _deleteCallback = func;
386 
387  return old;
388 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:61

◆ setDeleteCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setDeleteCallbackId ( Citizen::memId  id)
staticinherited

Call the current DeleteCallback when block is deleted.

Parameters
idDesired ID

Definition at line 347 of file Citizen.cc.

348  {
349  WriteGuard guard(citizenLock);
350  Citizen::memId oldId = _deleteId;
351  _deleteId = id;
352 
353  return oldId;
354 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:58
table::Key< int > id
Definition: Detector.cc:166

◆ setNewCallback()

dafBase::Citizen::memNewCallback lsst::daf::base::Citizen::setNewCallback ( Citizen::memNewCallback  func)
staticinherited

Set the NewCallback function.

Parameters
funcThe new function to be called when a designated block is allocated

Definition at line 371 of file Citizen.cc.

373  {
374  Citizen::memNewCallback old = _newCallback;
375  _newCallback = func;
376 
377  return old;
378 }
memId(* memNewCallback)(const memId cid)
A function used to register a callback.
Definition: Citizen.h:60

◆ setNewCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setNewCallbackId ( Citizen::memId  id)
staticinherited

Call the NewCallback when block is allocated.

Parameters
idDesired ID

Definition at line 337 of file Citizen.cc.

338  {
339  WriteGuard guard(citizenLock);
340  Citizen::memId oldId = _newId;
341  _newId = id;
342 
343  return oldId;
344 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:58
table::Key< int > id
Definition: Detector.cc:166

◆ setPeakCatalog()

void lsst::afw::detection::Footprint::setPeakCatalog ( PeakCatalog const &  otherPeaks)
inherited

Set the peakCatalog to a copy of the supplied catalog.

PeakCatalog will be copied into the Footprint, but a PeakCatalog is a shallow copy, so records will not be duplicated. This function will throw an error if the PeakCatalog of *this is not empty.

Parameters
otherPeaksThe PeakCatalog to copy

Definition at line 425 of file Footprint.cc.

425  {
426  if (!getPeaks().empty()) {
427  throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot change the PeakCatalog unless it is empty");
428  }
429  // this syntax doesn't work in Python, which is why this method has to exist
430  getPeaks() = otherPeaks;
431 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131

◆ setPeakSchema()

void lsst::afw::detection::Footprint::setPeakSchema ( afw::table::Schema const &  peakSchema)
inherited

Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).

Parameters
peakSchemaThe schema to use in the PeakCatalog
Exceptions
pex::exceptions::LogicErrorThrown if if the PeakCatalog is not empty

Definition at line 421 of file Footprint.cc.

421  {
422  setPeakCatalog(PeakCatalog(peakSchema));
423 }
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition: Peak.h:244
void setPeakCatalog(PeakCatalog const &otherPeaks)
Set the peakCatalog to a copy of the supplied catalog.
Definition: Footprint.cc:425

◆ setRegion()

void lsst::afw::detection::Footprint::setRegion ( lsst::geom::Box2I const &  region)
inlineinherited

Set the corners of the MaskedImage wherein the footprints dwell.

Parameters
regionA box describing the corners of the Image the Footprint derives from

Definition at line 222 of file Footprint.h.

222 { _region = region; }

◆ setSpans()

void lsst::afw::detection::Footprint::setSpans ( std::shared_ptr< geom::SpanSet otherSpanSet)
inherited

Sets the shared pointer to the SpanSet in the Footprint.

Parameters
otherSpanSetShared pointer to a SpanSet

Definition at line 48 of file Footprint.cc.

48 { _spans = otherSpanSet; }

◆ shift() [1/2]

void lsst::afw::detection::Footprint::shift ( int  dx,
int  dy 
)
inherited

Shift a Footprint by (dx, dy)

Parameters
dxHow much to move Footprint in column direction
dyHow much to move in row direction

Definition at line 67 of file Footprint.cc.

67  {
68  setSpans(getSpans()->shiftedBy(dx, dy));
69  for (auto& peak : getPeaks()) {
70  peak.setIx(peak.getIx() + dx);
71  peak.setIy(peak.getIy() + dy);
72  peak.setFx(peak.getFx() + dx);
73  peak.setFy(peak.getFy() + dy);
74  }
75 }
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:48
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131

◆ shift() [2/2]

void lsst::afw::detection::Footprint::shift ( lsst::geom::ExtentI const &  d)
inlineinherited

Shift a Footprint by a given extent.

Parameters
dExtentI object which gives the dimensions the Footprint should be shifted

Definition at line 205 of file Footprint.h.

205 { shift(d.getX(), d.getY()); }
void shift(int dx, int dy)
Shift a Footprint by (dx, dy)
Definition: Footprint.cc:67

◆ sortPeaks()

void lsst::afw::detection::Footprint::sortPeaks ( afw::table::Key< float > const &  key = afw::table::Key<float>())
inherited

Sort Peaks from most positive value to most negative.

If the key passed is invalid (the default) PeakTable::getPeakValueKey() will be used.

Parameters
keyA key corresponding to the field in the Schema the PeakCatalog is to be sorted by.

Definition at line 60 of file Footprint.cc.

60  {
61  auto validatedKey = key.isValid() ? key : PeakTable::getPeakValueKey();
62  getPeaks().sort([&validatedKey](detection::PeakRecord const& a, detection::PeakRecord const& b) {
63  return a.get(validatedKey) > b.get(validatedKey);
64  });
65 }
table::Key< int > b
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
Definition: Catalog.h:749
table::Key< int > a
static afw::table::Key< float > getPeakValueKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:169
Key< U > key
Definition: Schema.cc:281
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131

◆ split()

std::vector< std::shared_ptr< Footprint > > lsst::afw::detection::Footprint::split ( ) const
inherited

Split a multi-component Footprint into a vector of contiguous Footprints.

Split a multi-component Footprint such that each Footprint in the output vector is contiguous and contains only peaks that can be found within the bounds of the Footprint

Definition at line 148 of file Footprint.cc.

148  {
149  auto splitSpanSets = getSpans()->split();
151  footprintList.reserve(splitSpanSets.size());
152  for (auto& spanPtr : splitSpanSets) {
153  auto tmpFootprintPointer = std::make_shared<Footprint>(spanPtr, getPeaks().getSchema(), getRegion());
154  tmpFootprintPointer->_peaks = getPeaks();
155  // No need to remove any peaks, as there is only one Footprint, so it will
156  // simply be a copy of the original
157  if (splitSpanSets.size() > 1) {
158  tmpFootprintPointer->removeOrphanPeaks();
159  }
160  footprintList.push_back(std::move(tmpFootprintPointer));
161  }
162  return footprintList;
163 }
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:117
T push_back(T... args)
T move(T... args)
STL class.
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131
lsst::geom::Box2I getRegion() const
Return the corners of the MaskedImage the footprints live in.
Definition: Footprint.h:215
T reserve(T... args)

◆ transform() [1/4]

std::shared_ptr< Footprint > lsst::afw::detection::Footprint::transform ( std::shared_ptr< geom::SkyWcs source,
std::shared_ptr< geom::SkyWcs target,
lsst::geom::Box2I const &  region,
bool  doClip = true 
) const
inherited

Transform the footprint from one WCS to another.

Parameters
sourceWcs that defines the coordinate system of the input footprint.
targetWcs that defines that desired coordinate system of the returned footprint.
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 84 of file Footprint.cc.

86  {
87  auto srcToTarget = geom::makeWcsPairTransform(*source, *target);
88  return transform(*srcToTarget, region, doClip);
89 }
std::shared_ptr< Footprint > transform(std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
Transform the footprint from one WCS to another.
Definition: Footprint.cc:84
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
Definition: SkyWcs.cc:152

◆ transform() [2/4]

std::shared_ptr< Footprint > lsst::afw::detection::Footprint::transform ( lsst::geom::LinearTransform const &  t,
lsst::geom::Box2I const &  region,
bool  doClip = true 
) const
inherited

Return a new Footprint whose pixels are the product of applying the specified transformation.

Parameters
tA linear transform object which will be used to map the pixels
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 91 of file Footprint.cc.

92  {
93  return transform(lsst::geom::AffineTransform(t), region, doClip);
94 }
An affine coordinate transformation consisting of a linear transformation and an offset.
std::shared_ptr< Footprint > transform(std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
Transform the footprint from one WCS to another.
Definition: Footprint.cc:84

◆ transform() [3/4]

std::shared_ptr< Footprint > lsst::afw::detection::Footprint::transform ( lsst::geom::AffineTransform const &  t,
lsst::geom::Box2I const &  region,
bool  doClip = true 
) const
inherited

Return a new Footprint whose pixels are the product of applying the specified transformation.

Parameters
tAn affine transform object which will be used to map the pixels
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 96 of file Footprint.cc.

97  {
98  return transform(*geom::makeTransform(t), region, doClip);
99 }
std::shared_ptr< Footprint > transform(std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
Transform the footprint from one WCS to another.
Definition: Footprint.cc:84
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.

◆ transform() [4/4]

std::shared_ptr< Footprint > lsst::afw::detection::Footprint::transform ( geom::TransformPoint2ToPoint2 const &  t,
lsst::geom::Box2I const &  region,
bool  doClip = true 
) const
inherited

Return a new Footprint whose pixels are the product of applying the specified transformation.

Parameters
tA 2-D transform which will be used to map the pixels
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 101 of file Footprint.cc.

102  {
103  // Transfrom the SpanSet first
104  auto transformedSpan = getSpans()->transformedBy(t);
105  // Use this new SpanSet and the peakSchema to create a new Footprint
106  auto newFootprint = std::make_shared<Footprint>(transformedSpan, getPeaks().getSchema(), region);
107  // now populate the new Footprint with transformed Peaks
109  peakPosList.reserve(_peaks.size());
110  for (auto const& peak : getPeaks()) {
111  peakPosList.emplace_back(peak.getF());
112  }
113  auto newPeakPosList = t.applyForward(peakPosList);
114  auto newPeakPos = newPeakPosList.cbegin();
115  for (auto peak = getPeaks().cbegin(), endPeak = getPeaks().cend(); peak != endPeak;
116  ++peak, ++newPeakPos) {
117  newFootprint->addPeak(newPeakPos->getX(), newPeakPos->getY(), peak->getPeakValue());
118  }
119  if (doClip) {
120  newFootprint->clipTo(region);
121  }
122  return newFootprint;
123 }
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:117
STL class.
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:117
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:131
T reserve(T... args)

◆ write()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::write ( OutputArchiveHandle handle) const
overrideprotectedvirtual

Write an instance of a Footprint to an output Archive.

Reimplemented from lsst::afw::detection::Footprint.

Definition at line 270 of file HeavyFootprint.cc.

270  {
271  HeavyFootprintPersistenceHelper<ImagePixelT, MaskPixelT, VariancePixelT> const& keys =
272  HeavyFootprintPersistenceHelper<ImagePixelT, MaskPixelT, VariancePixelT>::get();
273  // delegate to Footprint::write to handle spans and peaks
274  Footprint::write(handle);
275  // add one more catalog for pixel values
276  afw::table::BaseCatalog cat = handle.makeCatalog(keys.schema);
277  std::shared_ptr<afw::table::BaseRecord> record = cat.addNew();
278  // We could deep-copy the arrays instead of const-casting them, which might be marginally safer,
279  // but we always save an OutputArchive to disk immediately after we create it, so there's really
280  // no chance that we could get the HeavyFootprint in trouble by having this view modified.
281  record->set(keys.image, ndarray::const_array_cast<ImagePixelT>(getImageArray()));
282  record->set(keys.mask, ndarray::const_array_cast<MaskPixelT>(getMaskArray()));
283  record->set(keys.variance, ndarray::const_array_cast<VariancePixelT>(getVarianceArray()));
284  handle.saveCatalog(cat);
285 }
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:71
ndarray::Array< MaskPixelT, 1, 1 > getMaskArray()
ndarray::Array< VariancePixelT, 1, 1 > getVarianceArray()
void write(OutputArchiveHandle &handle) const override
Write an instance of a Footprint to an output Archive.
Definition: Footprint.cc:263
ndarray::Array< ImagePixelT, 1, 1 > getImageArray()

◆ writeFits() [1/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.

24  {
25  fits::Fits fitsfile(fileName, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
26  writeFits(fitsfile);
27 }
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
Definition: Persistable.cc:24

◆ 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.

29  {
30  fits::Fits fitsfile(manager, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
31  writeFits(fitsfile);
32 }
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
Definition: Persistable.cc:24

◆ writeFits() [3/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.

18  {
19  OutputArchive archive;
20  archive.put(this);
21  archive.writeFits(fitsfile);
22 }

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