50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
#include <mutex>
|
|
|
|
#include "../common/DiffractionSpot.h"
|
|
#include "../common/DiffractionExperiment.h"
|
|
#include "indexing/IndexerThreadPool.h"
|
|
#include "lattice_search/LatticeSearch.h"
|
|
|
|
struct RotationIndexerResult {
|
|
CrystalLattice lattice;
|
|
LatticeSearchResult search_result;
|
|
DiffractionGeometry geom;
|
|
std::optional<GoniometerAxis> axis;
|
|
};
|
|
|
|
class RotationIndexer {
|
|
mutable std::mutex m;
|
|
const DiffractionExperiment& experiment;
|
|
|
|
constexpr static size_t max_spots = 10000;
|
|
constexpr static size_t max_spots_per_image = 200;
|
|
|
|
const bool index_ice_rings;
|
|
|
|
std::vector<std::vector<SpotToSave>> v_;
|
|
|
|
std::optional<GoniometerAxis> axis_;
|
|
const DiffractionGeometry geom_;
|
|
DiffractionGeometry updated_geom_;
|
|
LatticeSearchResult search_result_;
|
|
|
|
IndexerThreadPool &indexer_;
|
|
|
|
size_t accumulated_spots = 0;
|
|
|
|
std::optional<CrystalLattice> indexed_lattice;
|
|
public:
|
|
RotationIndexer(const DiffractionExperiment& x, IndexerThreadPool& indexer);
|
|
void ProcessImage(int64_t image, const std::vector<SpotToSave>& spots);
|
|
void RunIndexing();
|
|
std::optional<RotationIndexerResult> GetLattice() const;
|
|
|
|
size_t GetAccumulatedImages() const;
|
|
};
|