Commit 824bb790 authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Erase elements after removing them from ROI vector

When computing the vector containing the detectors to ROI, in the
case of pixel and tube, erase elements after using remove, both to
remove a warning and because it is not supposed to work without this
change, even though it did.
parent 0bd45666
......@@ -581,8 +581,11 @@ void InstrumentWidgetMaskTab::singlePixelPicked(size_t pickID) {
if (m_pixel->isChecked()) {
// remove the picked pixel from the list of detectors to mask
std::remove(detectorsToMask.begin(), detectorsToMask.end(), pickID);
std::vector<size_t>::iterator newEnd;
newEnd =
std::remove(detectorsToMask.begin(), detectorsToMask.end(), pickID);
detectorsToMask.erase(newEnd, detectorsToMask.end());
} else if (m_tube->isChecked()) {
if (!componentInfo.hasParent(pickID)) {
return;
......@@ -592,9 +595,11 @@ void InstrumentWidgetMaskTab::singlePixelPicked(size_t pickID) {
// remove all the detectors from the picked tube from the list of
// detectors to mask
std::vector<size_t>::iterator newEnd = detectorsToMask.end();
for (auto toKeep : detectorsToKeep) {
std::remove(detectorsToMask.begin(), detectorsToMask.end(), toKeep);
newEnd = std::remove(detectorsToMask.begin(), newEnd, toKeep);
}
detectorsToMask.erase(newEnd, detectorsToMask.end());
}
// then mask selected detectors
actor.addMaskBinsData(detectorsToMask);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment