Blob/Source API¶
These classes define image pixel data structure.
Defined in src/imgproc/Pixel.h
-
class Caesar::Pixel : public TObject¶
Public Types
Public Functions
-
Pixel()¶
Class constructor: initialize structures.
-
Pixel(long int _gbin, long int _ix, long int _iy, double _x, double _y, double _S)¶
Parametric constructor.
-
virtual ~Pixel()¶
Class destructor: free allocated memory.
-
void Copy(TObject &pixel) const¶
Copy method.
-
inline void SetPhysCoords(double xx, double yy)¶
Set physical coordinates.
-
inline void SetCoords(long int i, long int j)¶
Set coordinates.
-
inline void SetBkg(double bkg, double noise)¶
Set bkg and rms value.
-
inline void SetCurv(double val)¶
Set curvature information.
-
inline void SetEdge(double val)¶
Set edgeness information.
-
inline std::pair<double, double> GetBkg()¶
Get bkg and noise.
-
inline double GetCurv()¶
Get curvature information.
-
inline double GetEdge()¶
Get edgeness information.
-
inline void Print()¶
Dump pixel info.
-
Pixel()¶
This class defines contour (point collection) data structure.
Defined in src/imgproc/Contour.h
-
class Caesar::Contour : public TObject¶
Public Functions
-
Contour()¶
Class constructor: initialize structures.
-
virtual ~Contour()¶
Class destructor: free allocated memory.
-
void Copy(TObject &contour) const¶
Copy method.
-
inline int GetN()¶
Get number of points.
-
inline bool HasPoints()¶
Check if contour has points.
-
inline void SetPoints(Points p)¶
Set contour points.
-
inline Points GetPoints()¶
Get contour points.
-
inline TVector2 *GetPoint(int i)¶
Get contour point with given index.
-
TVector2 *FindPoint(double x, double y, double tol = 0)¶
Find point (with tolerance)
-
bool IsPointInsideContour(double x, double y)¶
Check if point is inside contour.
-
int ApplyOffset(double offsetX, double offsetY)¶
Apply offset to points and centroid.
-
inline int GetPointXY(double &x, double &y, int i)¶
Get contour point x & y.
-
inline void AddPoint(TVector2 p)¶
Add contour points.
-
inline int SortPointsCounterClockWise()¶
Sort points counter-clockwise.
-
inline void Reset()¶
Reset contour.
-
TGraph *GetGraph(bool addLastPoint = true)¶
Return a graph object with contour points.
-
TPolyLine *GetBoundingBoxLine()¶
Return a polyline object with bounding box.
-
TPaveText *GetParamInfoBox()¶
Return a info box with parameter values.
-
int ComputeParameters()¶
Compute contour parameters.
-
void ComputeShapeParams(std::vector<cv::Point2f> const &points)¶
Compute shape parameters.
-
void ComputeMomentParams(std::vector<cv::Point2f> const &points)¶
Compute moments pars.
-
int ComputeFittedEllipse()¶
Compute fitted ellipse.
-
TEllipse *GetFittedEllipse()¶
Return an ellipse object fitted to contour.
-
void ComputeFourierDescriptors()¶
Compute Fourier descriptors.
-
void ComputeCentroidDistanceFD()¶
Compute centroid distance FD.
-
void ComputeBendingEnergy()¶
Compute bending energy.
-
inline void Dump()¶
Dump.
-
inline void Log(std::string level = "INFO")¶
Log.
-
inline std::string GetPrintable()¶
GetPrintable.
-
Contour()¶
This class defines an image blob data structure.
Defined in src/imgproc/Blob.h
-
class Caesar::Blob : public TNamed
Subclassed by Caesar::Region, Caesar::Source
Public Functions
-
Blob()
Class constructor: initialize structures.
-
Blob(std::string name)
Parametric constructor.
-
Blob(std::vector<Pixel*> const &pixels, std::string name = "")
Parametric constructor.
-
Blob(const Blob &blob)
Copy constructor.
-
virtual ~Blob()
Class destructor: free allocated memory.
-
void Copy(TObject &blob) const
Copy method.
-
inline void SetId(int id)
Set blob id.
-
inline void SetName(std::string name)
Set blob name.
-
inline bool IsAtEdge()
Is blob at image edge.
-
inline void SetEdgeFlag(bool choice)
Set edge flag.
-
inline int SetImageMetaData(ImgMetaData *data, double crpix1Offset = 0, double crpix2Offset = 0)
Set image metadata.
-
inline ImgMetaData *GetImageMetaData()
get image metadata
-
inline bool HasImageMetaData()
Set image metadata.
-
inline long int GetNPixels()
Get number of pixels.
-
inline const PixelCollection &GetPixels() const
Get pixel collection.
-
inline void SetPixels(PixelCollection &pixels)
Set pixel collection.
-
int AddPixel(Pixel *pixel, bool makeCopy = false)
Add a pixel to collection.
-
inline bool HasPixels()
Has pixels stored?
-
inline Pixel *GetPixel(int index)
Get access to pixel by index.
-
inline std::vector<int> GetSeedPixelIndexes()
Get access to seed pixel indexes.
-
inline Pixel *GetSeedPixel()
Find and return largest-significance seed pixel.
-
inline void MarkHaloPixels(double ZThr)
Mark pixels with significance within given thresholds as halo pixels.
-
int ComputeStats(bool computeRobustStats = true, bool forceRecomputing = false, bool useParallelMedian = false)
Compute stats.
-
inline bool HasStats()
Has stats?
-
inline void SetHasStats(bool value)
Has stats?
-
int ComputeMorphologyParams()
Compute morphology parameters.
-
int ComputeZernikeMoments(int order = 6)
Compute Zernike moments.
-
inline bool HasParameters()
Has morphology parameters computed.
-
inline void SetHasParameters(bool value)
Set has morphology pars.
-
inline double GetM1()
Get 1st pixel moment (= mean)
-
inline void SetM1(double value)
Set 1st pixel moment (= mean)
-
inline double GetM2()
Get 2nd pixel moment.
-
inline void SetM2(double value)
Set 2nd pixel moment.
-
inline double GetM3()
Get 3rd pixel moment.
-
inline void SetM3(double value)
Set 3rd pixel moment.
-
inline double GetM4()
Get 4th pixel moment.
-
inline void SetM4(double value)
Set 4th pixel moment.
-
inline double GetM1Curv()
Get 1st pixel curvature moment (= mean)
-
inline void SetM1Curv(double value)
Set 1st pixel curvature moment (= mean)
-
inline double GetM2Curv()
Get 2nd pixel curvature moment.
-
inline void SetM2Curv(double value)
Set 2nd pixel curvature moment.
-
inline double GetS()
Get pixel flux sum.
-
inline void SetS(double value)
Set pixel flux sum.
-
inline double GetSmax() const
Get pixel flux max.
-
inline void SetSmax(double value)
Set pixel flux max.
-
inline double GetSmin() const
Get pixel flux min.
-
inline void SetSmin(double value)
Set pixel flux min.
-
inline double GetSxx()
Get pixel flux XX correlation.
-
inline void SetSxx(double value)
Set pixel flux XX correlation.
-
inline double GetSyy()
Get pixel flux YY correlation.
-
inline void SetSyy(double value)
Get pixel flux YY correlation.
-
inline double GetSxy()
Get pixel flux XY correlation.
-
inline void SetSxy(double value)
Set pixel flux XY correlation.
-
inline double GetSx()
Get pixel flux sum weighted by position x.
-
inline void SetSx(double value)
Set pixel flux sum weighted by position x.
-
inline double GetSy()
Get pixel flux sum weighted by position y.
-
inline void SetSy(double value)
Set pixel flux sum weighted by position y.
-
inline long int GetSmaxPixId()
Get id of maximum flux pixel.
-
inline void SetSmaxPixId(long int value)
Set id of maximum flux pixel.
-
inline long int GetSminPixId()
Get id of minimum flux pixel.
-
inline void SetSminPixId(long int value)
Set id of minimum flux pixel.
-
inline double GetScurv()
Get pixel sum of curvature.
-
inline void SetScurv(double value)
Set pixel sum of curvature.
-
inline double GetSedge()
Get pixel sum of edgeness.
-
inline void SetSedge(double value)
Set pixel sum of edgeness.
-
inline void GetSourceRange(float &xmin, float &xmax, float &ymin, float &ymax)
Get source x-y range.
-
inline long int GetXmin()
Get source pixel x_min.
-
inline long int GetXmax()
Get source pixel x_max.
-
inline long int GetYmin()
Get source pixel y_min.
-
inline long int GetYmax()
Get source pixel y_max.
-
inline void SetSourceRange(float xmin, float xmax, float ymin, float ymax)
Set source x-y range.
-
inline void GetSourcePixelRange(long int &ixmin, long int &ixmax, long int &iymin, long int &iymax)
Get source pixel coordinate range.
-
inline long int GetIxMin()
Get source pixel ix_min.
-
inline long int GetIxMax()
Get source pixel ix_max.
-
inline long int GetIyMin()
Get source pixel iy_min.
-
inline long int GetIyMax()
Get source pixel iy_max.
-
inline void SetSourcePixelRange(long int ixmin, long int ixmax, long int iymin, long int iymax)
Set source pixel coordinate range.
-
int GetSampleStdDev(double &sigmaX, double &sigmaY, double &covXY)
Get sample source standard deviations.
-
inline void Print()
Dump blob info.
-
Image *GetImage(ImgType mode, int pixMargin = 1, bool includeHaloPixels = false)
Generate an image from source pixel.
-
TH2D *GetWCSHisto(ImgType mode, int pixMargin = 1, int coordSyst = -1)
Generate an image from source pixel.
-
Image *GetNestedBlobMask(Image *sourceImage = 0, int pixMargin = 1, double nestedBlobMinScale = 1, double nestedBlobMaxScale = 3, double nestedBlobScaleStep = 1, double nestedBlobPeakZThr = 5, double nestedBlobPeakZMergeThr = 2.5, int NMinPix = 5, double nestedBlobThrFactor = 0, double nestedBlobKernFactor = 6)
Get blob mask.
-
inline bool HasContours()
Has contours.
-
inline std::vector<Contour*> GetContours()
Return contours.
NB: Do not delete pointers.
-
inline Contour *GetContour(int index)
Return contour with index.
-
std::vector<Contour*> GetWCSContours(WCS *wcs = 0, int coordSystem = -1, double pixOffset = 0, bool computePars = false, bool castCoordsToInt = false)
Return contours converted in WCS.
-
Contour *GetWCSContour(int index, WCS *wcs = 0, int coordSystem = -1, double pixOffset = 0, bool computePars = false, bool castCoordsToInt = false)
Return contour with index and convert to WCS.
-
inline void AddContour(Contour *aContour)
Add contour.
-
bool IsPointOnContour(double x, double y, double tol = 1)
Is point on contour?
-
inline double GetBkgSum()
Get bkg sum.
-
inline double GetBkgRMSSum()
Get bkg rms sum.
-
inline void SetBkgSum(double bkg)
Set bkg sum (USED BY SERIALIZER)
-
inline void SetBkgRMSSum(double rms)
Set bkg rms sum (USED BY SERIALIZER)
-
inline bool HasBoxBkgInfo()
Check if bkg info in a box around the blob has ben set.
-
inline void SetHasBoxBkgInfo(bool flag)
Set has box bkg info flag (USED BY SERIALIZER)
-
inline double GetBoxBkg()
Get bkg estimate in a box around the blob.
-
inline double GetBoxBkgRMS()
Get bkg rms estimate in a box around the blob.
-
inline void SetBoxBkgInfo(double bkg, double rms)
Set bkg and rms estimate in a box around the blob.
-
inline WCS *GetWCS(int coordSystem = -1)
Get WCS from stored metadata (TO BE DEPRECATED)
Get WCS from stored metadata
-
Blob()
This class defines a source data structure.
Defined in src/imgproc/Source.h
and inheriting from Blob class.
-
class Caesar::Source : public Caesar::Blob¶
Public Functions
-
Source()¶
Class constructor: initialize structures.
-
Source(std::string name)¶
Parametric constructor.
-
virtual ~Source()¶
Class destructor: free allocated memory.
-
void Copy(TObject &source) const¶
Copy method.
-
inline void SetType(SourceType choice)¶
Set source type.
-
inline void SetFlag(SourceFlag choice)¶
Set source flag.
-
inline void SetSimType(SimSourceType choice)¶
Set source sim type.
-
inline void SetSimMaxScale(float val)¶
Set source sim max scale.
-
inline void SetBeamFluxIntegral(double val)¶
Set beam flux integral.
-
inline double GetBeamFluxIntegral()¶
Get beam flux integral.
-
inline bool IsGoodSource()¶
Is a “good” source.
-
inline void SetGoodSourceFlag(bool flag)¶
Set source as “good”.
-
inline void SetDepthLevel(int level)¶
Set source depth level (0=mother, 1=nested)
-
inline int GetDepthLevel()¶
Get source depth level (0=mother, 1=nested)
-
inline bool HasNestedSources()¶
Has nested sources?
-
inline void SetHasNestedSources(bool val)¶
Set has nested sources.
-
inline int ClearNestedSources()¶
Clear nested sources.
-
inline int SetNestedSources(std::vector<Source*> &sources, bool clear_existing = true)¶
Set nested sources.
-
inline int GetNestedSourceNumber()¶
Get nested source number.
-
int FindNestedSources(std::vector<Source*> &nestedSources, double nestedBlobMinScale = 1, double nestedBlobMaxScale = 3, double nestedBlobScaleStep = 1, double nestedBlobPeakZThr = 5, double nestedBlobPeakZMergeThr = 2.5, int minPixels = 5, double nestedBlobThrFactor = 0, double nestedBlobKernFactor = 6, double minNestedMotherDist = 2, double maxMatchingPixFraction = 0.5)¶
Find nested sources.
-
void Draw(bool drawBoundingBox = false, bool drawFittedEllipse = false, bool drawNested = false, int lineColor = kBlack, int lineStyle = kSolid)¶
Draw contours.
-
int Draw(int pixMargin = 0, ImgType imgType = eFluxMap, bool drawImage = true, bool drawContours = true, bool drawNested = true, bool drawFitComponents = true, int lineColor = kBlack, int lineStyle = kSolid, bool useWCS = false, int coordSyst = 0)¶
Draw source.
-
const std::string GetDS9Region(bool dumpNestedSourceInfo = false, bool convertToWCS = false, WCS *wcs = 0, int coordSystem = -1)¶
Get DS9 region info.
-
const std::string GetDS9EllipseRegion(bool dumpNestedSourceInfo = false)¶
Get DS9 ellipse info.
-
const std::string GetDS9FittedEllipseRegion(bool useFWHM = true, bool dumpNestedSourceInfo = false, bool convertToWCS = false, WCS *wcs = 0, int coordSystem = -1, bool useWCSSimpleConversion = true)¶
Get DS9 fitted ellipse info.
-
inline std::string GetDS9RegionColor()¶
Get DS9 region color according to source type.
-
inline std::string GetDS9RegionTag()¶
Get DS9 region tag according to source type.
-
inline void Print()¶
Dump source info.
-
inline bool IsAtBoxEdge(float xmin, float xmax, float ymin, float ymax)¶
Check if source share boundary with given box.
-
inline bool HasBoxOverlap(float xmin, float xmax, float ymin, float ymax)¶
Is source inside given box.
-
bool CheckBoxOverlapping(Source*)¶
Check if this source bounding box overlaps with another given source.
-
int MergeSource(Source *aSource, bool copyPixels = false, bool checkIfAdjacent = true, bool computeStatPars = true, bool computeMorphPars = true, bool sumMatchingPixels = false)¶
Merge this source with given source.
-
long int GetNMatchingPixels(std::vector<Pixel*> &matching_pixels, Source *aSource, bool sorted = false)¶
Get collection of matching pixels between this and another source.
-
inline long int GetNMatchingPixels(Source *aSource, bool sorted = false)¶
Get number of matching pixels between this and another source.
-
bool FindSourceMatchByOverlapArea(SourceOverlapMatchPars &pars, const std::vector<Source*> &sources, float overlapThr)¶
Find source match in a collection by overlapping area.
-
bool FindSourceMatchByPos(std::vector<SourcePosMatchPars> &pars, const std::vector<Source*> &sources, float posThr)¶
Find source match in a collection by position.
-
int Fit(SourceFitOptions &fitOptions)¶
Fit source with a multi-component gaussian model.
-
int Fit(SourceFitOptions &fitOptions, SourceFitPars &initfitPars)¶
Fit source with a multi-component gaussian model using provided start fit parameters.
-
inline void SetTrueInfo(double S_true, double X0_true, double Y0_true)¶
Set true source info.
-
inline bool HasTrueInfo()¶
Has true source info.
-
inline double GetTrueFlux()¶
Get true source flux.
-
inline void GetTruePos(double &x, double &y)¶
Get true source position.
-
inline bool HasFitInfo()¶
Has fit info.
-
inline void SetHasFitInfo(bool flag)¶
Set Has fit info (for serialization scopes)
-
inline SourceFitPars &GetFitPars()¶
Get fit pars.
-
inline void SetFitPars(SourceFitPars &fitPars)¶
Set fit pars (for serialization scopes)
-
inline int SetFitComponentFlag(int componentId, int flag)¶
Set fit component flag.
-
inline int GetFitComponentFlag(int &flag, int componentId)¶
Get fit component flag.
-
inline int GetFitStatus()¶
Get fit status.
-
inline void SetFitStatus(int fitStatus)¶
Set fit status (for serialization scopes)
-
inline int GetFluxDensity(double &fluxDensity)¶
Get integrated flux density.
-
inline int GetFluxDensityErr(double &fluxDensityErr)¶
Get integrated flux density error.
-
inline int GetFitQuality()¶
Get fit quality flag.
-
inline int GetCondonComponentFluxDensityErr(std::vector<double> &fluxDensityErrList)¶
Get integrated flux density error on components according to Condon (1997) formula 14.
-
int GetFitEllipses(std::vector<TEllipse*> &fitEllipses, bool useFWHM = true, bool convertToWCS = false, WCS *wcs = 0, int coordSystem = -1, double pixOffset = 0, bool useWCSSimpleConversion = true)¶
Get fit ellipses.
-
inline int GetNFitComponents()¶
Get number of fit components.
-
inline int GetNSelFitComponents()¶
Get number of selected fit components.
-
int FindComponentPeaks(std::vector<ImgPeak> &peaks, double peakZThr = 0, int maxPeaks = -1, int peakShiftTolerance = 2, std::vector<int> kernels = {3, 5, 7}, int peakKernelMultiplicityThr = 1, bool invertSearch = false)¶
Find component peaks.
-
int FindBlendedComponents(std::vector<Source*> &deblendedComponents, std::vector<ImgPeak> &deblendedPeaks, double peakZThr = 0, int maxPeaks = -1, double sigmaMin = 3, double sigmaMax = 3, double sigmaStep = 1, int minBlobSize = 5, double thrFactor = 0, int kernelFactor = 1, int pixMargin = 10)¶
Find blended source components.
-
inline int GetWCSPos(double &xwcs, double &ywcs, WCS *wcs = 0, int coordSystem = eJ2000)¶
Return source position in WCS coordinates.
-
inline int GetWCSWeightedPos(double &xwcs, double &ywcs, WCS *wcs = 0, int coordSystem = eJ2000)¶
Return signal-weighted source position in WCS coordinates.
-
inline int GetWCSSourceRange(double &xmin_wcs, double &xmax_wcs, double &ymin_wcs, double &ymax_wcs, WCS *wcs = 0, int coordSystem = eJ2000)¶
Return bounding box in WCS coordinates.
-
std::string GetIAUName(bool useWeightedPos = false, WCS *wcs = 0, int coordSystem = eJ2000)¶
Return source name following IAU convention.
-
int GetSpectralAxisInfo(double &val, double &dval, std::string &units)¶
Return spectral axis info.
-
inline bool HasSpectralIndexData()¶
Has spectral index data.
-
inline void SetHasSpectralIndexData(bool val)¶
Set has spectral index data flag.
-
inline SpectralIndexData &GetSpectralIndexData()¶
Get spectral index data.
-
inline void SetSpectralIndexData(SpectralIndexData &data)¶
Set spectral index data.
-
inline bool HasComponentSpectralIndexData()¶
Has component spectral index data.
-
inline void SetHasComponentSpectralIndexData(bool val)¶
Set has spectral index data flag.
-
inline std::vector<SpectralIndexData> &GetComponentSpectralIndexData()¶
Get component spectral index data.
-
inline void SetComponentSpectralIndexData(std::vector<SpectralIndexData> &data)¶
Set component spectral index data.
-
inline bool HasAstroObjects()¶
Has astro object data.
-
inline void SetHasAstroObjects(bool choice)¶
Has astro object data.
-
inline std::vector<AstroObject> &GetAstroObjects()¶
Get astro objects data.
-
inline void SetAstroObjects(std::vector<AstroObject> &data)¶
Set astro objects data.
-
int AddAstroObject(AstroObject &astroObject)¶
Add astro objects data.
-
inline bool HasComponentAstroObjects()¶
Has component astro object data.
-
inline void SetHasComponentAstroObjects(bool choice)¶
Has astro object data.
-
inline std::vector<std::vector<AstroObject>> &GetComponentAstroObjects()¶
Get astro objects data.
-
inline void SetComponentAstroObjects(std::vector<std::vector<AstroObject>> &data)¶
Set astro objects data.
-
int AddComponentAstroObject(int componentIndex, AstroObject &astroObject)¶
Add component astro objects data.
-
int ComputeObjClassId()¶
Compute object class id from astro object data (if available)
-
int ComputeComponentObjClassId()¶
Compute component object class id from astro object data (if available)
-
inline bool IsResolved_XXLSurveyMethod(double p0 = 1.08, double p1 = 2.03)¶
Compute if source island is resolved according to XXL survey criterion.
-
inline bool IsComponentResolved_XXLSurveyMethod(int componentId, double p0 = 1.08, double p1 = 2.03)¶
Compute if source fit component is resolved according to XXL survey criterion.
-
Source()¶
This class defines a source cube (source at different frequency channels) data structure.
Defined in src/imgproc/SourceCube.h
-
class Caesar::SourceCube : public TNamed¶
Public Functions
-
SourceCube()¶
Class constructor: initialize structures.
-
SourceCube(std::string name)¶
Parametric constructor.
-
virtual ~SourceCube()¶
Class destructor: free allocated memory.
-
SourceCube(const SourceCube &scube)¶
Copy constructor.
-
SourceCube &operator=(const SourceCube &scube)¶
Assignment Operator.
-
void Copy(TObject &scube) const¶
Copy method.
-
inline int GetSize()¶
Get cube size.
-
inline int GetNMatches()¶
Get number of matches.
-
inline void AddComponentMatch()¶
Add component.
-
int AddIndexToComponent(int cubeComponentIndex, size_t sindex, size_t componentIndex)¶
Add index to existing component.
-
int DoSourceImagePlot(bool useWCS = true, int coordSyst = 0)¶
Draw source images.
-
int DoSourceSEDs()¶
Draw source SEDs.
-
SourceCube()¶