PredictSpotsOnDetector: Add (but no correctness test so far)
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "../image_analysis/RadialIntegration.h"
|
||||
#include "../common/Logger.h"
|
||||
#include "../image_analysis/PredictSpotsOnDetector.h"
|
||||
|
||||
#define make_unit_cell(a1,a2,a3,a4,a5,a6) UnitCell{.a = a1, .b = a2, .c = a3, .alpha = a4, .beta = a5, .gamma = a6}
|
||||
|
||||
@@ -50,6 +51,46 @@ auto TestAll(const DiffractionExperiment &experiment, const JFJochProtoBuf::Data
|
||||
return strstream.str();
|
||||
}
|
||||
|
||||
auto TestAllWithROI(const DiffractionExperiment &experiment, const JFJochProtoBuf::DataProcessingSettings &settings,
|
||||
GPUImageAnalysis &spot_finder, int16_t* image, size_t nimages) {
|
||||
IndexerWrapper indexer;
|
||||
indexer.Setup(experiment.GetUnitCell());
|
||||
|
||||
spot_finder.SetInputBuffer(image);
|
||||
|
||||
std::vector<int16_t> roi_image(experiment.GetPixelsNum());
|
||||
|
||||
auto start_time = std::chrono::system_clock::now();
|
||||
for (int i = 0; i < nimages; i++) {
|
||||
ROIFilter filter(experiment.GetXPixelsNum(), experiment.GetYPixelsNum());
|
||||
|
||||
std::vector<DiffractionSpot> spots;
|
||||
std::vector<float> result;
|
||||
spot_finder.LoadDataToGPU();
|
||||
spot_finder.RunSpotFinder(settings);
|
||||
spot_finder.GetSpotFinderResults(experiment, settings, spots);
|
||||
spot_finder.RunRadialIntegration();
|
||||
std::vector<Coord> recip;
|
||||
for (const auto& s: spots)
|
||||
recip.emplace_back(s.ReciprocalCoord(experiment));
|
||||
auto indexer_ret = indexer.Run(recip);
|
||||
spot_finder.GetRadialIntegrationProfile(result);
|
||||
if (!indexer_ret.empty()) {
|
||||
PredictSpotsOnDetector(filter, experiment, indexer_ret[0].l);
|
||||
filter.Apply<int16_t>(roi_image, INT16_MIN);
|
||||
}
|
||||
}
|
||||
|
||||
auto end_time = std::chrono::system_clock::now();
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
|
||||
|
||||
std::ostringstream strstream;
|
||||
logger.Info("{:20s} {:8.1f} ms/image", "Full+ROI",
|
||||
elapsed.count() / (1000.0 * (double) nimages));
|
||||
|
||||
return strstream.str();
|
||||
}
|
||||
|
||||
void TestIndexing() {
|
||||
constexpr const int nexec = 5;
|
||||
|
||||
@@ -305,5 +346,6 @@ int main(int argc, char **argv) {
|
||||
if (GPUImageAnalysis::GPUPresent()) {
|
||||
GPUImageAnalysis local_peakfinder_gpu(x.GetXPixelsNum(), x.GetYPixelsNum(), one_byte_mask, mapping);
|
||||
TestAll(x, settings, local_peakfinder_gpu,image_conv.data(), nimages);
|
||||
TestAllWithROI(x, settings, local_peakfinder_gpu,image_conv.data(), nimages);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user