Ejemplo n.º 1
0
    def _createViewFrames(self):
        import modules.Insight.resources.python.register2DViewFrames
        reload(modules.Insight.resources.python.register2DViewFrames)

        viewerFrame = modules.Insight.resources.python.register2DViewFrames.\
                      viewerFrame
        self.viewerFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, viewerFrame)

        self._threedRenderer = vtk.vtkRenderer()
        self._threedRenderer.SetBackground(0.5, 0.5, 0.5)
        self.viewerFrame.threedRWI.GetRenderWindow().AddRenderer(
            self._threedRenderer)

        istyle = vtk.vtkInteractorStyleImage()
        self.viewerFrame.threedRWI.SetInteractorStyle(istyle)
        

        

        # controlFrame creation
        controlFrame = modules.Insight.resources.python.\
                       register2DViewFrames.controlFrame
        self.controlFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, controlFrame)

        # display
        self.viewerFrame.Show(True)
        self.controlFrame.Show(True)
Ejemplo n.º 2
0
    def _createViewFrames(self):
        import modules.Insight.resources.python.register2DViewFrames
        reload(modules.Insight.resources.python.register2DViewFrames)

        viewerFrame = modules.Insight.resources.python.register2DViewFrames.\
                      viewerFrame
        self.viewerFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, viewerFrame)

        self._threedRenderer = vtk.vtkRenderer()
        self._threedRenderer.SetBackground(0.5, 0.5, 0.5)
        self.viewerFrame.threedRWI.GetRenderWindow().AddRenderer(
            self._threedRenderer)

        istyle = vtk.vtkInteractorStyleImage()
        self.viewerFrame.threedRWI.SetInteractorStyle(istyle)

        # controlFrame creation
        controlFrame = modules.Insight.resources.python.\
                       register2DViewFrames.controlFrame
        self.controlFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, controlFrame)

        # display
        self.viewerFrame.Show(True)
        self.controlFrame.Show(True)
Ejemplo n.º 3
0
    def _create_view_frame(self):
        import resources.python.tfeditorframe
        reload(resources.python.tfeditorframe)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.tfeditorframe.TFEditorFrame)

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

        # add the ECASH buttons
        module_utils.create_eoca_buttons(self, self._view_frame,
                                         self._view_frame.view_frame_panel)

        # and customize the presets choice
        vf = self._view_frame
        keys = TF_LIBRARY.keys()
        keys.sort()
        vf.preset_choice.Clear()
        for key in keys:
            vf.preset_choice.Append(key)

        vf.preset_choice.Select(0)
Ejemplo n.º 4
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._view_frame = None
        self._viewer = None
        self._input_image = None
        self._dummy_image_source = vtk.vtkImageMandelbrotSource()
        
        self._widgets = M2DWidgetList()

        # build frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, Measure2DFrame.Measure2DFrame)

        # now link up all event handlers
        self._bind_events()

        # then build VTK pipeline
        self._create_vtk_pipeline()

        # set us up with dummy input
        self._setup_new_image()

        # show everything
        self.view()
Ejemplo n.º 5
0
    def _createViewFrame(self):

        mm = self._module_manager
        # import/reload the viewFrame (created with wxGlade)
        mm.import_reload(
            'modules.filters.resources.python.shellSplatSimpleFLTViewFrame')
        # this line is harmless due to Python's import caching, but we NEED
        # to do it so that the Installer knows that this devide module
        # requires it and so that it's available in this namespace.
        import modules.filters.resources.python.shellSplatSimpleFLTViewFrame

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, mm,
            modules.filters.resources.python.shellSplatSimpleFLTViewFrame.\
            shellSplatSimpleFLTViewFrame)

        # setup introspection with default everythings
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.viewFramePanel,
            self._object_dict, None)

        # create and configure the standard ECAS buttons
        module_utils.create_eoca_buttons(self, self._view_frame,
                                         self._view_frame.viewFramePanel)

        # now we can finally do our own stuff to
        wx.EVT_BUTTON(self._view_frame, self._view_frame.colourButtonId,
                      self._colourButtonCallback)
Ejemplo n.º 6
0
    def _createViewFrame(self):
        import modules.readers.resources.python.dicomRDRViewFrame
        reload(modules.readers.resources.python.dicomRDRViewFrame)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.readers.resources.python.dicomRDRViewFrame.\
            dicomRDRViewFrame)

        # make sure the listbox is empty
        self._viewFrame.dicomFilesListBox.Clear()

        objectDict = {'dicom reader': self._reader}
        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel, objectDict,
            None)

        module_utils.create_eoca_buttons(self, self._viewFrame,
                                         self._viewFrame.viewFramePanel)

        wx.EVT_BUTTON(self._viewFrame, self._viewFrame.addButton.GetId(),
                      self._handlerAddButton)

        wx.EVT_BUTTON(self._viewFrame, self._viewFrame.removeButton.GetId(),
                      self._handlerRemoveButton)

        # follow ModuleBase convention to indicate that we now have
        # a view
        self.view_initialised = True
Ejemplo n.º 7
0
    def _createViewFrame(self):
        import modules.readers.resources.python.dicomRDRViewFrame
        reload(modules.readers.resources.python.dicomRDRViewFrame)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.readers.resources.python.dicomRDRViewFrame.\
            dicomRDRViewFrame)

        # make sure the listbox is empty
        self._viewFrame.dicomFilesListBox.Clear()

        objectDict = {'dicom reader' : self._reader}
        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel,
            objectDict, None)

        module_utils.create_eoca_buttons(self, self._viewFrame,
                                      self._viewFrame.viewFramePanel)

        wx.EVT_BUTTON(self._viewFrame, self._viewFrame.addButton.GetId(),
                      self._handlerAddButton)

        wx.EVT_BUTTON(self._viewFrame, self._viewFrame.removeButton.GetId(),
                      self._handlerRemoveButton)

        # follow ModuleBase convention to indicate that we now have
        # a view
        self.view_initialised = True
Ejemplo n.º 8
0
    def _createViewFrame(self):

        # import the viewFrame (created with wxGlade)
        import modules.readers.resources.python.rawVolumeRDRViewFrame
        reload(modules.readers.resources.python.rawVolumeRDRViewFrame)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.readers.resources.python.rawVolumeRDRViewFrame.\
            rawVolumeRDRViewFrame)

        # bind the file browse button
        wx.EVT_BUTTON(self._viewFrame,
                      self._viewFrame.browseButtonId,
                      self._browseButtonCallback)
                   
        # setup object introspection
        objectDict = {'vtkImageReader' : self._reader}
        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel,
            objectDict, None)

        # standard module buttons + events
        module_utils.create_eoca_buttons(self, self._viewFrame,
                                      self._viewFrame.viewFramePanel)

        # finish setting up the output datatype choice
        self._viewFrame.dataTypeChoice.Clear()
        for aType in self._dataTypes.keys():
            self._viewFrame.dataTypeChoice.Append(aType)
Ejemplo n.º 9
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._view_frame = None
        self._viewer = None
        self._input_image = None
        self._dummy_image_source = vtk.vtkImageMandelbrotSource()

        self._widgets = M2DWidgetList()

        # build frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, Measure2DFrame.Measure2DFrame)

        # now link up all event handlers
        self._bind_events()

        # then build VTK pipeline
        self._create_vtk_pipeline()

        # set us up with dummy input
        self._setup_new_image()

        # show everything
        self.view()
Ejemplo n.º 10
0
    def _create_view_frame(self):
        """By default, this will be a File Open dialog.  If fileOpen is
        False, it will be a File Save dialog.
        """

        if not self._module_manager._devide_app.view_mode:
            raise RuntimeError(
                'Eror calling view-dependent createViewFrame() in '
                'backend-type DeVIDE.')

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.filename_view_module_mixin_frame.\
            FilenameViewModuleMixinFrame)

        wx.EVT_BUTTON(
            self._view_frame, self._view_frame.browseButtonId, lambda e: self.
            browseButtonCallback(self._browse_msg, self._file_wildcard))

        if self._object_dict != None:
            module_utils.create_standard_object_introspection(
                self, self._view_frame, self._view_frame.viewFramePanel,
                self._object_dict, None)

        # new style standard ECAS buttons
        module_utils.create_eoca_buttons(self, self._view_frame,
                                         self._view_frame.viewFramePanel)

        # following module_base convention
        self.view_initialised = True
Ejemplo n.º 11
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.º 12
0
    def _createViewFrame(self):

        # import the viewFrame (created with wxGlade)
        import modules.readers.resources.python.rawVolumeRDRViewFrame
        reload(modules.readers.resources.python.rawVolumeRDRViewFrame)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.readers.resources.python.rawVolumeRDRViewFrame.\
            rawVolumeRDRViewFrame)

        # bind the file browse button
        wx.EVT_BUTTON(self._viewFrame, self._viewFrame.browseButtonId,
                      self._browseButtonCallback)

        # setup object introspection
        objectDict = {'vtkImageReader': self._reader}
        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel, objectDict,
            None)

        # standard module buttons + events
        module_utils.create_eoca_buttons(self, self._viewFrame,
                                         self._viewFrame.viewFramePanel)

        # finish setting up the output datatype choice
        self._viewFrame.dataTypeChoice.Clear()
        for aType in self._dataTypes.keys():
            self._viewFrame.dataTypeChoice.Append(aType)
Ejemplo n.º 13
0
    def _createViewFrame(self):
        parentWindow = self._module_manager.get_module_view_parent_window()

        import resources.python.defaultModuleViewFrame
        reload(resources.python.defaultModuleViewFrame)

        dMVF = resources.python.defaultModuleViewFrame.defaultModuleViewFrame
        viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, dMVF)

        # ConfigVtkObj parent not important, we're passing frame + panel
        # this should populate the sizer with a new sizer7
        # params: noParent, noRenwin, vtk_obj, frame, panel
        self._configVtkObj = ConfigVtkObj(None, None, self._theFilter,
                                          viewFrame, viewFrame.viewFramePanel)

        module_utils.create_standard_object_introspection(
            self, viewFrame, viewFrame.viewFramePanel, {'Module (self)': self},
            None)

        # we don't want the Execute button to be default... else stuff gets
        # executed with every enter in the command window (at least in Doze)
        module_utils.create_eoca_buttons(self, viewFrame,
                                         viewFrame.viewFramePanel, False)

        self._viewFrame = viewFrame
        return viewFrame
Ejemplo n.º 14
0
    def _createViewFrame(self):

        mm = self._module_manager
        # import/reload the viewFrame (created with wxGlade)
        mm.import_reload(
            'modules.filters.resources.python.shellSplatSimpleFLTViewFrame')
        # this line is harmless due to Python's import caching, but we NEED
        # to do it so that the Installer knows that this devide module
        # requires it and so that it's available in this namespace.
        import modules.filters.resources.python.shellSplatSimpleFLTViewFrame

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, mm,
            modules.filters.resources.python.shellSplatSimpleFLTViewFrame.\
            shellSplatSimpleFLTViewFrame)

        # setup introspection with default everythings
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.viewFramePanel,
            self._object_dict, None)

        # create and configure the standard ECAS buttons
        module_utils.create_eoca_buttons(self, self._view_frame,
                                      self._view_frame.viewFramePanel)

        
        # now we can finally do our own stuff to
        wx.EVT_BUTTON(self._view_frame, self._view_frame.colourButtonId,
                      self._colourButtonCallback)
Ejemplo n.º 15
0
    def _createViewFrame(self):
        parentWindow = self._module_manager.get_module_view_parent_window()

        import resources.python.defaultModuleViewFrame
        reload(resources.python.defaultModuleViewFrame)

        dMVF = resources.python.defaultModuleViewFrame.defaultModuleViewFrame
        viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, dMVF)

        # ConfigVtkObj parent not important, we're passing frame + panel
        # this should populate the sizer with a new sizer7
        # params: noParent, noRenwin, vtk_obj, frame, panel
        self._configVtkObj = ConfigVtkObj(None, None,
                                          self._theFilter,
                                          viewFrame, viewFrame.viewFramePanel)

        module_utils.create_standard_object_introspection(
            self, viewFrame, viewFrame.viewFramePanel,
            {'Module (self)' : self}, None)

        # we don't want the Execute button to be default... else stuff gets
        # executed with every enter in the command window (at least in Doze)
        module_utils.create_eoca_buttons(self, viewFrame,
                                      viewFrame.viewFramePanel,
                                      False)
            
        self._viewFrame = viewFrame
        return viewFrame
Ejemplo n.º 16
0
    def _create_view_frame(self):

        """By default, this will be a File Open dialog.  If fileOpen is
        False, it will be a File Save dialog.
        """

        if not self._module_manager._devide_app.view_mode:
            raise RuntimeError("Eror calling view-dependent createViewFrame() in " "backend-type DeVIDE.")

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, resources.python.filename_view_module_mixin_frame.FilenameViewModuleMixinFrame
        )

        wx.EVT_BUTTON(
            self._view_frame,
            self._view_frame.browseButtonId,
            lambda e: self.browseButtonCallback(self._browse_msg, self._file_wildcard),
        )

        if self._object_dict != None:
            module_utils.create_standard_object_introspection(
                self, self._view_frame, self._view_frame.viewFramePanel, self._object_dict, None
            )

        # new style standard ECAS buttons
        module_utils.create_eoca_buttons(self, self._view_frame, self._view_frame.viewFramePanel)

        # following module_base convention
        self.view_initialised = True
Ejemplo n.º 17
0
    def _createViewFrame(self):

        # import the viewFrame (created with wxGlade)
        import modules.filters.resources.python.doubleThresholdFLTFrame
        reload(modules.filters.resources.python.doubleThresholdFLTFrame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.filters.resources.python.doubleThresholdFLTFrame.\
            doubleThresholdFLTFrame)

        objectDict = {
            'imageThreshold': self._imageThreshold,
            'module (self)': self
        }
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.viewFramePanel,
            objectDict, None)

        module_utils.create_eoca_buttons(self, self._view_frame,
                                         self._view_frame.viewFramePanel)

        # finish setting up the output datatype choice
        self._view_frame.outputDataTypeChoice.Clear()
        for aType in self._outputTypes.keys():
            self._view_frame.outputDataTypeChoice.Append(aType)
Ejemplo n.º 18
0
    def _create_view_frame(self):
        import resources.python.tfeditorframe
        reload(resources.python.tfeditorframe)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.tfeditorframe.TFEditorFrame)

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

        # add the ECASH buttons
        module_utils.create_eoca_buttons(self, self._view_frame,
                                        self._view_frame.view_frame_panel)

        # and customize the presets choice
        vf = self._view_frame
        keys = TF_LIBRARY.keys()
        keys.sort()
        vf.preset_choice.Clear()
        for key in keys:
            vf.preset_choice.Append(key)

        vf.preset_choice.Select(0)
Ejemplo n.º 19
0
    def __init__(self, module_manager):
        """Standard constructor.  All DeVIDE modules have these, we do
        the required setup actions.
        """

        # we record the setting here, in case the user changes it
        # during the lifetime of this model, leading to different
        # states at init and shutdown.
        self.IMAGE_VIEWER = IMAGE_VIEWER

        ModuleBase.__init__(self, module_manager)

        # create the view frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, 
            CoMedIFrame.CoMedIFrame)
        # change the title to something more spectacular
        self._view_frame.SetTitle('CoMedI')


        self._setup_vis()


        # hook up all event handlers
        self._bind_events()

        # make our window appear (this is a viewer after all)
        self.view()
        # all modules should toggle this once they have shown their
        # views. 
        self.view_initialised = True

        # this will cause the correct set_cam_* call to be made
        self._config.cam_parallel = False

        # setup all match modes here.  even if the user switches
        # modes, all metadata should be serialised, so that after a
        # network reload, the user can switch and will get her old
        # metadata back from a previous session.
        self._config.sstructlandmarksmm_cfg = {}

        # default match mode is the landmark thingy
        self._config.match_mode = MATCH_MODE_LANDMARK_SS
        # this will hold a binding to the current match mode that will
        # be initially setup by config_to_logic
        self.match_mode = None

        self._config.data2mcm_cfg = {}
        self._config.checkerboardcm_cfg = {}
        self._config.focusdiffcm_cfg = {}

        self._config.comparison_mode = COMPARISON_MODE_DATA2M
        self.comparison_mode = None

        # apply config information to underlying logic
        self.sync_module_logic_with_config()
        # then bring it all the way up again to the view
        self.sync_module_view_with_logic()
Ejemplo n.º 20
0
    def _create_view_frame(self):
        import resources.python.slicinator_frames
        reload(resources.python.slicinator_frames)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.slicinator_frames.SlicinatorFrame)

        vf = self._view_frame
Ejemplo n.º 21
0
    def _create_view_frame(self):
        import resources.python.slicinator_frames
        reload(resources.python.slicinator_frames)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.slicinator_frames.SlicinatorFrame)

        vf = self._view_frame
Ejemplo n.º 22
0
    def _create_view_frame(self):
        import resources.python.code_runner_frame
        reload(resources.python.code_runner_frame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.code_runner_frame.\
            CodeRunnerFrame)

        self._view_frame.main_splitter.SetMinimumPaneSize(50)
Ejemplo n.º 23
0
    def _create_view_frame(self):
        import resources.python.code_runner_frame
        reload(resources.python.code_runner_frame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.code_runner_frame.\
            CodeRunnerFrame)

        self._view_frame.main_splitter.SetMinimumPaneSize(50)
Ejemplo n.º 24
0
    def _createViewFrame(self):
        # create the viewerFrame
        import modules.viewers.resources.python.histogramSegmentFrames

        # this reload is temporary during development
        reload(modules.viewers.resources.python.histogramSegmentFrames)

        viewFrame = modules.viewers.resources.python.histogramSegmentFrames.viewFrame

        # DeVIDE takes care of the icon and the window close handlers
        self._viewFrame = module_utils.instantiate_module_view_frame(self, self._module_manager, viewFrame)
Ejemplo n.º 25
0
    def _createViewFrame(self):
        self._module_manager.import_reload("modules.Insight.resources.python.imageStackRDRViewFrame")
        import modules.Insight.resources.python.imageStackRDRViewFrame

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, modules.Insight.resources.python.imageStackRDRViewFrame.imageStackRDRViewFrame
        )

        module_utils.create_eoca_buttons(self, self._viewFrame, self._viewFrame.viewFramePanel)

        self._bindEvents()
Ejemplo n.º 26
0
    def _createViewFrame(self):
        # create the viewerFrame
        import modules.viewers.resources.python.histogramSegmentFrames
        # this reload is temporary during development
        reload(modules.viewers.resources.python.histogramSegmentFrames)

        viewFrame = modules.viewers.resources.python.histogramSegmentFrames.\
                    viewFrame

        # DeVIDE takes care of the icon and the window close handlers
        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, viewFrame)
Ejemplo n.º 27
0
    def __init__(self, module_manager):
        """Standard constructor.  All DeVIDE modules have these, we do
        the required setup actions.
        """

        # we record the setting here, in case the user changes it
        # during the lifetime of this model, leading to different
        # states at init and shutdown.
        self.IMAGE_VIEWER = IMAGE_VIEWER

        ModuleBase.__init__(self, module_manager)

        # create the view frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            SkeletonAUIViewerFrame.SkeletonAUIViewerFrame)
        # change the title to something more spectacular
        self._view_frame.SetTitle('Skeleton AUI Viewer')

        # create the necessary VTK objects: we only need a renderer,
        # the RenderWindowInteractor in the view_frame has the rest.
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.5, 0.5, 0.5)
        self._view_frame.rwi.GetRenderWindow().AddRenderer(self.ren)

        # hook up all event handlers
        self._bind_events()

        # anything you stuff into self._config will be saved
        self._config.my_string = 'la la'

        # make our window appear (this is a viewer after all)
        self.view()
        # all modules should toggle this once they have shown their
        # views.
        self.view_initialised = True

        # apply config information to underlying logic
        self.sync_module_logic_with_config()
        # then bring it all the way up again to the view
        self.sync_module_view_with_logic()

        # the self.timer bits demonstrate how to use a timer to trigger some event
        # every few milliseconds. this can for example be used to poll a
        # tracking device.
        # to see this in action in this example, do the following:
        # 1. instantiate the SkeletonAUIViewer
        # 2. click on "add superquadric" a few times
        # 3. click on "reset camera" so that they are all in view
        # 4. click on "start timer event" and see them rotate while you can do
        #    other things!
        self.timer = None
Ejemplo n.º 28
0
    def __init__(self, module_manager):
        """Standard constructor.  All DeVIDE modules have these, we do
        the required setup actions.
        """

        # we record the setting here, in case the user changes it
        # during the lifetime of this model, leading to different
        # states at init and shutdown.
        self.IMAGE_VIEWER = IMAGE_VIEWER

        ModuleBase.__init__(self, module_manager)

        # create the view frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, 
            SkeletonAUIViewerFrame.SkeletonAUIViewerFrame)
        # change the title to something more spectacular
        self._view_frame.SetTitle('Skeleton AUI Viewer')

        # create the necessary VTK objects: we only need a renderer,
        # the RenderWindowInteractor in the view_frame has the rest.
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.5,0.5,0.5)
        self._view_frame.rwi.GetRenderWindow().AddRenderer(self.ren)

        # hook up all event handlers
        self._bind_events()

        # anything you stuff into self._config will be saved
        self._config.my_string = 'la la'

        # make our window appear (this is a viewer after all)
        self.view()
        # all modules should toggle this once they have shown their
        # views. 
        self.view_initialised = True

        # apply config information to underlying logic
        self.sync_module_logic_with_config()
        # then bring it all the way up again to the view
        self.sync_module_view_with_logic()
        
        # the self.timer bits demonstrate how to use a timer to trigger some event
        # every few milliseconds. this can for example be used to poll a
        # tracking device.
        # to see this in action in this example, do the following:
        # 1. instantiate the SkeletonAUIViewer
        # 2. click on "add superquadric" a few times
        # 3. click on "reset camera" so that they are all in view
        # 4. click on "start timer event" and see them rotate while you can do
        #    other things!
        self.timer = None
Ejemplo n.º 29
0
    def _create_view_frame(self):
        import resources.python.quick_info_frames
        reload(resources.python.quick_info_frames)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            resources.python.quick_info_frames.QuickInfoFrame)

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

        module_utils.create_eoca_buttons(self, self._view_frame,
                                         self._view_frame.view_frame_panel)
Ejemplo n.º 30
0
    def _createViewFrame(self):
        self._module_manager.import_reload(
            'modules.Insight.resources.python.imageStackRDRViewFrame')
        import modules.Insight.resources.python.imageStackRDRViewFrame

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.Insight.resources.python.imageStackRDRViewFrame.\
            imageStackRDRViewFrame)

        module_utils.create_eoca_buttons(self, self._viewFrame,
                                         self._viewFrame.viewFramePanel)

        self._bindEvents()
Ejemplo n.º 31
0
    def _create_view_frame(self):
        import resources.python.quick_info_frames
        reload(resources.python.quick_info_frames)

        self._view_frame = module_utils.instantiate_module_view_frame(
                self, self._module_manager,
                resources.python.quick_info_frames.QuickInfoFrame)

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

        module_utils.create_eoca_buttons(self, self._view_frame,
                                        self._view_frame.view_frame_panel)
Ejemplo n.º 32
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, 
            DICOMBrowserFrame.DICOMBrowserFrame)
        # change the title to something more spectacular
        # default is DICOMBrowser View
        self._view_frame.SetTitle('DeVIDE DICOMBrowser')

        self._image_viewer = None
        self._setup_image_viewer()

        # map from study_uid to Study instances
        self._study_dict = {}
        # map from studies listctrl itemdata to study uid
        self._item_data_to_study_uid = {}
        # currently selected study_uid
        self._selected_study_uid = None

        self._item_data_to_series_uid = {}
        self._selected_series_uid = None

        # store name of currently previewed filename, so we don't
        # reload unnecessarily.
        self._current_filename = None

        self._bind_events()


        self._config.dicom_search_paths = []
        self._config.lock_pz = False
        self._config.lock_wl = False
        self._config.s_study_dict = {}

        self.sync_module_logic_with_config()
        self.sync_module_view_with_logic()

        self.view()
        # all modules should toggle this once they have shown their
        # stuff.
        self.view_initialised = True

        if os.name == 'posix':
            # bug with GTK where the image window appears bunched up
            # in the top-left corner.  By setting the default view
            # (again), it's worked around
            self._view_frame.set_default_view()
Ejemplo n.º 33
0
    def _createViewFrame(self):
        self._module_manager.import_reload(
            'modules.filters.resources.python.resampleImageViewFrame')
        import modules.filters.resources.python.resampleImageViewFrame

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.filters.resources.python.resampleImageViewFrame.\
            resampleImageViewFrame)

        objectDict = {'vtkImageResample' : self._imageResample}
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.viewFramePanel,
            objectDict, None)

        module_utils.create_eoca_buttons(self, self._view_frame,
                                      self._view_frame.viewFramePanel)
Ejemplo n.º 34
0
    def _createViewFrame(self):
        self._module_manager.import_reload(
            'modules.filters.resources.python.resampleImageViewFrame')
        import modules.filters.resources.python.resampleImageViewFrame

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.filters.resources.python.resampleImageViewFrame.\
            resampleImageViewFrame)

        objectDict = {'vtkImageResample': self._imageResample}
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.viewFramePanel,
            objectDict, None)

        module_utils.create_eoca_buttons(self, self._view_frame,
                                         self._view_frame.viewFramePanel)
Ejemplo n.º 35
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, DICOMBrowserFrame.DICOMBrowserFrame)
        # change the title to something more spectacular
        # default is DICOMBrowser View
        self._view_frame.SetTitle('DeVIDE DICOMBrowser')

        self._image_viewer = None
        self._setup_image_viewer()

        # map from study_uid to Study instances
        self._study_dict = {}
        # map from studies listctrl itemdata to study uid
        self._item_data_to_study_uid = {}
        # currently selected study_uid
        self._selected_study_uid = None

        self._item_data_to_series_uid = {}
        self._selected_series_uid = None

        # store name of currently previewed filename, so we don't
        # reload unnecessarily.
        self._current_filename = None

        self._bind_events()

        self._config.dicom_search_paths = []
        self._config.lock_pz = False
        self._config.lock_wl = False
        self._config.s_study_dict = {}

        self.sync_module_logic_with_config()
        self.sync_module_view_with_logic()

        self.view()
        # all modules should toggle this once they have shown their
        # stuff.
        self.view_initialised = True

        if os.name == 'posix':
            # bug with GTK where the image window appears bunched up
            # in the top-left corner.  By setting the default view
            # (again), it's worked around
            self._view_frame.set_default_view()
Ejemplo n.º 36
0
    def _createViewFrame(self):

        # import the viewFrame (created with wxGlade)
        import modules.Filters.resources.python.contourFLTBaseViewFrame
        reload(modules.Filters.resources.python.contourFLTBaseViewFrame)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.Filters.resources.python.contourFLTBaseViewFrame.\
            contourFLTBaseViewFrame)

        objectDict = {'contourFilter' : self._contourFilter}
        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel,
            objectDict, None)

        module_utils.create_eoca_buttons(
            self, self._viewFrame, self._viewFrame.viewFramePanel)
Ejemplo n.º 37
0
    def _createViewFrame(self):

        # import the viewFrame (created with wxGlade)
        import modules.Filters.resources.python.contourFLTBaseViewFrame
        reload(modules.Filters.resources.python.contourFLTBaseViewFrame)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.Filters.resources.python.contourFLTBaseViewFrame.\
            contourFLTBaseViewFrame)

        objectDict = {'contourFilter': self._contourFilter}
        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel, objectDict,
            None)

        module_utils.create_eoca_buttons(self, self._viewFrame,
                                         self._viewFrame.viewFramePanel)
Ejemplo n.º 38
0
    def _createViewFrame(self):
        # create the viewerFrame
        import modules.viewers.resources.python.histogram1DFrames

        reload(modules.viewers.resources.python.histogram1DFrames)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, modules.viewers.resources.python.histogram1DFrames.histogram1DFrame
        )

        self._viewFrame.plotCanvas.SetEnableZoom(True)
        self._viewFrame.plotCanvas.SetEnableGrid(True)

        objectDict = {"Module (self)": self, "vtkImageAccumulate": self._imageAccumulate}

        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel, objectDict, None
        )

        module_utils.create_eoca_buttons(self, self._viewFrame, self._viewFrame.viewFramePanel)
Ejemplo n.º 39
0
    def _createViewFrame(self):

        # import the viewFrame (created with wxGlade)
        import modules.filters.resources.python.doubleThresholdFLTFrame
        reload(modules.filters.resources.python.doubleThresholdFLTFrame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.filters.resources.python.doubleThresholdFLTFrame.\
            doubleThresholdFLTFrame)

        objectDict = {'imageThreshold' : self._imageThreshold,
                      'module (self)' : self}
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.viewFramePanel,
            objectDict, None)

        module_utils.create_eoca_buttons(self, self._view_frame,
                                      self._view_frame.viewFramePanel)

        # finish setting up the output datatype choice
        self._view_frame.outputDataTypeChoice.Clear()
        for aType in self._outputTypes.keys():
            self._view_frame.outputDataTypeChoice.Append(aType)    
Ejemplo n.º 40
0
    def _create_view_frame(self):
        import modules.readers.resources.python.DICOMReaderViewFrame
        reload(modules.readers.resources.python.DICOMReaderViewFrame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.readers.resources.python.DICOMReaderViewFrame.\
            DICOMReaderViewFrame)

        # make sure the listbox is empty
        self._view_frame.dicom_files_lb.Clear()

        object_dict = {
                'Module (self)'      : self,
                'vtkGDCMImageReader' : self._reader}
        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.view_frame_panel,
            object_dict, None)

        module_utils.create_eoca_buttons(self, self._view_frame,
                                      self._view_frame.view_frame_panel)

        # now add the event handlers
        self._view_frame.add_files_b.Bind(wx.EVT_BUTTON,
                self._handler_add_files_b)
        self._view_frame.remove_files_b.Bind(wx.EVT_BUTTON,
                self._handler_remove_files_b)

        # also the drop handler
        dt = DRDropTarget(self)
        self._view_frame.dicom_files_lb.SetDropTarget(dt)


        # follow ModuleBase convention to indicate that we now have
        # a view
        self.view_initialised = True
Ejemplo n.º 41
0
    def _createViewFrame(self):
        # create the viewerFrame
        import modules.viewers.resources.python.histogram1DFrames
        reload(modules.viewers.resources.python.histogram1DFrames)

        self._viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.viewers.resources.python.histogram1DFrames.\
            histogram1DFrame)

        self._viewFrame.plotCanvas.SetEnableZoom(True)
        self._viewFrame.plotCanvas.SetEnableGrid(True)

        objectDict = {
            'Module (self)': self,
            'vtkImageAccumulate': self._imageAccumulate
        }

        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel, objectDict,
            None)

        module_utils.create_eoca_buttons(self, self._viewFrame,
                                         self._viewFrame.viewFramePanel)
Ejemplo n.º 42
0
    def _create_view_frame(self):
        import modules.filters.resources.python.EditMedicalMetaDataViewFrame
        reload(modules.filters.resources.python.EditMedicalMetaDataViewFrame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.filters.resources.python.EditMedicalMetaDataViewFrame.\
            EditMedicalMetaDataViewFrame)


        # resize the grid and populate it with the various property
        # names
        grid = self._view_frame.prop_grid
        grid.DeleteRows(0, grid.GetNumberRows())
        grid.AppendRows(len(self.mip_attr_l))
        for i in range(len(self.mip_attr_l)):
            grid.SetCellValue(i, 0, self.mip_attr_l[i])
            # key is read-only
            grid.SetReadOnly(i, 0)
            # current value is also read-only
            grid.SetReadOnly(i, 1)
            # use special method to set new value (this also takes
            # care of cell colouring)
            self._grid_set_new_val(i, None)

        # make sure the first column fits neatly around the largest
        # key name
        grid.AutoSizeColumn(0)

        def handler_grid_cell_change(event):
            # event is a wx.GridEvent
            r,c = event.GetRow(), event.GetCol()
            grid = self._view_frame.prop_grid

            key = self.mip_attr_l[r]
            gval = grid.GetCellValue(r,c) 
            if gval == '':
                # this means the user doesn't want this field to be
                # changed, so we have to remove it from the
                # _grid_value_dict and we have to adapt the cell
                del self._grid_value_dict[key]
                # we only use this to change the cell background
                self._grid_set_new_val(r, gval, value_change=False)

            else:
                # the user has changed the value, so set it in the
                # prop dictionary
                self._grid_value_dict[key] = gval
                # and make sure the background colour is changed
                # appropriately.
                self._grid_set_new_val(r, gval, value_change=False)

        grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, handler_grid_cell_change)


        object_dict = {
                'Module (self)'      : self}

        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.view_frame_panel,
            object_dict, None)

        # we don't want enter to OK and escape to cancel, as these are
        # used for confirming and cancelling grid editing operations
        module_utils.create_eoca_buttons(self, self._view_frame,
                                        self._view_frame.view_frame_panel,
                                        ok_default=False,
                                        cancel_hotkey=False)

        # follow ModuleBase convention to indicate that we now have
        # a view
        self.view_initialised = True

        self._grid_sync_with_current()
Ejemplo n.º 43
0
    def __init__(self, module_manager):
        """Standard constructor.  All DeVIDE modules have these, we do
        the required setup actions.
        """

        # we record the setting here, in case the user changes it
        # during the lifetime of this model, leading to different
        # states at init and shutdown.
        self.IMAGE_VIEWER = IMAGE_VIEWER

        # we need all this for our contours
        self.mask_data = None
        self.image_data = None
        self.lungVolume = None

        self.contour_severe_actor = vtk.vtkActor()
        self.contour_moderate_actor = vtk.vtkActor()
        self.contour_lungedge_actor = vtk.vtkActor()

        self.severe_mapper = vtk.vtkPolyDataMapper()
        self.severe_mapper.ScalarVisibilityOff()

        self.moderate_mapper = vtk.vtkPolyDataMapper()
        self.moderate_mapper.ScalarVisibilityOff()

        self.lung_mapper = vtk.vtkPolyDataMapper()
        self.lung_mapper.ScalarVisibilityOff()

        self.contour_severe_actor.SetMapper(self.severe_mapper)
        self.contour_severe_actor.GetProperty().SetColor(1, 0, 0)
        self.contour_severe_actor.GetProperty().SetOpacity(0.5)

        self.contour_moderate_actor.SetMapper(self.moderate_mapper)
        self.contour_moderate_actor.GetProperty().SetColor(0.5, 0, 1)
        self.contour_moderate_actor.GetProperty().SetOpacity(0.25)

        self.contour_lungedge_actor.SetMapper(self.lung_mapper)
        self.contour_lungedge_actor.GetProperty().SetColor(0.9, 0.9, 0.9)
        self.contour_lungedge_actor.GetProperty().SetOpacity(0.1)

        ModuleBase.__init__(self, module_manager)

        # create the view frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            EmphysemaViewerFrame.EmphysemaViewerFrame)
        # change the title to something more spectacular (or at least something non-default)
        self._view_frame.SetTitle('EmphysemaViewer')

        # create the necessary VTK objects: we only need a renderer,
        # the RenderWindowInteractor in the view_frame has the rest.
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.5, 0.5, 0.5)
        self._view_frame.rwi.GetRenderWindow().AddRenderer(self.ren)

        self.ren.AddActor(self.contour_severe_actor)
        self.ren.AddActor(self.contour_moderate_actor)
        self.ren.AddActor(self.contour_lungedge_actor)

        self.ren2 = vtk.vtkRenderer()
        self.ren2.SetBackground(0.5, 0.5, 0.5)
        self._view_frame.overlay.GetRenderWindow().AddRenderer(self.ren2)
        self.slice_viewer1 = CMSliceViewer(self._view_frame.overlay, self.ren2)

        self.ren3 = vtk.vtkRenderer()
        self.ren3.SetBackground(0.5, 0.5, 0.5)
        self._view_frame.original.GetRenderWindow().AddRenderer(self.ren3)
        self.slice_viewer2 = CMSliceViewer(self._view_frame.original,
                                           self.ren3)

        self.slice_viewer3 = CMSliceViewer(self._view_frame.rwi, self.ren)

        self.sync = SyncSliceViewers()
        self.sync.add_slice_viewer(self.slice_viewer1)
        self.sync.add_slice_viewer(self.slice_viewer2)
        self.sync.add_slice_viewer2(self.slice_viewer3)

        # hook up all event handlers
        self._bind_events()

        # anything you stuff into self._config will be saved
        self._config.last_used_dir = ''

        # make our window appear (this is a viewer after all)
        self.view()
        # all modules should toggle this once they have shown their
        # views.
        self.view_initialised = True

        # apply config information to underlying logic
        self.sync_module_logic_with_config()
        # then bring it all the way up again to the view
        self.sync_module_view_with_logic()
Ejemplo n.º 44
0
    def _create_view_frame(self):
        parentWindow = self._module_manager.get_module_view_parent_window()

        import resources.python.defaultModuleViewFrame

        reload(resources.python.defaultModuleViewFrame)

        dMVF = resources.python.defaultModuleViewFrame.defaultModuleViewFrame
        viewFrame = module_utils.instantiate_module_view_frame(self, self._module_manager, dMVF)

        # this viewFrame doesn't have the 7-sizer yet
        sizer7 = wx.BoxSizer(wx.HORIZONTAL)
        viewFrame.viewFramePanel.GetSizer().Add(sizer7, 1, wx.ALL | wx.EXPAND, 7)

        # now let's add the wxGridSizer
        # as many rows as there are tuples in configList, 2 columns,
        # 7 pixels vgap, 4 pixels hgap
        gridSizer = wx.FlexGridSizer(len(self._configList), 2, 7, 4)
        # maybe after we've added everything?
        gridSizer.AddGrowableCol(1)
        panel = viewFrame.viewFramePanel
        for configTuple in self._configList:
            label = wx.StaticText(panel, -1, configTuple[0])
            gridSizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL, 0)
            widget = None

            if configTuple[3] == "static_text":
                widget = wx.StaticText(panel, -1, "")

            elif configTuple[3] == "text":
                widget = wx.TextCtrl(panel, -1, "")

            elif configTuple[3] == "tupleText":
                # find out how many elements
                typeD = configTuple[2]
                castString, numString = typeD.split(":")[1].split(",")
                num = int(numString)
                textWidgets = []
                twSizer = wx.BoxSizer(wx.HORIZONTAL)

                for i in range(num):
                    textWidgets.append(wx.TextCtrl(panel, -1, ""))
                    twSizer.Add(textWidgets[-1], 0, wx.ALIGN_CENTER_VERTICAL, 1)
                    if i < num - 1:
                        twSizer.Add(wx.StaticText(panel, -1, ","), 0, wx.RIGHT, border=4)

                widget = None
                widgets = textWidgets
                widgetsSizer = twSizer

            elif configTuple[3] == "maskedText":
                widget = wx.lib.masked.TextCtrl(panel, -1, "", **configTuple[5])

            elif configTuple[3] == "checkbox":  # checkbox
                widget = wx.CheckBox(panel, -1, "")

            elif configTuple[3] == "radiobox":  # radiobox
                # configTuple[5] has to be a list of strings
                widget = wx.RadioBox(panel, -1, "", choices=configTuple[5])

            elif configTuple[3] == "choice":  # choice
                widget = wx.Choice(panel, -1)
                # in this case, configTuple[5] has to be a list of strings
                for cString in configTuple[5]:
                    widget.Append(cString)

            elif configTuple[3] == "filebrowser":  # filebrowser
                widget = FileBrowseButton(
                    panel,
                    -1,
                    fileMask=configTuple[5]["fileMask"],
                    fileMode=configTuple[5]["fileMode"],
                    labelText=None,
                    toolTip=configTuple[4],
                )

            else:  # dirbrowser
                widget = DirBrowseButton(panel, -1, labelText=None, toolTip=configTuple[4])

            if widget:
                if len(configTuple[4]) > 0:
                    widget.SetToolTip(wx.ToolTip(configTuple[4]))

                gridSizer.Add(widget, 0, wx.EXPAND, 0)
                self._widgets[configTuple[0:5]] = widget

            elif len(widgets) > 0:
                if len(configTuple[4]) > 0:
                    for w in widgets:
                        w.SetToolTip(wx.ToolTip(configTuple[4]))

                gridSizer.Add(widgetsSizer, 0, wx.EXPAND, 0)
                self._widgets[configTuple[0:5]] = widgets

        sizer7.Add(gridSizer, 1, wx.EXPAND, 0)

        if self._object_dict != None:
            module_utils.create_standard_object_introspection(
                self, viewFrame, viewFrame.viewFramePanel, self._object_dict, None
            )

        module_utils.create_eoca_buttons(self, viewFrame, viewFrame.viewFramePanel)

        # following ModuleBase convention to indicate that view is
        # available.
        self.view_initialised = True

        self._view_frame = viewFrame
        return viewFrame
Ejemplo n.º 45
0
    def __init__(self, module_manager):
        """Standard constructor.  All DeVIDE modules have these, we do
        the required setup actions.
        """

        # we record the setting here, in case the user changes it
        # during the lifetime of this model, leading to different
        # states at init and shutdown.
        self.IMAGE_VIEWER = IMAGE_VIEWER

	    # we need all this for our contours
        self.mask_data = None
        self.image_data = None
        self.lungVolume = None

        self.contour_severe_actor = vtk.vtkActor()
        self.contour_moderate_actor = vtk.vtkActor()
        self.contour_lungedge_actor = vtk.vtkActor()

        self.severe_mapper = vtk.vtkPolyDataMapper()
        self.severe_mapper.ScalarVisibilityOff()

        self.moderate_mapper = vtk.vtkPolyDataMapper()
        self.moderate_mapper.ScalarVisibilityOff()

        self.lung_mapper = vtk.vtkPolyDataMapper()
        self.lung_mapper.ScalarVisibilityOff()

        self.contour_severe_actor.SetMapper(self.severe_mapper)
        self.contour_severe_actor.GetProperty().SetColor(1,0,0)
        self.contour_severe_actor.GetProperty().SetOpacity(0.5)

        self.contour_moderate_actor.SetMapper(self.moderate_mapper)
        self.contour_moderate_actor.GetProperty().SetColor(0.5,0,1)
        self.contour_moderate_actor.GetProperty().SetOpacity(0.25)

        self.contour_lungedge_actor.SetMapper(self.lung_mapper)
        self.contour_lungedge_actor.GetProperty().SetColor(0.9,0.9,0.9)	
        self.contour_lungedge_actor.GetProperty().SetOpacity(0.1)

        ModuleBase.__init__(self, module_manager)

        # create the view frame
        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, 
            EmphysemaViewerFrame.EmphysemaViewerFrame)
        # change the title to something more spectacular (or at least something non-default)
        self._view_frame.SetTitle('EmphysemaViewer')

        # create the necessary VTK objects: we only need a renderer,
        # the RenderWindowInteractor in the view_frame has the rest.
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.5,0.5,0.5)
        self._view_frame.rwi.GetRenderWindow().AddRenderer(self.ren)

        self.ren.AddActor(self.contour_severe_actor)
        self.ren.AddActor(self.contour_moderate_actor)
        self.ren.AddActor(self.contour_lungedge_actor)

        self.ren2 = vtk.vtkRenderer()
        self.ren2.SetBackground(0.5,0.5,0.5)
        self._view_frame.overlay.GetRenderWindow().AddRenderer(self.ren2)
        self.slice_viewer1 = CMSliceViewer(self._view_frame.overlay, self.ren2)

        self.ren3 = vtk.vtkRenderer()
        self.ren3.SetBackground(0.5,0.5,0.5)
        self._view_frame.original.GetRenderWindow().AddRenderer(self.ren3)
        self.slice_viewer2 = CMSliceViewer(self._view_frame.original, self.ren3)
        
        self.slice_viewer3 = CMSliceViewer(self._view_frame.rwi, self.ren)
        

        self.sync = SyncSliceViewers()
        self.sync.add_slice_viewer(self.slice_viewer1)
        self.sync.add_slice_viewer(self.slice_viewer2)
        self.sync.add_slice_viewer2(self.slice_viewer3)

        # hook up all event handlers
        self._bind_events()

        # anything you stuff into self._config will be saved
        self._config.last_used_dir = ''

        # make our window appear (this is a viewer after all)
        self.view()
        # all modules should toggle this once they have shown their
        # views. 
        self.view_initialised = True

        # apply config information to underlying logic
        self.sync_module_logic_with_config()
        # then bring it all the way up again to the view
        self.sync_module_view_with_logic()
Ejemplo n.º 46
0
    def _create_view_frame(self):
        import modules.filters.resources.python.EditMedicalMetaDataViewFrame
        reload(modules.filters.resources.python.EditMedicalMetaDataViewFrame)

        self._view_frame = module_utils.instantiate_module_view_frame(
            self, self._module_manager,
            modules.filters.resources.python.EditMedicalMetaDataViewFrame.\
            EditMedicalMetaDataViewFrame)

        # resize the grid and populate it with the various property
        # names
        grid = self._view_frame.prop_grid
        grid.DeleteRows(0, grid.GetNumberRows())
        grid.AppendRows(len(self.mip_attr_l))
        for i in range(len(self.mip_attr_l)):
            grid.SetCellValue(i, 0, self.mip_attr_l[i])
            # key is read-only
            grid.SetReadOnly(i, 0)
            # current value is also read-only
            grid.SetReadOnly(i, 1)
            # use special method to set new value (this also takes
            # care of cell colouring)
            self._grid_set_new_val(i, None)

        # make sure the first column fits neatly around the largest
        # key name
        grid.AutoSizeColumn(0)

        def handler_grid_cell_change(event):
            # event is a wx.GridEvent
            r, c = event.GetRow(), event.GetCol()
            grid = self._view_frame.prop_grid

            key = self.mip_attr_l[r]
            gval = grid.GetCellValue(r, c)
            if gval == '':
                # this means the user doesn't want this field to be
                # changed, so we have to remove it from the
                # _grid_value_dict and we have to adapt the cell
                del self._grid_value_dict[key]
                # we only use this to change the cell background
                self._grid_set_new_val(r, gval, value_change=False)

            else:
                # the user has changed the value, so set it in the
                # prop dictionary
                self._grid_value_dict[key] = gval
                # and make sure the background colour is changed
                # appropriately.
                self._grid_set_new_val(r, gval, value_change=False)

        grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, handler_grid_cell_change)

        object_dict = {'Module (self)': self}

        module_utils.create_standard_object_introspection(
            self, self._view_frame, self._view_frame.view_frame_panel,
            object_dict, None)

        # we don't want enter to OK and escape to cancel, as these are
        # used for confirming and cancelling grid editing operations
        module_utils.create_eoca_buttons(self,
                                         self._view_frame,
                                         self._view_frame.view_frame_panel,
                                         ok_default=False,
                                         cancel_hotkey=False)

        # follow ModuleBase convention to indicate that we now have
        # a view
        self.view_initialised = True

        self._grid_sync_with_current()
Ejemplo n.º 47
0
    def _create_window(self):
        import modules.viewers.resources.python.slice3dVWRFrames
        reload(modules.viewers.resources.python.slice3dVWRFrames)

        stereo = self._module_manager.get_app_main_config().stereo
        #print "STEREO:", stereo
        modules.viewers.resources.python.slice3dVWRFrames.S3DV_STEREO = stereo

        # threedFrame creation and basic setup -------------------
        threedFrame = modules.viewers.resources.python.slice3dVWRFrames.\
                      threedFrame
        self.threedFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, threedFrame)
        self.threedFrame.SetTitle('slice3dVWR 3D view')

        # see about stereo
        #self.threedFrame.threedRWI.GetRenderWindow().SetStereoCapableWindow(1)

        # create foreground and background renderers
        self._threedRenderer = vtk.vtkRenderer()

        if BACKGROUND_RENDERER:
            self._background_renderer = vtk.vtkRenderer()

        renwin = self.threedFrame.threedRWI.GetRenderWindow()

        # I've not yet been able to get depth peeling working on my
        # NV 8800 on Ubuntu 8.10 Linux x86_64.  Will continue later...
        #renwin.SetMultiSamples(0)
        #renwin.SetAlphaBitPlanes(1)
        #self._threedRenderer.SetUseDepthPeeling(1)
        #self._threedRenderer.SetMaximumNumberOfPeels(100)
        #self._threedRenderer.SetOcclusionRatio(0.1)
        #renwin.AddRenderer(self._threedRenderer)

        # use function to setup fg and bg renderers so we can have a
        # nice gradient background.
        if BACKGROUND_RENDERER:
            import module_kits.vtk_kit
            module_kits.vtk_kit.utils.setup_renderers(
                renwin, self._threedRenderer, self._background_renderer)
        else:
            self._threedRenderer.SetBackground(0.5, 0.5, 0.5)
            if GRADIENT_BACKGROUND:
                self._threedRenderer.SetBackground2(1, 1, 1)
                self._threedRenderer.SetGradientBackground(1)

            renwin.AddRenderer(self._threedRenderer)

        # controlFrame creation and basic setup -------------------
        controlFrame = modules.viewers.resources.python.slice3dVWRFrames.\
                       controlFrame
        self.controlFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, controlFrame)
        self.controlFrame.SetTitle('slice3dVWR Controls')

        # fix for the grid
        #self.controlFrame.spointsGrid.SetSelectionMode(wx.Grid.wxGridSelectRows)
        #self.controlFrame.spointsGrid.DeleteRows(
        #   0, self.controlFrame.spointsGrid.GetNumberRows())

        # add possible point names
        self.controlFrame.sliceCursorNameCombo.Clear()
        self.controlFrame.sliceCursorNameCombo.Append('Point 1')
        self.controlFrame.sliceCursorNameCombo.Append('GIA Glenoid')
        self.controlFrame.sliceCursorNameCombo.Append('GIA Humerus')
        self.controlFrame.sliceCursorNameCombo.Append('FBZ Superior')
        self.controlFrame.sliceCursorNameCombo.Append('FBZ Inferior')

        # event handlers for the global control buttons
        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.showControlsButtonId,
                      self._handlerShowControls)

        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.resetCameraButtonId,
                      self._handlerResetCamera)

        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.resetAllButtonId,
                      lambda e: (self._resetAll(), self._resetAll()))

        wx.EVT_BUTTON(self.threedFrame,
                      self.threedFrame.saveImageButton.GetId(),
                      self._handlerSaveImageButton)

        wx.EVT_CHOICE(self.threedFrame, self.threedFrame.projectionChoiceId,
                      self._handlerProjectionChoice)

        wx.EVT_BUTTON(self.threedFrame,
                      self.threedFrame.introspectButton.GetId(),
                      self._handlerIntrospectButton)

        wx.EVT_BUTTON(
            self.threedFrame,
            self.threedFrame.introspectPipelineButtonId,
            lambda e, pw=self.threedFrame, s=self, rw=self.threedFrame.
            threedRWI.GetRenderWindow(): s.vtkPipelineConfigure(pw, rw))

        def handler_freeze_slices_button(e):
            names = self.sliceDirections.get_all_slice_names()
            for n in names:
                self.sliceDirections._setSliceInteraction(n, not e.IsChecked())

        self.threedFrame.freeze_slices_button.Bind(
            wx.EVT_TOGGLEBUTTON, handler_freeze_slices_button)

        # event logic for the voi panel
        wx.EVT_CHECKBOX(self.controlFrame,
                        self.controlFrame.voiEnabledCheckBoxId,
                        self._handlerWidgetEnabledCheckBox)

        wx.EVT_CHOICE(self.controlFrame,
                      self.controlFrame.voiAutoSizeChoice.GetId(),
                      self._handlerVoiAutoSizeChoice)

        wx.EVT_BUTTON(self.controlFrame,
                      self.controlFrame.voiFilenameBrowseButton.GetId(),
                      self._handlerVoiFilenameBrowseButton)

        wx.EVT_BUTTON(self.controlFrame,
                      self.controlFrame.voiSaveButton.GetId(),
                      self._handlerVoiSaveButton)

        def _ps_cb():
            # FIXME: update to new factoring
            sliceDirection = self.getCurrentSliceDirection()
            if sliceDirection:
                val = self.threedFrame.pushSliceSpinCtrl.GetValue()
                if val:
                    sliceDirection.pushSlice(val)
                    self.threedFrame.pushSliceSpinCtrl.SetValue(0)
                    self.threedFrame.threedRWI.Render()

        # clicks directly in the window for picking
        self.threedFrame.threedRWI.AddObserver('LeftButtonPressEvent',
                                               self._rwiLeftButtonCallback)

        # objectAnimationFrame creation and basic setup -------------------
        oaf = modules.viewers.resources.python.slice3dVWRFrames.\
              objectAnimationFrame
        self.objectAnimationFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, oaf)

        # display the windows (but we don't show the oaf yet)
        self.view()

        if os.name == 'posix':
            # yet another workaround for GTK1.2 on Linux (Debian 3.0)
            # if we don't do this, the renderer is far smaller than its
            # containing window and only corrects once the window is resized

            # also, this shouldn't really fix it, but it does:
            # then size that we set, is the "small" incorrect size
            # but somehow tickling GTK in this way makes everything better
            self.threedFrame.threedRWI.GetRenderWindow().SetSize(
                self.threedFrame.threedRWI.GetSize())
            self.threedFrame.threedRWI._Iren.ConfigureEvent()
            wx.SafeYield()
        def _init_frame():
            # call base constructor
            ModuleBase.__init__(self, module_manager)        
            self._numDataInputs = self.NUM_INPUTS
            # use list comprehension to create list keeping track of inputs
            self._inputs = [{'Connected' : None, 'inputData' : None,
                             'vtkActor' : None, 'ipw' : None}
                           for i in range(self._numDataInputs)]

            # create the view frame
            self.frame = module_utils.instantiate_module_view_frame(
                self, self._module_manager, 
                multiDirectionalSlicedViewSegmentation3dVieWeRFrame.multiDirectionalSlicedViewSegmentation3dVieWeRFrame)
            
            #THE FRAME (reference)
            frame = self.frame

            # change the title to something more spectacular (or at least something non-default)
            frame.SetTitle('multiDirectionalSlicedViewSegmentation3dVieWeR')

            # predefine this
            self.selectedData = []

            self.controlIsCurrentlyDown = 0

            # list of objects that want to be contoured by this slice
            self._contourObjectsDict1 = {}
            self._contourObjectsDict2 = {}
            self._contourObjectsDict3 = {}

            # anything you stuff into self._config will be saved
            self._config.last_used_dir = ''

            #color definitions
            twoD_bg_color = (0.19,0.19,0.19)
            threeD_bg_color = (0.62,0.62,0.62)
            contour_color = (0.6,0.6,0.6)

            # create the necessary VTK objects

            # setup the Top Renderer (id: 1)
            self.renderer_top = vtk.vtkRenderer()
            self.renderer_top.SetBackground(twoD_bg_color)
            frame.top.GetRenderWindow().AddRenderer(self.renderer_top)
            self.slice_viewer_top = CMSliceViewer(frame.top, self.renderer_top)
            self.slice_viewer_top.set_parallel()
        
            # setup the Side Renderer (id: 2)
            self.renderer_side = vtk.vtkRenderer()
            self.renderer_side.SetBackground(twoD_bg_color)
            frame.side.GetRenderWindow().AddRenderer(self.renderer_side)
            self.slice_viewer_side = CMSliceViewer(frame.side, self.renderer_side)
            self.slice_viewer_side.set_parallel()

            # setup the Front Renderer (id: 3)
            self.renderer_front = vtk.vtkRenderer()
            self.renderer_front.SetBackground(twoD_bg_color)
            frame.front.GetRenderWindow().AddRenderer(self.renderer_front)
            self.slice_viewer_front = CMSliceViewer(frame.front, self.renderer_front)
            self.slice_viewer_front.set_parallel()

            # setup the 3D Renderer (id: 4)
            self.contour_actor = vtk.vtkActor()
            self.contour_mapper = vtk.vtkPolyDataMapper()
            self.contour_mapper.ScalarVisibilityOff()

            self.contour_selected_actors = []

            self.contour_actor.SetMapper(self.contour_mapper)
            self.contour_actor.GetProperty().SetColor(contour_color)
            self._on_slide_transparency()

            self.renderer_3d = vtk.vtkRenderer()
            self.renderer_3d.SetBackground(threeD_bg_color)
            self.renderer_3d.AddActor(self.contour_actor)

            frame.view3d.GetRenderWindow().AddRenderer(self.renderer_3d)
            frame.view3d._outline_source = vtk.vtkOutlineSource()
            om = vtk.vtkPolyDataMapper()
            om.SetInput(frame.view3d._outline_source.GetOutput())
            frame.view3d._outline_actor = vtk.vtkActor()
            frame.view3d._outline_actor.SetMapper(om)
            frame.view3d._cInteractorStyle = vtk.vtkInteractorStyleTrackballCamera()
            frame.view3d.SetInteractorStyle(frame.view3d._cInteractorStyle)
            frame.view3d._orientation_widget.On()  

            # make our window appear (this is a viewer after all)
            self.view()
            # all modules should toggle this once they have shown their views. 
            self.view_initialised = True

            # apply config information to underlying logic
            self.sync_module_logic_with_config()
            # then bring it all the way up again to the view
            self.sync_module_view_with_logic()

            self.clearSeedPoints()
Ejemplo n.º 49
0
    def _create_window(self):
        import modules.viewers.resources.python.slice3dVWRFrames
        reload(modules.viewers.resources.python.slice3dVWRFrames)

        stereo = self._module_manager.get_app_main_config().stereo
        #print "STEREO:", stereo
        modules.viewers.resources.python.slice3dVWRFrames.S3DV_STEREO = stereo

        # threedFrame creation and basic setup -------------------
        threedFrame = modules.viewers.resources.python.slice3dVWRFrames.\
                      threedFrame
        self.threedFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, threedFrame)
        self.threedFrame.SetTitle('slice3dVWR 3D view')
            
        # see about stereo
        #self.threedFrame.threedRWI.GetRenderWindow().SetStereoCapableWindow(1)

        # create foreground and background renderers 
        self._threedRenderer = vtk.vtkRenderer()

        if BACKGROUND_RENDERER:
            self._background_renderer = vtk.vtkRenderer()

        renwin = self.threedFrame.threedRWI.GetRenderWindow()

        # I've not yet been able to get depth peeling working on my
        # NV 8800 on Ubuntu 8.10 Linux x86_64.  Will continue later...
        #renwin.SetMultiSamples(0)
        #renwin.SetAlphaBitPlanes(1)
        #self._threedRenderer.SetUseDepthPeeling(1)
        #self._threedRenderer.SetMaximumNumberOfPeels(100)
        #self._threedRenderer.SetOcclusionRatio(0.1)
        #renwin.AddRenderer(self._threedRenderer)


        # use function to setup fg and bg renderers so we can have a
        # nice gradient background.
        if BACKGROUND_RENDERER:
            import module_kits.vtk_kit
            module_kits.vtk_kit.utils.setup_renderers(renwin,
                    self._threedRenderer, self._background_renderer)
        else:
            self._threedRenderer.SetBackground(0.5,0.5,0.5)
            if GRADIENT_BACKGROUND:
                self._threedRenderer.SetBackground2(1,1,1)
                self._threedRenderer.SetGradientBackground(1)

            renwin.AddRenderer(self._threedRenderer)

        # controlFrame creation and basic setup -------------------
        controlFrame = modules.viewers.resources.python.slice3dVWRFrames.\
                       controlFrame
        self.controlFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, controlFrame)
        self.controlFrame.SetTitle('slice3dVWR Controls')

        # fix for the grid
        #self.controlFrame.spointsGrid.SetSelectionMode(wx.Grid.wxGridSelectRows)
        #self.controlFrame.spointsGrid.DeleteRows(
        #   0, self.controlFrame.spointsGrid.GetNumberRows())


        # add possible point names
        self.controlFrame.sliceCursorNameCombo.Clear()
        self.controlFrame.sliceCursorNameCombo.Append('Point 1')
        self.controlFrame.sliceCursorNameCombo.Append('GIA Glenoid')
        self.controlFrame.sliceCursorNameCombo.Append('GIA Humerus')
        self.controlFrame.sliceCursorNameCombo.Append('FBZ Superior')
        self.controlFrame.sliceCursorNameCombo.Append('FBZ Inferior')
        
        # event handlers for the global control buttons
        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.showControlsButtonId,
                   self._handlerShowControls)
        
        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.resetCameraButtonId,
                   self._handlerResetCamera)

        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.resetAllButtonId,
                   lambda e: (self._resetAll(), self._resetAll()))

        wx.EVT_BUTTON(self.threedFrame, self.threedFrame.saveImageButton.GetId(),
                   self._handlerSaveImageButton)
        
        wx.EVT_CHOICE(self.threedFrame,
                   self.threedFrame.projectionChoiceId,
                   self._handlerProjectionChoice)

        wx.EVT_BUTTON(self.threedFrame,
                   self.threedFrame.introspectButton.GetId(),
                   self._handlerIntrospectButton)

        wx.EVT_BUTTON(self.threedFrame,
                   self.threedFrame.introspectPipelineButtonId,
                   lambda e, pw=self.threedFrame, s=self,
                   rw=self.threedFrame.threedRWI.GetRenderWindow():
                   s.vtkPipelineConfigure(pw, rw))

        def handler_freeze_slices_button(e):
            names = self.sliceDirections.get_all_slice_names()
            for n in names:
                self.sliceDirections._setSliceInteraction(
                        n, not e.IsChecked())

        self.threedFrame.freeze_slices_button.Bind(
                wx.EVT_TOGGLEBUTTON, handler_freeze_slices_button)


        # event logic for the voi panel
        wx.EVT_CHECKBOX(self.controlFrame,
                     self.controlFrame.voiEnabledCheckBoxId,
                     self._handlerWidgetEnabledCheckBox)

        wx.EVT_CHOICE(self.controlFrame,
                   self.controlFrame.voiAutoSizeChoice.GetId(),
                   self._handlerVoiAutoSizeChoice)

        wx.EVT_BUTTON(self.controlFrame,
                   self.controlFrame.voiFilenameBrowseButton.GetId(),
                   self._handlerVoiFilenameBrowseButton)

        wx.EVT_BUTTON(self.controlFrame,
                   self.controlFrame.voiSaveButton.GetId(),
                   self._handlerVoiSaveButton)


        def _ps_cb():
            # FIXME: update to new factoring
            sliceDirection  = self.getCurrentSliceDirection()
            if sliceDirection:
                val = self.threedFrame.pushSliceSpinCtrl.GetValue()
                if val:
                    sliceDirection.pushSlice(val)
                    self.threedFrame.pushSliceSpinCtrl.SetValue(0)
                    self.threedFrame.threedRWI.Render()

        # clicks directly in the window for picking
        self.threedFrame.threedRWI.AddObserver('LeftButtonPressEvent',
                                               self._rwiLeftButtonCallback)


        # objectAnimationFrame creation and basic setup -------------------
        oaf = modules.viewers.resources.python.slice3dVWRFrames.\
              objectAnimationFrame
        self.objectAnimationFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, oaf)

        # display the windows (but we don't show the oaf yet)
        self.view()
        
        if os.name == 'posix':
            # yet another workaround for GTK1.2 on Linux (Debian 3.0)
            # if we don't do this, the renderer is far smaller than its
            # containing window and only corrects once the window is resized

            # also, this shouldn't really fix it, but it does:
            # then size that we set, is the "small" incorrect size
            # but somehow tickling GTK in this way makes everything better
            self.threedFrame.threedRWI.GetRenderWindow().SetSize(
                self.threedFrame.threedRWI.GetSize())
            self.threedFrame.threedRWI._Iren.ConfigureEvent()
            wx.SafeYield()
Ejemplo n.º 50
0
    def _create_view_frame(self):
        parentWindow = self._module_manager.get_module_view_parent_window()

        import resources.python.defaultModuleViewFrame
        reload(resources.python.defaultModuleViewFrame)

        dMVF = resources.python.defaultModuleViewFrame.defaultModuleViewFrame
        viewFrame = module_utils.instantiate_module_view_frame(
            self, self._module_manager, dMVF)

        # this viewFrame doesn't have the 7-sizer yet
        sizer7 = wx.BoxSizer(wx.HORIZONTAL)
        viewFrame.viewFramePanel.GetSizer().Add(sizer7, 1, wx.ALL | wx.EXPAND,
                                                7)

        # now let's add the wxGridSizer
        # as many rows as there are tuples in configList, 2 columns,
        # 7 pixels vgap, 4 pixels hgap
        gridSizer = wx.FlexGridSizer(len(self._configList), 2, 7, 4)
        # maybe after we've added everything?
        gridSizer.AddGrowableCol(1)
        panel = viewFrame.viewFramePanel
        for configTuple in self._configList:
            label = wx.StaticText(panel, -1, configTuple[0])
            gridSizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL, 0)
            widget = None

            if configTuple[3] == 'static_text':
                widget = wx.StaticText(panel, -1, "")

            elif configTuple[3] == 'text':
                widget = wx.TextCtrl(panel, -1, "")

            elif configTuple[3] == 'tupleText':
                # find out how many elements
                typeD = configTuple[2]
                castString, numString = typeD.split(':')[1].split(',')
                num = int(numString)
                textWidgets = []
                twSizer = wx.BoxSizer(wx.HORIZONTAL)

                for i in range(num):
                    textWidgets.append(wx.TextCtrl(panel, -1, ""))
                    twSizer.Add(textWidgets[-1], 0, wx.ALIGN_CENTER_VERTICAL,
                                1)
                    if i < num - 1:
                        twSizer.Add(wx.StaticText(panel, -1, ','),
                                    0,
                                    wx.RIGHT,
                                    border=4)

                widget = None
                widgets = textWidgets
                widgetsSizer = twSizer

            elif configTuple[3] == 'maskedText':
                widget = wx.lib.masked.TextCtrl(panel, -1, '',
                                                **configTuple[5])

            elif configTuple[3] == 'checkbox':  # checkbox
                widget = wx.CheckBox(panel, -1, "")

            elif configTuple[3] == 'radiobox':  # radiobox
                # configTuple[5] has to be a list of strings
                widget = wx.RadioBox(panel, -1, "", choices=configTuple[5])

            elif configTuple[3] == 'choice':  # choice
                widget = wx.Choice(panel, -1)
                # in this case, configTuple[5] has to be a list of strings
                for cString in configTuple[5]:
                    widget.Append(cString)

            elif configTuple[3] == 'filebrowser':  # filebrowser
                widget = FileBrowseButton(panel,
                                          -1,
                                          fileMask=configTuple[5]['fileMask'],
                                          fileMode=configTuple[5]['fileMode'],
                                          labelText=None,
                                          toolTip=configTuple[4])

            else:  # dirbrowser
                widget = DirBrowseButton(panel,
                                         -1,
                                         labelText=None,
                                         toolTip=configTuple[4])

            if widget:
                if len(configTuple[4]) > 0:
                    widget.SetToolTip(wx.ToolTip(configTuple[4]))

                gridSizer.Add(widget, 0, wx.EXPAND, 0)
                self._widgets[configTuple[0:5]] = widget

            elif len(widgets) > 0:
                if len(configTuple[4]) > 0:
                    for w in widgets:
                        w.SetToolTip(wx.ToolTip(configTuple[4]))

                gridSizer.Add(widgetsSizer, 0, wx.EXPAND, 0)
                self._widgets[configTuple[0:5]] = widgets

        sizer7.Add(gridSizer, 1, wx.EXPAND, 0)

        if self._object_dict != None:
            module_utils.create_standard_object_introspection(
                self, viewFrame, viewFrame.viewFramePanel, self._object_dict,
                None)

        module_utils.create_eoca_buttons(self, viewFrame,
                                         viewFrame.viewFramePanel)

        # following ModuleBase convention to indicate that view is
        # available.
        self.view_initialised = True

        self._view_frame = viewFrame
        return viewFrame