SourceXtractorPlusPlus  0.13
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 ImageType>
70  void convolve(size_t, ImageType& image) {
71  PsfType::convolve(image);
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 ImageType>
111  void convolve(size_t i, ImageType& image) {
112  auto& context = m_psf_contexts[i];
113  if (!context) {
114  context = PsfType::prepare(image);
115  }
116  PsfType::convolve(image, context);
117  }
118 
119 private:
121 };
122 
123 
124 template <typename PsfType, typename ImageType>
125 class FrameModel {
126 private:
127 
128  // PsfTraits must have a has_context boolean with the value of true
129  // if PsfType has a context type and a prepare method.
130  // If it is the case, the PSF will be wrapped by FrameModelPsfContextContainer:
131  // each model will have its own context.
132  // Otherwise, the PSF will be just wrapped by FrameModelPsfContainer, which
133  // forwards directly the calls.
138  >::type;
139 
140 public:
141 
143 
145  std::vector<ConstantModel> constant_model_list,
146  std::vector<PointModel> point_model_list,
148  PsfType psf);
149 
151  std::vector<ConstantModel> constant_model_list,
152  std::vector<PointModel> point_model_list,
154 
155 
156  FrameModel(FrameModel&&) = default;
157 
158  virtual ~FrameModel();
159 
161 
162  const ImageType& getImage();
163 
164  void rasterToImage(ImageType&);
165 
167 
169 
170  std::size_t size() const;
171 
172 private:
173 
182 
183 }; // end of class FrameModel
184 
185 } // end of namespace ModelFitting
186 
187 #include "_impl/FrameModel.icpp"
188 
189 #endif /* MODELFITTING_FRAMEMODEL_H */
190 
ModelFitting::FrameModel::m_pixel_scale
double m_pixel_scale
Definition: FrameModel.h:174
std::shared_ptr
STL class.
ModelFitting::FrameModelPsfContextContainer
Definition: FrameModel.h:82
ModelFitting::FrameModel::recomputeImage
void recomputeImage()
ModelFitting::FrameModel::m_psf
psf_container_t m_psf
Definition: FrameModel.h:180
std::vector
STL class.
ModelFitting::FrameModel::rasterToImage
void rasterToImage(ImageType &)
ModelFitting::FrameModel::m_height
std::size_t m_height
Definition: FrameModel.h:176
ModelFitting::FrameModelPsfContainer
Definition: FrameModel.h:43
ModelFitting::FrameModel::FrameModel
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)
ModelFitting::FrameModel::m_constant_model_list
std::vector< ConstantModel > m_constant_model_list
Definition: FrameModel.h:177
ModelFitting::FrameModelPsfContainer::FrameModelPsfContainer
FrameModelPsfContainer(PsfType psf, std::size_t n_extended_models)
ModelFitting::FrameModel::FrameModel
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)
PsfTraits.h
ModelFitting::ImageTraits
Definition: ImageTraits.h:29
ModelFitting::FrameModel::end
const_iterator end()
ModelFitting::FrameModel::m_extended_model_list
std::vector< std::shared_ptr< ExtendedModel< ImageType > > > m_extended_model_list
Definition: FrameModel.h:179
pixel_scale
const double pixel_scale
Definition: TestImage.cpp:75
ModelFitting::FrameModel::m_width
std::size_t m_width
Definition: FrameModel.h:175
ModelFitting::FrameModelPsfContextContainer::FrameModelPsfContextContainer
FrameModelPsfContextContainer(std::size_t n_extended_models)
FrameModel.icpp
ModelFitting::FrameModel::m_point_model_list
std::vector< PointModel > m_point_model_list
Definition: FrameModel.h:178
ModelFitting::FrameModel::begin
const_iterator begin()
PointModel.h
ModelFitting::PsfTraits
Definition: PsfTraits.h:37
ModelFitting::FrameModel::psf_container_t
typename std::conditional< PsfTraits< PsfType >::has_context, FrameModelPsfContextContainer< PsfType >, FrameModelPsfContainer< PsfType > >::type psf_container_t
Definition: FrameModel.h:138
ImageTraits.h
ConstantModel.h
ModelFitting::FrameModel::size
std::size_t size() const
ModelFitting::FrameModelPsfContainer::FrameModelPsfContainer
FrameModelPsfContainer(std::size_t n_extended_models)
ModelFitting::FrameModelPsfContextContainer::m_psf_contexts
std::vector< typename PsfTraits< PsfType >::context_t > m_psf_contexts
Definition: FrameModel.h:120
ModelFitting::FrameModelPsfContextContainer::FrameModelPsfContextContainer
FrameModelPsfContextContainer(PsfType psf, std::size_t n_extended_models)
ModelFitting::FrameModelPsfContextContainer::convolve
void convolve(size_t i, ImageType &image)
Definition: FrameModel.h:111
ModelFitting::FrameModel::~FrameModel
virtual ~FrameModel()
ModelFitting::FrameModel::FrameModel
FrameModel(FrameModel &&)=default
ExtendedModel.h
ModelFitting::ExtendedModel
Definition: ExtendedModel.h:39
ModelFitting::FrameModel::getImage
const ImageType & getImage()
ModelFitting::FrameModelPsfContainer::convolve
void convolve(size_t, ImageType &image)
Definition: FrameModel.h:70
ModelFitting::FrameModel
Definition: FrameModel.h:125
std::size_t
ModelFitting::FrameModel::m_model_image
std::unique_ptr< ImageType > m_model_image
Definition: FrameModel.h:181
std::conditional
std::unique_ptr< ImageType >
ModelFitting
Definition: AsinhChiSquareComparator.h:30
ModelFitting::FrameModel::const_iterator
typename ImageTraits< ImageType >::iterator const_iterator
Definition: FrameModel.h:142