DiffractionExperiment: Remove ROI-mask function

This commit is contained in:
2023-11-06 16:51:34 +01:00
parent b2743072e6
commit d6c1b19599
14 changed files with 168 additions and 606 deletions

View File

@@ -11,7 +11,6 @@
#include "../image_analysis/IndexerWrapper.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}
@@ -47,44 +46,6 @@ 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);
std::vector<Coord> recip;
for (const auto& s: spots)
recip.emplace_back(s.ReciprocalCoord(experiment));
auto indexer_ret = indexer.Run(recip);
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("{:30s} {:8.1f} ms/image", "Full+ROI",
elapsed.count() / (1000.0 * (double) nimages));
return strstream.str();
}
void TestIndexing() {
constexpr const int nexec = 5;
@@ -252,6 +213,5 @@ int main(int argc, char **argv) {
if (GPUImageAnalysis::GPUPresent()) {
GPUImageAnalysis local_peakfinder_gpu(x.GetXPixelsNum(), x.GetYPixelsNum());
TestAll(x, settings, local_peakfinder_gpu,image_conv.data(), nimages);
TestAllWithROI(x, settings, local_peakfinder_gpu,image_conv.data(), nimages);
}
}