def __init_vtk(self): text_image_size = vtku.Text() text_image_size.SetPosition(const.TEXT_POS_LEFT_UP) text_image_size.SetValue("") text_image_size.SetSize(const.TEXT_SIZE_SMALL) self.text_image_size = text_image_size text_image_location = vtku.Text() text_image_location.SetVerticalJustificationToBottom() text_image_location.SetPosition(const.TEXT_POS_LEFT_DOWN) text_image_location.SetValue("") text_image_location.SetSize(const.TEXT_SIZE_SMALL) self.text_image_location = text_image_location text_patient = vtku.Text() text_patient.SetJustificationToRight() text_patient.SetPosition(const.TEXT_POS_RIGHT_UP) text_patient.SetValue("") text_patient.SetSize(const.TEXT_SIZE_SMALL) self.text_patient = text_patient text_acquisition = vtku.Text() text_acquisition.SetJustificationToRight() text_acquisition.SetVerticalJustificationToBottom() text_acquisition.SetPosition(const.TEXT_POS_RIGHT_DOWN) text_acquisition.SetValue("") text_acquisition.SetSize(const.TEXT_SIZE_SMALL) self.text_acquisition = text_acquisition renderer = vtk.vtkRenderer() renderer.AddActor(text_image_size.actor) renderer.AddActor(text_image_location.actor) renderer.AddActor(text_patient.actor) renderer.AddActor(text_acquisition.actor) self.renderer = renderer style = vtk.vtkInteractorStyleImage() interactor = wxVTKRenderWindowInteractor(self.panel, -1, size=wx.Size(340, 340)) interactor.SetRenderWhenDisabled(True) interactor.GetRenderWindow().AddRenderer(renderer) interactor.SetInteractorStyle(style) interactor.Render() self.interactor = interactor sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(interactor, 1, wx.GROW | wx.EXPAND) sizer.Fit(self.panel) self.panel.SetSizer(sizer) self.Layout() self.Update()
def CreateSensorID(self): sen1 = vtku.Text() sen1.SetSize(const.TEXT_SIZE_LARGE) sen1.SetPosition((const.X, const.Y)) sen1.ShadowOff() sen1.SetValue("O") self.sen1 = sen1 self.ren.AddActor(sen1.actor) sen2 = vtku.Text() sen2.SetSize(const.TEXT_SIZE_LARGE) sen2.SetPosition((const.X + 0.04, const.Y)) sen2.ShadowOff() sen2.SetValue("O") self.sen2 = sen2 self.ren.AddActor(sen2.actor) self.interactor.Render()
def __init_vtk(self): text_image_size = vtku.Text() text_image_size.SetPosition(const.TEXT_POS_LEFT_UP) text_image_size.SetValue("") text_image_size.SetSize(const.TEXT_SIZE_SMALL) self.text_image_size = text_image_size text_image_location = vtku.Text() text_image_location.SetVerticalJustificationToBottom() text_image_location.SetPosition(const.TEXT_POS_LEFT_DOWN) text_image_location.SetValue("") text_image_location.SetSize(const.TEXT_SIZE_SMALL) self.text_image_location = text_image_location text_patient = vtku.Text() text_patient.SetJustificationToRight() text_patient.SetPosition(const.TEXT_POS_RIGHT_UP) text_patient.SetValue("") text_patient.SetSize(const.TEXT_SIZE_SMALL) self.text_patient = text_patient text_acquisition = vtku.Text() text_acquisition.SetJustificationToRight() text_acquisition.SetVerticalJustificationToBottom() text_acquisition.SetPosition(const.TEXT_POS_RIGHT_DOWN) text_acquisition.SetValue("") text_acquisition.SetSize(const.TEXT_SIZE_SMALL) self.text_acquisition = text_acquisition renderer = vtk.vtkRenderer() renderer.AddActor(text_image_size.actor) renderer.AddActor(text_image_location.actor) renderer.AddActor(text_patient.actor) renderer.AddActor(text_acquisition.actor) self.renderer = renderer style = vtk.vtkInteractorStyleImage() self.interactor.GetRenderWindow().AddRenderer(renderer) self.interactor.SetInteractorStyle(style) self.interactor.Render()
def __init__(self, parent): wx.Panel.__init__(self, parent, size=wx.Size(320, 320)) self.SetBackgroundColour(wx.Colour(0, 0, 0)) self.interaction_style = st.StyleStateManager() self.initial_focus = None self.staticballs = [] style = vtk.vtkInteractorStyleTrackballCamera() self.style = style interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) interactor.SetInteractorStyle(style) self.interactor = interactor sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(interactor, 1, wx.EXPAND) self.sizer = sizer self.SetSizer(sizer) self.Layout() # It would be more correct (API-wise) to call interactor.Initialize() and # interactor.Start() here, but Initialize() calls RenderWindow.Render(). # That Render() call will get through before we can setup the # RenderWindow() to render via the wxWidgets-created context; this # causes flashing on some platforms and downright breaks things on # other platforms. Instead, we call widget.Enable(). This means # that the RWI::Initialized ivar is not set, but in THIS SPECIFIC CASE, # that doesn't matter. interactor.Enable(1) ren = vtk.vtkRenderer() interactor.GetRenderWindow().AddRenderer(ren) self.ren = ren self.raycasting_volume = False self.onclick = False self.text = vtku.Text() self.text.SetValue("") self.ren.AddActor(self.text.actor) self.slice_plane = None self.view_angle = None self.__bind_events() self.__bind_events_wx() self.mouse_pressed = 0 self.on_wl = False self.picker = vtk.vtkPointPicker() interactor.SetPicker(self.picker) self.seed_points = [] self.points_reference = [] self.measure_picker = vtk.vtkPropPicker() #self.measure_picker.SetTolerance(0.005) self.measures = [] self._last_state = 0 self.repositioned_axial_plan = 0 self.repositioned_sagital_plan = 0 self.repositioned_coronal_plan = 0 self.added_actor = 0 self.camera_state = True self.ball_actor = None self._mode_cross = False self._to_show_ball = 0 self._ball_ref_visibility = False