I’m creating an application which slices through a 3D volume and displays an overlay of the slice in a corner. I use a vtkImagePlaneWidget for interacting with the slice, and vtkLogoRepresentation to display the 2D slice, as shown below
Instead I would like to not display the image within the volume, and only show the outline. I do this by calling TextureVisibilityOff() of the vtkImagePlaneWidget. However then the 2D corner display does not display any data and returns an error message of “No scalar values found for texture input!”
The relevant section of code is here, using the Python bindings
plane_widget = vtk.vtkImagePlaneWidget()
plane_widget.SetResliceInterpolateToLinear()
plane_widget.DisplayTextOn()
plane_widget.SetInputConnection(dataImporter.GetOutputPort())
plane_widget.SetPlaneOrientationToXAxes()
plane_widget.SetSliceIndex(int(s_shape[0] / 2))
plane_widget.SetPicker(picker)
plane_widget.SetKeyPressActivationValue("x")
plane_widget.SetPlaneOrientationToZAxes()
plane_widget.TextureVisibilityOff()
plane_widget.GetLookupTable().SetTableRange(0, s_max)
plane_widget.SetMarginSizeX(0)
plane_widget.SetMarginSizeY(0)
prop1 = plane_widget.GetPlaneProperty()
prop1.SetColor(1, 0, 0)
logo_rep = vtk.vtkLogoRepresentation()
logo_rep.SetImage(plane_widget.GetResliceOutput())
logo_rep.SetPosition(0, 0)
logo_rep.SetPosition2(0.4, 0.4)
logo_rep.GetImageProperty().SetOpacity(0.7)