SourceXtractorPlusPlus
0.11
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
SEImplementation
src
lib
Plugin
CoreThresholdPartition
CoreThresholdPartitionStep.cpp
Go to the documentation of this file.
1
23
#include "
SEFramework/Property/DetectionFrame.h
"
24
#include "
SEImplementation/Measurement/MultithreadedMeasurement.h
"
25
#include "
SEImplementation/Plugin/CoreThresholdPartition/CoreThresholdPartitionStep.h
"
26
#include "
SEImplementation/Property/PixelCoordinateList.h
"
27
28
namespace
SourceXtractor {
29
30
CoreThresholdPartitionStep::CoreThresholdPartitionStep
(
double
snr_level,
unsigned
int
min_pixel_count) :
31
m_snr_level(snr_level), m_min_pixel_count(min_pixel_count) {
32
}
33
34
std::vector<std::shared_ptr<SourceInterface>
>
CoreThresholdPartitionStep::partition
(
std::shared_ptr<SourceInterface>
source)
const
{
35
long
int
n_snr_level(0);
36
// SNR Image accesses the underlying detection image, which may be a buffered image
37
std::lock_guard<std::recursive_mutex>
lock
(
MultithreadedMeasurement::g_global_mutex
);
38
39
// get the SNR image
40
const
auto
& snr_image = source->getProperty<
DetectionFrame
>().getFrame()->getSnrImage();
41
42
// go over all pixels
43
for
(
auto
pixel_coord : source->getProperty<
PixelCoordinateList
>().
getCoordinateList
())
44
// enhance the counter if the SNR is above the level
45
if
(snr_image->getValue(pixel_coord.m_x, pixel_coord.m_y) >=
m_snr_level
)
46
n_snr_level += 1;
47
48
// check whether the pixel # is above the threshold
49
if
(n_snr_level <
m_min_pixel_count
) {
50
return
{};
51
}
else
{
52
return
{ source };
53
}
54
}
55
56
}
// SEImplementation namespace
57
PixelCoordinateList.h
std::shared_ptr
SourceXtractor::CoreThresholdPartitionStep::m_snr_level
double m_snr_level
Definition:
CoreThresholdPartitionStep.h:49
SourceXtractor::PixelCoordinateList
Definition:
PixelCoordinateList.h:31
SourceXtractor::CoreThresholdPartitionStep::partition
virtual std::vector< std::shared_ptr< SourceInterface > > partition(std::shared_ptr< SourceInterface > source) const override
Definition:
CoreThresholdPartitionStep.cpp:34
SourceXtractor::DetectionFrame
Definition:
DetectionFrame.h:33
SourceXtractor::CoreThresholdPartitionStep::CoreThresholdPartitionStep
CoreThresholdPartitionStep(double snr_level, unsigned int min_pixel_count)
Constructor.
Definition:
CoreThresholdPartitionStep.cpp:30
std::lock
T lock(T...args)
DetectionFrame.h
CoreThresholdPartitionStep.h
std::vector
STL class.
std::lock_guard
SourceXtractor::PixelCoordinateList::getCoordinateList
const std::vector< PixelCoordinate > & getCoordinateList() const
Definition:
PixelCoordinateList.h:41
SourceXtractor::MultithreadedMeasurement::g_global_mutex
static std::recursive_mutex g_global_mutex
Definition:
MultithreadedMeasurement.h:54
SourceXtractor::CoreThresholdPartitionStep::m_min_pixel_count
unsigned int m_min_pixel_count
Definition:
CoreThresholdPartitionStep.h:50
MultithreadedMeasurement.h
Generated by
1.8.5