mirror of
https://gitlab.ethz.ch/gfattori/glocalize.git
synced 2026-05-03 13:44:26 +02:00
refactoring
This commit is contained in:
+13
-1
@@ -154,6 +154,18 @@ MarkerList LocalizationService::localize(
|
||||
if (!labeled)
|
||||
return result;
|
||||
|
||||
// VTK has changed over time whether "RegionId" is stored on cells or points.
|
||||
// For stable per-region extraction we want it on *cells*.
|
||||
vtkPolyData* labeledForThreshold = labeled;
|
||||
vtkNew<vtkPointDataToCellData> p2c;
|
||||
if (!labeled->GetCellData()->GetArray("RegionId") && labeled->GetPointData()->GetArray("RegionId"))
|
||||
{
|
||||
p2c->SetInputData(labeled);
|
||||
p2c->PassPointDataOn();
|
||||
p2c->Update();
|
||||
labeledForThreshold = vtkPolyData::SafeDownCast(p2c->GetOutput());
|
||||
}
|
||||
|
||||
const int nRegions = connectivity->GetNumberOfExtractedRegions();
|
||||
if (nRegions <= 0)
|
||||
return result;
|
||||
@@ -168,7 +180,7 @@ MarkerList LocalizationService::localize(
|
||||
onProgress(100.0 * static_cast<double>(regionId + 1) / static_cast<double>(nRegions));
|
||||
|
||||
vtkNew<vtkThreshold> th;
|
||||
th->SetInputData(labeled);
|
||||
th->SetInputData(labeledForThreshold);
|
||||
th->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "RegionId");
|
||||
th->SetLowerThreshold(regionId);
|
||||
th->SetUpperThreshold(regionId);
|
||||
|
||||
Reference in New Issue
Block a user