Wireframe Representation not Working

Hello,

I transformed the visualize fill holes example into a function, but the wireframe representation isn’t working:

void visualizeHoles(vtkSmartPointer<vtkPolyData> originalPolyData, vtkSmartPointer<vtkPolyData> filledPolyData,const std::string& filename) {
	    vtkIdType numOriginalCells = originalPolyData->GetNumberOfCells();
	    vtkIdType numNewCells = filledPolyData->GetNumberOfCells();

	        vtkNew<vtkNamedColors> colors;
	        
	    // Iterate over the original cells
	    auto it = filledPolyData->NewCellIterator();
	    vtkIdType numCells = 0;
	    for (it->InitTraversal();!it->IsDoneWithTraversal() && numCells < numOriginalCells; it->GoToNextCell(), ++numCells){}
	    std::cout << "Num original: " << numOriginalCells << ", Num new: " << numNewCells << ", Num added: " << numNewCells - numOriginalCells << std::endl;
	    
	    vtkNew<vtkPolyData> holePolyData;
	    holePolyData->Allocate(originalPolyData, numNewCells - numOriginalCells);
	    holePolyData->SetPoints(originalPolyData->GetPoints());

	    vtkNew<vtkGenericCell> cell;
	    // The remaining cells are the new ones from the hole filler
	    for (; !it->IsDoneWithTraversal(); it->GoToNextCell())
	    {it->GetCell(cell); holePolyData->InsertNextCell(it->GetCellType(), cell->GetPointIds());}
	    it->Delete();

	    // We have to use ConnectivtyFilter and not
	    // PolyDataConnectivityFilter since the later does not create
	    // RegionIds cell data.
	    vtkNew<vtkConnectivityFilter> connectivity;
	    connectivity->SetInputData(holePolyData);
	    connectivity->SetExtractionModeToAllRegions();
	    connectivity->ColorRegionsOn();
	    connectivity->Update();
	    std::cout << "Found " << connectivity->GetNumberOfExtractedRegions()<< " holes" << std::endl;

	    // Create a mapper and actor for the fill polydata
	    vtkNew<vtkDataSetMapper> filledMapper;
	    filledMapper->SetInputConnection(connectivity->GetOutputPort());
	    filledMapper->SetScalarModeToUseCellData();
	    filledMapper->SetScalarRange(connectivity->GetOutput()->GetCellData()->GetArray("RegionId")->GetRange());
	    
	    vtkNew<vtkActor> filledActor;
	    filledActor->SetMapper(filledMapper);
	    filledActor->GetProperty()->SetDiffuseColor(colors->GetColor3d("Chocolate").GetData());
	    
	    
	    // Create a mapper and actor for the original polydata
	    vtkNew<vtkPolyDataMapper> originalMapper;
	    originalMapper->SetInputData(originalPolyData);

	    vtkNew<vtkProperty> backfaceProp;
	    backfaceProp->SetDiffuseColor(colors->GetColor3d("Banana").GetData());

	    vtkNew<vtkActor> originalActor;
	    originalActor->SetMapper(originalMapper);
	    originalActor->SetBackfaceProperty(backfaceProp);
	    originalActor->GetProperty()->SetDiffuseColor(colors->GetColor3d("Flesh").GetData());
	    originalActor->GetProperty()->SetRepresentationToWireframe();
	    originalActor->Modified();
	    
	    // Create a renderer, render window, and interactor
	    vtkNew<vtkRenderer> renderer;

	    vtkNew<vtkEGLRenderWindow> renderWindow;
	    renderWindow->SetSize(512, 512);
	    renderWindow->AddRenderer(renderer);
	    renderWindow->SetWindowName("IdentifyHoles");

	    vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
	    renderWindowInteractor->SetRenderWindow(renderWindow);

	    // Add the actor to the scene
	    renderer->AddActor(originalActor);
	    renderer->AddActor(filledActor);
	    renderer->SetBackground(colors->GetColor3d("Burlywood").GetData());

	    renderer->GetActiveCamera()->SetPosition(0, -1, 0);
	    renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);
	    renderer->GetActiveCamera()->SetViewUp(0, 0, 1);
	    renderer->GetActiveCamera()->Azimuth(60);
	    renderer->GetActiveCamera()->Elevation(30);

	    renderer->ResetCamera();

	    renderWindow->Render();
	    renderWindowInteractor->Start();
	    
	    vtkNew<vtkWindowToImageFilter> windowToImageFilter;
	    windowToImageFilter->SetInput(renderWindow);
	    windowToImageFilter->Update();
	 
	  
	    vtkNew<vtkPNGWriter> writer;
	    writer->SetFileName(filename.c_str());
	    writer->SetInputConnection(windowToImageFilter->GetOutputPort());
	    writer->Write();}