lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
LocalExtrema.hh File Reference

Declares localextrema functions that build maps and lists of local minima/maxima in 1-d and 2-d arrays, and the diagonal-offset helpers. More...

#include <string>
#include <vector>
#include <iostream>
#include <cstddef>
#include <cstring>
#include <cmath>
#include "Types.hh"
#include "psalg/alloc/AllocArray.hh"
#include "psalg/alloc/Allocator.hh"

Namespaces

namespace  localextrema
 Local-extremum search functions for 1-d and 2-d arrays (maps of local minima and maxima, lists of extremum indexes) used by the peak finders.
 

Typedefs

typedef types::mask_t localextrema::mask_t
 LocalExtrema - methods for 2-d image processing algorithms.
 
typedef types::extrim_t localextrema::extrim_t
 Alias for types::extrim_t (uint16_t).
 
typedef types::TwoIndexes localextrema::TwoIndexes
 Alias for types::TwoIndexes.
 

Functions

AllocArray1D< TwoIndexes > localextrema::evaluateDiagIndexes_drp (const size_t &rank, Allocator *allocator)
 Return the (i, j) offsets with -rank <= i, j <= rank and both nonzero (the square around a pixel without its central row and column), in an AllocArray1D allocated from allocator.
 
void localextrema::printMatrixOfDiagIndexes (const size_t &rank)
 Print to stdout a (2*rank+1) x (2*rank+1) matrix of the offsets used by evaluateDiagIndexes(): 1 for used, 0 for the central row and column, and + at the center.
 
void localextrema::printVectorOfDiagIndexes (const size_t &rank)
 Print the size and the (i, j) pairs of evaluateDiagIndexes(rank) to stdout, ten pairs per line.
 
size_t localextrema::numberOfExtrema (const extrim_t *map, const size_t &rows, const size_t &cols, const extrim_t &vsel=7)
 Return how many of the rows*cols entries of map equal vsel.
 
std::vector< TwoIndexes > localextrema::evaluateDiagIndexes (const size_t &rank)
 Return the (i, j) offsets with -rank <= i, j <= rank and both nonzero, as a std::vector.
 
std::vector< TwoIndexes > localextrema::vectorOfExtremeIndexes (const extrim_t *map, const size_t &rows, const size_t &cols, const extrim_t &vsel=7, const size_t &maxlen=0)
 Return the (row, col) indexes of all entries of map equal to vsel, in row-major order.
 
template<typename T >
size_t localextrema::localMinima1d (const T *data, const mask_t *mask, const size_t &cols, const size_t &stride=1, const size_t &rank=5, extrim_t *local_minima=0)
 returns number of found minima and array local_minima of local minimums of requested rank, where rank defins a square region [cols-rank, cols+rank].
 
template<typename T >
size_t localextrema::localMaxima1d (const T *data, const mask_t *mask, const size_t &cols, const size_t &stride=1, const size_t &rank=5, extrim_t *local_maxima=0)
 returns number of found maxima and array local_maxima of local maximums of requested rank, where rank defins a region [cols-rank, cols+rank].
 
template<typename T >
size_t localextrema::mapOfLocalMinimums_drp (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const size_t &rank, extrim_t *local_minima, Allocator *allocator)
 returns map of local minimums of requested rank, where rank defins a square region around central pixel [rowc-rank, rowc+rank], [colc-rank, colc+rank].
 
template<typename T >
size_t localextrema::mapOfLocalMaximums_drp (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const size_t &rank, extrim_t *local_maxima, Allocator *allocator)
 returns map of local maximums of requested rank, where rank defins a square region around central pixel [rowc-rank, rowc+rank], [colc-rank, colc+rank].
 
template<typename T >
size_t localextrema::mapOfLocalMaximumsRank1Cross (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, extrim_t *local_maxima)
 returns map of local maximums of runk=1 cross(+) region (very special case for Chuck's algorithm).
 
template<typename T >
size_t localextrema::mapOfThresholdMaximums (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const size_t &rank, const double &thr_low, const T &thr_high, extrim_t *thr_maxima)
 returns map of local maximums for 2-threshold algorithm.
 
template<typename T >
size_t localextrema::mapOfLocalMinimums (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const size_t &rank, extrim_t *local_minima)
 returns map of local minimums of requested rank, where rank defins a square region around central pixel [rowc-rank, rowc+rank], [colc-rank, colc+rank].
 
template<typename T >
size_t localextrema::mapOfLocalMaximums (const T *data, const mask_t *mask, const size_t &rows, const size_t &cols, const size_t &rank, extrim_t *local_maxima)
 returns map of local maximums of requested rank, where rank defins a square region around central pixel [rowc-rank, rowc+rank], [colc-rank, colc+rank].
 

Detailed Description

Declares localextrema functions that build maps and lists of local minima/maxima in 1-d and 2-d arrays, and the diagonal-offset helpers.