SourceXtractorPlusPlus
0.19.2
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
addVarianceCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> variance_image) {
129
m_variance_images
.emplace_back(variance_image);
130
}
131
132
void
addFilteredCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> filtered_image) {
133
m_filtered_images
.
emplace_back
(filtered_image);
134
}
135
136
void
addThresholdedCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> thresholded_image) {
137
m_thresholded_images
.
emplace_back
(thresholded_image);
138
}
139
140
void
addSnrCheckImage
(
std::shared_ptr
<
Image<SeFloat>
> snr_image) {
141
m_snr_images
.
emplace_back
(snr_image);
142
}
143
144
std::shared_ptr<WriteableImage<SeFloat>
>
getWriteableCheckImage
(
std::string
id
,
int
width,
int
height);
145
void
setCustomCheckImage
(
std::string
id
,
std::shared_ptr
<
Image<SeFloat>
> image);
146
147
void
reportConfigDependencies
(
Euclid::Configuration::ConfigManager
& manager)
const override
;
148
void
configure
(
Euclid::Configuration::ConfigManager
& manager)
override
;
149
150
static
CheckImages
&
getInstance
() {
151
if
(
m_instance
==
nullptr
) {
152
m_instance
.reset(
new
CheckImages
);
153
}
154
155
return
*
m_instance
;
156
}
157
158
private
:
159
CheckImages
();
160
161
static
std::unique_ptr<CheckImages>
m_instance
;
162
163
struct
FrameInfo
{
164
std::string
m_label
;
165
int
m_width
,
m_height
;
166
std::shared_ptr<CoordinateSystem>
m_coordinate_system
;
167
std::shared_ptr<DetectionImage>
m_subtracted_image
;
168
};
169
170
// check image
171
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_segmentation_images
;
172
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_partition_images
;
173
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_group_images
;
174
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_auto_aperture_images
;
175
std::vector<std::shared_ptr<WriteableImage<int>
>>
m_aperture_images
;
176
std::vector<std::shared_ptr<WriteableImage<SeFloat>
>>
m_moffat_images
;
177
178
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_measurement_aperture_images
;
179
std::map<unsigned int, std::shared_ptr<WriteableImage<int>
>>
m_measurement_auto_aperture_images
;
180
std::map<unsigned int, std::shared_ptr<WriteableImage<MeasurementImage::PixelType>
>>
m_check_image_model_fitting
,
m_check_image_psf
;
181
std::vector<std::map<unsigned int, std::shared_ptr<WriteableImage<float>
>>>
m_check_image_ml_detection
;
182
183
std::vector<std::shared_ptr<DetectionImage>
>
m_detection_images
;
184
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_background_images
;
185
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_filtered_images
;
186
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_thresholded_images
;
187
std::vector<std::shared_ptr<Image<SeFloat>
>>
m_snr_images
;
188
std::vector<std::shared_ptr<WeightImage>
>
m_variance_images
;
189
190
191
std::vector<std::shared_ptr<CoordinateSystem>
>
m_coordinate_systems
;
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
209
std::map<boost::filesystem::path, std::tuple<std::shared_ptr<Image<SeFloat>
>,
bool
>>
m_custom_images
;
210
211
std::map<int, FrameInfo>
m_measurement_frames
;
212
213
std::mutex
m_access_mutex
;
214
};
215
216
}
217
218
219
220
#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:198
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:188
SourceXtractor::CheckImages::m_detection_images
std::vector< std::shared_ptr< DetectionImage > > m_detection_images
Definition
CheckImages.h:183
SourceXtractor::CheckImages::m_measurement_aperture_images
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_aperture_images
Definition
CheckImages.h:178
SourceXtractor::CheckImages::getMeasurementAutoApertureImage
std::shared_ptr< WriteableImage< int > > getMeasurementAutoApertureImage(unsigned int frame_number)
Definition
CheckImages.cpp:171
SourceXtractor::CheckImages::addVarianceCheckImage
void addVarianceCheckImage(std::shared_ptr< Image< SeFloat > > variance_image)
Definition
CheckImages.h:128
SourceXtractor::CheckImages::m_group_filename
boost::filesystem::path m_group_filename
Definition
CheckImages.h:199
SourceXtractor::CheckImages::m_check_image_psf
std::map< unsigned int, std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > > m_check_image_psf
Definition
CheckImages.h:180
SourceXtractor::CheckImages::m_ml_detection_filename
boost::filesystem::path m_ml_detection_filename
Definition
CheckImages.h:207
SourceXtractor::CheckImages::setCustomCheckImage
void setCustomCheckImage(std::string id, std::shared_ptr< Image< SeFloat > > image)
Definition
CheckImages.cpp:80
SourceXtractor::CheckImages::m_residual_filename
boost::filesystem::path m_residual_filename
Definition
CheckImages.h:194
SourceXtractor::CheckImages::m_measurement_auto_aperture_images
std::map< unsigned int, std::shared_ptr< WriteableImage< int > > > m_measurement_auto_aperture_images
Definition
CheckImages.h:179
SourceXtractor::CheckImages::m_filtered_filename
boost::filesystem::path m_filtered_filename
Definition
CheckImages.h:200
SourceXtractor::CheckImages::addFilteredCheckImage
void addFilteredCheckImage(std::shared_ptr< Image< SeFloat > > filtered_image)
Definition
CheckImages.h:132
SourceXtractor::CheckImages::getMeasurementApertureImage
std::shared_ptr< WriteableImage< int > > getMeasurementApertureImage(unsigned int frame_number)
Definition
CheckImages.cpp:198
SourceXtractor::CheckImages::m_group_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_group_images
Definition
CheckImages.h:173
SourceXtractor::CheckImages::getMLDetectionImage
std::shared_ptr< WriteableImage< float > > getMLDetectionImage(unsigned int plane_number, size_t index)
Definition
CheckImages.cpp:288
SourceXtractor::CheckImages::m_model_background_filename
boost::filesystem::path m_model_background_filename
Definition
CheckImages.h:195
SourceXtractor::CheckImages::m_instance
static std::unique_ptr< CheckImages > m_instance
Definition
CheckImages.h:161
SourceXtractor::CheckImages::m_model_variance_filename
boost::filesystem::path m_model_variance_filename
Definition
CheckImages.h:196
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:203
SourceXtractor::CheckImages::addSnrCheckImage
void addSnrCheckImage(std::shared_ptr< Image< SeFloat > > snr_image)
Definition
CheckImages.h:140
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition
CheckImages.h:150
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:180
SourceXtractor::CheckImages::m_moffat_filename
boost::filesystem::path m_moffat_filename
Definition
CheckImages.h:205
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::m_filtered_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_filtered_images
Definition
CheckImages.h:185
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:202
SourceXtractor::CheckImages::m_thresholded_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_thresholded_images
Definition
CheckImages.h:186
SourceXtractor::CheckImages::m_psf_filename
boost::filesystem::path m_psf_filename
Definition
CheckImages.h:206
SourceXtractor::CheckImages::getPsfImage
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getPsfImage(unsigned int frame_number)
Definition
CheckImages.cpp:260
SourceXtractor::CheckImages::m_coordinate_systems
std::vector< std::shared_ptr< CoordinateSystem > > m_coordinate_systems
Definition
CheckImages.h:191
SourceXtractor::CheckImages::m_partition_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_partition_images
Definition
CheckImages.h:172
SourceXtractor::CheckImages::m_aperture_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_aperture_images
Definition
CheckImages.h:175
SourceXtractor::CheckImages::m_segmentation_filename
boost::filesystem::path m_segmentation_filename
Definition
CheckImages.h:197
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:171
SourceXtractor::CheckImages::addThresholdedCheckImage
void addThresholdedCheckImage(std::shared_ptr< Image< SeFloat > > thresholded_image)
Definition
CheckImages.h:136
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:181
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:201
SourceXtractor::CheckImages::m_aperture_filename
boost::filesystem::path m_aperture_filename
Definition
CheckImages.h:204
SourceXtractor::CheckImages::m_snr_images
std::vector< std::shared_ptr< Image< SeFloat > > > m_snr_images
Definition
CheckImages.h:187
SourceXtractor::CheckImages::m_auto_aperture_images
std::vector< std::shared_ptr< WriteableImage< int > > > m_auto_aperture_images
Definition
CheckImages.h:174
SourceXtractor::CheckImages::getModelFittingImage
std::shared_ptr< WriteableImage< MeasurementImage::PixelType > > getModelFittingImage(unsigned int frame_number)
Definition
CheckImages.cpp:226
SourceXtractor::CheckImages::m_moffat_images
std::vector< std::shared_ptr< WriteableImage< SeFloat > > > m_moffat_images
Definition
CheckImages.h:176
SourceXtractor::CheckImages::m_model_fitting_image_filename
boost::filesystem::path m_model_fitting_image_filename
Definition
CheckImages.h:193
SourceXtractor::CheckImages::saveImages
void saveImages()
Definition
CheckImages.cpp:315
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:211
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:184
SourceXtractor::CheckImages::m_custom_images
std::map< boost::filesystem::path, std::tuple< std::shared_ptr< Image< SeFloat > >, bool > > m_custom_images
Definition
CheckImages.h:209
SourceXtractor::CheckImages::m_access_mutex
std::mutex m_access_mutex
Definition
CheckImages.h:213
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::vector::emplace_back
T emplace_back(T... args)
std::map
std::mutex
SourceXtractor
Definition
Aperture.h:30
std::shared_ptr
SourceXtractor::CheckImages::FrameInfo
Definition
CheckImages.h:163
SourceXtractor::CheckImages::FrameInfo::m_coordinate_system
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition
CheckImages.h:166
SourceXtractor::CheckImages::FrameInfo::m_label
std::string m_label
Definition
CheckImages.h:164
SourceXtractor::CheckImages::FrameInfo::m_width
int m_width
Definition
CheckImages.h:165
SourceXtractor::CheckImages::FrameInfo::m_subtracted_image
std::shared_ptr< DetectionImage > m_subtracted_image
Definition
CheckImages.h:167
SourceXtractor::CheckImages::FrameInfo::m_height
int m_height
Definition
CheckImages.h:165
std::unique_ptr
std::vector
Generated by
1.9.7