Hi all,
I have write a little script to draw on slicer an ellipsoid.
However, I do not know how to set the position (center), could you please help me?
Thanks in advance.
The code
ellips = vtk.vtkParametricEllipsoid()
ellips.SetXRadius(40.0)
ellips.SetYRadius(10.0)
ellips.SetZRadius(15.0)
ellipsSource = vtk.vtkParametricFunctionSource()
ellipsSource.SetParametricFunction(ellips)
ellipsSource.Update()
modelsLogic = slicer.modules.models.logic()
model = modelsLogic.AddModel(ellipsSource.GetOutput())
model.SetName(‘ellipse_1’)
model.GetDisplayNode().SetSliceIntersectionVisibility(True)
model.GetDisplayNode().SetSliceIntersectionThickness(3)
from this code:
ellipsoid = vtk.vtkParametricEllipsoid()
ellipsoid.SetXRadius(1)
ellipsoid.SetYRadius(0.75)
ellipsoid.SetZRadius(0.5)
ellipsoidSource = vtk.vtkParametricFunctionSource()
ellipsoidSource.SetParametricFunction(ellipsoid)
ellipsoidSource.SetScalarModeToZ()
ellipsoidMapper = vtk.vtkPolyDataMapper()
ellipsoidMapper.SetInputConnection(ellipsoidSource.GetOutputPort())
ellipsoidMapper.SetScalarRange(-0.5, 0.5)
ellipsoidActor = vtk.vtkActor()
ellipsoidActor.SetMapper(ellipsoidMapper)
ellipsoidActor.SetPosition(8, -12, 0)
ellipsoidActor.SetScale(1.5, 1.5, 1.5)