SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
FrameModel.h
Go to the documentation of this file.
1
22
23#ifndef MODELFITTING_FRAMEMODEL_H
24#define MODELFITTING_FRAMEMODEL_H
25
26#include <vector>
27#include <cmath>
33
34namespace ModelFitting {
35
42template <typename PsfType>
43class FrameModelPsfContainer: public PsfType {
44public:
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
81template <typename PsfType>
82class FrameModelPsfContextContainer: public PsfType {
83public:
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
120private:
122};
123
124
125template <typename PsfType, typename ImageType>
127private:
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
141public:
142
144
145 FrameModel(double pixel_scale, std::size_t width, std::size_t height,
146 std::vector<ConstantModel> constant_model_list,
147 std::vector<PointModel> point_model_list,
149 PsfType psf);
150
151 FrameModel(double pixel_scale, std::size_t width, std::size_t height,
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
161 void recomputeImage();
162
163 const ImageType& getImage();
164
165 void rasterToImage(ImageType&);
166
168
170
171 std::size_t size() const;
172
173private:
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(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
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
std::size_t size() const
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
typename std::conditional< PsfTraits< PsfType >::has_context, FrameModelPsfContextContainer< PsfType >, FrameModelPsfContainer< PsfType > >::type psf_container_t
Definition FrameModel.h:135
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)
const ImageType & getImage()
std::vector< ConstantModel > m_constant_model_list
Definition FrameModel.h:178
T forward(T... args)
T move(T... args)
static constexpr bool has_context
Definition PsfTraits.h:39