SourceXtractorPlusPlus
1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
SEImplementation
CheckImages
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
33
#include "
SEFramework/Configuration/Configurable.h
"
34
#include "
SEFramework/CoordinateSystem/CoordinateSystem.h
"
35
#include "
SEFramework/Image/Image.h
"
36
#include "
SEFramework/Image/VectorImage.h
"
37
#include "
SEFramework/Image/ProcessedImage.h
"
38
#include "
SEFramework/Image/WriteableImage.h
"
39
#include "
SEFramework/Frame/Frame.h
"
40
41
#include "
SEImplementation/Image/LockedWriteableImage.h
"
42
43
44
namespace
SourceXtractor
{
45
46
class
CheckImages
:
public
Configurable
{
47
48
public
:
49
50
virtual
~CheckImages
() =
default
;
51
52
void
saveImages
();
53
54
std::shared_ptr<WriteableImage<int>
>
getSegmentationImage
(
size_t
index)
const
{
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
64
std::shared_ptr<WriteableImage<int>
>
getPartitionImage
(
size_t
index)
const
{
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
74
std::shared_ptr<WriteableImage<int>
>
getGroupImage
(
size_t
index)
const
{
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
84
std::shared_ptr<WriteableImage<int>
>
getDetectionAutoApertureImage
(
size_t
index)
const
{
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
94
std::shared_ptr<WriteableImage<int>
>
getDetectionApertureImage
(
size_t
index)
const
{
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
104
std::shared_ptr<WriteableImage<SeFloat>
>
getMoffatImage
(
size_t
index)
const
{
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
114
std::shared_ptr<WriteableImage<int>
>
getMeasurementAutoApertureImage
(
unsigned
int
frame_number);
115
116
std::shared_ptr<WriteableImage<int>
>
getMeasurementApertureImage
(
unsigned
int
frame_number);
117
118
std::shared_ptr<WriteableImage<MeasurementImage::PixelType>
>
getModelFittingImage
(
unsigned
int
frame_number);
119
120
std::shared_ptr<WriteableImage<int>
>
getFittingWindowImage
(
unsigned
int
frame_number);
121
122
std::shared_ptr<WriteableImage<MeasurementImage::PixelType>
>
getPsfImage
(
unsigned
int
frame_number);
123
124
std::shared_ptr<WriteableImage<float>
>
getMLDetectionImage
(
unsigned
int
plane_number,
size_t
index);
125
126
void
addBackgroundCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> background_image) {
127
m_background_images
.emplace_back(background_image);
128
}
129
130
void
addMeasurementBackgroundCheckImage
(
size_t
index,
std::shared_ptr
<
Image<SeFloat>
> background_image) {
131
m_measurement_background_images
[index] = background_image;
132
}
133
134
void
addVarianceCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> variance_image) {
135
m_variance_images
.emplace_back(variance_image);
136
}
137
138
void
addMeasurementVarianceCheckImage
(
size_t
index,
std::shared_ptr
<
Image<SeFloat>
> variance_image) {
139
m_measurement_variance_images
[index] = variance_image;
140
}
141
142
void
addFilteredCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> filtered_image) {
143
m_filtered_images
.emplace_back(filtered_image);
144
}
145
146
void
addThresholdedCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> thresholded_image) {
147
m_thresholded_images
.emplace_back(thresholded_image);
148
}
149
150
void
addSnrCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> snr_image) {
151
m_snr_images
.emplace_back(snr_image);
152
}
153
154
std::shared_ptr<WriteableImage<SeFloat>
>
getWriteableCheckImage
(
std::string
id
,
int
width,
int
height);
155
void
setCustomCheckImage
(
std::string
id
,
std::shared_ptr
<
Image<SeFloat>
> image);
156
157
void
reportConfigDependencies
(
Euclid::Configuration::ConfigManager
& manager)
const override
;
158
void
configure
(
Euclid::Configuration::ConfigManager
& manager)
override
;
159
160
static
CheckImages
&
getInstance
() {
161
if
(
m_instance
==
nullptr
) {
162
m_instance
.reset(
new
CheckImages
);
163
}
164
165
return
*
m_instance
;
166
}
167
168
private
:
169
CheckImages
();
170
171
static
std::unique_ptr<CheckImages>
m_instance
;
172
173
struct
FrameInfo
{
174
std::string
m_label
;
175
int
m_width
,
m_height
;
176
std::shared_ptr<CoordinateSystem>
m_coordinate_system
;
177
std::shared_ptr<DetectionImage>
m_subtracted_image
;
178
};
179
180
// check image
181
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_segmentation_images
;
182
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_partition_images
;
183
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_group_images
;
184
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_auto_aperture_images
;
185
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_aperture_images
;
186
std::vector<std::shared_ptr<WriteableImage<SeFloat>
>>
m_moffat_images
;
187
188
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_measurement_aperture_images
;
189
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_measurement_auto_aperture_images
;
190
std::map<unsigned int, std::shared_ptr<WriteableImage<MeasurementImage::PixelType>
>>
m_check_image_model_fitting
,
m_check_image_psf
;
191
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_check_image_fitting_window
;
192
std::vector<std::map<unsigned int, std::shared_ptr<WriteableImage<float>
>>>
m_check_image_ml_detection
;
193
194
std::vector<std::shared_ptr<DetectionImage>
>
m_detection_images
;
195
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_background_images
;
196
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_filtered_images
;
197
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_thresholded_images
;
198
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_snr_images
;
199
std::vector<std::shared_ptr<WeightImage>
>
m_variance_images
;
200
201
std::map<unsigned int, std::shared_ptr<Image<SeFloat>
>>
m_measurement_background_images
;
202
std::map<unsigned int, std::shared_ptr<WeightImage>
>
m_measurement_variance_images
;
203
204
205
std::vector<std::shared_ptr<CoordinateSystem>
>
m_coordinate_systems
;
206
207
boost::filesystem::path
m_model_fitting_image_filename
;
208
boost::filesystem::path
m_fitting_window_image_filename
;
209
boost::filesystem::path
m_residual_filename
;
210
boost::filesystem::path
m_background_filename
;
211
boost::filesystem::path
m_variance_filename
;
212
boost::filesystem::path
m_segmentation_filename
;
213
boost::filesystem::path
m_partition_filename
;
214
boost::filesystem::path
m_group_filename
;
215
boost::filesystem::path
m_filtered_filename
;
216
boost::filesystem::path
m_thresholded_filename
;
217
boost::filesystem::path
m_snr_filename
;
218
boost::filesystem::path
m_auto_aperture_filename
;
219
boost::filesystem::path
m_aperture_filename
;
220
boost::filesystem::path
m_moffat_filename
;
221
boost::filesystem::path
m_psf_filename
;
222
boost::filesystem::path
m_ml_detection_filename
;
223
224
boost::filesystem::path
m_measurement_background_filename
;
225
boost::filesystem::path
m_measurement_variance_filename
;
226
227
std::map<boost::filesystem::path, std::tuple<std::shared_ptr<Image<SeFloat>
>,
bool
>>
m_custom_images
;
228
229
std::map<int, FrameInfo>
m_measurement_frames
;
230
231
std::mutex
m_access_mutex
;
232
};
233
234
}
235
236
237
238
#endif
/* _SEIMPLEMENTATION_CHECKIMAGES_CHECKIMAGES_H_ */
Configurable.h
CoordinateSystem.h
Frame.h
Image.h
LockedWriteableImage.h
ProcessedImage.h
VectorImage.h
WriteableImage.h
std::string
Euclid::Configuration::ConfigManager
SourceXtractor::CheckImages::m_partition_filename
boost::filesystem::path m_partition_filename
Definition
CheckImages.h:213
SourceXtractor::CheckImages::getGroupImage
std::shared_ptr< WriteableImage< int > > getGroupImage(size_t index) const
Definition
CheckImages.h:74
SourceXtractor::CheckImages::m_variance_images
std::vector< std::shared_ptr< WeightImage > > m_variance_images
Definition
CheckImages.h:199
SourceXtractor::CheckImages::m_detection_images
std::vector< std::shared_ptr< DetectionImage > > m_detection_images
Definition
CheckImages.h:194
SourceXtractor::CheckImages::m_measurement_aperture_images
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_aperture_images
Definition
CheckImages.h:188
SourceXtractor::CheckImages::addMeasurementBackgroundCheckImage
void addMeasurementBackgroundCheckImage(size_t index, std::shared_ptr< Image< SeFloat > > background_image)
Definition
CheckImages.h:130
SourceXtractor::CheckImages::getMeasurementAutoApertureImage
std::shared_ptr< WriteableImage< int > > getMeasurementAutoApertureImage(unsigned int frame_number)
Definition
CheckImages.cpp:175
SourceXtractor::CheckImages::addVarianceCheckImage
void addVarianceCheckImage(std::shared_ptr< Image< SeFloat > > variance_image)
Definition
CheckImages.h:134
SourceXtractor::CheckImages::m_group_filename
boost::filesystem::path m_group_filename
Definition
CheckImages.h:214
SourceXtractor::CheckImages::m_check_image_psf
std::map< unsigned int, std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > > m_check_image_psf
Definition
CheckImages.h:190
SourceXtractor::CheckImages::m_ml_detection_filename
boost::filesystem::path m_ml_detection_filename
Definition
CheckImages.h:222
SourceXtractor::CheckImages::setCustomCheckImage
void setCustomCheckImage(std::string id, std::shared_ptr< Image< SeFloat > > image)
Definition
CheckImages.cpp:80
SourceXtractor::CheckImages::m_variance_filename
boost::filesystem::path m_variance_filename
Definition
CheckImages.h:211
SourceXtractor::CheckImages::m_residual_filename
boost::filesystem::path m_residual_filename
Definition
CheckImages.h:209
SourceXtractor::CheckImages::m_measurement_auto_aperture_images
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_auto_aperture_images
Definition
CheckImages.h:189
SourceXtractor::CheckImages::m_filtered_filename
boost::filesystem::path m_filtered_filename
Definition
CheckImages.h:215
SourceXtractor::CheckImages::m_fitting_window_image_filename
boost::filesystem::path m_fitting_window_image_filename
Definition
CheckImages.h:208
SourceXtractor::CheckImages::addFilteredCheckImage
void addFilteredCheckImage(std::shared_ptr< Image< SeFloat > > filtered_image)
Definition
CheckImages.h:142
SourceXtractor::CheckImages::getMeasurementApertureImage
std::shared_ptr< WriteableImage< int > > getMeasurementApertureImage(unsigned int frame_number)
Definition
CheckImages.cpp:202
SourceXtractor::CheckImages::m_measurement_background_images
std::map< unsigned int, std::shared_ptr< Image< SeFloat > > > m_measurement_background_images
Definition
CheckImages.h:201
SourceXtractor::CheckImages::m_group_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_group_images
Definition
CheckImages.h:183
SourceXtractor::CheckImages::getMLDetectionImage
std::shared_ptr< WriteableImage< float > > getMLDetectionImage(unsigned int plane_number, size_t index)
Definition
CheckImages.cpp:319
SourceXtractor::CheckImages::m_instance
static std::unique_ptr< CheckImages > m_instance
Definition
CheckImages.h:171
SourceXtractor::CheckImages::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition
CheckImages.cpp:84
SourceXtractor::CheckImages::getWriteableCheckImage
std::shared_ptr< WriteableImage< SeFloat > > getWriteableCheckImage(std::string id, int width, int height)
Definition
CheckImages.cpp:65
SourceXtractor::CheckImages::getFittingWindowImage
std::shared_ptr< WriteableImage< int > > getFittingWindowImage(unsigned int frame_number)
Definition
CheckImages.cpp:265
SourceXtractor::CheckImages::~CheckImages
virtual ~CheckImages()=default
SourceXtractor::CheckImages::m_auto_aperture_filename
boost::filesystem::path m_auto_aperture_filename
Definition
CheckImages.h:218
SourceXtractor::CheckImages::addSnrCheckImage
void addSnrCheckImage(std::shared_ptr< Image< SeFloat > > snr_image)
Definition
CheckImages.h:150
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition
CheckImages.h:160
SourceXtractor::CheckImages::m_check_image_model_fitting
std::map< unsigned int, std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > > m_check_image_model_fitting
Definition
CheckImages.h:190
SourceXtractor::CheckImages::m_moffat_filename
boost::filesystem::path m_moffat_filename
Definition
CheckImages.h:220
SourceXtractor::CheckImages::addBackgroundCheckImage
void addBackgroundCheckImage(std::shared_ptr< Image< SeFloat > > background_image)
Definition
CheckImages.h:126
SourceXtractor::CheckImages::getMoffatImage
std::shared_ptr< WriteableImage< SeFloat > > getMoffatImage(size_t index) const
Definition
CheckImages.h:104
SourceXtractor::CheckImages::addMeasurementVarianceCheckImage
void addMeasurementVarianceCheckImage(size_t index, std::shared_ptr< Image< SeFloat > > variance_image)
Definition
CheckImages.h:138
SourceXtractor::CheckImages::m_filtered_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_filtered_images
Definition
CheckImages.h:196
SourceXtractor::CheckImages::getSegmentationImage
std::shared_ptr< WriteableImage< int > > getSegmentationImage(size_t index) const
Definition
CheckImages.h:54
SourceXtractor::CheckImages::m_snr_filename
boost::filesystem::path m_snr_filename
Definition
CheckImages.h:217
SourceXtractor::CheckImages::m_thresholded_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_thresholded_images
Definition
CheckImages.h:197
SourceXtractor::CheckImages::m_measurement_variance_filename
boost::filesystem::path m_measurement_variance_filename
Definition
CheckImages.h:225
SourceXtractor::CheckImages::m_psf_filename
boost::filesystem::path m_psf_filename
Definition
CheckImages.h:221
SourceXtractor::CheckImages::getPsfImage
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getPsfImage(unsigned int frame_number)
Definition
CheckImages.cpp:291
SourceXtractor::CheckImages::m_coordinate_systems
std::vector< std::shared_ptr< CoordinateSystem > > m_coordinate_systems
Definition
CheckImages.h:205
SourceXtractor::CheckImages::m_partition_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_partition_images
Definition
CheckImages.h:182
SourceXtractor::CheckImages::m_aperture_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_aperture_images
Definition
CheckImages.h:185
SourceXtractor::CheckImages::m_measurement_background_filename
boost::filesystem::path m_measurement_background_filename
Definition
CheckImages.h:224
SourceXtractor::CheckImages::m_segmentation_filename
boost::filesystem::path m_segmentation_filename
Definition
CheckImages.h:212
SourceXtractor::CheckImages::reportConfigDependencies
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition
CheckImages.cpp:58
SourceXtractor::CheckImages::m_segmentation_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_segmentation_images
Definition
CheckImages.h:181
SourceXtractor::CheckImages::addThresholdedCheckImage
void addThresholdedCheckImage(std::shared_ptr< Image< SeFloat > > thresholded_image)
Definition
CheckImages.h:146
SourceXtractor::CheckImages::m_check_image_ml_detection
std::vector< std::map< unsigned int, std::shared_ptr< WriteableImage< float > > > > m_check_image_ml_detection
Definition
CheckImages.h:192
SourceXtractor::CheckImages::CheckImages
CheckImages()
Definition
CheckImages.cpp:55
SourceXtractor::CheckImages::getDetectionApertureImage
std::shared_ptr< WriteableImage< int > > getDetectionApertureImage(size_t index) const
Definition
CheckImages.h:94
SourceXtractor::CheckImages::m_thresholded_filename
boost::filesystem::path m_thresholded_filename
Definition
CheckImages.h:216
SourceXtractor::CheckImages::m_aperture_filename
boost::filesystem::path m_aperture_filename
Definition
CheckImages.h:219
SourceXtractor::CheckImages::m_snr_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_snr_images
Definition
CheckImages.h:198
SourceXtractor::CheckImages::m_auto_aperture_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_auto_aperture_images
Definition
CheckImages.h:184
SourceXtractor::CheckImages::getModelFittingImage
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getModelFittingImage(unsigned int frame_number)
Definition
CheckImages.cpp:230
SourceXtractor::CheckImages::m_background_filename
boost::filesystem::path m_background_filename
Definition
CheckImages.h:210
SourceXtractor::CheckImages::m_measurement_variance_images
std::map< unsigned int, std::shared_ptr< WeightImage > > m_measurement_variance_images
Definition
CheckImages.h:202
SourceXtractor::CheckImages::m_moffat_images
std::vector< std::shared_ptr< WriteableImage< SeFloat > > > m_moffat_images
Definition
CheckImages.h:186
SourceXtractor::CheckImages::m_model_fitting_image_filename
boost::filesystem::path m_model_fitting_image_filename
Definition
CheckImages.h:207
SourceXtractor::CheckImages::saveImages
void saveImages()
Definition
CheckImages.cpp:345
SourceXtractor::CheckImages::getPartitionImage
std::shared_ptr< WriteableImage< int > > getPartitionImage(size_t index) const
Definition
CheckImages.h:64
SourceXtractor::CheckImages::m_measurement_frames
std::map< int, FrameInfo > m_measurement_frames
Definition
CheckImages.h:229
SourceXtractor::CheckImages::getDetectionAutoApertureImage
std::shared_ptr< WriteableImage< int > > getDetectionAutoApertureImage(size_t index) const
Definition
CheckImages.h:84
SourceXtractor::CheckImages::m_background_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_background_images
Definition
CheckImages.h:195
SourceXtractor::CheckImages::m_check_image_fitting_window
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_check_image_fitting_window
Definition
CheckImages.h:191
SourceXtractor::CheckImages::m_custom_images
std::map< boost::filesystem::path, std::tuple< std::shared_ptr< Image< SeFloat > >, bool > > m_custom_images
Definition
CheckImages.h:227
SourceXtractor::CheckImages::m_access_mutex
std::mutex m_access_mutex
Definition
CheckImages.h:231
SourceXtractor::Configurable
Interface of objects which can be configured.
Definition
Configurable.h:37
SourceXtractor::Image
Interface representing an image.
Definition
Image.h:44
SourceXtractor::LockedWriteableImage::create
static std::shared_ptr< LockedWriteableImage< T > > create(Args &&... args)
Definition
LockedWriteableImage.h:25
std::map
std::mutex
SourceXtractor
Definition
Aperture.h:30
std::shared_ptr
SourceXtractor::CheckImages::FrameInfo
Definition
CheckImages.h:173
SourceXtractor::CheckImages::FrameInfo::m_coordinate_system
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition
CheckImages.h:176
SourceXtractor::CheckImages::FrameInfo::m_label
std::string m_label
Definition
CheckImages.h:174
SourceXtractor::CheckImages::FrameInfo::m_width
int m_width
Definition
CheckImages.h:175
SourceXtractor::CheckImages::FrameInfo::m_subtracted_image
std::shared_ptr< DetectionImage > m_subtracted_image
Definition
CheckImages.h:177
SourceXtractor::CheckImages::FrameInfo::m_height
int m_height
Definition
CheckImages.h:175
std::unique_ptr
std::vector
Generated by
1.15.0