def __init__(self): ''' Constructor ''' self.__OrientationMatrix = vtk.vtkMatrix4x4() self.__CornerAnnotation = vtk.vtkCornerAnnotation() self.__TextProperty = vtk.vtkTextProperty() self.__LookupTable = vtk.vtkLookupTable() self.__ScalarBarActor = vtk.vtkScalarBarActor() self.__Prop3DCollection = vtk.vtkProp3DCollection() self.__DataSetCollection = vtk.vtkDataSetCollection() self.__OrientationTransform = vtk.vtkMatrixToLinearTransform() self.__OrientationMatrix.Identity() self.__CornerAnnotation.SetNonlinearFontScaleFactor(0.30) self.__CornerAnnotation.SetText(0, "Jolly - (c) summit 2009 ref vtkINRIA3D") self.__CornerAnnotation.SetMaximumFontSize(46) self.__ScalarBarActor.SetLabelTextProperty(self.__TextProperty) self.__ScalarBarActor.GetLabelTextProperty().BoldOff() self.__ScalarBarActor.GetLabelTextProperty().ItalicOff() self.__ScalarBarActor.SetNumberOfLabels(3) self.__ScalarBarActor.SetWidth(0.1) self.__ScalarBarActor.SetHeight(0.5) self.__ScalarBarActor.SetPosition(0.9, 0.3) self.__LookupTable.SetTableRange(0, 1) self.__LookupTable.SetSaturationRange(0, 0) self.__LookupTable.SetHueRange(0, 0) self.__LookupTable.SetValueRange(0, 1) self.__LookupTable.Build() self.__ShowAnnotations = True self.__ShowScalarBar = True self.__OrientationTransform.SetInput(self.__OrientationMatrix) self.__WindowLevel = self.GetWindowLevel() self.__WindowLevel.SetLookupTable( self.__LookupTable ) self.__ScalarBarActor.SetLookupTable(self.__LookupTable) self.__Renderer = self.GetRenderer() self.__Renderer.AddViewProp(self.__CornerAnnotation) self.__Renderer.AddViewProp(self.__ScalarBarActor) self.__ImageActor = self.GetImageActor() self.__RenderWindow = self.GetRenderWindow () self.__InteractorStyle = self.GetInteractorStyle() self.__Interactor = None self.__CornerAnnotation.SetWindowLevel(self.__WindowLevel) self.__CornerAnnotation.SetImageActor(self.__ImageActor) self.__CornerAnnotation.ShowSliceAndImageOn() # Sometime we would want to set the default window/level value instead # of the ImageData's ScalarRange self.__RefWindow = None self.__RefLevel = None
def __init__(self): ''' Constructor ''' vtkPythonViewImage.__init__(self) # texture mapper in 3D: vtkVolumeMapper self.__VolumeMapper = None # texture mapper in 3D: vtkVolumeTextureMapper3D self.__VolumeTextureMapper = vtk.vtkVolumeTextureMapper3D() # volume ray cast mapper vtkFixedPointVolumeRayCastMapper self.__VolumeRayCastMapper = vtk.vtkFixedPointVolumeRayCastMapper() # volume property: vtkVolumeProperty self.__VolumeProperty = vtk.vtkVolumeProperty() # volume actor: vtkVolume self.__VolumeActor = vtk.vtkVolume() # opacity transfer function: vtkPiecewiseFunction self.__OpacityFunction = vtk.vtkPiecewiseFunction() # color transfer function: vtkColorTransferFunction self.__ColorFunction = vtk.vtkColorTransferFunction() # vtkProp3DCollection self.__PhantomCollection = vtk.vtkProp3DCollection() # blender: vtkImageBlend self.__Blender = None # image 3D cropping box callback: vtkImage3DCroppingBoxCallback self.__Callback = vtkPythonImage3DCroppingBoxCallback() # box widget: vtkOrientedBoxWidget # self.__BoxWidget = vtkOrientedBoxWidget() # Now I could not wrap vtkOrientedBoxWidget self.__BoxWidget = vtk.vtkBoxWidget() # vtkPlane widget: vtkPlaneWidget self.__PlaneWidget = vtk.vtkPlaneWidget() # annotated cube actor: vtkAnnotatedCubeActor, vtkOrientationMarkerWidget self.__Cube = vtk.vtkAnnotatedCubeActor() self.__Marker = vtk.vtkOrientationMarkerWidget() self.SetupVolumeRendering() self.SetupWidgets() self.ShowAnnotationsOn() self.getTextProperty().SetColor(0, 0, 0) self.SetBackground(0.9, 0.9, 0.9) # white self.__FirstRender = 1 self.__RenderingMode = self.PLANAR_RENDERING self.__VRQuality = 1 self.__InteractorStyleSwitcher = None