merge conflict

This commit is contained in:
Mazzoleni Alice Francesca
2025-04-01 17:50:11 +02:00
parent 4240942cec
commit 3083d51699
3 changed files with 32 additions and 35 deletions

View File

@@ -152,8 +152,10 @@ template <typename T> Eta2 calculate_eta2(const Cluster<T, 3, 3> &cl) {
template <typename T> Eta2 calculate_eta2(const Cluster<T, 2, 2> &cl) {
Eta2 eta{};
eta.x = static_cast<double>(cl.data[1]) / (cl.data[0] + cl.data[1]);
eta.y = static_cast<double>(cl.data[2]) / (cl.data[0] + cl.data[2]);
if ((cl.data[0] + cl.data[1]) != 0)
eta.x = static_cast<double>(cl.data[1]) / (cl.data[0] + cl.data[1]);
if ((cl.data[0] + cl.data[2]) != 0)
eta.y = static_cast<double>(cl.data[2]) / (cl.data[0] + cl.data[2]);
eta.sum = cl.data[0] + cl.data[1] + cl.data[2] + cl.data[3];
eta.c = cBottomLeft; // TODO! This is not correct, but need to put something
return eta;

View File

@@ -272,25 +272,25 @@ class ClusterVector<Cluster<T, ClusterSizeX, ClusterSizeY, CoordType>> {
m_size = new_size;
}
void apply_gain_map(const NDView<double> gain_map){
//in principle we need to know the size of the image for this lookup
//TODO! check orientations
// TODO: Generalize !!!!
void apply_gain_map(const NDView<double> gain_map) {
// in principle we need to know the size of the image for this lookup
// TODO! check orientations
std::array<int64_t, 9> xcorr = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
std::array<int64_t, 9> ycorr = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
for (size_t i=0; i<m_size; i++){
auto& cl = at<Cluster3x3>(i);
for (size_t i = 0; i < m_size; i++) {
auto &cl = at(i);
if (cl.x > 0 && cl.y > 0 && cl.x < gain_map.shape(1)-1 && cl.y < gain_map.shape(0)-1){
for (size_t j=0; j<9; j++){
if (cl.x > 0 && cl.y > 0 && cl.x < gain_map.shape(1) - 1 &&
cl.y < gain_map.shape(0) - 1) {
for (size_t j = 0; j < 9; j++) {
size_t x = cl.x + xcorr[j];
size_t y = cl.y + ycorr[j];
cl.data[j] = static_cast<T>(cl.data[j] * gain_map(y, x));
}
}else{
memset(cl.data, 0, 9*sizeof(T)); //clear edge clusters
} else {
memset(cl.data, 0, 9 * sizeof(T)); // clear edge clusters
}
}
}