Move all image analysis related code to image_analysis/ directory
This commit is contained in:
35
image_analysis/IndexerWrapper.cpp
Normal file
35
image_analysis/IndexerWrapper.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "IndexerWrapper.h"
|
||||
|
||||
void IndexerWrapper::Setup(const UnitCell &cell) {
|
||||
indexer.iCellM() = CrystalLattice(cell).GetEigenMatrix();
|
||||
}
|
||||
|
||||
std::vector<CrystalLattice> IndexerWrapper::Run(const std::vector<Coord> &coord) {
|
||||
std::vector<CrystalLattice> ret;
|
||||
|
||||
if (coord.size() < MIN_SPOTS_TO_INDEX)
|
||||
return ret;
|
||||
|
||||
size_t nspots = std::min<size_t>(MAX_SPOTS_TO_INDEX, coord.size());
|
||||
|
||||
for (int i = 0; i < nspots; i++) {
|
||||
indexer.spotX(i) = coord[i].x;
|
||||
indexer.spotY(i) = coord[i].y;
|
||||
indexer.spotZ(i) = coord[i].z;
|
||||
}
|
||||
|
||||
// Index
|
||||
indexer.index(1, nspots);
|
||||
|
||||
// Get best cell
|
||||
auto id = fast_feedback::refine::best_cell(indexer.oScoreV());
|
||||
|
||||
// Check if is viable
|
||||
if (fast_feedback::refine::is_viable_cell(indexer.oCell(id), indexer.Spots(), 0.05f, 9u))
|
||||
ret.emplace_back(indexer.oCell(id));
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user