SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PeakValueTask.h
Go to the documentation of this file.
1 
17 /*
18  * PeakValueTask.h
19  *
20  * Created on: Feb 9, 2017
21  * Author: mschefer
22  */
23 
24 #ifndef _SEIMPLEMENTATION_PLUGIN_PEAKVALUE_PEAKVALUETASK_H_
25 #define _SEIMPLEMENTATION_PLUGIN_PEAKVALUE_PEAKVALUETASK_H_
26 
31 
32 namespace SourceXtractor {
33 
34 class PeakValueTask : public SourceTask {
35 
36 public:
37 
38  virtual ~PeakValueTask() = default;
39 
40  void computeProperties(SourceInterface& source) const override {
41  // FIXME is it correct to use filtered values?
42  const auto& pixel_values = source.getProperty<DetectionFramePixelValues>().getFilteredValues();
43 
44  auto& coordinates = source.getProperty<PixelCoordinateList>().getCoordinateList();
45 
48 
49  unsigned int index=0;
50  int peak_value_x=-1;
51  int peak_value_y=-1;
52  for (auto value = pixel_values.begin(); value!=pixel_values.end(); ++value){
53  //for(unsigned i : indices(pixel_values)) {
54  if (*value>peak_value){
55  peak_value = *value;
56  peak_value_x = coordinates[index].m_x;
57  peak_value_y = coordinates[index].m_y;
58  }
59  if (*value<min_value)
60  min_value=*value;
61  index++;
62  }
63  //std::cout << "Value: " << peak_value << "x/y: " << peak_value_x << " " << peak_value_y<< std::endl;
64  source.setProperty<PeakValue>(min_value, peak_value, peak_value_x, peak_value_y);
65  }
66 
67 
68 private:
69 
70 };
71 
72 
73 } /* namespace SourceXtractor */
74 
75 
76 #endif /* _SEIMPLEMENTATION_PLUGIN_PEAKVALUE_PEAKVALUETASK_H_ */
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Definition: PeakValueTask.h:40
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
A Task that acts on a Source to compute one or more properties.
Definition: SourceTask.h:36
The values of a Source&#39;s pixels in the detection image. They are returned as a vector in the same ord...
The SourceInterface is an abstract &quot;source&quot; that has properties attached to it.
virtual ~PeakValueTask()=default