I have found this example here which is written in C++, I’m interested in VTK Javascript or Python, There is not a getProducer
for actor.getMapper().getInputData()
as I saw.
https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ReverseAccess
//
// Now we retrieve the source object from vtkActor reversely,
// meaning we don't use the spheresource object we instantiated
// above directly,
// instead we retrieve a reference to the spheresource through the
// actor.
// An advantage of this concept might be that we don't need to
// maintain the source object anymore
// in a more complex application.
// To demonstrate that we can modify properties of the spheresource
// through this reference
// beside changing some properties of the actor (in this example we
// change actor's x-position),
// we change the radius of the spheresource as well.
//
// next two lines are the core lines for reverse access
//
vtkSmartPointer<vtkAlgorithm> algorithm =
sphereActor->GetMapper()->GetInputConnection(0, 0)->GetProducer();
vtkSmartPointer<vtkSphereSource> srcReference =
vtkSphereSource::SafeDownCast(algorithm);
float origRadius = srcReference->GetRadius();
for (int i = 0; i < 360; ++i)
{
// change radius of the spheresource
srcReference->SetRadius(origRadius * (1 + sin((float)i/180.0 * vtkMath::Pi())));
// change x-position of the actor
sphereActor->SetPosition(sin((float)i/45.0 * vtkMath::Pi())*0.5, 0, 0);
renWin->Render();
}
//
// Thanks to the usage of vtkSmartPointer there is no explicit need
// to free any objects at this point.
//
return EXIT_SUCCESS;