40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#ifndef JFJOCH_ASSIGNSPOTSTORINGS_H
|
|
#define JFJOCH_ASSIGNSPOTSTORINGS_H
|
|
|
|
#include <vector>
|
|
#include <optional>
|
|
#include "../../common/SpotToSave.h"
|
|
#include "RingOptimizer.h"
|
|
|
|
struct RingClusters {
|
|
std::vector<int> spots;
|
|
float R_obs;
|
|
int ring_idx = -1;
|
|
};
|
|
|
|
struct FindCircleCenterResult {
|
|
int64_t total_votes;
|
|
int64_t votes_for_beam_center;
|
|
float x;
|
|
float y;
|
|
};
|
|
|
|
FindCircleCenterResult FindCircleCenter(const std::vector<SpotToSave> &v,
|
|
int64_t width = 4000,
|
|
int64_t height = 4000,
|
|
int64_t max_spots = 500);
|
|
|
|
std::vector<std::vector<int>> ClusterSpotsIntoRings(const std::vector<float>& r, float eps = 1.5, int minPts = 5);
|
|
std::vector<RingClusters> AnalyzeClusters(const std::vector<float>& r, const std::vector<std::vector<int>> &clusters);
|
|
std::vector<float> CalculateCubicXtalRings( float a, int hkl_max = 4);
|
|
float GuessDetectorDistance(const DiffractionGeometry& geom, float ring_radius_pxl, float d_A);
|
|
|
|
std::vector<RingClusters> GuessInitialGeometry(DiffractionGeometry &geom, const std::vector<SpotToSave> &v, float calibrant_a_A);
|
|
void GuessGeometry(DiffractionGeometry &geom, const std::vector<SpotToSave> &v, float calibrant_a_A);
|
|
void OptimizeGeometry(DiffractionGeometry &geom, const std::vector<SpotToSave> &v, float calibrant_a_A);
|
|
|
|
#endif //JFJOCH_ASSIGNSPOTSTORINGS_H
|