CFEL - ASG Software Suite  2.5.0
CASS
autocorrelation.h
Go to the documentation of this file.
1 // Copyright (C) 2013 Lutz Foucar
2 
3 /**
4  * @file autocorrelation.h containing the class to calculate the
5  * autocorrelation of a 2d histogram
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _AUTOCORRELATION_H_
11 #define _AUTOCORRELATION_H_
12 
13 #include "processor.h"
14 
15 namespace cass
16 {
17 
18 /** calculate the autocorrelation of an image in radial coordinates
19  *
20  * details
21  *
22  * @PPList "310": calculate the autocorrelation of an image in radial coordinates
23  *
24  * @cassttng Processor/\%name\%/{ImageName} \n
25  * processor name containing the histogram whos autocorrelation
26  * should be calculated. The radius should be along the y-axis and the
27  * phi should be along the x-axis.
28  *
29  * @author Aliakbar Jafarpour
30  * @author Stephan Kassemeyer
31  * @author Lutz Foucar
32  */
33 class pp310 : public Processor
34 {
35 public:
36  /** constructor */
37  pp310(const name_t &);
38 
39  /** process the event */
40  virtual void process(const CASSEvent&, result_t&);
41 
42  /** load the settings of this pp */
43  virtual void loadSettings(size_t);
44 
45 protected:
46  /** pp containing histogram to calculate the autocorrelation for */
48 };
49 
50 
51 /** calculate the autocorrelation of an image
52  *
53  * details
54  *
55  * @PPList "311": calculate the autocorrelation of an image
56  *
57  * @cassttng Processor/\%name\%/{CenterX|CenterY} \n
58  * @cassttng Processor/\%name\%/{MaximumRadius} \n
59  * @cassttng Processor/\%name\%/{ImageName} \n
60  * processor name containing the histogram whos autocorrelation
61  * should be calculated.
62  *
63  * @author Stephan Kassemeyer
64  * @author Lutz Foucar
65  */
66 class pp311 : public Processor
67 {
68 public:
69  /** constructor */
70  pp311(const name_t &);
71 
72  /** process the event */
73  virtual void process(const CASSEvent&, result_t&);
74 
75  /** load the settings of this pp */
76  virtual void loadSettings(size_t);
77 
78 protected:
79  /** pp containing histogram to calculate the autocorrelation for */
81 
82 private:
83  /** define a ring that knows its position in the original image and the value
84  * at that position
85  */
86  typedef std::vector<std::pair<int,result_t::value_t> > ring_t;
87 
88  /** retrieve the length of the ring for a given radius
89  *
90  * @return the amount of pixels that belong to the radius
91  * @param rad the radius that one wants to find the pixels for
92  */
93  int getCircleLength(const int rad);
94 
95  /** fill the ring with the pixels that belong to a certain radius around a
96  * given center
97  *
98  * @note the ring that is passed to this function should already contain
99  * enough elements as it will not be refilled.
100  *
101  * @param image the original image
102  * @param rad the radius for which the ring should be found
103  * @param x0 the center in x
104  * @param y0 the center in y
105  * @param nxx the number of columns of the original image
106  * @param ring the ring that will contain the result
107  */
108  void fillRing(const result_t &image,
109  const int rad, const int x0, const int y0, const int nxx,
110  ring_t &ring);
111 
112  /** the used center of the image */
113  std::pair<int,int> _center;
114 
115  /** the used maximum radius*/
116  int _maxrad;
117 
118 };
119 } //end namespace cass
120 #endif
void fillRing(const result_t &image, const int rad, const int x0, const int y0, const int nxx, ring_t &ring)
fill the ring with the pixels that belong to a certain radius around a given center ...
Event to store all LCLS Data.
Definition: cass_event.h:32
virtual void process(const CASSEvent &, result_t &)
process the event
calculate the autocorrelation of an image
virtual void loadSettings(size_t)
load the settings of this pp
std::pair< int, int > _center
the used center of the image
virtual void process(const CASSEvent &, result_t &)
process the event
int _maxrad
the used maximum radius
int getCircleLength(const int rad)
retrieve the length of the ring for a given radius
base class for processors.
Definition: processor.h:39
pp311(const name_t &)
constructor
virtual void loadSettings(size_t)
load the settings of this pp
pp310(const name_t &)
constructor
shared_pointer _hist
pp containing histogram to calculate the autocorrelation for
std::vector< std::pair< int, result_t::value_t > > ring_t
define a ring that knows its position in the original image and the value at that position ...
file contains processors baseclass declaration
shared_pointer _hist
pp containing histogram to calculate the autocorrelation for
calculate the autocorrelation of an image in radial coordinates
std::string name_t
define the name type
Definition: processor.h:46
std::tr1::shared_ptr< Processor > shared_pointer
a shared pointer of this
Definition: processor.h:43