File writer and spot finding improvements

This commit is contained in:
2024-04-08 11:18:50 +02:00
parent 15d99c6162
commit c6d2b5eedf
72 changed files with 690 additions and 893 deletions
+32 -13
View File
@@ -3,13 +3,15 @@
#include "CPUSpotFinder.h"
template <int N>
void FindSpots(StrongPixelSet& set,
void FindSpots(DeviceOutput &output,
int big_column, int big_row,
const SpotFindingSettings& settings,
const int16_t* image) {
uint64_t sum = 0;
uint64_t sum2 = 0;
uint64_t valid_count = 0;
const float *d_array) {
auto image = (int16_t *) output.pixels;
int64_t sum = 0;
int64_t sum2 = 0;
int64_t valid_count = 0;
for (int y = 0; y < N; y++) {
for (int x = 0; x < N; x++) {
@@ -27,16 +29,30 @@ void FindSpots(StrongPixelSet& set,
for (int y = 0; y < N; y++) {
for (int x = 0; x < N; x++) {
size_t coord = (big_row * N + y) * RAW_MODULE_COLS + big_column * N + x;
size_t line = big_row * N + y;
size_t col = big_column * N + x;
size_t coord = line * RAW_MODULE_COLS + col;
bool strong_pixel = true;
if ((line == 255) || (line == 256)
|| (col == 255) || (col == 256)
|| (col == 511) || (col == 512)
|| (col == 767) || (col == 768))
strong_pixel = false;
if (d_array[coord] != 0) {
if ((d_array[coord] < settings.high_resolution_limit)
|| (d_array[coord] > settings.low_resolution_limit))
strong_pixel = false;
}
if ((settings.photon_count_threshold < 0)
&& (settings.signal_to_noise_threshold <= 0))
strong_pixel = false;
if ((settings.photon_count_threshold >= 0)
&& (image[coord] < settings.photon_count_threshold)) {
&& (image[coord] <= settings.photon_count_threshold)) {
strong_pixel = false;
}
@@ -48,17 +64,20 @@ void FindSpots(StrongPixelSet& set,
strong_pixel = false;
}
if (strong_pixel)
set.AddStrongPixel(big_column * N + x, big_row * N + y, image[coord]);
if (strong_pixel) {
output.spot_finding_result.strong_pixel[coord / 8] |= (1 << (coord % 8));
output.spot_finding_result.strong_pixel_count++;
}
}
}
}
void FindSpots(StrongPixelSet& set,
const SpotFindingSettings& settings,
const int16_t* image) {
void FindSpots(DeviceOutput &output, const SpotFindingSettings& settings, const float *d_array) {
for (auto &i: output.spot_finding_result.strong_pixel)
i = 0;
for (int i = 0; i < RAW_MODULE_LINES / 32; i++) {
for (int j = 0; j < RAW_MODULE_COLS / 32; j++)
FindSpots<32>(set, j, i, settings, image);
FindSpots<32>(output, j, i, settings, d_array);
}
}