Exemplo n.º 1
0
    def __init__(self, parent=None):
        super(ModelmapViewer, self).__init__(parent)

        self._surface_algorithm = None
        self._surface_actor = None
        self._volume_scalars = None
        self._volume = None
        self._surface_level = 0.5
        self._color = (0.2, 0.8, 0.2)
        self._planes = []
        self._volume_max = 0.
        self._volume_numpy = None

        self._vtk_widget = QVTKRenderWindowInteractor(self._widget) # _vtk_widget is actually the RenderWindowInteractor
        self._vtk_widget.SetInteractorStyle(vtk.vtkInteractorStyleRubberBandPick())
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self._vtk_widget)

        self._widget.setLayout(layout)
        #self._vtk_widget.Initialize()
        #self._vtk_widget.Start()

        self._renderer = vtk.vtkRenderer()
        self._vtk_render_window = self._vtk_widget.GetRenderWindow()
        self._vtk_render_window.AddRenderer(self._renderer)
        #self._renderer = self._vtk_widget.GetRenderWindow().GetRenderer()
        self._lut = vtk_tools.get_lookup_table(0., 1., log=False, colorscale="jet")

        self._create_volume_map()

        white = (1., 1., 1.)
        self._renderer.SetBackground(white)
Exemplo n.º 2
0
 def plot_rotations(self, values):
     """Update the viewer to show the new values."""
     if len(values) != self._sphere.get_number_of_points():
         #raise ValueError("values must be array of length {0}. Length {1} array received.".format(self._sphere.get_number_of_points(), len(values)))
         sampling_n = icosahedral_sphere.points_to_n(len(values))
         self.set_sampling_n(sampling_n)
     self._sphere.set_lookup_table(vtk_tools.get_lookup_table(0., values.max(), log=False, colorscale="jet", number_of_colors=1000))
     self._sphere.set_values(values)
     #self._sphere
     #self._renderer.Render()
     self._vtk_widget.Render()
Exemplo n.º 3
0
    def _setup_slice_view(self):
        """Setup background, camera and LUT."""
        self._renderer.SetBackground(1, 1, 1)

        # camera
        self._camera = vtk.vtkCamera()
        self._camera.SetPosition(130, 130, 170)
        self._camera.SetFocalPoint(0., 0., 0.)
        self._camera.SetViewUp(0, 0, 1)
        self._renderer.SetActiveCamera(self._camera)

        # self._lut = vtk_tools.get_lookup_table(self._data.get_total_min(), self._data.get_total_max(),
        #                                        log=True, colorscale="jet")
        self._lut = vtk_tools.get_lookup_table(0.1, 10., log=True, colorscale="jet")
        self._actors = {}
Exemplo n.º 4
0
    def _setup_slice_view(self):
        """Setup background, camera and LUT."""
        self._renderer.SetBackground(1, 1, 1)

        # camera
        self._camera = vtk.vtkCamera()
        self._camera.SetPosition(130, 130, 170)
        self._camera.SetFocalPoint(0., 0., 0.)
        self._camera.SetViewUp(0, 0, 1)
        self._renderer.SetActiveCamera(self._camera)

        # self._lut = vtk_tools.get_lookup_table(self._data.get_total_min(), self._data.get_total_max(),
        #                                        log=True, colorscale="jet")
        self._lut = vtk_tools.get_lookup_table(0.1,
                                               10.,
                                               log=True,
                                               colorscale="jet")
        self._actors = {}
Exemplo n.º 5
0
    def __init__(self, parent=None):
        super(ModelmapViewer, self).__init__(parent)

        self._surface_algorithm = None
        self._surface_actor = None
        self._volume_scalars = None
        self._volume = None
        self._surface_level = 0.5
        self._color = (0.2, 0.8, 0.2)
        self._planes = []
        self._volume_max = 0.
        self._volume_numpy = None

        self._vtk_widget = QVTKRenderWindowInteractor(
            self._widget)  # _vtk_widget is actually the RenderWindowInteractor
        self._vtk_widget.SetInteractorStyle(
            vtk.vtkInteractorStyleRubberBandPick())
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self._vtk_widget)

        self._widget.setLayout(layout)
        #self._vtk_widget.Initialize()
        #self._vtk_widget.Start()

        self._renderer = vtk.vtkRenderer()
        self._vtk_render_window = self._vtk_widget.GetRenderWindow()
        self._vtk_render_window.AddRenderer(self._renderer)
        #self._renderer = self._vtk_widget.GetRenderWindow().GetRenderer()
        self._lut = vtk_tools.get_lookup_table(0.,
                                               1.,
                                               log=False,
                                               colorscale="jet")

        self._create_volume_map()

        white = (1., 1., 1.)
        self._renderer.SetBackground(white)