diff --git a/image_analysis/IndexerWrapper.cpp b/image_analysis/IndexerWrapper.cpp index ec11922e..1c548781 100644 --- a/image_analysis/IndexerWrapper.cpp +++ b/image_analysis/IndexerWrapper.cpp @@ -9,22 +9,6 @@ void IndexerWrapper::Setup(const UnitCell &cell) { #endif } -// Select spots that belong to indexing solution -// - cell cell in real space -// - spots spots in reciprocal space -// - threshold radius around approximated miller indices -template -inline auto select_indexed_spots(const Eigen::MatrixBase& cell, - const Eigen::MatrixBase& spots, - float_type threshold=.02f) -{ - using M3x = Eigen::MatrixX3; - M3x resid = spots * cell.transpose(); - const M3x miller = round(resid.array()); - resid -= miller; - return resid.rowwise().norm().array() < threshold; -} - std::vector IndexerWrapper::Run(const std::vector &coord) { #ifdef JFJOCH_USE_CUDA std::vector ret; @@ -46,10 +30,15 @@ std::vector IndexerWrapper::Run(const std::vector &coord) // Get best cell auto id = fast_feedback::refine::best_cell(indexer.oScoreV()); - // Get indexed spots - auto arr = select_indexed_spots(indexer.oCell(id), indexer.Spots(), threshold); + // get indexed spots + using M3x = Eigen::MatrixX3; + M3x resid = indexer.Spots() * indexer.oCell(id).transpose(); + const M3x miller = round(resid.array()); + resid -= miller; + auto arr = resid.rowwise().norm().array() < threshold; auto indexed_spot_count = arr.count(); + // Check if result is viable if (indexed_spot_count > min_spots) { IndexingResult result; diff --git a/image_analysis/IndexerWrapper.h b/image_analysis/IndexerWrapper.h index e2afb100..e73a9e49 100644 --- a/image_analysis/IndexerWrapper.h +++ b/image_analysis/IndexerWrapper.h @@ -18,7 +18,7 @@ struct IndexingResult { CrystalLattice l; - std::vector indexed_spots; + std::vector indexed_spots; uint64_t indexed_spots_count; };