def __init__(self, parent, name = "Timepoint selection"): """ Initialization """ wx.Dialog.__init__(self, parent, -1, name, style = wx.CAPTION | wx.STAY_ON_TOP | wx.CLOSE_BOX | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER, size = (640, 480)) self.parent = parent scripting.registerDialog(name, self) self.dialogName = name self.Bind(wx.EVT_CLOSE, self.closeWindowCallback) self.mainsizer = wx.GridBagSizer(10, 10) self.rendering = 0 self.SetTitle("Timepoint Selection") ico = reduce(os.path.join, [scripting.get_icon_dir(), "logo.ico"]) self.icon = wx.Icon(ico, wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.panel = TimepointSelectionPanel(self, parentStr = "scripting.dialogs['%s']" % self.dialogName) self.timepointSelection = self.panel self.mainsizer.Add(self.panel, (0, 0), flag = wx.EXPAND | wx.ALL) self.createButtonBox() self.status = wx.ID_CANCEL self.SetSizer(self.mainsizer) self.SetAutoLayout(True) self.mainsizer.Fit(self)
def createToolbar(self): """ Creates the toolbar for the script editor """ flags = wx.NO_BORDER | wx.TB_HORIZONTAL | wx.TB_TEXT self.CreateToolBar(flags) tb = self.GetToolBar() tb.SetToolBitmapSize((32, 32)) iconpath = scripting.get_icon_dir() bmp = wx.Image(os.path.join(iconpath, "record.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() tb.DoAddTool(MenuManager.ID_RECORD_SCRIPT, "Record", bmp, shortHelp = "Record script") wx.EVT_TOOL(self, MenuManager.ID_RECORD_SCRIPT, self.onRecordScript) bmp = wx.Image(os.path.join(iconpath, "pause.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() tb.DoAddTool(MenuManager.ID_STOP_RECORD, "Pause", bmp, shortHelp = "Pause recording") wx.EVT_TOOL(self, MenuManager.ID_STOP_RECORD, self.onStopRecord) tb.EnableTool(MenuManager.ID_STOP_RECORD, 0) bmp = wx.Image(os.path.join(iconpath, "play.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() tb.DoAddTool(MenuManager.ID_RUN_SCRIPT, "Run", bmp, shortHelp = "Run recorded script") wx.EVT_TOOL(self, MenuManager.ID_RUN_SCRIPT, self.onRunScript) tb.Realize() self.tb = tb
def createSliders(self): """ Method that creates the sliders """ self.sliderPanel = wx.Panel(self.sliderWin, -1) self.setCurrentSliderPanel(self.sliderPanel) iconpath = scripting.get_icon_dir() leftarrow = wx.Image(os.path.join(iconpath, "Arrow_Left.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() rightarrow = wx.Image(os.path.join(iconpath, "Arrow_Right.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() uparrow = wx.Image(os.path.join(iconpath, "Arrow_Up.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() downarrow = wx.Image(os.path.join(iconpath, "Arrow_Down.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.prev = wx.BitmapButton(self.sliderPanel, -1, leftarrow) self.prev.SetSize((64, 64)) self.next = wx.BitmapButton(self.sliderPanel, -1, rightarrow) self.next.SetSize((64, 64)) self.sliderbox = wx.BoxSizer(wx.HORIZONTAL) self.prev.Bind(wx.EVT_BUTTON, self.onPrevTimepoint) self.next.Bind(wx.EVT_BUTTON, self.onNextTimepoint) self.timeslider = wx.Slider(self.sliderPanel, value = 1, minValue = 0, maxValue = 1, style = wx.SL_HORIZONTAL | wx.SL_LABELS) self.timeslider.SetHelpText("Use this slider to select the displayed timepoint.") self.bindTimeslider(self.onUpdateTimepoint) self.zsliderPanel = wx.Panel(self.zsliderWin) boxsizer = wx.BoxSizer(wx.VERTICAL) self.zslider = wx.Slider(self.zsliderPanel, value = 1, minValue = 0, maxValue = 1, style = wx.SL_VERTICAL | wx.SL_LABELS | wx.SL_AUTOTICKS) self.upbtn = wx.BitmapButton(self.zsliderPanel, -1, uparrow) self.downbtn = wx.BitmapButton(self.zsliderPanel, -1, downarrow) self.downbtn.Bind(wx.EVT_BUTTON, self.onSliceDown) self.upbtn.Bind(wx.EVT_BUTTON, self.onSliceUp) boxsizer.Add(self.upbtn) boxsizer.Add(self.zslider, 1) boxsizer.Add(self.downbtn) self.zsliderPanel.SetSizer(boxsizer) self.zsliderPanel.SetAutoLayout(1) self.zsliderSizer = boxsizer self.zsliderSizer.Fit(self.zsliderPanel) self.zslider.SetHelpText("Use this slider to select the displayed optical slice.") self.zslider.Bind(wx.EVT_SCROLL, self.onChangeZSlice) self.zslider.Bind(wx.EVT_SCROLL_PAGEDOWN, self.onZPageDown) self.zslider.Bind(wx.EVT_SCROLL_PAGEUP, self.onZPageUp) lib.messenger.connect(None, "zslice_changed", self.onChangeZSlice) self.sliderbox.Add(self.prev, flag = wx.ALIGN_CENTER_VERTICAL) self.sliderbox.Add(self.timeslider, 1) self.sliderbox.Add(self.next, flag = wx.ALIGN_CENTER_VERTICAL) self.sliderPanel.SetSizer(self.sliderbox) self.sliderPanel.SetAutoLayout(1) self.sliderbox.Fit(self.sliderPanel)
def __init__(self, parent): wx.Dialog.__init__( self, parent, -1, "Settings for BioImageXD", style=wx.CAPTION | wx.STAY_ON_TOP | wx.CLOSE_BOX | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.DIALOG_EX_CONTEXTHELP, size=(640, 480), ) self.listbook = wx.Listbook(self, -1, style=wx.LB_LEFT) self.listbook.SetSize((640, 480)) self.sizer = wx.BoxSizer(wx.VERTICAL) try: self.imagelist = wx.ImageList(32, 32) self.listbook.AssignImageList(self.imagelist) imgpath = scripting.get_icon_dir() for i in ["general.gif", "paths.gif", "performance.gif"]: icon = os.path.join(imgpath, i) bmp = wx.Bitmap(icon, wx.BITMAP_TYPE_GIF) self.imagelist.Add(bmp) except: pass self.generalPanel = GeneralSettings(self.listbook) self.pathsPanel = PathSettings(self.listbook) self.performancePanel = PerformanceSettings(self.listbook) self.listbook.AddPage(self.generalPanel, "General", imageId=0) self.listbook.AddPage(self.pathsPanel, "Paths", imageId=1) self.listbook.AddPage(self.performancePanel, "Performance", imageId=2) self.sizer.Add(self.listbook, flag=wx.EXPAND | wx.ALL) self.staticLine = wx.StaticLine(self, -1) self.sizer.Add(self.staticLine, flag=wx.EXPAND) self.buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) self.sizer.Add(self.buttonSizer, 1, flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT) wx.EVT_BUTTON(self, wx.ID_OK, self.writeSettings) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self)
def addChannelItem(self, name, bitmap, toolid, func): """ Add a channel item """ icondir = scripting.get_icon_dir() btn = buttons.GenBitmapToggleButton(self, toolid, bitmap) w, h = bitmap.GetWidth(), bitmap.GetHeight() #btn.SetBestSize((w,h)) btn.SetSize((64, 64)) btn.SetToolTipString(name) btn.Bind(wx.EVT_BUTTON, func) self.numberOfChannels += 1 self.sizer.Add(btn, (self.sizerCount + self.numberOfChannels, 0), span = (1, 2)) self.channelButtons[toolid] = btn self.Layout()
def addChannelItem(self, name, bitmap, toolid, func): """ Add a channel item """ icondir = scripting.get_icon_dir() btn = buttons.GenBitmapToggleButton(self, toolid, bitmap) w, h = bitmap.GetWidth(), bitmap.GetHeight() #btn.SetBestSize((w,h)) btn.SetSize((64, 64)) btn.SetToolTipString(name) btn.Bind(wx.EVT_BUTTON, func) self.numberOfChannels += 1 self.sizer.Add(btn, (self.sizerCount + self.numberOfChannels, 0), span=(1, 2)) self.channelButtons[toolid] = btn self.Layout()
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, "Settings for BioImageXD", style=wx.CAPTION | wx.STAY_ON_TOP | wx.CLOSE_BOX | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.DIALOG_EX_CONTEXTHELP, size=(640, 480)) self.listbook = wx.Listbook(self, -1, style=wx.LB_LEFT) self.listbook.SetSize((640, 480)) self.sizer = wx.BoxSizer(wx.VERTICAL) try: self.imagelist = wx.ImageList(32, 32) self.listbook.AssignImageList(self.imagelist) imgpath = scripting.get_icon_dir() for i in ["general.gif", "paths.gif", "performance.gif"]: icon = os.path.join(imgpath, i) bmp = wx.Bitmap(icon, wx.BITMAP_TYPE_GIF) self.imagelist.Add(bmp) except: pass self.generalPanel = GeneralSettings(self.listbook) self.pathsPanel = PathSettings(self.listbook) self.performancePanel = PerformanceSettings(self.listbook) self.listbook.AddPage(self.generalPanel, "General", imageId=0) self.listbook.AddPage(self.pathsPanel, "Paths", imageId=1) self.listbook.AddPage(self.performancePanel, "Performance", imageId=2) self.sizer.Add(self.listbook, flag=wx.EXPAND | wx.ALL) self.staticLine = wx.StaticLine(self, -1) self.sizer.Add(self.staticLine, flag=wx.EXPAND) self.buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) self.sizer.Add(self.buttonSizer, 1, flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT) wx.EVT_BUTTON(self, wx.ID_OK, self.writeSettings) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self)
def __init__(self, parent, name="Timepoint selection"): """ Initialization """ wx.Dialog.__init__(self, parent, -1, name, style=wx.CAPTION | wx.STAY_ON_TOP | wx.CLOSE_BOX | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER, size=(640, 480)) self.parent = parent scripting.registerDialog(name, self) self.dialogName = name self.Bind(wx.EVT_CLOSE, self.closeWindowCallback) self.mainsizer = wx.GridBagSizer(10, 10) self.rendering = 0 self.SetTitle("Timepoint Selection") ico = reduce(os.path.join, [scripting.get_icon_dir(), "logo.ico"]) self.icon = wx.Icon(ico, wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.panel = TimepointSelectionPanel( self, parentStr="scripting.dialogs['%s']" % self.dialogName) self.timepointSelection = self.panel self.mainsizer.Add(self.panel, (0, 0), flag=wx.EXPAND | wx.ALL) self.createButtonBox() self.status = wx.ID_CANCEL self.SetSizer(self.mainsizer) self.SetAutoLayout(True) self.mainsizer.Fit(self)
def OnInit(self): """ Create the application's main window """ self.SetAppName("BioImageXD") iconpath = scripting.get_icon_dir() splashimage = os.path.join(iconpath, "splash3.png") self.splash = GUI.SplashScreen.SplashScreen(None, duration = 99000, bitmapfile = splashimage) self.splash.Show() self.splash.SetMessage("Loading BioImageXD...") provider = wx.SimpleHelpProvider() wx.HelpProvider_Set(provider) self.mainwin = GUI.MainWindow.MainWindow(None, -1, self, self.splash) self.mainwin.config = wx.Config("BioImageXD", style = wx.CONFIG_USE_LOCAL_FILE) scripting.app = self scripting.mainWindow = self.mainwin self.mainwin.Show(True) self.SetTopWindow(self.mainwin) return True
def createToolbar(self): """ Method to create a toolbar for the window """ icondir = scripting.get_icon_dir() if self.tb: return self.tb = GUI.Toolbar.Toolbar(self.toolWin, -1, style = wx.TB_HORIZONTAL) self.tb.SetToolBitmapSize((32, 32)) self.maxWidth = self.parent.GetSize()[0] #toolSize = self.tb.GetToolSize()[0] wx.EVT_COMBOBOX(self.parent, GUI.MenuManager.ID_SET_VIEW, self.onSetView) self.zoomLevels = [0.1, 0.125, 0.25, 0.3333, 0.5, 0.6667, 0.75, 1.0, 1.25, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, -1] choices = ["10%", "12.5%", "25%", "33.33%", "50%", "66.67%", "75%", "100%", "125%", "150%", "200%", "300%", "400%", "600%", "800%", "Zoom to fit"] self.tb.AddSimpleTool(GUI.MenuManager.ID_ZOOM_IN, \ wx.Image(os.path.join(icondir, "Zoom_In.png"), \ wx.BITMAP_TYPE_PNG).ConvertToBitmap(), \ "Zoom in", \ "Zoom in on the slice") self.tb.AddSimpleTool(GUI.MenuManager.ID_ZOOM_OUT, wx.Image(os.path.join(icondir, "Zoom_Out.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Zoom out", "Zoom out on the optical slice") self.tb.AddSimpleTool(GUI.MenuManager.ID_ZOOM_TO_FIT, \ wx.Image(os.path.join(icondir, "Zoom_ToFit.png"), \ wx.BITMAP_TYPE_PNG).ConvertToBitmap(), \ "Zoom to Fit", \ "Zoom the slice so that it fits in the window") self.tb.AddSimpleTool(GUI.MenuManager.ID_ZOOM_OBJECT, \ wx.Image(os.path.join(icondir, "Zoom_ToRegion.png"), \ wx.BITMAP_TYPE_PNG).ConvertToBitmap(), \ "Zoom object", \ "Zoom user selected portion of the slice") self.zoomCombo = wx.ComboBox(self.tb, GUI.MenuManager.ID_ZOOM_COMBO, "Zoom to fit", choices = choices, size = (120, -1), style = wx.CB_DROPDOWN) self.zoomCombo.SetSelection(len(choices)-1) self.zoomCombo.SetHelpText("This controls the zoom level of visualization views.") self.tb.AddControl(self.zoomCombo) if platform.system() != "Darwin": self.tb.AddSeparator() self.viewCombo = wx.ComboBox(self.tb, GUI.MenuManager.ID_SET_VIEW, "Isometric", choices = ["+X", "-X", "+Y", "-Y", "+Z", "-Z", "Isometric"], size = (130, -1), style = wx.CB_DROPDOWN) self.viewCombo.SetSelection(6) self.viewCombo.SetHelpText("This controls the view angle of 3D view mode.") self.tb.AddControl(self.viewCombo) self.pitch = wx.SpinButton(self.tb, GUI.MenuManager.PITCH, style = wx.SP_VERTICAL, size = (-1, 22)) self.tb.AddControl(self.pitch) self.yaw = wx.SpinButton(self.tb, GUI.MenuManager.YAW, style = wx.SP_VERTICAL, size = (-1, 22)) self.tb.AddControl(self.yaw) self.roll = wx.SpinButton(self.tb, GUI.MenuManager.ROLL, style = wx.SP_VERTICAL, size = (-1, 22)) self.tb.AddControl(self.roll) self.elevation = wx.SpinButton(self.tb, -1, style = wx.SP_VERTICAL, size = (-1, 22)) self.tb.AddControl(self.elevation) if platform.system() != "Darwin": self.tb.AddSeparator() icon = wx.Image(os.path.join(icondir, "Original.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.origBtn = wx.lib.buttons.GenBitmapButton(self.tb, GUI.MenuManager.ORIG_BUTTON, icon, style = wx.BORDER_NONE, size = (32,32)) self.origBtn.SetHelpText("Use this button to show how the unprocessed dataset looks like.") self.origBtn.Bind(wx.EVT_LEFT_DOWN, lambda x: self.onShowOriginal(x, 1)) self.origBtn.Bind(wx.EVT_LEFT_UP, lambda x: self.onShowOriginal(x, 0)) self.tb.AddControl(self.origBtn) self.dimInfo = GUI.UIElements.DimensionInfo(self.tb, -1, size = (160, 50)) self.tb.AddControl(self.dimInfo) resampleBmp = wx.Image(os.path.join(icondir, "Resample.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.resamplingBtn = wx.lib.buttons.GenBitmapToggleButton(self.tb, GUI.MenuManager.ID_RESAMPLING, resampleBmp) self.resamplingBtn.SetBestSize((32, 32)) self.resamplingBtn.SetToolTipString("Enable or disable the resampling of image data") self.resamplingBtn.SetToggle(0) self.resamplingBtn.Enable(0) self.resamplingBtn.Bind(wx.EVT_BUTTON, self.onResampleData) self.tb.AddControl(self.resamplingBtn) wx.EVT_TOOL(self.parent, GUI.MenuManager.ID_ZOOM_IN, self.zoomIn) wx.EVT_TOOL(self.parent, GUI.MenuManager.ID_ZOOM_OUT, self.zoomOut) wx.EVT_TOOL(self.parent, GUI.MenuManager.ID_ZOOM_TO_FIT, self.zoomToFit) wx.EVT_TOOL(self.parent, GUI.MenuManager.ID_ZOOM_OBJECT, self.zoomObject) self.zoomCombo.Bind(wx.EVT_COMBOBOX, self.zoomToComboSelection) self.tb.Realize() self.viewCombo.Enable(0) self.pitch.Enable(0) self.yaw.Enable(0) self.roll.Enable(0) self.elevation.Enable(0)
def __init__(self, parent, control): """ Initialization Parameters: control UrmasControl object """ self.parent = parent self.control = control self.dropsource = None self.icons = {} self.panels = {} self.sbmps = {} wx.Panel.__init__(self, parent, style=wx.RAISED_BORDER, size=(750, 32)) self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.iconpath = scripting.get_icon_dir() self.ID_NEWTIMEPOINTTRACK = wx.NewId() toolTip = wx.ToolTip("Click to add a track for controlling animated timepoints.") self.addNormalItem( self.ID_NEWTIMEPOINTTRACK, "Animator_TrackTimepoint.png", self.onToolNewTimepointTrack, toolTip ) self.ID_NEWSPLINETRACK = wx.NewId() toolTip = wx.ToolTip("Click to add a track for controlling the camera movement using a spline curve.") self.addNormalItem(self.ID_NEWSPLINETRACK, "Animator_TrackCameraPath.png", self.onToolNewSplineTrack, toolTip) self.ID_NEWKEYFRAMETRACK = wx.NewId() toolTip = wx.ToolTip( "Click to the timeline to add a track for controlling the camera movement by creating keyframes." ) self.addNormalItem(self.ID_NEWKEYFRAMETRACK, "Animator_TrackKeyframe.png", self.onToolNewKeyframeTrack, toolTip) p = wx.Panel(self, -1, size=(50, 1)) self.sizer.Add(p, flag=wx.RIGHT, border=2) self.ID_NEWTIMEPOINT = wx.NewId() toolTip = wx.ToolTip("Drag this on to a timepoint track to select visualized timepoints.") self.addDragDropItem(self.ID_NEWTIMEPOINT, "Animator_Timepoint.png", self.onToolNewTimepoint, toolTip) self.ID_NEWSPLINE = wx.NewId() toolTip = wx.ToolTip("Drag this on to a camera path track to add a random camera path.") self.addDragDropItem(self.ID_NEWSPLINE, "Animator_CameraPath.png", self.onToolNewSpline, toolTip) self.ID_NEWCIRCULAR = wx.NewId() toolTip = wx.ToolTip("Drag this on to a camera path track to make camera rotate around X axis.") self.addDragDropItem(self.ID_NEWCIRCULAR, "Animator_CameraPathX.png", self.onToolNewCircular, toolTip) self.ID_NEWPERPENDICULAR = wx.NewId() toolTip = wx.ToolTip("Drag this on to a camera path track to make camera rotate around Y axis.") self.addDragDropItem(self.ID_NEWPERPENDICULAR, "Animator_CameraPathY.png", self.onToolNewPerpendicular, toolTip) self.ID_STOP_CAMERA = wx.NewId() toolTip = wx.ToolTip("Drag this on to a camera path to add a pause in camera movement.") self.addDragDropItem(self.ID_STOP_CAMERA, "Animator_Pause.png", self.onToolNewStop, toolTip) self.ID_ADD_KEYFRAME = wx.NewId() toolTip = wx.ToolTip("Drag this on to a keyframe track to add a keyframe at the current camera position.") self.addDragDropItem(self.ID_ADD_KEYFRAME, "Animator_Keyframe.png", self.onToolNewKeyframe, toolTip) self.zoomLevels = [0.25, 0.3333, 0.5, 0.6667, 0.75, 1.0, 1.25, 1.5, 2.0, 3.0, 4.0, 6.0] self.zoomCombo = wx.ComboBox( self, GUI.MenuManager.ID_ANIM_ZOOM_COMBO, choices=["25%", "33.33%", "50%", "66.67%", "75%", "100%", "125%", "150%", "200%", "300%", "400%", "600%"], size=(100, -1), style=wx.CB_DROPDOWN, ) self.zoomCombo.SetSelection(5) self.zoomCombo.SetHelpText("This controls the zoom level of animator tracks.") self.zoomCombo.Bind(wx.EVT_COMBOBOX, self.zoomToComboSelection) self.sizer.Add(self.zoomCombo, flag=wx.RIGHT, border=2) self.ID_RENDER = wx.NewId() toolTip = wx.ToolTip("Click to render the project.") self.addNormalItem(self.ID_RENDER, "Animator_Render.png", self.parent.onMenuRender, toolTip) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About BioImageXD', size=(600, 400)) self.sizer = wx.GridBagSizer(5, 5) x, y = (600, 400) self.notebook = wx.Notebook(self, -1, size=(600, 400)) self.about = wx.html.HtmlWindow(self.notebook, -1, size=(420, 400)) if "gtk2" in wx.PlatformInfo: self.about.SetStandardFonts() col = self.GetBackgroundColour() bgcol = "#%2x%2x%2x" % (col.Red(), col.Green(), col.Blue()) dict = { "bgcolor": bgcol, "version": bxdversion.VERSION, "icondir": scripting.get_icon_dir() } self.about.SetPage(aboutText % dict) #ir = self.about.GetInternalRepresentation() 02.07.07 M.B. #self.about.SetSize( (ir.GetWidth()+25, ir.GetHeight()+25) ) self.about.SetSize((x, y)) self.notebook.AddPage(self.about, "About BioImageXD") #self.gplPanel = scrolled.ScrolledPanel(self.notebook,-1,size=(x,y)) #box= wx.BoxSizer(wx.VERTICAL) self.gpl = wx.html.HtmlWindow(self.notebook, -1, size=(420, 400)) if "gtk2" in wx.PlatformInfo: self.gpl.SetStandardFonts() #box.Add(self.gpl) #self.gplPanel.SetSizer(box) #self.gplPanel.SetAutoLayout(1) #self.gplPanel.SetupScrolling() bgcol = "#%2x%2x%2x" % (col.Red(), col.Green(), col.Blue()) dict = {"bgcolor": bgcol} self.gpl.SetPage(gplText % dict) self.gpl.SetSize((x, y)) self.notebook.AddPage(self.gpl, "BioImageXD License") #self.licensingPanel = scrolled.ScrolledPanel(self.notebook,-1,size=(420,200)) #box=wx.BoxSizer(wx.VERTICAL) self.licensing = wx.html.HtmlWindow(self.notebook, -1, size=(420, 400)) if "gtk2" in wx.PlatformInfo: self.licensing.SetStandardFonts() #box.Add(self.licensing) #self.licensingPanel.SetSizer(box) #self.licensingPanel.SetAutoLayout(1) #self.licensingPanel.SetupScrolling() col = self.GetBackgroundColour() bgcol = "#%2x%2x%2x" % (col.Red(), col.Green(), col.Blue()) dict = {"bgcolor": bgcol} self.licensing.SetPage(licensingText % dict) self.licensing.SetSize((x, y)) self.notebook.AddPage(self.licensing, "Libraries") self.sizer.Add(self.notebook, (0, 0)) #self.staticLine=wx.StaticLine(self) #self.sizer.Add(self.staticLine,(1,0),flag=wx.EXPAND|wx.LEFT|wx.RIGHT) self.ok = wx.Button(self, -1, "Ok") self.ok.Bind(wx.EVT_BUTTON, self.closeWindow) self.ok.SetDefault() self.sizer.Add(self.ok, (2, 0), flag=wx.ALIGN_CENTER) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.SetSizeHints(self) self.sizer.Fit(self) self.CentreOnParent(wx.BOTH)
def initializeGUI(self): """ Creates a frame that contains the various widgets used to control the colocalization settings """ self.sizer = wx.GridBagSizer() self.filtersizer = wx.GridBagSizer(4, 4) self.filterLbl = wx.StaticText(self, -1, "Procedure list:") self.filterListbox = wx.CheckListBox(self, -1, size = self.filterBoxSize) self.filterListbox.Bind(wx.EVT_LISTBOX, self.onSelectFilter) self.filterListbox.Bind(wx.EVT_CHECKLISTBOX, self.onCheckFilter) self.addFilteringBtn = wx.Button(self, -1, u"Filtering \u00BB") self.addArithmeticsBtn = wx.Button(self, -1, u"Arithmetics \u00BB") self.addSegmentationBtn = wx.Button(self, -1, u"Segmentation \u00BB") self.addAnalyzeBtn = wx.Button(self, -1, u"Analyze \u00BB") self.addMiscBtn = wx.Button(self, -1, u"Misc \u00BB") self.presetBtn = wx.Button(self, -1, u"Presets \u00BB") MP = self.filtersModule f = lambda evt, btn = self.addFilteringBtn, \ cats = (lib.FilterTypes.FILTERING, lib.FilterTypes.DECONVOLUTION, lib.FilterTypes.FEATUREDETECTION, lib.FilterTypes.MORPHOLOGICAL, lib.FilterTypes.FOURIER, lib.FilterTypes.MISCFILTERING): \ self.onShowAddMenu(evt, btn, cats) self.addFilteringBtn.Bind(wx.EVT_LEFT_DOWN, f) f = lambda evt, btn = self.addArithmeticsBtn, \ cats = (lib.FilterTypes.MATH, lib.FilterTypes.LOGIC, lib.FilterTypes.SUBTRACT): \ self.onShowAddMenu(evt, btn, cats) self.addArithmeticsBtn.Bind(wx.EVT_LEFT_DOWN, f) f = lambda evt, btn = self.addSegmentationBtn, \ cats = (lib.FilterTypes.THRESHOLDING, lib.FilterTypes.WATERSHED, \ lib.FilterTypes.REGION_GROWING, \ lib.FilterTypes.ACTIVECONTOUR, lib.FilterTypes.OBJECT): \ self.onShowAddMenu(evt, btn, cats) self.addSegmentationBtn.Bind(wx.EVT_LEFT_DOWN, f) f = lambda evt, btn = self.addAnalyzeBtn, \ cats = (lib.FilterTypes.SEGMENTATIONANALYSE, lib.FilterTypes.VOXELANALYSE, lib.FilterTypes.COLOCALIZATION): \ self.onShowAddMenu(evt, btn, cats) self.addAnalyzeBtn.Bind(wx.EVT_LEFT_DOWN, f) f = lambda evt, btn = self.addMiscBtn, \ cats = (lib.FilterTypes.ROI, lib.FilterTypes.SIMULATION, lib.FilterTypes.REGISTRATION, lib.FilterTypes.TRACKING, lib.FilterTypes.CONVERSION): \ self.onShowAddMenu(evt, btn, cats) self.addMiscBtn.Bind(wx.EVT_LEFT_DOWN, f) #f = lambda evt, btn = self.addTrackingBtn, cats = (lib.FilterTypes.TRACKING, ): \ # self.onShowAddMenu(evt, btn, cats) #self.addTrackingBtn.Bind(wx.EVT_LEFT_DOWN, f) self.presetBtn.Bind(wx.EVT_LEFT_DOWN, self.onShowPresetsMenu) vertbtnBox = wx.BoxSizer(wx.VERTICAL) #bmp = wx.ArtProvider_GetBitmap(wx.ART_DELETE, wx.ART_TOOLBAR, (16, 16)) #self.remove = wx.BitmapButton(self, -1, bmp) #self.remove.Bind(wx.EVT_BUTTON, self.onRemoveFilter) #bmp = wx.ArtProvider_GetBitmap(wx.ART_GO_UP, wx.ART_TOOLBAR, (16, 16)) #self.up = wx.BitmapButton(self, -1, bmp) #bmp = wx.ArtProvider_GetBitmap(wx.ART_GO_DOWN, wx.ART_TOOLBAR, (16, 16)) #self.up.Bind(wx.EVT_BUTTON, self.onMoveFilterUp) #self.down = wx.BitmapButton(self, -1, bmp) #self.down.Bind(wx.EVT_BUTTON, self.onMoveFilterDown) iconpath = scripting.get_icon_dir() uparrow = wx.Image(os.path.join(iconpath, "Arrow_Up.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() downarrow = wx.Image(os.path.join(iconpath, "Arrow_Down.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() remove = wx.Image(os.path.join(iconpath, "Delete.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.up = wx.BitmapButton(self, -1, uparrow) self.down = wx.BitmapButton(self, -1, downarrow) self.remove = wx.BitmapButton(self, -1, remove) self.up.Bind(wx.EVT_BUTTON, self.onMoveFilterUp) self.down.Bind(wx.EVT_BUTTON, self.onMoveFilterDown) self.remove.Bind(wx.EVT_BUTTON, self.onRemoveFilter) vertbtnBox.Add(self.remove) vertbtnBox.Add(self.up) vertbtnBox.Add(self.down) btnBox = wx.FlexGridSizer(2, 3) btnBox.SetVGap(3) btnBox.SetHGap(4) #btnBox2 = wx.GridSizer(wx.HORIZONTAL) btnBox.Add(self.addFilteringBtn) #btnBox.AddSpacer((4, 4)) btnBox.Add(self.addArithmeticsBtn) #btnBox.AddSpacer((4, 4)) btnBox.Add(self.addSegmentationBtn) #btnBox2.Add(self.addTrackingBtn) btnBox.Add(self.addAnalyzeBtn) #btnBox2.AddSpacer((4, 4)) btnBox.Add(self.addMiscBtn) #btnBox2.AddSpacer((4, 4)) btnBox.Add(self.presetBtn) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(self.filterListbox) box.Add(vertbtnBox) self.filtersizer.Add(self.filterLbl, (0, 0)) self.filtersizer.Add(box, (1, 0), flag = wx.EXPAND | wx.LEFT | wx.RIGHT) self.filtersizer.Add(btnBox, (2, 0)) #self.filtersizer.Add(btnBox2, (3, 0)) self.sizer.Add(self.filtersizer, (0, 0)) self.SetSizer(self.sizer) self.SetAutoLayout(1)
def __init__(self, parent, n): """ Method that initializes the class """ wx.Panel.__init__(self, parent, -1, size = (1024, 34)) #wx.SashLayoutWind#ow.__init__(self,parent,-1) self.sizer = wx.BoxSizer(wx.HORIZONTAL) #self.SetBackgroundColour((255,0,0)) iconpath = scripting.get_icon_dir() self.rangeMax = n self.buttonPanel = wx.Panel(self, -1, size = (48, -1), style = wx.RAISED_BORDER) self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL) self.buttonPanel.SetSizer(self.buttonSizer) self.buttonPanel.SetAutoLayout(1) self.nextIcon = wx.Image(os.path.join(iconpath, "next.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() self.prevIcon = wx.Image(os.path.join(iconpath, "previous.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() self.playIcon = wx.Image(os.path.join(iconpath, "player_play.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() self.pauseIcon = wx.Image(os.path.join(iconpath, "player_pause.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() #self.stopicon = wx.Image(os.path.join(iconpath,"stop.gif"),wx.BITMAP_TYPE_GIF).ConvertToBitmap() self.beginIcon = wx.Image(os.path.join(iconpath, "player_start.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() self.endIcon = wx.Image(os.path.join(iconpath, "player_end.gif"), wx.BITMAP_TYPE_GIF).ConvertToBitmap() #self.playpause=buttons.GenBitmapButton(self,-1,self.playicon) #self.stop = buttons.GenBitmapButton(self,-1,self.stopicon) self.beginButton = buttons.GenBitmapButton(self.buttonPanel, -1, self.beginIcon, style = wx.BORDER_NONE) self.prevButton = buttons.GenBitmapButton(self.buttonPanel, -1, self.prevIcon, style = wx.BORDER_NONE) self.playButton = buttons.GenBitmapButton(self.buttonPanel, -1, self.playIcon, style = wx.BORDER_NONE) self.pauseButton = buttons.GenBitmapButton(self.buttonPanel, -1, self.pauseIcon, style = wx.BORDER_NONE) self.nextButton = buttons.GenBitmapButton(self.buttonPanel, -1, self.nextIcon, style = wx.BORDER_NONE) self.endButton = buttons.GenBitmapButton(self.buttonPanel, -1, self.endIcon, style = wx.BORDER_NONE) self.nextButton.Bind(wx.EVT_BUTTON, self.onNextFrame) self.prevButton.Bind(wx.EVT_BUTTON, self.onPrevFrame) self.beginButton.Bind(wx.EVT_BUTTON, self.onFirstFrame) self.endButton.Bind(wx.EVT_BUTTON, self.onLastFrame) self.playButton.Bind(wx.EVT_BUTTON, self.onPlay) self.pauseButton.Bind(wx.EVT_BUTTON, self.onPause) self.timeslider = wx.Slider(self, size = (32, -1), value = 1, minValue = 1, maxValue = n, style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS) #self.sizer.Add(self.playpause,) #self.sizer.Add(self.stop) for btn in [self.beginButton, self.prevButton, self.playButton, self.pauseButton, self.nextButton, self.endButton]: btn.SetBestSize((24, 24)) self.buttonSizer.Add(btn) self.buttonSizer.Fit(self.buttonPanel) self.sizer.Add(self.buttonPanel, 0, flag = wx.ALIGN_CENTER_VERTICAL) self.sizer.Add(self.timeslider, 1, flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) self.callback = None self.changing = 0 #self.playpause.Bind(wx.EVT_BUTTON,self.onPlayPause) #self.stop.Bind(wx.EVT_BUTTON,self.onStop) #self.stop.Enable(0) self.pauseButton.Enable(0) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self) lib.messenger.connect(None, "set_timeslider_value", self.onSetTimeslider) lib.messenger.connect(None, "set_frames", self.onSetFrames) lib.messenger.connect(None, "timepoint_changed", self.onSetTimepoint) lib.messenger.connect(None, "set_play_mode", self.onSetPlay)
def __init__(self, parent, control): """ Initialization Parameters: control UrmasControl object """ self.parent = parent self.control = control self.dropsource = None self.icons = {} self.panels = {} self.sbmps = {} wx.Panel.__init__(self, parent, style=wx.RAISED_BORDER, size=(750, 32)) self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.iconpath = scripting.get_icon_dir() self.ID_NEWTIMEPOINTTRACK = wx.NewId() toolTip = wx.ToolTip( "Click to add a track for controlling animated timepoints.") self.addNormalItem(self.ID_NEWTIMEPOINTTRACK, "Animator_TrackTimepoint.png", self.onToolNewTimepointTrack, toolTip) self.ID_NEWSPLINETRACK = wx.NewId() toolTip = wx.ToolTip( "Click to add a track for controlling the camera movement using a spline curve." ) self.addNormalItem(self.ID_NEWSPLINETRACK, "Animator_TrackCameraPath.png", self.onToolNewSplineTrack, toolTip) self.ID_NEWKEYFRAMETRACK = wx.NewId() toolTip = wx.ToolTip( "Click to the timeline to add a track for controlling the camera movement by creating keyframes." ) self.addNormalItem(self.ID_NEWKEYFRAMETRACK, "Animator_TrackKeyframe.png", self.onToolNewKeyframeTrack, toolTip) p = wx.Panel(self, -1, size=(50, 1)) self.sizer.Add(p, flag=wx.RIGHT, border=2) self.ID_NEWTIMEPOINT = wx.NewId() toolTip = wx.ToolTip( "Drag this on to a timepoint track to select visualized timepoints." ) self.addDragDropItem(self.ID_NEWTIMEPOINT, "Animator_Timepoint.png", self.onToolNewTimepoint, toolTip) self.ID_NEWSPLINE = wx.NewId() toolTip = wx.ToolTip( "Drag this on to a camera path track to add a random camera path.") self.addDragDropItem(self.ID_NEWSPLINE, "Animator_CameraPath.png", self.onToolNewSpline, toolTip) self.ID_NEWCIRCULAR = wx.NewId() toolTip = wx.ToolTip( "Drag this on to a camera path track to make camera rotate around X axis." ) self.addDragDropItem(self.ID_NEWCIRCULAR, "Animator_CameraPathX.png", self.onToolNewCircular, toolTip) self.ID_NEWPERPENDICULAR = wx.NewId() toolTip = wx.ToolTip( "Drag this on to a camera path track to make camera rotate around Y axis." ) self.addDragDropItem(self.ID_NEWPERPENDICULAR, "Animator_CameraPathY.png", self.onToolNewPerpendicular, toolTip) self.ID_STOP_CAMERA = wx.NewId() toolTip = wx.ToolTip( "Drag this on to a camera path to add a pause in camera movement.") self.addDragDropItem(self.ID_STOP_CAMERA, "Animator_Pause.png", self.onToolNewStop, toolTip) self.ID_ADD_KEYFRAME = wx.NewId() toolTip = wx.ToolTip( "Drag this on to a keyframe track to add a keyframe at the current camera position." ) self.addDragDropItem(self.ID_ADD_KEYFRAME, "Animator_Keyframe.png", self.onToolNewKeyframe, toolTip) self.zoomLevels = [ 0.25, 0.3333, 0.5, 0.6667, 0.75, 1.0, 1.25, 1.5, 2.0, 3.0, 4.0, 6.0 ] self.zoomCombo = wx.ComboBox(self, GUI.MenuManager.ID_ANIM_ZOOM_COMBO, choices=[ "25%", "33.33%", "50%", "66.67%", "75%", "100%", "125%", "150%", "200%", "300%", "400%", "600%" ], size=(100, -1), style=wx.CB_DROPDOWN) self.zoomCombo.SetSelection(5) self.zoomCombo.SetHelpText( "This controls the zoom level of animator tracks.") self.zoomCombo.Bind(wx.EVT_COMBOBOX, self.zoomToComboSelection) self.sizer.Add(self.zoomCombo, flag=wx.RIGHT, border=2) self.ID_RENDER = wx.NewId() toolTip = wx.ToolTip("Click to render the project.") self.addNormalItem(self.ID_RENDER, "Animator_Render.png", self.parent.onMenuRender, toolTip) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About BioImageXD', size = (600, 400)) self.sizer = wx.GridBagSizer(5, 5) x, y = (600, 400) self.notebook = wx.Notebook(self, -1, size = (600, 400)) self.about = wx.html.HtmlWindow(self.notebook, -1, size = (420, 400)) if "gtk2" in wx.PlatformInfo: self.about.SetStandardFonts() col = self.GetBackgroundColour() bgcol = "#%2x%2x%2x"% (col.Red(), col.Green(), col.Blue()) dict = {"bgcolor":bgcol, "version":bxdversion.VERSION, "icondir":scripting.get_icon_dir()} self.about.SetPage(aboutText%dict) #ir = self.about.GetInternalRepresentation() 02.07.07 M.B. #self.about.SetSize( (ir.GetWidth()+25, ir.GetHeight()+25) ) self.about.SetSize( (x, y) ) self.notebook.AddPage(self.about,"About BioImageXD") #self.gplPanel = scrolled.ScrolledPanel(self.notebook,-1,size=(x,y)) #box= wx.BoxSizer(wx.VERTICAL) self.gpl = wx.html.HtmlWindow(self.notebook, -1, size=(420, 400)) if "gtk2" in wx.PlatformInfo: self.gpl.SetStandardFonts() #box.Add(self.gpl) #self.gplPanel.SetSizer(box) #self.gplPanel.SetAutoLayout(1) #self.gplPanel.SetupScrolling() bgcol = "#%2x%2x%2x"% (col.Red(), col.Green(), col.Blue()) dict = {"bgcolor":bgcol} self.gpl.SetPage(gplText % dict) self.gpl.SetSize( (x, y) ) self.notebook.AddPage(self.gpl, "BioImageXD License") #self.licensingPanel = scrolled.ScrolledPanel(self.notebook,-1,size=(420,200)) #box=wx.BoxSizer(wx.VERTICAL) self.licensing = wx.html.HtmlWindow(self.notebook, -1, size = (420, 400)) if "gtk2" in wx.PlatformInfo: self.licensing.SetStandardFonts() #box.Add(self.licensing) #self.licensingPanel.SetSizer(box) #self.licensingPanel.SetAutoLayout(1) #self.licensingPanel.SetupScrolling() col = self.GetBackgroundColour() bgcol = "#%2x%2x%2x"% (col.Red(), col.Green(), col.Blue()) dict = {"bgcolor":bgcol} self.licensing.SetPage(licensingText%dict) self.licensing.SetSize((x, y) ) self.notebook.AddPage(self.licensing, "Libraries") self.sizer.Add(self.notebook, (0, 0)) #self.staticLine=wx.StaticLine(self) #self.sizer.Add(self.staticLine,(1,0),flag=wx.EXPAND|wx.LEFT|wx.RIGHT) self.ok = wx.Button(self, -1, "Ok") self.ok.Bind(wx.EVT_BUTTON, self.closeWindow) self.ok.SetDefault() self.sizer.Add(self.ok, (2, 0), flag = wx.ALIGN_CENTER) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.SetSizeHints(self) self.sizer.Fit(self) self.CentreOnParent(wx.BOTH)
def createAnnotationToolbar(self): """ Method to create a toolbar for the annotations """ icondir = scripting.get_icon_dir() def createBtn(bid, pngname, tooltip, btnclass=buttons.GenBitmapToggleButton): bmp = wx.Image(os.path.join(icondir, pngname), wx.BITMAP_TYPE_PNG).ConvertToBitmap() btn = btnclass(self, bid, bmp) btn.SetBestSize((32, 32)) #btn.SetBitmapLabel() btn.SetToolTipString(tooltip) return btn self.circleBtn = createBtn(MenuManager.ID_ROI_CIRCLE, "Annotation_Circle.png", "Select a circular area of the image") self.sizer.Add(self.circleBtn, (0, 0)) self.rectangleBtn = createBtn(MenuManager.ID_ROI_RECTANGLE, "Annotation_Rectangle.png", \ "Select a rectangular area of the image") self.sizer.Add(self.rectangleBtn, (0, 1)) self.polygonBtn = createBtn(MenuManager.ID_ROI_POLYGON, "Annotation_Polygon.png", \ "Select a polygonal area of the image") self.sizer.Add(self.polygonBtn, (1, 0)) self.scaleBtn = createBtn(MenuManager.ID_ADD_SCALE, "Annotation_Scalebar.png", "Draw a scale bar on the image") self.sizer.Add(self.scaleBtn, (1, 1)) icon = wx.Image(os.path.join(icondir, "Annotation_Delete.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.deleteAnnotationBtn = buttons.GenBitmapButton( self, MenuManager.ID_DEL_ANNOTATION, icon) self.deleteAnnotationBtn.SetBestSize((32, 32)) self.deleteAnnotationBtn.SetToolTipString("Delete an annotation") self.sizer.Add(self.deleteAnnotationBtn, (2, 0)) self.colorSelect = csel.ColourSelect(self, -1, "", self.annotateColor, size=(32, 32)) self.colorSelect.Bind(csel.EVT_COLOURSELECT, self.setAnnotationColor) self.sizer.Add(self.colorSelect, (2, 1)) if not scripting.TFLag: self.threeDPolygonBtn = createBtn( MenuManager.ID_ROI_THREE_D_POLYGON, "three_d_polygon.png", "Select one or several polygonal areas of the image in different slices to perform a 3D crop" ) self.sizer.Add(self.threeDPolygonBtn, (3, 0)) self.threeDCircleBtn = createBtn( MenuManager.ID_ROI_THREE_D_CIRCLE, "three_d_circle.png", "Select one or several circle areas of the image in different slices to perform a 3D crop" ) self.sizer.Add(self.threeDCircleBtn, (3, 1)) self.threeDRectangleBtn = createBtn( MenuManager.ID_ROI_THREE_D_RECTANGLE, "three_d_rectangle.png", "Select one or several rectangle areas of the image in different slices to perform a 3D crop" ) self.sizer.Add(self.threeDRectangleBtn, (4, 0)) # Interpolation stuff. :) self.interpolationStart = wx.SpinCtrl( self, wx.ID_ANY, size=(64, -1), min=1, max=self.visualizer.dataUnit.getDimensions()[2] if self.visualizer.dataUnit != None else 1) self.interpolationStart.SetValue(1) self.sizer.Add(self.interpolationStart, (5, 0), span=(1, 2)) self.interpolationEnd = wx.SpinCtrl( self, wx.ID_ANY, size=(64, -1), min=1, max=self.visualizer.dataUnit.getDimensions()[2] if self.visualizer.dataUnit != None else 1) self.interpolationEnd.SetValue(1) self.sizer.Add(self.interpolationEnd, (6, 0), span=(1, 2)) self.interpolateButton = wx.Button(self, wx.ID_ANY, "Interpolate", size=(64, 24)) self.sizer.Add(self.interpolateButton, (7, 0), span=(1, 2)) self.interpolateButton.Bind(wx.EVT_BUTTON, self.onInterpolate) self.copyToAllButton = wx.Button(self, wx.ID_ANY, "Copy to all", size=(64, 24)) self.sizer.Add(self.copyToAllButton, (8, 0), span=(1, 2)) self.copyToAllButton.Bind(wx.EVT_BUTTON, self.onCopyAll) #self.textBtn = createBtn(MenuManager.ID_ANNOTATION_TEXT, "text.gif", "Add a text annotation") #self.sizer.Add(self.textBtn, (2, 0)) #self.roiToMaskBtn = createBtn(MenuManager.ID_ROI_TO_MASK, "roitomask.gif", \ # "Convert the selected Region of Interest to a Mask", \ # btnclass = buttons.GenBitmapButton) #self.sizer.Add(self.roiToMaskBtn, (4, 0)) #self.fontBtn = createBtn(MenuManager.ID_ANNOTATION_FONT,"fonts.gif",\ # "Set the font for annotations", btnclass=buttons.GenBitmapButton) #self.sizer.Add(self.fontBtn, (3,1)) #self.resamplingBtn = createBtn(MenuManager.ID_RESAMPLING, "resample.gif", \ # "Enable or disable the resampling of image data") #self.resamplingBtn.SetToggle(1) #self.resampleToFitBtn = createBtn(MenuManager.ID_RESAMPLE_TO_FIT, "resample_tofit.gif", \ # "Enable or disable the resampling of image data") #self.sizer.Add(self.resamplingBtn, (6, 0)) #self.sizer.Add(self.resampleToFitBtn, (6, 1)) # self.recordBtn = buttons.GenToggleButton(self, MenuManager.ID_RECORD_EVENTS, "Record", size=(64,-1)) # self.sizer.Add(self.recordBtn, (7,0), span=(1,2)) # self.playBtn = createBtn(MenuManager.ID_PLAY_EVENTS,"player_play.gif", \ # "Play the recorded events", btnclass=buttons.GenBitmapButton) # self.stopBtn = createBtn(MenuManager.ID_PLAY_EVENTS,"player_pause.gif", \ # "Stop playing the recorded events", btnclass=buttons.GenBitmapButton) # self.sizer.Add(self.playBtn, (8,0)) # self.sizer.Add(self.stopBtn, (8,1)) # self.playBtn.Bind(wx.EVT_BUTTON, self.onPlayRecording) # self.stopBtn.Bind(wx.EVT_BUTTON, self.onStopPlaying) # self.recordBtn.Bind(wx.EVT_BUTTON, self.onRecord) # bmp = wx.Image(os.path.join(iconpath,"resample.gif")).ConvertToBitmap() # tb.DoAddTool(MenuManager.ID_RESAMPLING, "Resampling", bmp, kind = wx.ITEM_CHECK, \ # shortHelp = "Enable or disable the resampling of image data") # wx.EVT_TOOL(self,MenuManager.ID_RESAMPLING,self.onResampleData) # tb.EnableTool(MenuManager.ID_RESAMPLING,0) # tb.ToggleTool(MenuManager.ID_RESAMPLING,1) # sbox = wx.StaticBox(self,-1,"Resampling") # sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) # self.resamplingOff = wx.RadioButton(self,-1,"Disabled", style = wx.RB_GROUP) # self.resamplingOn = wx.RadioButton(self,-1,"Enabled") # self.resampleToFit = wx.RadioButton(self,-1,"To fit") # sboxsizer.Add(self.resamplingOn) # sboxsizer.Add(self.resamplingOff) # sboxsizer.Add(self.resampleToFit) # self.sizer.Add(sboxsizer, (6,0),span=(1,2)) # self.sizer.Add(self.resamplingOn, (7,0),span=(1,2)) # self.sizer.Add(self.resampleToFit, (8,0),span=(1,2)) # self.dimInfo = UIElements.DimensionInfo(self,-1, size=(120,50)) # self.sizer.Add(self.dimInfo, (6,0), span=(1,2)) self.sizerCount = 8 #self.resamplingBtn.Bind(wx.EVT_BUTTON, self.onResampleData) #self.resampleToFitBtn.Bind(wx.EVT_BUTTON, self.onResampleToFit) self.circleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.rectangleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.polygonBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.scaleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) if not scripting.TFLag: self.threeDPolygonBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.threeDCircleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.threeDRectangleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) #self.roiToMaskBtn.Bind(wx.EVT_BUTTON, self.roiToMask) # wx.EVT_TOOL(self.parent,MenuManager.ID_ADD_SCALE,self.addAnnotation) self.deleteAnnotationBtn.Bind(wx.EVT_BUTTON, self.deleteAnnotation)
def __init__(self, parent, **kws): """ Initialization """ self.parent = parent self.selectedPoint = None self.hasPainted = 0 wx.Panel.__init__(self, parent, -1) self.updateT = 0 if kws.has_key("alpha"): self.alpha = kws["alpha"] self.updateCallback = 0 self.ctf = vtk.vtkColorTransferFunction() self.doyield = 1 self.calling = 0 self.guiupdate = 0 self.freeMode = 0 self.selectThreshold = 35.0 self.ptThreshold = 0.1 self.color = 0 self.modCount = 0 self.minval = 0 self.maxval = 255 self.otf = vtk.vtkPiecewiseFunction() self.restoreDefaults() self.mainsizer = wx.BoxSizer(wx.VERTICAL) self.canvasBox = wx.BoxSizer(wx.VERTICAL) self.value = CTFValuePanel(self) self.canvasBox.Add(self.value, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10) self.canvas = CTFPaintPanel(self) self.canvasBox.Add(self.canvas, 1, wx.ALL | wx.EXPAND, 10) self.mainsizer.Add(self.canvasBox) self.itemBox = wx.BoxSizer(wx.HORIZONTAL) self.alphaMode = 0 iconpath = scripting.get_icon_dir() redbmp = wx.Image(os.path.join(iconpath, "CTF_Red.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.redBtn = buttons.GenBitmapToggleButton(self, -1, None) self.redBtn.SetBestSize((32, 32)) self.redBtn.SetValue(1) self.redBtn.SetBitmapLabel(redbmp) greenbmp = wx.Image(os.path.join(iconpath, "CTF_Green.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.greenBtn = buttons.GenBitmapToggleButton(self, -1, None) self.greenBtn.SetBestSize((32, 32)) self.greenBtn.SetBitmapLabel(greenbmp) bluebmp = wx.Image(os.path.join(iconpath, "CTF_Blue.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.blueBtn = buttons.GenBitmapToggleButton(self, -1, None) self.blueBtn.SetBestSize((32, 32)) self.blueBtn.SetBitmapLabel(bluebmp) if self.alpha: alphabmp = wx.Image(os.path.join(iconpath, "CTF_Alpha.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.alphaBtn = buttons.GenBitmapToggleButton(self, -1, None) self.alphaBtn.SetBestSize((32, 32)) self.alphaBtn.Bind(wx.EVT_BUTTON, self.onEditAlpha) self.alphaBtn.SetBitmapLabel(alphabmp) self.freeBtn = buttons.GenBitmapToggleButton(self, -1, None) self.freeBtn.SetBestSize((32, 32)) bmp = wx.Image(os.path.join(iconpath, "CTF_Freehand.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.freeBtn.SetBitmapLabel(bmp) self.colorBtn = csel.ColourSelect(self, -1, "", size=(32, 32)) self.colorBtn.Bind(csel.EVT_COLOURSELECT, self.onSetToColor) openbmp = wx.Image(os.path.join(iconpath, "CTF_OpenPalette.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.openBtn = buttons.GenBitmapButton(self, -1, None) self.openBtn.SetBestSize((32, 32)) self.openBtn.SetBitmapLabel(openbmp) savebmp = wx.Image(os.path.join(iconpath, "CTF_SavePalette.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.saveBtn = buttons.GenBitmapButton(self, -1, None) self.saveBtn.SetBestSize((32, 32)) self.saveBtn.SetBitmapLabel(savebmp) self.maxNodes = wx.SpinCtrl(self, -1, "20", min=2, max=9999, size=(54, -1), style=wx.TE_PROCESS_ENTER) self.maxNodes.SetToolTip( wx.ToolTip("Set the maximum number of nodes in the graph.")) self.maxNodes.SetHelpText( "Use this control to set the maximum number of nodes in the graph. This is useful if you have a hand drawn palette that you wish to edit by dragging the nodes." ) self.maxNodes.Bind(wx.EVT_SPINCTRL, self.onSetMaxNodes) self.maxNodes.Bind(wx.EVT_TEXT_ENTER, self.onSetMaxNodes) self.itemBox.Add(self.redBtn) self.itemBox.Add(self.greenBtn) self.itemBox.Add(self.blueBtn) if self.alpha: self.itemBox.Add(self.alphaBtn) self.itemBox.Add(self.freeBtn) self.itemBox.Add(self.colorBtn) self.itemBox.Add(self.openBtn) self.itemBox.Add(self.saveBtn) self.itemBox.Add(self.maxNodes) self.redBtn.Bind(wx.EVT_BUTTON, self.onEditRed) self.greenBtn.Bind(wx.EVT_BUTTON, self.onEditGreen) self.blueBtn.Bind(wx.EVT_BUTTON, self.onEditBlue) self.freeBtn.Bind(wx.EVT_BUTTON, self.onFreeMode) self.openBtn.Bind(wx.EVT_BUTTON, self.onOpenLut) self.saveBtn.Bind(wx.EVT_BUTTON, self.onSaveLut) self.mainsizer.Add(self.itemBox) self.SetAutoLayout(True) self.SetSizer(self.mainsizer) self.mainsizer.SetSizeHints(self) self.upToDate = 0 self.canvas.Bind(wx.EVT_LEFT_DOWN, self.onEditFunction) self.canvas.Bind(wx.EVT_LEFT_UP, self.updateCTFView) self.canvas.Bind(wx.EVT_LEFT_DCLICK, self.onDeletePoint) self.canvas.Bind(wx.EVT_RIGHT_DOWN, self.onCreatePoint) self.canvas.Bind(wx.EVT_MOTION, self.onDrawFunction) self.pos = (0, 0)
def __init__(self, parent, **kws): """ Initialization """ self.parent = parent self.selectedPoint = None self.hasPainted = 0 wx.Panel.__init__(self, parent, -1) self.updateT = 0 if kws.has_key("alpha"): self.alpha = kws["alpha"] self.updateCallback = 0 self.ctf = vtk.vtkColorTransferFunction() self.doyield = 1 self.calling = 0 self.guiupdate = 0 self.freeMode = 0 self.selectThreshold = 35.0 self.ptThreshold = 0.1 self.color = 0 self.modCount = 0 self.minval = 0 self.maxval = 255 self.otf = vtk.vtkPiecewiseFunction() self.restoreDefaults() self.mainsizer = wx.BoxSizer(wx.VERTICAL) self.canvasBox = wx.BoxSizer(wx.VERTICAL) self.value = CTFValuePanel(self) self.canvasBox.Add(self.value, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10) self.canvas = CTFPaintPanel(self) self.canvasBox.Add(self.canvas, 1, wx.ALL | wx.EXPAND, 10) self.mainsizer.Add(self.canvasBox) self.itemBox = wx.BoxSizer(wx.HORIZONTAL) self.alphaMode = 0 iconpath = scripting.get_icon_dir() redbmp = wx.Image(os.path.join(iconpath, "CTF_Red.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.redBtn = buttons.GenBitmapToggleButton(self, -1, None) self.redBtn.SetBestSize((32,32)) self.redBtn.SetValue(1) self.redBtn.SetBitmapLabel(redbmp) greenbmp = wx.Image(os.path.join(iconpath, "CTF_Green.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.greenBtn = buttons.GenBitmapToggleButton(self, -1, None) self.greenBtn.SetBestSize((32,32)) self.greenBtn.SetBitmapLabel(greenbmp) bluebmp = wx.Image(os.path.join(iconpath, "CTF_Blue.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.blueBtn = buttons.GenBitmapToggleButton(self, -1, None) self.blueBtn.SetBestSize((32,32)) self.blueBtn.SetBitmapLabel(bluebmp) if self.alpha: alphabmp = wx.Image(os.path.join(iconpath, "CTF_Alpha.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.alphaBtn = buttons.GenBitmapToggleButton(self, -1, None) self.alphaBtn.SetBestSize((32,32)) self.alphaBtn.Bind(wx.EVT_BUTTON, self.onEditAlpha) self.alphaBtn.SetBitmapLabel(alphabmp) self.freeBtn = buttons.GenBitmapToggleButton(self, -1, None) self.freeBtn.SetBestSize((32, 32)) bmp = wx.Image(os.path.join(iconpath, "CTF_Freehand.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.freeBtn.SetBitmapLabel(bmp) self.colorBtn = csel.ColourSelect(self, -1, "", size = (32, 32)) self.colorBtn.Bind(csel.EVT_COLOURSELECT, self.onSetToColor) openbmp = wx.Image(os.path.join(iconpath, "CTF_OpenPalette.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.openBtn = buttons.GenBitmapButton(self, -1, None) self.openBtn.SetBestSize((32,32)) self.openBtn.SetBitmapLabel(openbmp) savebmp = wx.Image(os.path.join(iconpath, "CTF_SavePalette.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.saveBtn = buttons.GenBitmapButton(self, -1, None) self.saveBtn.SetBestSize((32,32)) self.saveBtn.SetBitmapLabel(savebmp) self.maxNodes = wx.SpinCtrl(self, -1, "20", min = 2, max = 9999, size = (54, -1), style = wx.TE_PROCESS_ENTER) self.maxNodes.SetToolTip(wx.ToolTip("Set the maximum number of nodes in the graph.")) self.maxNodes.SetHelpText("Use this control to set the maximum number of nodes in the graph. This is useful if you have a hand drawn palette that you wish to edit by dragging the nodes.") self.maxNodes.Bind(wx.EVT_SPINCTRL, self.onSetMaxNodes) self.maxNodes.Bind(wx.EVT_TEXT_ENTER, self.onSetMaxNodes) self.itemBox.Add(self.redBtn) self.itemBox.Add(self.greenBtn) self.itemBox.Add(self.blueBtn) if self.alpha: self.itemBox.Add(self.alphaBtn) self.itemBox.Add(self.freeBtn) self.itemBox.Add(self.colorBtn) self.itemBox.Add(self.openBtn) self.itemBox.Add(self.saveBtn) self.itemBox.Add(self.maxNodes) self.redBtn.Bind(wx.EVT_BUTTON, self.onEditRed) self.greenBtn.Bind(wx.EVT_BUTTON, self.onEditGreen) self.blueBtn.Bind(wx.EVT_BUTTON, self.onEditBlue) self.freeBtn.Bind(wx.EVT_BUTTON, self.onFreeMode) self.openBtn.Bind(wx.EVT_BUTTON, self.onOpenLut) self.saveBtn.Bind(wx.EVT_BUTTON, self.onSaveLut) self.mainsizer.Add(self.itemBox) self.SetAutoLayout(True) self.SetSizer(self.mainsizer) self.mainsizer.SetSizeHints(self) self.upToDate = 0 self.canvas.Bind(wx.EVT_LEFT_DOWN, self.onEditFunction) self.canvas.Bind(wx.EVT_LEFT_UP, self.updateCTFView) self.canvas.Bind(wx.EVT_LEFT_DCLICK, self.onDeletePoint) self.canvas.Bind(wx.EVT_RIGHT_DOWN, self.onCreatePoint) self.canvas.Bind(wx.EVT_MOTION, self.onDrawFunction) self.pos = (0, 0)
def createAnnotationToolbar(self): """ Method to create a toolbar for the annotations """ icondir = scripting.get_icon_dir() def createBtn(bid, pngname, tooltip, btnclass = buttons.GenBitmapToggleButton): bmp = wx.Image(os.path.join(icondir, pngname), wx.BITMAP_TYPE_PNG).ConvertToBitmap() btn = btnclass(self, bid, bmp) btn.SetBestSize((32, 32)) #btn.SetBitmapLabel() btn.SetToolTipString(tooltip) return btn self.circleBtn = createBtn(MenuManager.ID_ROI_CIRCLE, "Annotation_Circle.png", "Select a circular area of the image") self.sizer.Add(self.circleBtn, (0, 0)) self.rectangleBtn = createBtn(MenuManager.ID_ROI_RECTANGLE, "Annotation_Rectangle.png", \ "Select a rectangular area of the image") self.sizer.Add(self.rectangleBtn, (0, 1)) self.polygonBtn = createBtn(MenuManager.ID_ROI_POLYGON, "Annotation_Polygon.png", \ "Select a polygonal area of the image") self.sizer.Add(self.polygonBtn, (1, 0)) self.scaleBtn = createBtn(MenuManager.ID_ADD_SCALE, "Annotation_Scalebar.png", "Draw a scale bar on the image") self.sizer.Add(self.scaleBtn, (1, 1)) icon = wx.Image(os.path.join(icondir, "Annotation_Delete.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.deleteAnnotationBtn = buttons.GenBitmapButton(self, MenuManager.ID_DEL_ANNOTATION, icon) self.deleteAnnotationBtn.SetBestSize((32,32)) self.deleteAnnotationBtn.SetToolTipString("Delete an annotation") self.sizer.Add(self.deleteAnnotationBtn, (2, 0)) self.colorSelect = csel.ColourSelect(self, -1, "", self.annotateColor, size = (32, 32)) self.colorSelect.Bind(csel.EVT_COLOURSELECT, self.setAnnotationColor) self.sizer.Add(self.colorSelect, (2, 1)) if not scripting.TFLag: self.threeDPolygonBtn = createBtn(MenuManager.ID_ROI_THREE_D_POLYGON, "three_d_polygon.png", "Select one or several polygonal areas of the image in different slices to perform a 3D crop") self.sizer.Add(self.threeDPolygonBtn, (3, 0)) self.threeDCircleBtn = createBtn(MenuManager.ID_ROI_THREE_D_CIRCLE, "three_d_circle.png", "Select one or several circle areas of the image in different slices to perform a 3D crop") self.sizer.Add(self.threeDCircleBtn, (3, 1)) self.threeDRectangleBtn = createBtn(MenuManager.ID_ROI_THREE_D_RECTANGLE, "three_d_rectangle.png", "Select one or several rectangle areas of the image in different slices to perform a 3D crop") self.sizer.Add(self.threeDRectangleBtn, (4, 0)) # Interpolation stuff. :) self.interpolationStart = wx.SpinCtrl(self, wx.ID_ANY, size = (64, -1), min = 1, max = self.visualizer.dataUnit.getDimensions()[2] if self.visualizer.dataUnit != None else 1) self.interpolationStart.SetValue(1) self.sizer.Add(self.interpolationStart, (5, 0), span = (1, 2)) self.interpolationEnd = wx.SpinCtrl(self, wx.ID_ANY, size = (64, -1), min = 1, max = self.visualizer.dataUnit.getDimensions()[2] if self.visualizer.dataUnit != None else 1) self.interpolationEnd.SetValue(1) self.sizer.Add(self.interpolationEnd, (6, 0), span = (1, 2)) self.interpolateButton = wx.Button(self, wx.ID_ANY, "Interpolate", size = (64, 24)) self.sizer.Add(self.interpolateButton, (7, 0), span = (1, 2)) self.interpolateButton.Bind(wx.EVT_BUTTON, self.onInterpolate) self.copyToAllButton = wx.Button(self, wx.ID_ANY, "Copy to all", size = (64, 24)) self.sizer.Add(self.copyToAllButton, (8, 0), span = (1, 2)) self.copyToAllButton.Bind(wx.EVT_BUTTON, self.onCopyAll) #self.textBtn = createBtn(MenuManager.ID_ANNOTATION_TEXT, "text.gif", "Add a text annotation") #self.sizer.Add(self.textBtn, (2, 0)) #self.roiToMaskBtn = createBtn(MenuManager.ID_ROI_TO_MASK, "roitomask.gif", \ # "Convert the selected Region of Interest to a Mask", \ # btnclass = buttons.GenBitmapButton) #self.sizer.Add(self.roiToMaskBtn, (4, 0)) #self.fontBtn = createBtn(MenuManager.ID_ANNOTATION_FONT,"fonts.gif",\ # "Set the font for annotations", btnclass=buttons.GenBitmapButton) #self.sizer.Add(self.fontBtn, (3,1)) #self.resamplingBtn = createBtn(MenuManager.ID_RESAMPLING, "resample.gif", \ # "Enable or disable the resampling of image data") #self.resamplingBtn.SetToggle(1) #self.resampleToFitBtn = createBtn(MenuManager.ID_RESAMPLE_TO_FIT, "resample_tofit.gif", \ # "Enable or disable the resampling of image data") #self.sizer.Add(self.resamplingBtn, (6, 0)) #self.sizer.Add(self.resampleToFitBtn, (6, 1)) # self.recordBtn = buttons.GenToggleButton(self, MenuManager.ID_RECORD_EVENTS, "Record", size=(64,-1)) # self.sizer.Add(self.recordBtn, (7,0), span=(1,2)) # self.playBtn = createBtn(MenuManager.ID_PLAY_EVENTS,"player_play.gif", \ # "Play the recorded events", btnclass=buttons.GenBitmapButton) # self.stopBtn = createBtn(MenuManager.ID_PLAY_EVENTS,"player_pause.gif", \ # "Stop playing the recorded events", btnclass=buttons.GenBitmapButton) # self.sizer.Add(self.playBtn, (8,0)) # self.sizer.Add(self.stopBtn, (8,1)) # self.playBtn.Bind(wx.EVT_BUTTON, self.onPlayRecording) # self.stopBtn.Bind(wx.EVT_BUTTON, self.onStopPlaying) # self.recordBtn.Bind(wx.EVT_BUTTON, self.onRecord) # bmp = wx.Image(os.path.join(iconpath,"resample.gif")).ConvertToBitmap() # tb.DoAddTool(MenuManager.ID_RESAMPLING, "Resampling", bmp, kind = wx.ITEM_CHECK, \ # shortHelp = "Enable or disable the resampling of image data") # wx.EVT_TOOL(self,MenuManager.ID_RESAMPLING,self.onResampleData) # tb.EnableTool(MenuManager.ID_RESAMPLING,0) # tb.ToggleTool(MenuManager.ID_RESAMPLING,1) # sbox = wx.StaticBox(self,-1,"Resampling") # sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) # self.resamplingOff = wx.RadioButton(self,-1,"Disabled", style = wx.RB_GROUP) # self.resamplingOn = wx.RadioButton(self,-1,"Enabled") # self.resampleToFit = wx.RadioButton(self,-1,"To fit") # sboxsizer.Add(self.resamplingOn) # sboxsizer.Add(self.resamplingOff) # sboxsizer.Add(self.resampleToFit) # self.sizer.Add(sboxsizer, (6,0),span=(1,2)) # self.sizer.Add(self.resamplingOn, (7,0),span=(1,2)) # self.sizer.Add(self.resampleToFit, (8,0),span=(1,2)) # self.dimInfo = UIElements.DimensionInfo(self,-1, size=(120,50)) # self.sizer.Add(self.dimInfo, (6,0), span=(1,2)) self.sizerCount = 8 #self.resamplingBtn.Bind(wx.EVT_BUTTON, self.onResampleData) #self.resampleToFitBtn.Bind(wx.EVT_BUTTON, self.onResampleToFit) self.circleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.rectangleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.polygonBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.scaleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) if not scripting.TFLag: self.threeDPolygonBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.threeDCircleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) self.threeDRectangleBtn.Bind(wx.EVT_BUTTON, self.addAnnotation) #self.roiToMaskBtn.Bind(wx.EVT_BUTTON, self.roiToMask) # wx.EVT_TOOL(self.parent,MenuManager.ID_ADD_SCALE,self.addAnnotation) self.deleteAnnotationBtn.Bind(wx.EVT_BUTTON, self.deleteAnnotation)