SourceXtractorPlusPlus
0.21
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<MeasurementImage::PixelType>
>
getPsfImage
(
unsigned
int
frame_number
);
121
122
std::shared_ptr<WriteableImage<float>
>
getMLDetectionImage
(
unsigned
int
plane_number
,
size_t
index);
123
124
void
addBackgroundCheckImage
(
std::shared_ptr
<
Image<SeFloat>
>
background_image
) {
125
m_background_images
.
emplace_back
(
background_image
);
126
}
127
128
void
addMeasurementBackgroundCheckImage
(
size_t
index,
std::shared_ptr
<
Image<SeFloat>
>
background_image
) {
129
m_measurement_background_images
[index] =
background_image
;
130
}
131
132
void
addVarianceCheckImage
(
std::shared_ptr
<
Image<SeFloat>
>
variance_image
) {
133
m_variance_images
.emplace_back(
variance_image
);
134
}
135
136
void
addMeasurementVarianceCheckImage
(
size_t
index,
std::shared_ptr
<
Image<SeFloat>
>
variance_image
) {
137
m_measurement_variance_images
[index] =
variance_image
;
138
}
139
140
void
addFilteredCheckImage
(
std::shared_ptr
<
Image<SeFloat>
>
filtered_image
) {
141
m_filtered_images
.
emplace_back
(
filtered_image
);
142
}
143
144
void
addThresholdedCheckImage
(
std::shared_ptr
<
Image<SeFloat>
>
thresholded_image
) {
145
m_thresholded_images
.
emplace_back
(
thresholded_image
);
146
}
147
148
void
addSnrCheckImage
(
std::shared_ptr
<
Image<SeFloat>
>
snr_image
) {
149
m_snr_images
.
emplace_back
(
snr_image
);
150
}
151
152
std::shared_ptr<WriteableImage<SeFloat>
>
getWriteableCheckImage
(
std::string
id
,
int
width,
int
height);
153
void
setCustomCheckImage
(
std::string
id
,
std::shared_ptr
<
Image<SeFloat>
>
image
);
154
155
void
reportConfigDependencies
(
Euclid::Configuration::ConfigManager
&
manager
)
const override
;
156
void
configure
(
Euclid::Configuration::ConfigManager
&
manager
)
override
;
157
158
static
CheckImages
&
getInstance
() {
159
if
(
m_instance
==
nullptr
) {
160
m_instance
.reset(
new
CheckImages
);
161
}
162
163
return
*
m_instance
;
164
}
165
166
private
:
167
CheckImages
();
168
169
static
std::unique_ptr<CheckImages>
m_instance
;
170
171
struct
FrameInfo
{
172
std::string
m_label
;
173
int
m_width
,
m_height
;
174
std::shared_ptr<CoordinateSystem>
m_coordinate_system
;
175
std::shared_ptr<DetectionImage>
m_subtracted_image
;
176
};
177
178
// check image
179
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_segmentation_images
;
180
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_partition_images
;
181
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_group_images
;
182
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_auto_aperture_images
;
183
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_aperture_images
;
184
std::vector<std::shared_ptr<WriteableImage<SeFloat>
>>
m_moffat_images
;
185
186
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_measurement_aperture_images
;
187
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_measurement_auto_aperture_images
;
188
std::map<unsigned int, std::shared_ptr<WriteableImage<MeasurementImage::PixelType>
>>
m_check_image_model_fitting
,
m_check_image_psf
;
189
std::vector<std::map<unsigned int, std::shared_ptr<WriteableImage<float>
>>>
m_check_image_ml_detection
;
190
191
std::vector<std::shared_ptr<DetectionImage>
>
m_detection_images
;
192
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_background_images
;
193
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_filtered_images
;
194
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_thresholded_images
;
195
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_snr_images
;
196
std::vector<std::shared_ptr<WeightImage>
>
m_variance_images
;
197
198
std::map<unsigned int, std::shared_ptr<Image<SeFloat>
>>
m_measurement_background_images
;
199
std::map<unsigned int, std::shared_ptr<WeightImage>
>
m_measurement_variance_images
;
200
201
202
std::vector<std::shared_ptr<CoordinateSystem>
>
m_coordinate_systems
;
203
204
boost::filesystem::path
m_model_fitting_image_filename
;
205
boost::filesystem::path
m_residual_filename
;
206
boost::filesystem::path
m_background_filename
;
207
boost::filesystem::path
m_variance_filename
;
208
boost::filesystem::path
m_segmentation_filename
;
209
boost::filesystem::path
m_partition_filename
;
210
boost::filesystem::path
m_group_filename
;
211
boost::filesystem::path
m_filtered_filename
;
212
boost::filesystem::path
m_thresholded_filename
;
213
boost::filesystem::path
m_snr_filename
;
214
boost::filesystem::path
m_auto_aperture_filename
;
215
boost::filesystem::path
m_aperture_filename
;
216
boost::filesystem::path
m_moffat_filename
;
217
boost::filesystem::path
m_psf_filename
;
218
boost::filesystem::path
m_ml_detection_filename
;
219
220
boost::filesystem::path
m_measurement_background_filename
;
221
boost::filesystem::path
m_measurement_variance_filename
;
222
223
std::map<boost::filesystem::path, std::tuple<std::shared_ptr<Image<SeFloat>
>,
bool
>>
m_custom_images
;
224
225
std::map<int, FrameInfo>
m_measurement_frames
;
226
227
std::mutex
m_access_mutex
;
228
};
229
230
}
231
232
233
234
#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
Definition
CheckImages.h:46
SourceXtractor::CheckImages::m_partition_filename
boost::filesystem::path m_partition_filename
Definition
CheckImages.h:209
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:196
SourceXtractor::CheckImages::m_detection_images
std::vector< std::shared_ptr< DetectionImage > > m_detection_images
Definition
CheckImages.h:191
SourceXtractor::CheckImages::m_measurement_aperture_images
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_aperture_images
Definition
CheckImages.h:186
SourceXtractor::CheckImages::addMeasurementBackgroundCheckImage
void addMeasurementBackgroundCheckImage(size_t index, std::shared_ptr< Image< SeFloat > > background_image)
Definition
CheckImages.h:128
SourceXtractor::CheckImages::getMeasurementAutoApertureImage
std::shared_ptr< WriteableImage< int > > getMeasurementAutoApertureImage(unsigned int frame_number)
Definition
CheckImages.cpp:174
SourceXtractor::CheckImages::addVarianceCheckImage
void addVarianceCheckImage(std::shared_ptr< Image< SeFloat > > variance_image)
Definition
CheckImages.h:132
SourceXtractor::CheckImages::m_group_filename
boost::filesystem::path m_group_filename
Definition
CheckImages.h:210
SourceXtractor::CheckImages::m_check_image_psf
std::map< unsigned int, std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > > m_check_image_psf
Definition
CheckImages.h:188
SourceXtractor::CheckImages::m_ml_detection_filename
boost::filesystem::path m_ml_detection_filename
Definition
CheckImages.h:218
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:207
SourceXtractor::CheckImages::m_residual_filename
boost::filesystem::path m_residual_filename
Definition
CheckImages.h:205
SourceXtractor::CheckImages::m_measurement_auto_aperture_images
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_auto_aperture_images
Definition
CheckImages.h:187
SourceXtractor::CheckImages::m_filtered_filename
boost::filesystem::path m_filtered_filename
Definition
CheckImages.h:211
SourceXtractor::CheckImages::addFilteredCheckImage
void addFilteredCheckImage(std::shared_ptr< Image< SeFloat > > filtered_image)
Definition
CheckImages.h:140
SourceXtractor::CheckImages::getMeasurementApertureImage
std::shared_ptr< WriteableImage< int > > getMeasurementApertureImage(unsigned int frame_number)
Definition
CheckImages.cpp:201
SourceXtractor::CheckImages::m_measurement_background_images
std::map< unsigned int, std::shared_ptr< Image< SeFloat > > > m_measurement_background_images
Definition
CheckImages.h:198
SourceXtractor::CheckImages::m_group_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_group_images
Definition
CheckImages.h:181
SourceXtractor::CheckImages::getMLDetectionImage
std::shared_ptr< WriteableImage< float > > getMLDetectionImage(unsigned int plane_number, size_t index)
Definition
CheckImages.cpp:291
SourceXtractor::CheckImages::m_instance
static std::unique_ptr< CheckImages > m_instance
Definition
CheckImages.h:169
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::~CheckImages
virtual ~CheckImages()=default
SourceXtractor::CheckImages::m_auto_aperture_filename
boost::filesystem::path m_auto_aperture_filename
Definition
CheckImages.h:214
SourceXtractor::CheckImages::addSnrCheckImage
void addSnrCheckImage(std::shared_ptr< Image< SeFloat > > snr_image)
Definition
CheckImages.h:148
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition
CheckImages.h:158
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:188
SourceXtractor::CheckImages::m_moffat_filename
boost::filesystem::path m_moffat_filename
Definition
CheckImages.h:216
SourceXtractor::CheckImages::addBackgroundCheckImage
void addBackgroundCheckImage(std::shared_ptr< Image< SeFloat > > background_image)
Definition
CheckImages.h:124
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:136
SourceXtractor::CheckImages::m_filtered_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_filtered_images
Definition
CheckImages.h:193
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:213
SourceXtractor::CheckImages::m_thresholded_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_thresholded_images
Definition
CheckImages.h:194
SourceXtractor::CheckImages::m_measurement_variance_filename
boost::filesystem::path m_measurement_variance_filename
Definition
CheckImages.h:221
SourceXtractor::CheckImages::m_psf_filename
boost::filesystem::path m_psf_filename
Definition
CheckImages.h:217
SourceXtractor::CheckImages::getPsfImage
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getPsfImage(unsigned int frame_number)
Definition
CheckImages.cpp:263
SourceXtractor::CheckImages::m_coordinate_systems
std::vector< std::shared_ptr< CoordinateSystem > > m_coordinate_systems
Definition
CheckImages.h:202
SourceXtractor::CheckImages::m_partition_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_partition_images
Definition
CheckImages.h:180
SourceXtractor::CheckImages::m_aperture_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_aperture_images
Definition
CheckImages.h:183
SourceXtractor::CheckImages::m_measurement_background_filename
boost::filesystem::path m_measurement_background_filename
Definition
CheckImages.h:220
SourceXtractor::CheckImages::m_segmentation_filename
boost::filesystem::path m_segmentation_filename
Definition
CheckImages.h:208
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:179
SourceXtractor::CheckImages::addThresholdedCheckImage
void addThresholdedCheckImage(std::shared_ptr< Image< SeFloat > > thresholded_image)
Definition
CheckImages.h:144
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:189
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:212
SourceXtractor::CheckImages::m_aperture_filename
boost::filesystem::path m_aperture_filename
Definition
CheckImages.h:215
SourceXtractor::CheckImages::m_snr_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_snr_images
Definition
CheckImages.h:195
SourceXtractor::CheckImages::m_auto_aperture_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_auto_aperture_images
Definition
CheckImages.h:182
SourceXtractor::CheckImages::getModelFittingImage
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getModelFittingImage(unsigned int frame_number)
Definition
CheckImages.cpp:229
SourceXtractor::CheckImages::m_background_filename
boost::filesystem::path m_background_filename
Definition
CheckImages.h:206
SourceXtractor::CheckImages::m_measurement_variance_images
std::map< unsigned int, std::shared_ptr< WeightImage > > m_measurement_variance_images
Definition
CheckImages.h:199
SourceXtractor::CheckImages::m_moffat_images
std::vector< std::shared_ptr< WriteableImage< SeFloat > > > m_moffat_images
Definition
CheckImages.h:184
SourceXtractor::CheckImages::m_model_fitting_image_filename
boost::filesystem::path m_model_fitting_image_filename
Definition
CheckImages.h:204
SourceXtractor::CheckImages::saveImages
void saveImages()
Definition
CheckImages.cpp:318
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:225
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:192
SourceXtractor::CheckImages::m_custom_images
std::map< boost::filesystem::path, std::tuple< std::shared_ptr< Image< SeFloat > >, bool > > m_custom_images
Definition
CheckImages.h:223
SourceXtractor::CheckImages::m_access_mutex
std::mutex m_access_mutex
Definition
CheckImages.h:227
SourceXtractor::Configurable
Interface of objects which can be configured.
Definition
Configurable.h:37
SourceXtractor::LockedWriteableImage::create
static std::shared_ptr< LockedWriteableImage< T > > create(Args &&... args)
Definition
LockedWriteableImage.h:25
std::vector::emplace_back
T emplace_back(T... args)
std::function
std::mutex
SourceXtractor
Definition
Aperture.h:30
std::shared_ptr
SourceXtractor::CheckImages::FrameInfo
Definition
CheckImages.h:171
SourceXtractor::CheckImages::FrameInfo::m_coordinate_system
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition
CheckImages.h:174
SourceXtractor::CheckImages::FrameInfo::m_label
std::string m_label
Definition
CheckImages.h:172
SourceXtractor::CheckImages::FrameInfo::m_width
int m_width
Definition
CheckImages.h:173
SourceXtractor::CheckImages::FrameInfo::m_subtracted_image
std::shared_ptr< DetectionImage > m_subtracted_image
Definition
CheckImages.h:175
SourceXtractor::CheckImages::FrameInfo::m_height
int m_height
Definition
CheckImages.h:173
Generated by
1.10.0