コード例 #1
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)
コード例 #2
0
ファイル: rawVolumeRDR.py プロジェクト: fvpolpeta/devide
    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)
コード例 #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)
コード例 #4
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)
コード例 #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)
コード例 #6
0
ファイル: dicomRDR.py プロジェクト: fvpolpeta/devide
    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
コード例 #7
0
ファイル: dicomRDR.py プロジェクト: nagyistoce/devide
    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
コード例 #8
0
ファイル: mixins.py プロジェクト: nagyistoce/devide
    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
コード例 #9
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)
コード例 #10
0
ファイル: mixins.py プロジェクト: fvpolpeta/devide
    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
コード例 #11
0
ファイル: shellSplatSimple.py プロジェクト: fvpolpeta/devide
    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)
コード例 #12
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
コード例 #13
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
コード例 #14
0
ファイル: CodeRunner.py プロジェクト: fvpolpeta/devide
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)


        self.inputs = [None] * NUMBER_OF_INPUTS
        self.outputs = [None] * NUMBER_OF_OUTPUTS

        self._config.scratch_src = self._config.setup_src = \
                                   self._config.execute_src = ''

        self._config_srcs = ['scratch_src',
                             'setup_src',
                             'execute_src']

        # these are the real deals, i.e. the underlying logic
        self._src_scratch = self._src_setup = self._src_execute = ''
        self._srcs = ['_src_scratch', '_src_setup', '_src_execute']

        # we use this to determine whether the current setup src has been
        # executed or not
        self._md5_setup_src = ''

        self._create_view_frame()

        PythonShellMixin.__init__(self, self._view_frame.shell_window,
                                  module_manager)

        module_utils.create_eoca_buttons(self, self._view_frame,
                                        self._view_frame.view_frame_panel,
                                        ok_default=False,
                                        cancel_hotkey=False)

        # more convenience bindings
        self._editwindows = [self._view_frame.scratch_editwindow,
                             self._view_frame.setup_editwindow,
                             self._view_frame.execute_editwindow]
        
        self.interp = self._view_frame.shell_window.interp

        # set interpreter on all three our editwindows
        for ew in self._editwindows:
            ew.set_interp(self.interp)
        
        self._bind_events()

        self.interp.locals.update(
            {'obj' : self})

        # initialise macro packages
        self.support_vtk(self.interp)
        self.support_matplotlib(self.interp)

        self.config_to_logic()
        self.logic_to_config()
        self.config_to_view()
        self.view_initialised = True

        self.view()
コード例 #15
0
    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self.inputs = [None] * NUMBER_OF_INPUTS
        self.outputs = [None] * NUMBER_OF_OUTPUTS

        self._config.scratch_src = self._config.setup_src = \
                                   self._config.execute_src = ''

        self._config_srcs = ['scratch_src', 'setup_src', 'execute_src']

        # these are the real deals, i.e. the underlying logic
        self._src_scratch = self._src_setup = self._src_execute = ''
        self._srcs = ['_src_scratch', '_src_setup', '_src_execute']

        # we use this to determine whether the current setup src has been
        # executed or not
        self._md5_setup_src = ''

        self._create_view_frame()

        PythonShellMixin.__init__(self, self._view_frame.shell_window,
                                  module_manager)

        module_utils.create_eoca_buttons(self,
                                         self._view_frame,
                                         self._view_frame.view_frame_panel,
                                         ok_default=False,
                                         cancel_hotkey=False)

        # more convenience bindings
        self._editwindows = [
            self._view_frame.scratch_editwindow,
            self._view_frame.setup_editwindow,
            self._view_frame.execute_editwindow
        ]

        self.interp = self._view_frame.shell_window.interp

        # set interpreter on all three our editwindows
        for ew in self._editwindows:
            ew.set_interp(self.interp)

        self._bind_events()

        self.interp.locals.update({'obj': self})

        # initialise macro packages
        self.support_vtk(self.interp)
        self.support_matplotlib(self.interp)

        self.config_to_logic()
        self.logic_to_config()
        self.config_to_view()
        self.view_initialised = True

        self.view()
コード例 #16
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()
コード例 #17
0
ファイル: imageStackRDR.py プロジェクト: nagyistoce/devide
    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()
コード例 #18
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)
コード例 #19
0
ファイル: QuickInfo.py プロジェクト: fvpolpeta/devide
    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)
コード例 #20
0
ファイル: resampleImage.py プロジェクト: fvpolpeta/devide
    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)
コード例 #21
0
ファイル: resampleImage.py プロジェクト: nagyistoce/devide
    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)
コード例 #22
0
    def _create_view_frame(self):
        """This will create the self._view_frame for this module.

        objectDict is a dictionary with VTK object descriptions as keys and
        the actual corresponding instances as values.  If you specify
        objectDict as none, the introspection controls won't get added.
        """

        parent_window = self._module_manager.get_module_view_parent_window()

        viewFrame = wx.Frame(parent_window, -1,
                             module_utils.create_module_view_frame_title(self))
        viewFrame.viewFramePanel = wx.Panel(viewFrame, -1)

        viewFramePanelSizer = wx.BoxSizer(wx.VERTICAL)
        # make sure there's a 7px border at the top
        # FIXME: changed 10, 7 to tuple for wxPython 2.6
        viewFramePanelSizer.Add((10, 7), 0, wx.EXPAND)
        viewFrame.viewFramePanel.SetAutoLayout(True)
        viewFrame.viewFramePanel.SetSizer(viewFramePanelSizer)

        viewFrameSizer = wx.BoxSizer(wx.VERTICAL)
        viewFrameSizer.Add(viewFrame.viewFramePanel, 1, wx.EXPAND, 0)
        viewFrame.SetAutoLayout(True)
        viewFrame.SetSizer(viewFrameSizer)

        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)

        # make sure that a close of that window does the right thing
        wx.EVT_CLOSE(viewFrame, lambda e: viewFrame.Show(False))

        # set cute icon
        viewFrame.SetIcon(module_utils.get_module_icon())

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

        self._view_frame = viewFrame
        return viewFrame
コード例 #23
0
    def _create_view_frame(self):

        """This will create the self._view_frame for this module.

        objectDict is a dictionary with VTK object descriptions as keys and
        the actual corresponding instances as values.  If you specify
        objectDict as none, the introspection controls won't get added.
        """

        parent_window = self._module_manager.get_module_view_parent_window()

        viewFrame = wx.Frame(parent_window, -1, module_utils.create_module_view_frame_title(self))
        viewFrame.viewFramePanel = wx.Panel(viewFrame, -1)

        viewFramePanelSizer = wx.BoxSizer(wx.VERTICAL)
        # make sure there's a 7px border at the top
        # FIXME: changed 10, 7 to tuple for wxPython 2.6
        viewFramePanelSizer.Add((10, 7), 0, wx.EXPAND)
        viewFrame.viewFramePanel.SetAutoLayout(True)
        viewFrame.viewFramePanel.SetSizer(viewFramePanelSizer)

        viewFrameSizer = wx.BoxSizer(wx.VERTICAL)
        viewFrameSizer.Add(viewFrame.viewFramePanel, 1, wx.EXPAND, 0)
        viewFrame.SetAutoLayout(True)
        viewFrame.SetSizer(viewFrameSizer)

        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)

        # make sure that a close of that window does the right thing
        wx.EVT_CLOSE(viewFrame, lambda e: viewFrame.Show(False))

        # set cute icon
        viewFrame.SetIcon(module_utils.get_module_icon())

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

        self._view_frame = viewFrame
        return viewFrame
コード例 #24
0
ファイル: contourFLTBase.py プロジェクト: fvpolpeta/devide
    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)
コード例 #25
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)
コード例 #26
0
ファイル: histogram1D.py プロジェクト: sanguinariojoe/devide
    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)
コード例 #27
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)
コード例 #28
0
ファイル: DICOMReader.py プロジェクト: nagyistoce/devide
    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
コード例 #29
0
ファイル: doubleThreshold.py プロジェクト: fvpolpeta/devide
    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)    
コード例 #30
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()
コード例 #31
0
    def _buildPipeline(self):
        """Build underlying pipeline and configure rest of pipeline-dependent
        UI. 
        """
        
        # add the renderer
        self._renderer = vtk.vtkRenderer()
        self._renderer.SetBackground(0.5, 0.5, 0.5)
        self._viewFrame.rwi.GetRenderWindow().AddRenderer(
            self._renderer)
 
        self._histogram = vtkdevide.vtkImageHistogram2D()

        # make sure the user can't do anything entirely stupid
        istyle = vtk.vtkInteractorStyleImage()
        self._viewFrame.rwi.SetInteractorStyle(istyle)

        # we'll use this to keep track of our ImagePlaneWidget
        self._ipw = None
        self._overlayipw = None
        self._scalarBarWidget = None

        #
        self._appendPD = vtk.vtkAppendPolyData()

        self._extrude = vtk.vtkLinearExtrusionFilter()
        self._extrude.SetInput(self._appendPD.GetOutput())
        self._extrude.SetScaleFactor(1)
        self._extrude.SetExtrusionTypeToNormalExtrusion()
        self._extrude.SetVector(0,0,1)

        self._pdToImageStencil = vtk.vtkPolyDataToImageStencil()
        self._pdToImageStencil.SetInput(self._extrude.GetOutput())

        # stupid trick to make image with all ones, but as large as its
        # input
        
        self._allOnes = vtk.vtkImageThreshold()
        self._allOnes.ThresholdByLower(0.0)
        self._allOnes.ThresholdByUpper(0.0)
        self._allOnes.SetInValue(1.0)
        self._allOnes.SetOutValue(1.0)
        self._allOnes.SetInput(self._histogram.GetOutput())

        self._stencil = vtk.vtkImageStencil()
        self._stencil.SetInput(self._allOnes.GetOutput())
        #self._stencil.SetStencil(self._pdToImageStencil.GetOutput())
        self._stencil.ReverseStencilOff()
        self._stencil.SetBackgroundValue(0)

        self._lookupAppend = vtk.vtkImageAppendComponents()

        self._lookup = vtkdevide.vtkHistogramLookupTable()
        self._lookup.SetInput1(self._lookupAppend.GetOutput())        
        self._lookup.SetInput2(self._stencil.GetOutput())

        module_utils.create_standard_object_introspection(
            self, self._viewFrame, self._viewFrame.viewFramePanel,
            {'Module (self)' : self,
             'vtkHistogram2D' : self._histogram,
             'vtkRenderer' : self._renderer},
            self._renderer.GetRenderWindow())

        # add the ECASH buttons
        module_utils.create_eoca_buttons(self, self._viewFrame,
                                      self._viewFrame.viewFramePanel)
コード例 #32
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
コード例 #33
0
    def _buildPipeline(self):
        """Build underlying pipeline and configure rest of pipeline-dependent
        UI. 
        """

        # add the renderer
        self._renderer = vtk.vtkRenderer()
        self._renderer.SetBackground(0.5, 0.5, 0.5)
        self._viewFrame.rwi.GetRenderWindow().AddRenderer(self._renderer)

        self._histogram = vtkdevide.vtkImageHistogram2D()

        # make sure the user can't do anything entirely stupid
        istyle = vtk.vtkInteractorStyleImage()
        self._viewFrame.rwi.SetInteractorStyle(istyle)

        # we'll use this to keep track of our ImagePlaneWidget
        self._ipw = None
        self._overlayipw = None
        self._scalarBarWidget = None

        #
        self._appendPD = vtk.vtkAppendPolyData()

        self._extrude = vtk.vtkLinearExtrusionFilter()
        self._extrude.SetInput(self._appendPD.GetOutput())
        self._extrude.SetScaleFactor(1)
        self._extrude.SetExtrusionTypeToNormalExtrusion()
        self._extrude.SetVector(0, 0, 1)

        self._pdToImageStencil = vtk.vtkPolyDataToImageStencil()
        self._pdToImageStencil.SetInput(self._extrude.GetOutput())

        # stupid trick to make image with all ones, but as large as its
        # input

        self._allOnes = vtk.vtkImageThreshold()
        self._allOnes.ThresholdByLower(0.0)
        self._allOnes.ThresholdByUpper(0.0)
        self._allOnes.SetInValue(1.0)
        self._allOnes.SetOutValue(1.0)
        self._allOnes.SetInput(self._histogram.GetOutput())

        self._stencil = vtk.vtkImageStencil()
        self._stencil.SetInput(self._allOnes.GetOutput())
        # self._stencil.SetStencil(self._pdToImageStencil.GetOutput())
        self._stencil.ReverseStencilOff()
        self._stencil.SetBackgroundValue(0)

        self._lookupAppend = vtk.vtkImageAppendComponents()

        self._lookup = vtkdevide.vtkHistogramLookupTable()
        self._lookup.SetInput1(self._lookupAppend.GetOutput())
        self._lookup.SetInput2(self._stencil.GetOutput())

        module_utils.create_standard_object_introspection(
            self,
            self._viewFrame,
            self._viewFrame.viewFramePanel,
            {"Module (self)": self, "vtkHistogram2D": self._histogram, "vtkRenderer": self._renderer},
            self._renderer.GetRenderWindow(),
        )

        # add the ECASH buttons
        module_utils.create_eoca_buttons(self, self._viewFrame, self._viewFrame.viewFramePanel)
コード例 #34
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()
コード例 #35
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