46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "../reader/JFJochHDF5Reader.h"
|
|
#include "../image_analysis/indexing/IndexerFactory.h"
|
|
#include "../common/Logger.h"
|
|
|
|
int main(int argc, char** argv) {
|
|
Logger logger("jfjoch_indexing_test");
|
|
|
|
if (argc != 2) {
|
|
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Usage: ./jfjoch_indexing_test <file>");
|
|
}
|
|
|
|
JFJochHDF5Reader reader;
|
|
reader.ReadFile(argv[1]);
|
|
if (!reader.GetDataset())
|
|
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Error opening file");
|
|
|
|
DiffractionExperiment experiment(reader.GetDataset()->experiment);
|
|
experiment.IndexingAlgorithm(IndexingAlgorithmEnum::Auto);
|
|
// experiment.SetUnitCell(UnitCell(37,78,78,90,90,90));
|
|
auto indexer = CreateIndexer(experiment);
|
|
|
|
for (int i = 0; i < reader.GetNumberOfImages(); i++) {
|
|
auto img = reader.LoadImage(i);
|
|
|
|
if (!img)
|
|
continue;
|
|
|
|
DataMessage msg = img->ImageData();
|
|
|
|
auto output = indexer->Run(msg);
|
|
|
|
logger.Info("Result {} {}", msg.number, msg.indexing_result.value_or(0));
|
|
if (msg.indexing_lattice) {
|
|
auto a = msg.indexing_lattice->Vec0();
|
|
|
|
auto b = msg.indexing_lattice->Vec1();
|
|
auto c = msg.indexing_lattice->Vec2();
|
|
|
|
logger.Info("Lattice {:8.02f} {:8.02f} {:8.02f} {:8.02f} {:8.02f} {:8.02f} {:8.02f} {:8.02f} {:8.02f}",
|
|
a[0],a[1],a[2],b[0],b[1],b[2],c[0],c[1], c[2]);
|
|
}
|
|
}
|
|
} |