Ejemplo n.º 1
0
    def _create_view_frame(self):
        import resources.python.larynx_measurement_frame
        reload(resources.python.larynx_measurement_frame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.larynx_measurement_frame.LarynxMeasurementFrame)

        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.view_frame_panel,
            {'Module (self)' : self})

        # now setup the VTK stuff
        if self._viewer is None and not self._view_frame is None:
            # vtkImageViewer() does not zoom but retains colour
            # vtkImageViewer2() does zoom but discards colour at
            # first window-level action.
            # vtkgdcm.vtkImageColorViewer() does both right!
            self._viewer = vtkgdcm.vtkImageColorViewer()
            self._viewer.SetupInteractor(self._view_frame.rwi)
            self._viewer.GetRenderer().SetBackground(0.3,0.3,0.3)
            self._set_image_viewer_dummy_input()

            pp = vtk.vtkPointPicker()
            pp.SetTolerance(0.0)
            self._view_frame.rwi.SetPicker(pp)
Ejemplo n.º 2
0
def ViewGDCM(imagedata):
    viewer = vtkgdcm.vtkImageColorViewer()
    viewer.SetInput(reader.GetOutput())
    viewer.SetColorWindow(500.)
    viewer.SetColorLevel(50.)
    viewer.Render()

    import time
    time.sleep(5)
Ejemplo n.º 3
0
def ViewGDCM(imagedata):
    viewer = vtkgdcm.vtkImageColorViewer()
    viewer.SetInput(reader.GetOutput())
    viewer.SetColorWindow(500.)
    viewer.SetColorLevel(50.)
    viewer.Render()

    import time
    time.sleep(5)
Ejemplo n.º 4
0
    def _setup_image_viewer(self):
        # FIXME: I'm planning to factor this out into a medical image
        # viewing class, probably in the GDCM_KIT

        # setup VTK viewer with dummy source (else it complains)
        self._image_viewer = vtkgdcm.vtkImageColorViewer()
        self._image_viewer.SetupInteractor(self._view_frame.image_pane.rwi)
        self._set_image_viewer_dummy_input()

        def setup_text_actor(x, y):
            ta = vtk.vtkTextActor()

            c = ta.GetPositionCoordinate()
            c.SetCoordinateSystemToNormalizedDisplay()
            c.SetValue(x,y)

            p = ta.GetTextProperty()
            p.SetFontFamilyToArial()
            p.SetFontSize(14)
            p.SetBold(0)
            p.SetItalic(0)
            p.SetShadow(0)

            return ta

        ren = self._image_viewer.GetRenderer()

        # direction labels left and right #####
        xl = self._image_viewer.xl_text_actor = setup_text_actor(0.01, 0.5)
        ren.AddActor(xl)
        xr = self._image_viewer.xr_text_actor = setup_text_actor(0.99, 0.5)
        xr.GetTextProperty().SetJustificationToRight()
        ren.AddActor(xr)

        # direction labels top and bottom #####
        # y coordinate ~ 0, bottom of normalized display
        yb = self._image_viewer.yb_text_actor = setup_text_actor(
                0.5, 0.01)
        ren.AddActor(yb)

        yt = self._image_viewer.yt_text_actor = setup_text_actor(
                0.5, 0.99)
        yt.GetTextProperty().SetVerticalJustificationToTop()
        ren.AddActor(yt)
                
        # labels upper-left #####
        ul = self._image_viewer.ul_text_actor = \
            setup_text_actor(0.01, 0.99)
        ul.GetTextProperty().SetVerticalJustificationToTop()
        ren.AddActor(ul)

        # labels upper-right #####
        ur = self._image_viewer.ur_text_actor = \
            setup_text_actor(0.99, 0.99)
        ur.GetTextProperty().SetVerticalJustificationToTop()
        ur.GetTextProperty().SetJustificationToRight()
        ren.AddActor(ur)

        # labels bottom-right #####
        br = self._image_viewer.br_text_actor = \
            setup_text_actor(0.99, 0.01)
        br.GetTextProperty().SetVerticalJustificationToBottom()
        br.GetTextProperty().SetJustificationToRight()
        ren.AddActor(br)
Ejemplo n.º 5
0
    def _setup_image_viewer(self):
        # FIXME: I'm planning to factor this out into a medical image
        # viewing class, probably in the GDCM_KIT

        # setup VTK viewer with dummy source (else it complains)
        self._image_viewer = vtkgdcm.vtkImageColorViewer()
        self._image_viewer.SetupInteractor(self._view_frame.image_pane.rwi)
        self._set_image_viewer_dummy_input()

        def setup_text_actor(x, y):
            ta = vtk.vtkTextActor()

            c = ta.GetPositionCoordinate()
            c.SetCoordinateSystemToNormalizedDisplay()
            c.SetValue(x, y)

            p = ta.GetTextProperty()
            p.SetFontFamilyToArial()
            p.SetFontSize(14)
            p.SetBold(0)
            p.SetItalic(0)
            p.SetShadow(0)

            return ta

        ren = self._image_viewer.GetRenderer()

        # direction labels left and right #####
        xl = self._image_viewer.xl_text_actor = setup_text_actor(0.01, 0.5)
        ren.AddActor(xl)
        xr = self._image_viewer.xr_text_actor = setup_text_actor(0.99, 0.5)
        xr.GetTextProperty().SetJustificationToRight()
        ren.AddActor(xr)

        # direction labels top and bottom #####
        # y coordinate ~ 0, bottom of normalized display
        yb = self._image_viewer.yb_text_actor = setup_text_actor(0.5, 0.01)
        ren.AddActor(yb)

        yt = self._image_viewer.yt_text_actor = setup_text_actor(0.5, 0.99)
        yt.GetTextProperty().SetVerticalJustificationToTop()
        ren.AddActor(yt)

        # labels upper-left #####
        ul = self._image_viewer.ul_text_actor = \
            setup_text_actor(0.01, 0.99)
        ul.GetTextProperty().SetVerticalJustificationToTop()
        ren.AddActor(ul)

        # labels upper-right #####
        ur = self._image_viewer.ur_text_actor = \
            setup_text_actor(0.99, 0.99)
        ur.GetTextProperty().SetVerticalJustificationToTop()
        ur.GetTextProperty().SetJustificationToRight()
        ren.AddActor(ur)

        # labels bottom-right #####
        br = self._image_viewer.br_text_actor = \
            setup_text_actor(0.99, 0.01)
        br.GetTextProperty().SetVerticalJustificationToBottom()
        br.GetTextProperty().SetJustificationToRight()
        ren.AddActor(br)