SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CheckImages.h
Go to the documentation of this file.
1 
17 /*
18  * CheckImages.h
19  *
20  * Created on: May 30, 2017
21  * Author: mschefer
22  */
23 
24 #ifndef _SEIMPLEMENTATION_CHECKIMAGES_CHECKIMAGES_H_
25 #define _SEIMPLEMENTATION_CHECKIMAGES_CHECKIMAGES_H_
26 
27 #include <mutex>
28 #include <map>
29 #include <iostream>
30 
31 #include <boost/filesystem/path.hpp>
32 
40 
42 
43 
44 namespace SourceXtractor {
45 
46 class CheckImages : public Configurable {
47 
48 public:
49 
50  virtual ~CheckImages() = default;
51 
52  void saveImages();
53 
55  if (index < m_segmentation_images.size()) {
56  auto segmentation_image = m_segmentation_images.at(index);
57  if (segmentation_image != nullptr) {
58  return LockedWriteableImage<int>::create(segmentation_image);
59  }
60  }
61  return nullptr;
62  }
63 
65  if (index < m_partition_images.size()) {
66  auto partition_image = m_partition_images.at(index);
67  if (partition_image != nullptr) {
68  return LockedWriteableImage<int>::create(partition_image);
69  }
70  }
71  return nullptr;
72  }
73 
75  if (index < m_group_images.size()) {
76  auto group_image = m_group_images.at(index);
77  if (group_image != nullptr) {
78  return LockedWriteableImage<int>::create(group_image);
79  }
80  }
81  return nullptr;
82  }
83 
85  if (index < m_auto_aperture_images.size()) {
86  auto auto_aperture_image = m_auto_aperture_images.at(index);
87  if (auto_aperture_image != nullptr) {
88  return LockedWriteableImage<int>::create(auto_aperture_image);
89  }
90  }
91  return nullptr;
92  }
93 
95  if (index < m_aperture_images.size()) {
96  auto aperture_image = m_aperture_images.at(index);
97  if (aperture_image != nullptr) {
98  return LockedWriteableImage<int>::create(aperture_image);
99  }
100  }
101  return nullptr;
102  }
103 
105  if (index < m_moffat_images.size()) {
106  auto moffat_image = m_moffat_images.at(index);
107  if (moffat_image != nullptr) {
108  return LockedWriteableImage<SeFloat>::create(moffat_image);
109  }
110  }
111  return nullptr;
112  }
113 
115 
117 
119 
121 
122  std::shared_ptr<WriteableImage<float>> getMLDetectionImage(unsigned int plane_number, size_t index);
123 
125  m_background_images.emplace_back(background_image);
126  }
127 
129  m_variance_images.emplace_back(variance_image);
130  }
131 
133  m_filtered_images.emplace_back(filtered_image);
134  }
135 
137  m_thresholded_images.emplace_back(thresholded_image);
138  }
139 
141  m_snr_images.emplace_back(snr_image);
142  }
143 
146 
148  void configure(Euclid::Configuration::ConfigManager& manager) override;
149 
151  if (m_instance == nullptr) {
152  m_instance.reset(new CheckImages);
153  }
154 
155  return *m_instance;
156  }
157 
158 private:
159  CheckImages();
160 
162 
163  struct FrameInfo {
168  };
169 
170  // check image
177 
182 
189 
190 
192 
193  boost::filesystem::path m_model_fitting_image_filename;
194  boost::filesystem::path m_residual_filename;
195  boost::filesystem::path m_model_background_filename;
196  boost::filesystem::path m_model_variance_filename;
197  boost::filesystem::path m_segmentation_filename;
198  boost::filesystem::path m_partition_filename;
199  boost::filesystem::path m_group_filename;
200  boost::filesystem::path m_filtered_filename;
201  boost::filesystem::path m_thresholded_filename;
202  boost::filesystem::path m_snr_filename;
203  boost::filesystem::path m_auto_aperture_filename;
204  boost::filesystem::path m_aperture_filename;
205  boost::filesystem::path m_moffat_filename;
206  boost::filesystem::path m_psf_filename;
207  boost::filesystem::path m_ml_detection_filename;
208 
210 
212 
214 };
215 
216 }
217 
218 
219 
220 #endif /* _SEIMPLEMENTATION_CHECKIMAGES_CHECKIMAGES_H_ */
std::vector< std::shared_ptr< CoordinateSystem > > m_coordinate_systems
Definition: CheckImages.h:191
boost::filesystem::path m_partition_filename
Definition: CheckImages.h:198
boost::filesystem::path m_model_background_filename
Definition: CheckImages.h:195
std::shared_ptr< WriteableImage< int > > getGroupImage(size_t index) const
Definition: CheckImages.h:74
static std::shared_ptr< LockedWriteableImage< T > > create(Args &&...args)
boost::filesystem::path m_filtered_filename
Definition: CheckImages.h:200
boost::filesystem::path m_thresholded_filename
Definition: CheckImages.h:201
void setCustomCheckImage(std::string id, std::shared_ptr< Image< SeFloat >> image)
Definition: CheckImages.cpp:80
std::shared_ptr< WriteableImage< int > > getPartitionImage(size_t index) const
Definition: CheckImages.h:64
virtual ~CheckImages()=default
std::vector< std::shared_ptr< WriteableImage< int > > > m_auto_aperture_images
Definition: CheckImages.h:174
std::map< boost::filesystem::path, std::tuple< std::shared_ptr< Image< SeFloat > >, bool > > m_custom_images
Definition: CheckImages.h:209
void addFilteredCheckImage(std::shared_ptr< Image< SeFloat >> filtered_image)
Definition: CheckImages.h:132
boost::filesystem::path m_model_variance_filename
Definition: CheckImages.h:196
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_auto_aperture_images
Definition: CheckImages.h:179
boost::filesystem::path m_aperture_filename
Definition: CheckImages.h:204
std::vector< std::shared_ptr< DetectionImage > > m_detection_images
Definition: CheckImages.h:183
std::vector< std::shared_ptr< Image< SeFloat > > > m_snr_images
Definition: CheckImages.h:187
Interface of objects which can be configured.
Definition: Configurable.h:37
boost::filesystem::path m_snr_filename
Definition: CheckImages.h:202
std::vector< std::shared_ptr< WriteableImage< int > > > m_segmentation_images
Definition: CheckImages.h:171
std::map< int, FrameInfo > m_measurement_frames
Definition: CheckImages.h:211
std::shared_ptr< WriteableImage< int > > getDetectionApertureImage(size_t index) const
Definition: CheckImages.h:94
static std::unique_ptr< CheckImages > m_instance
Definition: CheckImages.h:161
STL class.
std::vector< std::shared_ptr< WriteableImage< int > > > m_partition_images
Definition: CheckImages.h:172
void addBackgroundCheckImage(std::shared_ptr< Image< SeFloat >> background_image)
Definition: CheckImages.h:124
STL class.
std::vector< std::shared_ptr< Image< SeFloat > > > m_background_images
Definition: CheckImages.h:184
boost::filesystem::path m_auto_aperture_filename
Definition: CheckImages.h:203
boost::filesystem::path m_group_filename
Definition: CheckImages.h:199
static CheckImages & getInstance()
Definition: CheckImages.h:150
std::vector< std::shared_ptr< Image< SeFloat > > > m_thresholded_images
Definition: CheckImages.h:186
boost::filesystem::path m_psf_filename
Definition: CheckImages.h:206
boost::filesystem::path m_ml_detection_filename
Definition: CheckImages.h:207
void addVarianceCheckImage(std::shared_ptr< Image< SeFloat >> variance_image)
Definition: CheckImages.h:128
std::map< unsigned int, std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > > m_check_image_model_fitting
Definition: CheckImages.h:180
std::vector< std::shared_ptr< WriteableImage< int > > > m_aperture_images
Definition: CheckImages.h:175
std::shared_ptr< WriteableImage< int > > getSegmentationImage(size_t index) const
Definition: CheckImages.h:54
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition: CheckImages.cpp:84
std::map< unsigned int, std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > > m_check_image_psf
Definition: CheckImages.h:180
std::shared_ptr< DetectionImage > m_subtracted_image
Definition: CheckImages.h:167
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition: CheckImages.cpp:58
std::shared_ptr< WriteableImage< float > > getMLDetectionImage(unsigned int plane_number, size_t index)
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getPsfImage(unsigned int frame_number)
std::shared_ptr< WriteableImage< int > > getDetectionAutoApertureImage(size_t index) const
Definition: CheckImages.h:84
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition: CheckImages.h:166
STL class.
STL class.
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_aperture_images
Definition: CheckImages.h:178
std::shared_ptr< WriteableImage< int > > getMeasurementAutoApertureImage(unsigned int frame_number)
std::vector< std::shared_ptr< Image< SeFloat > > > m_filtered_images
Definition: CheckImages.h:185
Interface representing an image.
Definition: Image.h:43
std::vector< std::shared_ptr< WriteableImage< int > > > m_group_images
Definition: CheckImages.h:173
void addThresholdedCheckImage(std::shared_ptr< Image< SeFloat >> thresholded_image)
Definition: CheckImages.h:136
std::shared_ptr< WriteableImage< SeFloat > > getMoffatImage(size_t index) const
Definition: CheckImages.h:104
std::vector< std::shared_ptr< WeightImage > > m_variance_images
Definition: CheckImages.h:188
std::shared_ptr< WriteableImage< SeFloat > > getWriteableCheckImage(std::string id, int width, int height)
Definition: CheckImages.cpp:65
boost::filesystem::path m_moffat_filename
Definition: CheckImages.h:205
boost::filesystem::path m_residual_filename
Definition: CheckImages.h:194
std::shared_ptr< WriteableImage< int > > getMeasurementApertureImage(unsigned int frame_number)
boost::filesystem::path m_model_fitting_image_filename
Definition: CheckImages.h:193
void addSnrCheckImage(std::shared_ptr< Image< SeFloat >> snr_image)
Definition: CheckImages.h:140
std::vector< std::map< unsigned int, std::shared_ptr< WriteableImage< float > > > > m_check_image_ml_detection
Definition: CheckImages.h:181
std::vector< std::shared_ptr< WriteableImage< SeFloat > > > m_moffat_images
Definition: CheckImages.h:176
boost::filesystem::path m_segmentation_filename
Definition: CheckImages.h:197
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getModelFittingImage(unsigned int frame_number)