I recommend updating this function as well.
added bonus:
-Compatible with backwards segmentation
-Not deleting segmentation process above current segmentation job
-Displaying target segmentation layer when finishing the segmentation job.
void CWindow::onSegmentationFinished(Segmenter::PointSet ps)
{
setWidgetsEnabled(true);
worker_progress_updater_.stop();
worker_progress_.close();
// 3) concatenate the two parts to form the complete point cloud
// find starting location in fMasterCloud
int i;
for (i= 0; i < fMasterCloud.height(); i++) {
auto masterRowI = fMasterCloud.getRow(i);
if (ps[0][2] <= masterRowI[fUpperPart.width()-1][2]){
break;
}
}
// remove the duplicated point and ps in their stead. if i at the end, no duplicated point, just append
fUpperPart = fMasterCloud.copyRows(0, i);
fUpperPart.append(ps);
// check if remaining rows already exist in fMasterCloud behind ps
for(; i < fMasterCloud.height(); i++) {
auto masterRowI = fMasterCloud.getRow(i);
if (ps[ps.size() - 1][2] < masterRowI[fUpperPart.width()-1][2]) {
break;
}
}
// add the remaining rows
if (i < fMasterCloud.height()) {
fUpperPart.append(fMasterCloud.copyRows(i, fMasterCloud.height()));
}
fMasterCloud = fUpperPart;
statusBar->showMessage(tr("Segmentation complete"));
fVpkgChanged = true;
// set display to target layer
fPathOnSliceIndex = fSegParams.targetIndex;
CleanupSegmentation();
UpdateView();
}
I'm not sure if this is the way we ultimately want to approach this problem, but it's a start. The parts about removing duplicated points should be irrelevant after #25 is merged.
I recommend updating this function as well. added bonus: -Compatible with backwards segmentation -Not deleting segmentation process above current segmentation job -Displaying target segmentation layer when finishing the segmentation job.
Originally posted by @schillij95 in https://github.com/educelab/volume-cartographer/issues/25#issuecomment-1553691083