RotationIndexer: Retry indexing at 2x and 3x images
This commit is contained in:
@@ -24,10 +24,12 @@ RotationIndexer::RotationIndexer(const DiffractionExperiment &x, IndexerThreadPo
|
||||
if (x.GetImageNum() < min_images_for_indexing) {
|
||||
// For short measurements - only indexing at the end
|
||||
first_image_to_try_indexing = INT64_MAX;
|
||||
next_image_to_try_indexing = INT64_MAX;
|
||||
image_stride = 1;
|
||||
} else {
|
||||
first_image_to_try_indexing = std::max<int64_t>(min_images_for_indexing,
|
||||
x.GetIndexingSettings().GetRotationIndexingMinAngularRange_deg() / angle_norm_deg);
|
||||
next_image_to_try_indexing = first_image_to_try_indexing;
|
||||
image_stride = std::ceil(x.GetIndexingSettings().GetRotationIndexingAngularStride_deg() / angle_norm_deg);
|
||||
if (image_stride == 0)
|
||||
image_stride = 1;
|
||||
@@ -37,8 +39,6 @@ RotationIndexer::RotationIndexer(const DiffractionExperiment &x, IndexerThreadPo
|
||||
}
|
||||
|
||||
void RotationIndexer::TryIndex() {
|
||||
indexing_tried = true;
|
||||
|
||||
// Index
|
||||
std::vector<SpotToSave> v_sel;
|
||||
std::vector<Coord> coords_sel;
|
||||
@@ -101,8 +101,16 @@ void RotationIndexer::TryIndex() {
|
||||
indexed_lattice = data.latt;
|
||||
updated_geom_ = data.geom;
|
||||
axis_ = data.axis;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexing_range_multiplier < max_indexing_range_multiplier) {
|
||||
indexing_range_multiplier++;
|
||||
next_image_to_try_indexing = first_image_to_try_indexing * indexing_range_multiplier;
|
||||
} else {
|
||||
next_image_to_try_indexing = INT64_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<RotationIndexerResult> RotationIndexer::ProcessImage(int64_t image, const std::vector<SpotToSave> &spots) {
|
||||
@@ -115,7 +123,7 @@ std::optional<RotationIndexerResult> RotationIndexer::ProcessImage(int64_t image
|
||||
const float angle_deg = axis_->GetAngle_deg(image) + axis_->GetWedge_deg() / 2.0f;
|
||||
const auto rot = axis_->GetTransformationAngle(angle_deg);
|
||||
|
||||
if (!indexing_tried && image >= last_accumulated_image + image_stride) {
|
||||
if (!indexed_lattice && image >= last_accumulated_image + image_stride) {
|
||||
v_.reserve(v_.size() + spots.size());
|
||||
coords_.reserve(coords_.size() + spots.size());
|
||||
|
||||
@@ -129,7 +137,7 @@ std::optional<RotationIndexerResult> RotationIndexer::ProcessImage(int64_t image
|
||||
accumulated_images++;
|
||||
last_accumulated_image = image;
|
||||
|
||||
if (accumulated_images >= min_images_for_indexing && image >= first_image_to_try_indexing)
|
||||
if (accumulated_images >= min_images_for_indexing && image >= next_image_to_try_indexing)
|
||||
TryIndex();
|
||||
}
|
||||
if (!indexed_lattice)
|
||||
@@ -152,4 +160,4 @@ std::optional<RotationIndexerResult> RotationIndexer::GetLattice() {
|
||||
.geom = updated_geom_,
|
||||
.axis = axis_
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -31,9 +31,9 @@ class RotationIndexer {
|
||||
|
||||
constexpr static int64_t max_spots = 10000;
|
||||
constexpr static int64_t min_images_for_indexing = 10;
|
||||
constexpr static int64_t max_indexing_range_multiplier = 3;
|
||||
|
||||
const bool index_ice_rings;
|
||||
bool indexing_tried = false;
|
||||
float angle_norm_deg = 1.0f;
|
||||
|
||||
std::vector<SpotToSave> v_;
|
||||
@@ -48,8 +48,10 @@ class RotationIndexer {
|
||||
int64_t last_accumulated_image = -1;
|
||||
int64_t accumulated_images = 0;
|
||||
|
||||
int64_t image_stride;
|
||||
int64_t first_image_to_try_indexing;
|
||||
int64_t image_stride = 1;
|
||||
int64_t first_image_to_try_indexing = INT64_MAX;
|
||||
int64_t next_image_to_try_indexing = INT64_MAX;
|
||||
int64_t indexing_range_multiplier = 1;
|
||||
|
||||
std::optional<CrystalLattice> indexed_lattice;
|
||||
void TryIndex();
|
||||
|
||||
Reference in New Issue
Block a user