SourceXtractorPlusPlus  0.16
Please provide a description of the project.
FrameModel.h
Go to the documentation of this file.
1 
23 #ifndef MODELFITTING_FRAMEMODEL_H
24 #define MODELFITTING_FRAMEMODEL_H
25 
26 #include <vector>
27 #include <cmath>
33 
34 namespace ModelFitting {
35 
42 template <typename PsfType>
43 class FrameModelPsfContainer: public PsfType {
44 public:
45 
51  FrameModelPsfContainer(std::size_t n_extended_models);
52 
60  FrameModelPsfContainer(PsfType psf, std::size_t n_extended_models);
61 
69  template<typename... Args>
70  void convolve(size_t, Args&&... args) {
71  PsfType::convolve(std::forward<Args>(args)...);
72  }
73 };
74 
81 template <typename PsfType>
82 class FrameModelPsfContextContainer: public PsfType {
83 public:
84 
91 
99  FrameModelPsfContextContainer(PsfType psf, std::size_t n_extended_models);
100 
110  template<typename... Args>
111  void convolve(size_t i, Args&&... args) {
112  auto& context = m_psf_contexts[i];
113  if (!context) {
114  context = PsfType::prepare(std::forward<Args>(args)...);
115  m_psf_contexts[i] = std::move(context);
116  }
117  PsfType::convolve(std::forward<Args>(args)..., m_psf_contexts[i]);
118  }
119 
120 private:
122 };
123 
124 
125 template <typename PsfType, typename ImageType>
126 class FrameModel {
127 private:
128 
129  // PsfTraits must have a has_context boolean with the value of true
130  // if PsfType has a context type and a prepare method.
131  // If it is the case, the PSF will be wrapped by FrameModelPsfContextContainer:
132  // each model will have its own context.
133  // Otherwise, the PSF will be just wrapped by FrameModelPsfContainer, which
134  // forwards directly the calls.
139  >::type;
140 
141 public:
142 
144 
146  std::vector<ConstantModel> constant_model_list,
147  std::vector<PointModel> point_model_list,
149  PsfType psf);
150 
152  std::vector<ConstantModel> constant_model_list,
153  std::vector<PointModel> point_model_list,
155 
156 
157  FrameModel(FrameModel&&) = default;
158 
159  virtual ~FrameModel();
160 
162 
163  const ImageType& getImage();
164 
165  void rasterToImage(ImageType&);
166 
168 
170 
171  std::size_t size() const;
172 
173 private:
174 
183 
184 }; // end of class FrameModel
185 
186 } // end of namespace ModelFitting
187 
188 #include "_impl/FrameModel.icpp"
189 
190 #endif /* MODELFITTING_FRAMEMODEL_H */
191 
const double pixel_scale
Definition: TestImage.cpp:74
FrameModelPsfContainer(PsfType psf, std::size_t n_extended_models)
FrameModelPsfContainer(std::size_t n_extended_models)
void convolve(size_t, Args &&... args)
Definition: FrameModel.h:70
FrameModelPsfContextContainer(std::size_t n_extended_models)
std::vector< typename PsfTraits< PsfType >::context_t > m_psf_contexts
Definition: FrameModel.h:121
void convolve(size_t i, Args &&... args)
Definition: FrameModel.h:111
FrameModelPsfContextContainer(PsfType psf, std::size_t n_extended_models)
typename std::conditional< PsfTraits< PsfType >::has_context, FrameModelPsfContextContainer< PsfType >, FrameModelPsfContainer< PsfType > >::type psf_container_t
Definition: FrameModel.h:139
typename ImageTraits< ImageType >::iterator const_iterator
Definition: FrameModel.h:143
std::vector< std::shared_ptr< ExtendedModel< ImageType > > > m_extended_model_list
Definition: FrameModel.h:180
const_iterator begin()
std::size_t size() const
const ImageType & getImage()
void rasterToImage(ImageType &)
std::unique_ptr< ImageType > m_model_image
Definition: FrameModel.h:182
psf_container_t m_psf
Definition: FrameModel.h:181
std::vector< PointModel > m_point_model_list
Definition: FrameModel.h:179
FrameModel(FrameModel &&)=default
const_iterator end()
FrameModel(double pixel_scale, std::size_t width, std::size_t height, std::vector< ConstantModel > constant_model_list, std::vector< PointModel > point_model_list, std::vector< std::shared_ptr< ExtendedModel< ImageType >>> extended_model_list, PsfType psf)
FrameModel(double pixel_scale, std::size_t width, std::size_t height, std::vector< ConstantModel > constant_model_list, std::vector< PointModel > point_model_list, std::vector< std::shared_ptr< ExtendedModel< ImageType >>> extended_model_list)
std::vector< ConstantModel > m_constant_model_list
Definition: FrameModel.h:178
T move(T... args)