SourceXtractorPlusPlus  0.11
Please provide a description of the project.
CompactExponentialModel.h
Go to the documentation of this file.
1 /*
2  * CompactExponentialModel.h
3  *
4  * Created on: Aug 19, 2019
5  * Author: mschefer
6  */
7 
8 #ifndef _MODELFITTING_MODELS_COMPACTEXPONENTIALMODEL_H_
9 #define _MODELFITTING_MODELS_COMPACTEXPONENTIALMODEL_H_
10 
12 
13 namespace ModelFitting {
14 
15 template <typename ImageType>
16 class CompactExponentialModel : public CompactModelBase<ImageType> {
17 
18 public:
19  CompactExponentialModel(double sharp_radius,
22  std::shared_ptr<BasicParameter> rotation, double width, double height,
25 
26  virtual ~CompactExponentialModel() = default;
27 
28  double getValue(double x, double y) const override;
29  ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override;
30 
31 private:
37 
40  double i0, k;
41  double max_r_sqr;
42 
43  inline float evaluateModel(float x, float y) const {
44  float x2 = x * transform[0] + y * transform[1];
45  float y2 = x * transform[2] + y * transform[3];
46  float r_sqr = x2*x2 + y2*y2;
47  if (r_sqr < max_r_sqr) {
48  float r = std::sqrt(r_sqr);
49  return float(i0) * std::exp(float(-k * r));
50  } else {
51  return 0;
52  }
53  }
54  };
55 
57 
58  // Exponential parameters
61 };
62 
63 }
64 
66 
67 #endif /* _MODELFITTING_MODELS_COMPACTEXPONENTIALMODEL_H_ */
ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override
T exp(T... args)
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
std::shared_ptr< BasicParameter > m_k
std::shared_ptr< BasicParameter > m_i0
virtual ~CompactExponentialModel()=default
T sqrt(T... args)
CompactExponentialModel(double sharp_radius, std::shared_ptr< BasicParameter > i0, std::shared_ptr< BasicParameter > k, std::shared_ptr< BasicParameter > x_scale, std::shared_ptr< BasicParameter > y_scale, std::shared_ptr< BasicParameter > rotation, double width, double height, std::shared_ptr< BasicParameter > x, std::shared_ptr< BasicParameter > y, std::tuple< double, double, double, double > transform)
const double pixel_scale
Definition: TestImage.cpp:75
std::pair< double, double > transform(int x, int y, const std::array< double, 4 > &t)
double getValue(double x, double y) const override