SourceXtractorPlusPlus
0.12
Please provide a description of the project.
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/CoordinateSystem/CoordinateSystem.h
"
32
33
namespace
SourceXtractor
{
34
35
enum
FrameImageLayer
{
36
LayerOriginalImage
= 0,
37
LayerInterpolatedImage
,
38
LayerSubtractedImage
,
39
LayerFilteredImage
,
40
LayerThresholdedImage
,
41
LayerSignalToNoiseMap
,
42
LayerOriginalVarianceMap
,
43
LayerUnfilteredVarianceMap
,
44
LayerVarianceMap
,
45
LayerDetectionThresholdMap
46
};
47
48
template
<
typename
T>
49
class
Frame
{
50
51
public
:
52
53
class
ImageFilter
{
54
public
:
55
virtual
~ImageFilter
() =
default
;
56
virtual
std::shared_ptr<Image<T>
>
processImage
(
std::shared_ptr
<
Image<T>
> image,
std::shared_ptr
<
Image<T>
> variance, T threshold)
const
= 0;
57
};
58
59
Frame
(
std::shared_ptr
<
Image<T>
> detection_image,
60
std::shared_ptr<WeightImage>
variance_map,
61
WeightImage::PixelType
variance_threshold,
62
std::shared_ptr<CoordinateSystem>
coordinate_system,
63
SeFloat
gain,
SeFloat
saturation,
int
interpolation_gap);
64
65
// FIXME: this simplified version is used in unit tests, get rid of it
66
Frame
(
std::shared_ptr
<
Image<T>
> detection_image,
67
std::shared_ptr<CoordinateSystem>
coordinate_system =
nullptr
,
68
std::shared_ptr<WeightImage>
variance_map =
nullptr
);
69
70
//
71
// Methods to get the image in one form or another
72
//
73
74
std::shared_ptr<Image<T>
>
getImage
(
FrameImageLayer
layer)
const
;
75
76
77
// Just the original image
78
std::shared_ptr<Image<T>
>
getOriginalImage
()
const
{
79
return
m_image
;
80
}
81
82
// Returns the image with bad pixels interpolated (if interpolation is active, otherwise returns original)
83
std::shared_ptr<Image<T>
>
getInterpolatedImage
()
const
;
84
85
// Get the image with the background subtracted
86
std::shared_ptr<Image<T>
>
getSubtractedImage
()
const
;
87
88
// Get the image with a filter applied to the subtracted image
89
std::shared_ptr<Image<T>
>
getFilteredImage
()
const
;
90
91
// Get the filtered image with the detection threshold subtracted from it
92
std::shared_ptr<Image<T>
>
getThresholdedImage
()
const
;
93
94
// Get the SNR image
95
std::shared_ptr<Image<T>
>
getSnrImage
()
const
;
96
97
//
98
// Methods to get the image in one form or another
99
//
100
101
std::shared_ptr<WeightImage>
getVarianceMap
()
const
;
102
103
std::shared_ptr<WeightImage>
getUnfilteredVarianceMap
()
const
;
104
105
std::shared_ptr<WeightImage>
getOriginalVarianceMap
()
const
{
106
return
m_variance_map
;
107
}
108
109
//
110
// Methods to get frame metadata
111
//
112
113
std::shared_ptr<CoordinateSystem>
getCoordinateSystem
()
const
{
114
return
m_coordinate_system
;
115
}
116
117
typename
WeightImage::PixelType
getVarianceThreshold
()
const
{
118
return
m_variance_threshold
;
119
}
120
121
SeFloat
getGain
()
const
{
122
return
m_gain
;
123
}
124
125
SeFloat
getSaturation
()
const
{
126
return
m_saturation
;
127
}
128
129
SeFloat
getBackgroundMedianRms
()
const
{
130
return
m_background_rms
;
131
}
132
133
T
getDetectionThreshold
()
const
{
134
// FIXME using the 0,0 pixel makes no sense
135
return
sqrt
(
m_variance_map
->getValue(0,0)) *
m_detection_threshold
;
136
}
137
138
std::shared_ptr<Image<T>
>
getDetectionThresholdMap
()
const
;
139
140
std::string
getLabel
()
const
{
141
return
m_label
;
142
}
143
144
//
145
// Setters
146
//
147
148
void
setVarianceMap
(
std::shared_ptr<WeightImage>
variance_map);
149
150
void
setVarianceThreshold
(
WeightImage::PixelType
threshold);
151
152
std::shared_ptr<Image<T>
>
getBackgroundLevelMap
()
const
;
153
154
void
setDetectionThreshold
(T detection_threshold);
155
156
void
setBackgroundLevel
(T background_level);
157
158
void
setBackgroundLevel
(
std::shared_ptr
<
Image<T>
> background_level_map, T background_rms);
159
160
void
setFilter
(
std::shared_ptr<ImageFilter>
filter);
161
162
void
setLabel
(
const
std::string
&label);
163
164
private
:
165
166
void
applyFilter
();
167
168
std::shared_ptr<Image<T>
>
m_image
;
169
std::shared_ptr<WeightImage>
m_variance_map
;
170
std::shared_ptr<Image<T>
>
m_background_level_map
;
171
172
std::shared_ptr<CoordinateSystem>
m_coordinate_system
;
173
174
SeFloat
m_gain
;
175
SeFloat
m_saturation
;
176
SeFloat
m_background_rms
;
177
178
T
m_detection_threshold
;
179
typename
WeightImage::PixelType
m_variance_threshold
;
180
181
int
m_interpolation_gap
;
// max interpolation gap, 0 == no interpolation
182
183
std::shared_ptr<ImageFilter>
m_filter
;
184
std::shared_ptr<Image<T>
>
m_interpolated_image
;
185
std::shared_ptr<Image<WeightImage::PixelType>
>
m_interpolated_variance
;
186
std::shared_ptr<Image<T>
>
m_filtered_image
;
187
std::shared_ptr<Image<T>
>
m_filtered_variance_map
;
188
189
std::string
m_label
;
190
};
191
192
using
DetectionImageFrame
=
Frame<DetectionImage::PixelType>
;
193
using
MeasurementImageFrame
=
Frame<MeasurementImage::PixelType>
;
194
195
}
196
197
#endif
/* _SEFRAMEWORK_FRAME_FRAME_H_ */
SourceXtractor::Frame::getLabel
std::string getLabel() const
Definition:
Frame.h:140
SourceXtractor::LayerUnfilteredVarianceMap
Definition:
Frame.h:43
std::shared_ptr
Types.h
SourceXtractor::LayerDetectionThresholdMap
Definition:
Frame.h:45
SourceXtractor::Frame::m_image
std::shared_ptr< Image< T > > m_image
Definition:
Frame.h:168
SourceXtractor::Frame::getInterpolatedImage
std::shared_ptr< Image< T > > getInterpolatedImage() const
Definition:
Frame.cpp:106
SourceXtractor::Frame::ImageFilter
Definition:
Frame.h:53
SourceXtractor::Image::PixelType
T PixelType
Definition:
Image.h:47
SourceXtractor::Frame::m_filtered_image
std::shared_ptr< Image< T > > m_filtered_image
Definition:
Frame.h:186
SourceXtractor::LayerInterpolatedImage
Definition:
Frame.h:37
SourceXtractor::Frame::m_saturation
SeFloat m_saturation
Definition:
Frame.h:175
SourceXtractor::Frame::getSnrImage
std::shared_ptr< Image< T > > getSnrImage() const
Definition:
Frame.cpp:144
SourceXtractor::Frame
Definition:
Frame.h:49
SourceXtractor::Frame::getVarianceMap
std::shared_ptr< WeightImage > getVarianceMap() const
Definition:
Frame.cpp:150
SourceXtractor::LayerOriginalImage
Definition:
Frame.h:36
SourceXtractor::Frame::ImageFilter::~ImageFilter
virtual ~ImageFilter()=default
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition:
Types.h:32
SourceXtractor::Frame::getVarianceThreshold
WeightImage::PixelType getVarianceThreshold() const
Definition:
Frame.h:117
SourceXtractor::LayerOriginalVarianceMap
Definition:
Frame.h:42
SourceXtractor::Frame::m_interpolated_image
std::shared_ptr< Image< T > > m_interpolated_image
Definition:
Frame.h:184
SourceXtractor::LayerVarianceMap
Definition:
Frame.h:44
SourceXtractor::Frame::m_variance_map
std::shared_ptr< WeightImage > m_variance_map
Definition:
Frame.h:169
SourceXtractor::Frame::getImage
std::shared_ptr< Image< T > > getImage(FrameImageLayer layer) const
Definition:
Frame.cpp:68
SourceXtractor::Frame::m_interpolated_variance
std::shared_ptr< Image< WeightImage::PixelType > > m_interpolated_variance
Definition:
Frame.h:185
SourceXtractor::Frame::getGain
SeFloat getGain() const
Definition:
Frame.h:121
SourceXtractor::Frame::getOriginalImage
std::shared_ptr< Image< T > > getOriginalImage() const
Definition:
Frame.h:78
std::string
STL class.
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::getBackgroundMedianRms
SeFloat getBackgroundMedianRms() const
Definition:
Frame.h:129
Image.h
SourceXtractor::Frame::getCoordinateSystem
std::shared_ptr< CoordinateSystem > getCoordinateSystem() const
Definition:
Frame.h:113
SourceXtractor::Frame::m_label
std::string m_label
Definition:
Frame.h:189
SourceXtractor::Frame::applyFilter
void applyFilter()
Definition:
Frame.cpp:255
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::Frame::m_background_level_map
std::shared_ptr< Image< T > > m_background_level_map
Definition:
Frame.h:170
SourceXtractor::Frame::m_detection_threshold
T m_detection_threshold
Definition:
Frame.h:178
SourceXtractor::Frame::getUnfilteredVarianceMap
std::shared_ptr< WeightImage > getUnfilteredVarianceMap() const
Definition:
Frame.cpp:159
SourceXtractor::Frame::getBackgroundLevelMap
std::shared_ptr< Image< T > > getBackgroundLevelMap() const
Definition:
Frame.cpp:209
SourceXtractor::LayerSubtractedImage
Definition:
Frame.h:38
SourceXtractor::LayerSignalToNoiseMap
Definition:
Frame.h:41
SourceXtractor::Frame::setVarianceThreshold
void setVarianceThreshold(WeightImage::PixelType threshold)
Definition:
Frame.cpp:198
SourceXtractor::Frame::getOriginalVarianceMap
std::shared_ptr< WeightImage > getOriginalVarianceMap() const
Definition:
Frame.h:105
SourceXtractor::Frame::setLabel
void setLabel(const std::string &label)
Definition:
Frame.cpp:249
SourceXtractor::Frame::m_filter
std::shared_ptr< ImageFilter > m_filter
Definition:
Frame.h:183
SourceXtractor::Frame::getDetectionThreshold
T getDetectionThreshold() const
Definition:
Frame.h:133
SourceXtractor::Frame::getSaturation
SeFloat getSaturation() const
Definition:
Frame.h:125
SourceXtractor::LayerThresholdedImage
Definition:
Frame.h:40
CoordinateSystem.h
SourceXtractor::Frame::m_filtered_variance_map
std::shared_ptr< Image< T > > m_filtered_variance_map
Definition:
Frame.h:187
SourceXtractor::Frame::m_background_rms
SeFloat m_background_rms
Definition:
Frame.h:176
SourceXtractor::FrameImageLayer
FrameImageLayer
Definition:
Frame.h:35
SourceXtractor::Frame::m_gain
SeFloat m_gain
Definition:
Frame.h:174
SourceXtractor::Frame::setVarianceMap
void setVarianceMap(std::shared_ptr< WeightImage > variance_map)
Definition:
Frame.cpp:187
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:30
SourceXtractor::Frame::m_coordinate_system
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition:
Frame.h:172
SourceXtractor::Frame::setDetectionThreshold
void setDetectionThreshold(T detection_threshold)
Definition:
Frame.cpp:221
SourceXtractor::Frame::getThresholdedImage
std::shared_ptr< Image< T > > getThresholdedImage() const
Definition:
Frame.cpp:138
SourceXtractor::Frame::m_variance_threshold
WeightImage::PixelType m_variance_threshold
Definition:
Frame.h:179
SourceXtractor::Image
Interface representing an image.
Definition:
Image.h:43
std::sqrt
T sqrt(T... args)
SourceXtractor::Frame::setFilter
void setFilter(std::shared_ptr< ImageFilter > filter)
Definition:
Frame.cpp:241
SourceXtractor::Frame::m_interpolation_gap
int m_interpolation_gap
Definition:
Frame.h:181
SourceXtractor::Frame::getSubtractedImage
std::shared_ptr< Image< T > > getSubtractedImage() const
Definition:
Frame.cpp:123
SourceXtractor::Frame::setBackgroundLevel
void setBackgroundLevel(T background_level)
Definition:
Frame.cpp:227
SourceXtractor::LayerFilteredImage
Definition:
Frame.h:39
SourceXtractor::Frame::getDetectionThresholdMap
std::shared_ptr< Image< T > > getDetectionThresholdMap() const
Definition:
Frame.cpp:176
SourceXtractor::Frame::getFilteredImage
std::shared_ptr< Image< T > > getFilteredImage() const
Definition:
Frame.cpp:129
Generated by
1.8.14