Skip to content

Commit 50a52aa

Browse files
committed
#24 fix deprecated functions in vtk9
1 parent 4f210b4 commit 50a52aa

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/visualization/CellPopulationPyChasteActorGenerator.cpp

+22-18
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,17 @@ void CellPopulationPyChasteActorGenerator<DIM>::AddPottsBasedCellPopulationActor
324324
}
325325
}
326326

327-
vtkSmartPointer<vtkGeometryFilter> p_geometry_filter_pre =
328-
vtkSmartPointer<vtkGeometryFilter>::New();
329-
#if VTK_MAJOR_VERSION <= 5
330-
p_geometry_filter_pre->SetInput(p_potts_grid);
331-
#else
332-
p_geometry_filter_pre->SetInputData(p_potts_grid);
333-
#endif
327+
auto p_geometry_filter_pre = vtkSmartPointer<vtkGeometryFilter>::New();
328+
p_geometry_filter_pre->SetInputData(p_potts_grid);
334329

335330
vtkSmartPointer<vtkThreshold> p_threshold = vtkSmartPointer<vtkThreshold>::New();
336331
p_threshold->SetInputConnection(p_geometry_filter_pre->GetOutputPort());
332+
333+
#if VTK_MAJOR_VERSION < 9
337334
p_threshold->ThresholdByUpper(0.0);
335+
#else
336+
p_threshold->SetUpperThreshold(0.0);
337+
#endif
338338
p_threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Cell Id");
339339

340340
vtkSmartPointer<vtkGeometryFilter> p_geom_filter = vtkSmartPointer<vtkGeometryFilter>::New();
@@ -366,12 +366,16 @@ void CellPopulationPyChasteActorGenerator<DIM>::AddPottsBasedCellPopulationActor
366366
for(unsigned idx=0; idx<p_potts_grid->GetNumberOfCells(); idx++)
367367
{
368368
vtkSmartPointer<vtkThreshold> p_local_threshold = vtkSmartPointer<vtkThreshold>::New();
369-
#if VTK_MAJOR_VERSION <= 5
370-
p_local_threshold->SetInput(p_geom_filter->GetOutput());
371-
#else
372-
p_local_threshold->SetInputData(p_geom_filter->GetOutput());
373-
#endif
374-
p_local_threshold->ThresholdBetween(p_element_base_ids->GetTuple1(idx), p_element_base_ids->GetTuple1(idx));
369+
p_local_threshold->SetInputData(p_geom_filter->GetOutput());
370+
371+
#if VTK_MAJOR_VERSION < 9
372+
p_local_threshold->ThresholdBetween(p_element_base_ids->GetTuple1(idx),
373+
p_element_base_ids->GetTuple1(idx));
374+
#else
375+
p_threshold->SetLowerThreshold(p_element_base_ids->GetTuple1(idx));
376+
p_threshold->SetUpperThreshold(p_element_base_ids->GetTuple1(idx));
377+
#endif
378+
375379
p_local_threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Cell Base Id");
376380

377381
vtkSmartPointer<vtkGeometryFilter> p_local_geom_filter = vtkSmartPointer<vtkGeometryFilter>::New();
@@ -1110,12 +1114,12 @@ void CellPopulationPyChasteActorGenerator<DIM>::AddMeshBasedCellPopulationActor(
11101114
p_scaled_ctf->Build();
11111115

11121116
vtkSmartPointer<vtkThreshold> p_threshold = vtkSmartPointer<vtkThreshold>::New();
1113-
#if VTK_MAJOR_VERSION <= 5
1114-
p_threshold->SetInput(p_voronoi_grid);
1115-
#else
1116-
p_threshold->SetInputData(p_voronoi_grid);
1117-
#endif
1117+
p_threshold->SetInputData(p_voronoi_grid);
1118+
#if VTK_MAJOR_VERSION < 9
11181119
p_threshold->ThresholdByUpper(0.0);
1120+
#else
1121+
p_threshold->SetUpperThreshold(0.0);
1122+
#endif
11191123
p_threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "CellColors");
11201124

11211125
vtkSmartPointer<vtkGeometryFilter> p_geom_filter = vtkSmartPointer<vtkGeometryFilter>::New();

0 commit comments

Comments
 (0)