lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
psalg1::PeakFinderAlgos Class Reference

PeakFinderAlgos - class contains collection of methods for peak finding algorithms of 2-d image. More...

#include <PeakFinderAlgosLCLS1.hh>

Public Member Functions

 PeakFinderAlgos (const size_t &seg=0, const unsigned &pbits=0)
 Class constructor is used for initialization of all paramaters.
 
virtual ~PeakFinderAlgos ()
 Delete the local-maxima, local-minima and connected-pixel maps, logging a message first if the DEBUG bit of the print bits is set.
 
void printParameters ()
 Prints memeber data.
 
void _initMapsAndVectors ()
 Initialaise maps and vectors per event; uses m_img_size, m_npksmax, vectors and maps.
 
void _evaluateRingIndexes ()
 Evaluate ring indexes for S/N algorithm.
 
void printMatrixOfRingIndexes ()
 Prints indexes for S/N algorithm.
 
void printVectorOfRingIndexes ()
 Print the (row, col) offsets used for the background ring to stdout, ten per line, computing them first with _evaluateRingIndexes() if the list is empty.
 
void setPeakSelectionPars (const float &npix_min=0, const float &npix_max=1e6, const float &amax_thr=0, const float &atot_thr=0, const float &son_min=0)
 Recursive method finding connected pixels in constrained region and filling vector of indexes for V3r3.
 
void printSelectionPars ()
 Prints peak selection parameters.
 
bool _peakIsSelected (const Peak &peak)
 Decide if peak should be included or not in the output v_peaks.
 
void _makeVectorOfSelectedPeaks ()
 Makes vector of selected peaks v_peaks_sel from v_peaks.
 
void _printVectorOfPeaks (const std::vector< Peak > &v)
 Prints vector of peaks, i.e. v_peaks_sel or v_peaks.
 
const Peak & peak (const int &i=0)
 Returns peak from v_peaks by specified index.
 
const Peak & peakSelected (const int &i=0)
 Returns peak from v_peaks_sel by specified index.
 
const std::vector< Peak > & vectorOfPeaks ()
 Returns vector of peaks v_peaks.
 
const std::vector< Peak > & vectorOfPeaksSelected ()
 Returns vector of selected peaks v_peaks_sel.
 
void localMaxima (extrim_t *map, const size_t &rows, const size_t &cols)
 Fills-out (returns) array of local maxima.
 
void localMinima (extrim_t *map, const size_t &rows, const size_t &cols)
 Fills-out (returns) array of local minima.
 
void connectedPixels (conmap_t *map, const size_t &rows, const size_t &cols)
 Fills-out (returns) array of m_conmap.
 
template<typename T >
void peakFinderV3r3 (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const size_t &rank, const double &r0=7.0, const double &dr=2.0, const double &nsigm=0)
 peakFinderV3r3 - "Ranker" - further development of ImgAlgos.peakFinderV3r2.
 
template<typename T >
void _makeMapOfConnectedPixelsForLocalMaximums (const T *data)
 full peak processing in a right order
 
template<typename T >
RingAvgRms _evaluateRingAvgRmsV1 (const T *data, const int &row, const int &col)
 Evaluate background average and rms in the ring around pixel using data, mask, and map of local intensity extremes.
 
template<typename T >
RingAvgRms _evaluateRingAvgRmsForDroplet (const T *data, const int &row, const int &col)
 The same as _evaluateRingAvgRmsV1, but selection of pixel is for Droplet.
 
template<typename T >
void _findConnectedPixelsForLocalMaximumV2 (const T *data, const int &r0, const int &c0)
 _findConnectedPixelsForLocalMaximumV2 - apply flood filling algorithms to find a group of connected pixels around r0,c0 in constrained by rad region.
 
template<typename T >
void _findConnectedPixelsInRegionV3 (const T *data, const int &r, const int &c)
 Recursively add pixel (r, c) and its 4-connected neighbours to the current pixel group: a pixel is taken if it is unmasked, not yet in the connected-pixel map and not below the region threshold, and it is marked there with the current region number.
 
template<typename T >
void _procPixGroupV1 (const T *data, const RingAvgRms &bkgd, const std::vector< TwoIndexes > &vinds)
 _procPixGroupV1 - process a pixel group for peakFinderV3r3 further development of ImgAlgos::AlgImgProc::_procPixGroup V1 news: get rid of ndarray, use member data to pass parameters, subtract base level brfore processing
 
template<typename T >
void peakFinderV4r3 (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const double &thr_low, const double &thr_high, const size_t &rank=5, const double &r0=7.0, const double &dr=2.0)
 peakFinderV4r3 - further development of ImgAlgos.peakFinderV4r2.
 
template<typename T >
void _makeMapOfConnectedPixelsForDroplets (const T *data)
 full peak processing in a right order
 
void _findConnectedPixelsForDroplet (const int &r0, const int &c0)
 _findConnectedPixelsForDroplet - apply flood filling algorithms to find a group of connected pixels news: rank is passed as member data
 
void _findConnectedPixelsInDroplet (const int &r, const int &c)
 Recursively add pixel (r, c) and its 4-connected neighbours to the current pixel group when their value in the local-maxima map is at least 2 (the code comment says 0 is masked and 1 below the low threshold) and they are not yet in the connected-pixel map; each is marked with the current region number.
 

Detailed Description

PeakFinderAlgos - class contains collection of methods for peak finding algorithms of 2-d image.

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

Author
Mikhail Dubrovin
See also
ImgAlgos.ImgImgProc

Interface Description
  • Includes and typedefs
    #include <cstddef> // for size_t
    #include "psalgos/PeakFinderAlgos.h"
    #include "psalgos/Types.h"
    Non-owning view of an array of T: a data pointer, a pointer to a shape array and a rank.
    Definition Array.hh:27
    types::mask_t mask_t
    Alias for types::mask_t (uint16_t).
    Definition PeakFinderAlgosLCLS1.hh:36
    types::extrim_t extrim_t
    Alias for types::extrim_t (uint16_t).
    Definition PeakFinderAlgosLCLS1.hh:38

Constructor & Destructor Documentation

◆ PeakFinderAlgos()

psalg1::PeakFinderAlgos::PeakFinderAlgos ( const size_t &  seg = 0,
const unsigned &  pbits = 0 
)

Class constructor is used for initialization of all paramaters.

Parameters
[in]seg- ROI segment index in the ndarray
[in]pbits- print control bit-word; =0-print nothing, =1 debug, =2 info, ...

◆ ~PeakFinderAlgos()

virtual psalg1::PeakFinderAlgos::~PeakFinderAlgos ( )
virtual

Delete the local-maxima, local-minima and connected-pixel maps, logging a message first if the DEBUG bit of the print bits is set.

Member Function Documentation

◆ _evaluateRingAvgRmsForDroplet()

template<typename T >
RingAvgRms psalg1::PeakFinderAlgos::_evaluateRingAvgRmsForDroplet ( const T *  data,
const int &  row,
const int &  col 
)
inline

The same as _evaluateRingAvgRmsV1, but selection of pixel is for Droplet.

◆ _evaluateRingAvgRmsV1()

template<typename T >
RingAvgRms psalg1::PeakFinderAlgos::_evaluateRingAvgRmsV1 ( const T *  data,
const int &  row,
const int &  col 
)
inline

Evaluate background average and rms in the ring around pixel using data, mask, and map of local intensity extremes.

development of ImgAlgos.Alg.imgProc._evaluateBkgdAvgRmsV3 _evaluateRingAvgRmsV1 news: get rid of ndarray, mask, m_r0, m_dr etc are passed as member data, RingAvgRms is created at return.

Background average and rms are evaluated for any pixel specified by the (row,col). Uses mask. Good non-extreme pixels are used. This algorithm uses pixels in the ring m_r0, m_dr.

Parameters
[in]data- pointer to 2-d array with calibrated intensities
[in]row- pixel row
[in]col- pixel column

◆ _evaluateRingIndexes()

void psalg1::PeakFinderAlgos::_evaluateRingIndexes ( )

Evaluate ring indexes for S/N algorithm.

◆ _findConnectedPixelsForDroplet()

void psalg1::PeakFinderAlgos::_findConnectedPixelsForDroplet ( const int &  r0,
const int &  c0 
)
inline

_findConnectedPixelsForDroplet - apply flood filling algorithms to find a group of connected pixels news: rank is passed as member data

Parameters
[in]r0- droplet central pixel row-coordinate
[in]c0- droplet central pixel column-coordinate

◆ _findConnectedPixelsForLocalMaximumV2()

template<typename T >
void psalg1::PeakFinderAlgos::_findConnectedPixelsForLocalMaximumV2 ( const T *  data,
const int &  r0,
const int &  c0 
)
inline

_findConnectedPixelsForLocalMaximumV2 - apply flood filling algorithms to find a group of connected pixels around r0,c0 in constrained by rad region.

  • check that r0,c0 is absolute maximum, returns false if not found
  • apply flood filling and make vector of connected pixels in rad constrained by region. V2 news: mask and rank are passed as member data
Parameters
[in]data- pointer to 2-d array with calibrated intensities
[in]r0- droplet central pixel row-coordinate
[in]c0- droplet central pixel column-coordinate

◆ _findConnectedPixelsInDroplet()

void psalg1::PeakFinderAlgos::_findConnectedPixelsInDroplet ( const int &  r,
const int &  c 
)
inline

Recursively add pixel (r, c) and its 4-connected neighbours to the current pixel group when their value in the local-maxima map is at least 2 (the code comment says 0 is masked and 1 below the low threshold) and they are not yet in the connected-pixel map; each is marked with the current region number.

The search stays inside the current region limits.

◆ _findConnectedPixelsInRegionV3()

template<typename T >
void psalg1::PeakFinderAlgos::_findConnectedPixelsInRegionV3 ( const T *  data,
const int &  r,
const int &  c 
)
inline

Recursively add pixel (r, c) and its 4-connected neighbours to the current pixel group: a pixel is taken if it is unmasked, not yet in the connected-pixel map and not below the region threshold, and it is marked there with the current region number.

The search stays inside the current region limits.

◆ _initMapsAndVectors()

void psalg1::PeakFinderAlgos::_initMapsAndVectors ( )

Initialaise maps and vectors per event; uses m_img_size, m_npksmax, vectors and maps.

◆ _makeMapOfConnectedPixelsForDroplets()

template<typename T >
void psalg1::PeakFinderAlgos::_makeMapOfConnectedPixelsForDroplets ( const T *  data)
inline

full peak processing in a right order

  1. estimate background
  2. finds connected pixels
  3. fills vector of peaks
Parameters
[in]data- pointer to 2-d array with calibrated intensities

◆ _makeMapOfConnectedPixelsForLocalMaximums()

template<typename T >
void psalg1::PeakFinderAlgos::_makeMapOfConnectedPixelsForLocalMaximums ( const T *  data)
inline

full peak processing in a right order

  1. estimate background
  2. finds connected pixels
  3. fills vector of peaks
Parameters
[in]data- pointer to 2-d array with calibrated intensities

◆ _makeVectorOfSelectedPeaks()

void psalg1::PeakFinderAlgos::_makeVectorOfSelectedPeaks ( )

Makes vector of selected peaks v_peaks_sel from v_peaks.

◆ _peakIsSelected()

bool psalg1::PeakFinderAlgos::_peakIsSelected ( const Peak &  peak)

Decide if peak should be included or not in the output v_peaks.

◆ _printVectorOfPeaks()

void psalg1::PeakFinderAlgos::_printVectorOfPeaks ( const std::vector< Peak > &  v)

Prints vector of peaks, i.e. v_peaks_sel or v_peaks.

◆ _procPixGroupV1()

template<typename T >
void psalg1::PeakFinderAlgos::_procPixGroupV1 ( const T *  data,
const RingAvgRms &  bkgd,
const std::vector< TwoIndexes > &  vinds 
)
inline

_procPixGroupV1 - process a pixel group for peakFinderV3r3 further development of ImgAlgos::AlgImgProc::_procPixGroup V1 news: get rid of ndarray, use member data to pass parameters, subtract base level brfore processing

Parameters
[in]data- pointer to data array with calibrated intensities
[in]bkgd- structure of base level ave, rms, npix
[in]vinds- vector of connected pixel indexes

◆ connectedPixels()

void psalg1::PeakFinderAlgos::connectedPixels ( conmap_t *  map,
const size_t &  rows,
const size_t &  cols 
)
inline

Fills-out (returns) array of m_conmap.

◆ localMaxima()

void psalg1::PeakFinderAlgos::localMaxima ( extrim_t *  map,
const size_t &  rows,
const size_t &  cols 
)
inline

Fills-out (returns) array of local maxima.

◆ localMinima()

void psalg1::PeakFinderAlgos::localMinima ( extrim_t *  map,
const size_t &  rows,
const size_t &  cols 
)
inline

Fills-out (returns) array of local minima.

◆ peak()

const Peak & psalg1::PeakFinderAlgos::peak ( const int &  i = 0)
inline

Returns peak from v_peaks by specified index.

◆ peakFinderV3r3()

template<typename T >
void psalg1::PeakFinderAlgos::peakFinderV3r3 ( const T *  data,
const mask_t *  mask,
const size_t &  rows,
const size_t &  cols,
const size_t &  rank,
const double &  r0 = 7.0,
const double &  dr = 2.0,
const double &  nsigm = 0 
)
inline

peakFinderV3r3 - "Ranker" - further development of ImgAlgos.peakFinderV3r2.

Changes:

  • use packahe psalgos
  • get rid of ndarray
  • pass most of parameters via member data

◆ peakFinderV4r3()

template<typename T >
void psalg1::PeakFinderAlgos::peakFinderV4r3 ( const T *  data,
const mask_t *  mask,
const size_t &  rows,
const size_t &  cols,
const double &  thr_low,
const double &  thr_high,
const size_t &  rank = 5,
const double &  r0 = 7.0,
const double &  dr = 2.0 
)
inline

peakFinderV4r3 - further development of ImgAlgos.peakFinderV4r2.

Changes:

  • use packahe psalgos
  • get rid of ndarray
  • pass most of parameters via member data - "Droplet-finder" - further improvement of V4r1.

◆ peakSelected()

const Peak & psalg1::PeakFinderAlgos::peakSelected ( const int &  i = 0)
inline

Returns peak from v_peaks_sel by specified index.

◆ printMatrixOfRingIndexes()

void psalg1::PeakFinderAlgos::printMatrixOfRingIndexes ( )

Prints indexes for S/N algorithm.

◆ printParameters()

void psalg1::PeakFinderAlgos::printParameters ( )

Prints memeber data.

◆ printSelectionPars()

void psalg1::PeakFinderAlgos::printSelectionPars ( )

Prints peak selection parameters.

◆ printVectorOfRingIndexes()

void psalg1::PeakFinderAlgos::printVectorOfRingIndexes ( )

Print the (row, col) offsets used for the background ring to stdout, ten per line, computing them first with _evaluateRingIndexes() if the list is empty.

◆ setPeakSelectionPars()

void psalg1::PeakFinderAlgos::setPeakSelectionPars ( const float &  npix_min = 0,
const float &  npix_max = 1e6,
const float &  amax_thr = 0,
const float &  atot_thr = 0,
const float &  son_min = 0 
)

Recursive method finding connected pixels in constrained region and filling vector of indexes for V3r3.

Set peak selection parameters

◆ vectorOfPeaks()

const std::vector< Peak > & psalg1::PeakFinderAlgos::vectorOfPeaks ( )
inline

Returns vector of peaks v_peaks.

◆ vectorOfPeaksSelected()

const std::vector< Peak > & psalg1::PeakFinderAlgos::vectorOfPeaksSelected ( )
inline

Returns vector of selected peaks v_peaks_sel.


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