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