SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEFramework
SEFramework
Frame
Frame.h
Go to the documentation of this file.
1
17
/*
18
* Frame.h
19
*
20
* Created on: Mar 13, 2017
21
* Author: mschefer
22
*/
23
24
#ifndef _SEFRAMEWORK_FRAME_FRAME_H_
25
#define _SEFRAMEWORK_FRAME_FRAME_H_
26
27
#include <algorithm>
28
29
#include "
SEUtils/Types.h
"
30
#include "
SEFramework/Image/Image.h
"
31
#include "
SEFramework/Image/ImageSource.h
"
32
#include "
SEFramework/CoordinateSystem/CoordinateSystem.h
"
33
34
namespace
SourceXtractor
{
35
36
enum
FrameImageLayer
{
37
LayerOriginalImage
= 0,
38
LayerInterpolatedImage
,
39
LayerSubtractedImage
,
40
LayerFilteredImage
,
41
LayerThresholdedImage
,
42
LayerSignalToNoiseMap
,
43
LayerOriginalVarianceMap
,
44
LayerUnfilteredVarianceMap
,
45
LayerVarianceMap
,
46
LayerDetectionThresholdMap
47
};
48
49
template
<
typename
T>
50
class
Frame
{
51
52
public
:
53
54
class
ImageFilter
{
55
public
:
56
virtual
~ImageFilter
() =
default
;
57
virtual
std::shared_ptr<Image<T>
>
processImage
(
std::shared_ptr
<
Image<T>
>
image
,
std::shared_ptr
<
Image<T>
>
variance
, T
threshold
)
const
= 0;
58
};
59
60
Frame
(
std::shared_ptr
<
Image<T>
>
detection_image
,
61
std::shared_ptr<WeightImage>
variance_map
,
62
WeightImage::PixelType
variance_threshold
,
63
std::shared_ptr<CoordinateSystem>
coordinate_system
,
64
SeFloat
gain,
SeFloat
saturation,
int
interpolation_gap
);
65
66
// FIXME: this simplified version is used in unit tests, get rid of it
67
explicit
Frame
(
std::shared_ptr
<
Image<T>
>
detection_image
,
68
std::shared_ptr<CoordinateSystem>
coordinate_system
=
nullptr
,
69
std::shared_ptr<WeightImage>
variance_map
=
nullptr
);
70
71
//
72
// Methods to get the image in one form or another
73
//
74
75
std::shared_ptr<Image<T>
>
getImage
(
FrameImageLayer
layer
)
const
;
76
77
78
// Just the original image
79
std::shared_ptr<Image<T>
>
getOriginalImage
()
const
{
80
return
m_image
;
81
}
82
83
size_t
getHduIndex
()
const
{
84
return
m_hdu_index
;
85
}
86
87
void
setHduIndex
(
size_t
hdu_index
) {
88
m_hdu_index
=
hdu_index
;
89
}
90
91
// Metadata of the original image
92
const
std::map<std::string, MetadataEntry>
&
getMetadata
()
const
{
93
return
m_metadata
;
94
};
95
96
void
setMetadata
(
const
std::map<std::string, MetadataEntry>
&
metadata
) {
97
m_metadata
=
metadata
;
98
};
99
100
// Returns the image with bad pixels interpolated (if interpolation is active, otherwise returns original)
101
std::shared_ptr<Image<T>
>
getInterpolatedImage
()
const
;
102
103
// Get the image with the background subtracted
104
std::shared_ptr<Image<T>
>
getSubtractedImage
()
const
;
105
106
// Get the image with a filter applied to the subtracted image
107
std::shared_ptr<Image<T>
>
getFilteredImage
()
const
;
108
109
// Get the filtered image with the detection threshold subtracted from it
110
std::shared_ptr<Image<T>
>
getThresholdedImage
()
const
;
111
112
// Get the SNR image
113
std::shared_ptr<Image<T>
>
getSnrImage
()
const
;
114
115
//
116
// Methods to get the image in one form or another
117
//
118
119
std::shared_ptr<WeightImage>
getVarianceMap
()
const
;
120
121
std::shared_ptr<WeightImage>
getUnfilteredVarianceMap
()
const
;
122
123
std::shared_ptr<WeightImage>
getOriginalVarianceMap
()
const
{
124
return
m_variance_map
;
125
}
126
127
//
128
// Methods to get frame metadata
129
//
130
131
std::shared_ptr<CoordinateSystem>
getCoordinateSystem
()
const
{
132
return
m_coordinate_system
;
133
}
134
135
typename
WeightImage::PixelType
getVarianceThreshold
()
const
{
136
return
m_variance_threshold
;
137
}
138
139
SeFloat
getGain
()
const
{
140
return
m_gain
;
141
}
142
143
SeFloat
getSaturation
()
const
{
144
return
m_saturation
;
145
}
146
147
SeFloat
getBackgroundMedianRms
()
const
{
148
return
m_background_rms
;
149
}
150
151
std::shared_ptr<Image<T>
>
getDetectionThresholdMap
()
const
;
152
153
std::string
getLabel
()
const
{
154
return
m_label
;
155
}
156
157
//
158
// Setters
159
//
160
161
void
setVarianceMap
(
std::shared_ptr<WeightImage>
variance_map
);
162
163
void
setVarianceThreshold
(
WeightImage::PixelType
threshold
);
164
165
std::shared_ptr<Image<T>
>
getBackgroundLevelMap
()
const
;
166
167
void
setDetectionThreshold
(T
detection_threshold
);
168
169
void
setBackgroundLevel
(T
background_level
);
170
171
void
setBackgroundLevel
(
std::shared_ptr
<
Image<T>
>
background_level_map
, T
background_rms
);
172
173
void
setFilter
(
std::shared_ptr<ImageFilter>
filter
);
174
175
void
setLabel
(
const
std::string
&
label
);
176
177
private
:
178
179
void
applyFilter
();
180
void
applyInterpolation
();
181
182
std::shared_ptr<Image<T>
>
m_image
;
183
std::shared_ptr<WeightImage>
m_variance_map
;
184
std::shared_ptr<Image<T>
>
m_background_level_map
;
185
186
std::shared_ptr<CoordinateSystem>
m_coordinate_system
;
187
188
SeFloat
m_gain
;
189
SeFloat
m_saturation
;
190
SeFloat
m_background_rms
;
191
192
T
m_detection_threshold
;
193
typename
WeightImage::PixelType
m_variance_threshold
;
194
195
int
m_interpolation_gap
;
// max interpolation gap, 0 == no interpolation
196
197
std::shared_ptr<ImageFilter>
m_filter
;
198
std::shared_ptr<Image<T>
>
m_interpolated_image
;
199
std::shared_ptr<Image<WeightImage::PixelType>
>
m_interpolated_variance
;
200
std::shared_ptr<Image<T>
>
m_filtered_image
;
201
std::shared_ptr<Image<T>
>
m_filtered_variance_map
;
202
203
std::string
m_label
;
204
size_t
m_hdu_index
= 0;
205
std::map<std::string, MetadataEntry>
m_metadata
{};
206
};
207
208
using
DetectionImageFrame
=
Frame<DetectionImage::PixelType>
;
209
using
MeasurementImageFrame
=
Frame<MeasurementImage::PixelType>
;
210
211
}
212
213
#endif
/* _SEFRAMEWORK_FRAME_FRAME_H_ */
CoordinateSystem.h
ImageSource.h
Image.h
Types.h
std::string
SourceXtractor::Frame::ImageFilter
Definition
Frame.h:54
SourceXtractor::Frame::ImageFilter::~ImageFilter
virtual ~ImageFilter()=default
SourceXtractor::Frame::ImageFilter::processImage
virtual std::shared_ptr< Image< T > > processImage(std::shared_ptr< Image< T > > image, std::shared_ptr< Image< T > > variance, T threshold) const =0
SourceXtractor::Frame
Definition
Frame.h:50
SourceXtractor::Frame::getSnrImage
std::shared_ptr< Image< T > > getSnrImage() const
Definition
Frame.cpp:141
SourceXtractor::Frame::setBackgroundLevel
void setBackgroundLevel(T background_level)
Definition
Frame.cpp:230
SourceXtractor::Frame::m_gain
SeFloat m_gain
Definition
Frame.h:188
SourceXtractor::Frame::getMetadata
const std::map< std::string, MetadataEntry > & getMetadata() const
Definition
Frame.h:92
SourceXtractor::Frame::applyInterpolation
void applyInterpolation()
Definition
Frame.cpp:282
SourceXtractor::Frame::getCoordinateSystem
std::shared_ptr< CoordinateSystem > getCoordinateSystem() const
Definition
Frame.h:131
SourceXtractor::Frame::getDetectionThresholdMap
std::shared_ptr< Image< T > > getDetectionThresholdMap() const
Definition
Frame.cpp:164
SourceXtractor::Frame::setFilter
void setFilter(std::shared_ptr< ImageFilter > filter)
Definition
Frame.cpp:247
SourceXtractor::Frame::m_variance_map
std::shared_ptr< WeightImage > m_variance_map
Definition
Frame.h:183
SourceXtractor::Frame::m_label
std::string m_label
Definition
Frame.h:203
SourceXtractor::Frame::m_background_rms
SeFloat m_background_rms
Definition
Frame.h:190
SourceXtractor::Frame::m_interpolated_image
std::shared_ptr< Image< T > > m_interpolated_image
Definition
Frame.h:198
SourceXtractor::Frame::getImage
std::shared_ptr< Image< T > > getImage(FrameImageLayer layer) const
Definition
Frame.cpp:74
SourceXtractor::Frame::getGain
SeFloat getGain() const
Definition
Frame.h:139
SourceXtractor::Frame::m_hdu_index
size_t m_hdu_index
Definition
Frame.h:204
SourceXtractor::Frame::m_background_level_map
std::shared_ptr< Image< T > > m_background_level_map
Definition
Frame.h:184
SourceXtractor::Frame::applyFilter
void applyFilter()
Definition
Frame.cpp:262
SourceXtractor::Frame::m_interpolation_gap
int m_interpolation_gap
Definition
Frame.h:195
SourceXtractor::Frame::getHduIndex
size_t getHduIndex() const
Definition
Frame.h:83
SourceXtractor::Frame::setDetectionThreshold
void setDetectionThreshold(T detection_threshold)
Definition
Frame.cpp:224
SourceXtractor::Frame::setLabel
void setLabel(const std::string &label)
Definition
Frame.cpp:256
SourceXtractor::Frame::m_filter
std::shared_ptr< ImageFilter > m_filter
Definition
Frame.h:197
SourceXtractor::Frame::setVarianceMap
void setVarianceMap(std::shared_ptr< WeightImage > variance_map)
Definition
Frame.cpp:175
SourceXtractor::Frame::getBackgroundLevelMap
std::shared_ptr< Image< T > > getBackgroundLevelMap() const
Definition
Frame.cpp:212
SourceXtractor::Frame::m_filtered_variance_map
std::shared_ptr< Image< T > > m_filtered_variance_map
Definition
Frame.h:201
SourceXtractor::Frame::getOriginalVarianceMap
std::shared_ptr< WeightImage > getOriginalVarianceMap() const
Definition
Frame.h:123
SourceXtractor::Frame::m_variance_threshold
WeightImage::PixelType m_variance_threshold
Definition
Frame.h:193
SourceXtractor::Frame::m_interpolated_variance
std::shared_ptr< Image< WeightImage::PixelType > > m_interpolated_variance
Definition
Frame.h:199
SourceXtractor::Frame::getVarianceThreshold
WeightImage::PixelType getVarianceThreshold() const
Definition
Frame.h:135
SourceXtractor::Frame::Frame
Frame(std::shared_ptr< Image< T > > detection_image, std::shared_ptr< WeightImage > variance_map, WeightImage::PixelType variance_threshold, std::shared_ptr< CoordinateSystem > coordinate_system, SeFloat gain, SeFloat saturation, int interpolation_gap)
Definition
Frame.cpp:31
SourceXtractor::Frame::m_coordinate_system
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition
Frame.h:186
SourceXtractor::Frame::getInterpolatedImage
std::shared_ptr< Image< T > > getInterpolatedImage() const
Definition
Frame.cpp:112
SourceXtractor::Frame::getUnfilteredVarianceMap
std::shared_ptr< WeightImage > getUnfilteredVarianceMap() const
Definition
Frame.cpp:153
SourceXtractor::Frame::getLabel
std::string getLabel() const
Definition
Frame.h:153
SourceXtractor::Frame::getBackgroundMedianRms
SeFloat getBackgroundMedianRms() const
Definition
Frame.h:147
SourceXtractor::Frame::m_saturation
SeFloat m_saturation
Definition
Frame.h:189
SourceXtractor::Frame::m_metadata
std::map< std::string, MetadataEntry > m_metadata
Definition
Frame.h:205
SourceXtractor::Frame::setHduIndex
void setHduIndex(size_t hdu_index)
Definition
Frame.h:87
SourceXtractor::Frame::getOriginalImage
std::shared_ptr< Image< T > > getOriginalImage() const
Definition
Frame.h:79
SourceXtractor::Frame::m_filtered_image
std::shared_ptr< Image< T > > m_filtered_image
Definition
Frame.h:200
SourceXtractor::Frame::setMetadata
void setMetadata(const std::map< std::string, MetadataEntry > &metadata)
Definition
Frame.h:96
SourceXtractor::Frame::m_detection_threshold
T m_detection_threshold
Definition
Frame.h:192
SourceXtractor::Frame::getThresholdedImage
std::shared_ptr< Image< T > > getThresholdedImage() const
Definition
Frame.cpp:135
SourceXtractor::Frame::getFilteredImage
std::shared_ptr< Image< T > > getFilteredImage() const
Definition
Frame.cpp:129
SourceXtractor::Frame::getSaturation
SeFloat getSaturation() const
Definition
Frame.h:143
SourceXtractor::Frame::getSubtractedImage
std::shared_ptr< Image< T > > getSubtractedImage() const
Definition
Frame.cpp:123
SourceXtractor::Frame::getVarianceMap
std::shared_ptr< WeightImage > getVarianceMap() const
Definition
Frame.cpp:147
SourceXtractor::Frame::m_image
std::shared_ptr< Image< T > > m_image
Definition
Frame.h:182
SourceXtractor::Frame::setVarianceThreshold
void setVarianceThreshold(WeightImage::PixelType threshold)
Definition
Frame.cpp:190
SourceXtractor::Image::PixelType
T PixelType
Definition
Image.h:48
std::function
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::FrameImageLayer
FrameImageLayer
Definition
Frame.h:36
SourceXtractor::LayerVarianceMap
@ LayerVarianceMap
Definition
Frame.h:45
SourceXtractor::LayerFilteredImage
@ LayerFilteredImage
Definition
Frame.h:40
SourceXtractor::LayerOriginalImage
@ LayerOriginalImage
Definition
Frame.h:37
SourceXtractor::LayerDetectionThresholdMap
@ LayerDetectionThresholdMap
Definition
Frame.h:46
SourceXtractor::LayerUnfilteredVarianceMap
@ LayerUnfilteredVarianceMap
Definition
Frame.h:44
SourceXtractor::LayerThresholdedImage
@ LayerThresholdedImage
Definition
Frame.h:41
SourceXtractor::LayerInterpolatedImage
@ LayerInterpolatedImage
Definition
Frame.h:38
SourceXtractor::LayerOriginalVarianceMap
@ LayerOriginalVarianceMap
Definition
Frame.h:43
SourceXtractor::LayerSubtractedImage
@ LayerSubtractedImage
Definition
Frame.h:39
SourceXtractor::LayerSignalToNoiseMap
@ LayerSignalToNoiseMap
Definition
Frame.h:42
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition
Types.h:32
std::shared_ptr
Generated by
1.10.0