SourceXtractorPlusPlus
0.8
Please provide a description of the project.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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
T
getDetectionThreshold
()
const
{
113
// FIXME using the 0,0 pixel makes no sense
114
return
sqrt
(
m_variance_map
->getValue(0,0)) *
m_detection_threshold
;
115
}
116
117
std::shared_ptr<Image<T>
>
getDetectionThresholdMap
()
const
;
118
119
std::string
getLabel
()
const
{
120
return
m_label
;
121
}
122
123
//
124
// Setters
125
//
126
127
void
setVarianceMap
(
std::shared_ptr<WeightImage>
variance_map);
128
129
void
setVarianceThreshold
(
WeightImage::PixelType
threshold);
130
131
std::shared_ptr<Image<T>
>
getBackgroundLevelMap
()
const
;
132
133
void
setDetectionThreshold
(T detection_threshold);
134
135
void
setBackgroundLevel
(T background_level);
136
137
void
setBackgroundLevel
(
std::shared_ptr
<
Image<T>
> background_level_map);
138
139
void
setFilter
(
std::shared_ptr<ImageFilter>
filter);
140
141
void
setLabel
(
const
std::string
&label);
142
143
private
:
144
145
void
applyFilter
();
146
147
std::shared_ptr<Image<T>
>
m_image
;
148
std::shared_ptr<WeightImage>
m_variance_map
;
149
std::shared_ptr<Image<T>
>
m_background_level_map
;
150
151
std::shared_ptr<CoordinateSystem>
m_coordinate_system
;
152
153
SeFloat
m_gain
;
154
SeFloat
m_saturation
;
155
156
T
m_detection_threshold
;
157
typename
WeightImage::PixelType
m_variance_threshold
;
158
159
int
m_interpolation_gap
;
// max interpolation gap, 0 == no interpolation
160
161
std::shared_ptr<ImageFilter>
m_filter
;
162
std::shared_ptr<Image<T>
>
m_interpolated_image
;
163
std::shared_ptr<Image<WeightImage::PixelType>
>
m_interpolated_variance
;
164
std::shared_ptr<Image<T>
>
m_filtered_image
;
165
std::shared_ptr<Image<T>
>
m_filtered_variance_map
;
166
167
std::string
m_label
;
168
};
169
170
using
DetectionImageFrame
=
Frame<DetectionImage::PixelType>
;
171
using
MeasurementImageFrame
=
Frame<MeasurementImage::PixelType>
;
172
173
}
174
175
#endif
/* _SEFRAMEWORK_FRAME_FRAME_H_ */
SourceXtractor::Frame::getSnrImage
std::shared_ptr< Image< T > > getSnrImage() const
Definition:
Frame.cpp:105
std::shared_ptr
Types.h
SourceXtractor::Frame::getOriginalImage
std::shared_ptr< Image< T > > getOriginalImage() const
Definition:
Frame.h:61
SourceXtractor::Frame::m_image
std::shared_ptr< Image< T > > m_image
Definition:
Frame.h:147
SourceXtractor::Frame::getThresholdedImage
std::shared_ptr< Image< T > > getThresholdedImage() const
Definition:
Frame.cpp:99
SourceXtractor::Frame::getVarianceMap
std::shared_ptr< WeightImage > getVarianceMap() const
Definition:
Frame.cpp:111
SourceXtractor::Frame::ImageFilter
Definition:
Frame.h:39
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:164
SourceXtractor::Frame::m_saturation
SeFloat m_saturation
Definition:
Frame.h:154
SourceXtractor::Frame::getBackgroundLevelMap
std::shared_ptr< Image< T > > getBackgroundLevelMap() const
Definition:
Frame.cpp:170
SourceXtractor::Frame
Definition:
Frame.h:36
SourceXtractor::Frame::ImageFilter::~ImageFilter
virtual ~ImageFilter()=default
SourceXtractor::Frame::getLabel
std::string getLabel() const
Definition:
Frame.h:119
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition:
Types.h:32
SourceXtractor::Frame::m_interpolated_image
std::shared_ptr< Image< T > > m_interpolated_image
Definition:
Frame.h:162
SourceXtractor::Frame::getUnfilteredVarianceMap
std::shared_ptr< WeightImage > getUnfilteredVarianceMap() const
Definition:
Frame.cpp:120
SourceXtractor::Frame::getDetectionThresholdMap
std::shared_ptr< Image< T > > getDetectionThresholdMap() const
Definition:
Frame.cpp:137
SourceXtractor::Frame::m_variance_map
std::shared_ptr< WeightImage > m_variance_map
Definition:
Frame.h:148
SourceXtractor::Frame::m_interpolated_variance
std::shared_ptr< Image< WeightImage::PixelType > > m_interpolated_variance
Definition:
Frame.h:163
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
Image.h
SourceXtractor::Frame::getGain
SeFloat getGain() const
Definition:
Frame.h:104
SourceXtractor::Frame::m_label
std::string m_label
Definition:
Frame.h:167
SourceXtractor::Frame::getOriginalVarianceMap
std::shared_ptr< WeightImage > getOriginalVarianceMap() const
Definition:
Frame.h:88
SourceXtractor::Frame::applyFilter
void applyFilter()
Definition:
Frame.cpp:215
SourceXtractor::Frame::m_background_level_map
std::shared_ptr< Image< T > > m_background_level_map
Definition:
Frame.h:149
SourceXtractor::Frame::getFilteredImage
std::shared_ptr< Image< T > > getFilteredImage() const
Definition:
Frame.cpp:90
SourceXtractor::Frame::getCoordinateSystem
std::shared_ptr< CoordinateSystem > getCoordinateSystem() const
Definition:
Frame.h:96
SourceXtractor::Frame::m_detection_threshold
T m_detection_threshold
Definition:
Frame.h:156
SourceXtractor::Frame::getSubtractedImage
std::shared_ptr< Image< T > > getSubtractedImage() const
Definition:
Frame.cpp:84
SourceXtractor::Frame::setVarianceThreshold
void setVarianceThreshold(WeightImage::PixelType threshold)
Definition:
Frame.cpp:159
SourceXtractor::Frame::setLabel
void setLabel(const std::string &label)
Definition:
Frame.cpp:209
SourceXtractor::Frame::m_filter
std::shared_ptr< ImageFilter > m_filter
Definition:
Frame.h:161
CoordinateSystem.h
SourceXtractor::Frame::m_filtered_variance_map
std::shared_ptr< Image< T > > m_filtered_variance_map
Definition:
Frame.h:165
SourceXtractor::Frame::m_gain
SeFloat m_gain
Definition:
Frame.h:153
SourceXtractor::Frame::setVarianceMap
void setVarianceMap(std::shared_ptr< WeightImage > variance_map)
Definition:
Frame.cpp:148
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:151
SourceXtractor::Frame::setDetectionThreshold
void setDetectionThreshold(T detection_threshold)
Definition:
Frame.cpp:182
SourceXtractor::Frame::getDetectionThreshold
T getDetectionThreshold() const
Definition:
Frame.h:112
SourceXtractor::Frame::m_variance_threshold
WeightImage::PixelType m_variance_threshold
Definition:
Frame.h:157
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:201
SourceXtractor::Frame::m_interpolation_gap
int m_interpolation_gap
Definition:
Frame.h:159
SourceXtractor::Frame::setBackgroundLevel
void setBackgroundLevel(T background_level)
Definition:
Frame.cpp:188
SourceXtractor::Frame::getInterpolatedImage
std::shared_ptr< Image< T > > getInterpolatedImage() const
Definition:
Frame.cpp:67
SourceXtractor::Frame::getSaturation
SeFloat getSaturation() const
Definition:
Frame.h:108
SourceXtractor::Frame::getVarianceThreshold
WeightImage::PixelType getVarianceThreshold() const
Definition:
Frame.h:100
Generated by
1.8.5