コード例 #1
0
ファイル: cpa.py プロジェクト: jburel/CellProfiler-Analyst
 def on_show_about(self, evt):
     ''' Shows a message box with the version number etc.'''
     message = ('CellProfiler Analyst was developed at The Broad Institute\n'
                'Imaging Platform and is distributed under the GNU General\n'
                'Public License version 2.')
     info = wx.AboutDialogInfo()
     info.SetIcon(icons.get_cpa_icon())
     info.SetName('CellProfiler Analyst 2.0 (%s)'%('r'+str(__version__) or 'unknown revision'))
     info.SetDescription(message)
     info.AddDeveloper('Adam Fraser')
     info.AddDeveloper('Thouis (Ray) Jones')
     info.AddDeveloper('Vebjorn Ljosa')
     info.SetWebSite('www.CellProfiler.org')
     wx.AboutBox(info)
コード例 #2
0
ファイル: cpa.py プロジェクト: yoanisgil/CellProfiler-Analyst
 def on_show_about(self, evt):
     ''' Shows a message box with the version number etc.'''
     message = (
         'CellProfiler Analyst was developed at The Broad Institute\n'
         'Imaging Platform and is distributed under the GNU General\n'
         'Public License version 2.')
     info = wx.AboutDialogInfo()
     info.SetIcon(icons.get_cpa_icon())
     info.SetName('CellProfiler Analyst 2.0 (%s)' %
                  ('r' + str(__version__) or 'unknown revision'))
     info.SetDescription(message)
     info.AddDeveloper('Adam Fraser')
     info.AddDeveloper('Thouis (Ray) Jones')
     info.AddDeveloper('Vebjorn Ljosa')
     info.SetWebSite('www.CellProfiler.org')
     wx.AboutBox(info)
コード例 #3
0
ファイル: cpa.py プロジェクト: jburel/CellProfiler-Analyst
    def __init__(self, properties, parent, id=-1, **kwargs):
        wx.Frame.__init__(self, parent, id=id, title='CellProfiler Analyst 2.0 (r%s)'%(__version__), **kwargs)

        self.properties = properties
        self.SetIcon(get_cpa_icon())
        if not sys.platform.startswith('win'):
            # this is good for Mac, but on windows creates a (currently) unused icon in the system tray
            self.tbicon = wx.TaskBarIcon()
            self.tbicon.SetIcon(get_cpa_icon(), 'CellProfiler Analyst 2.0')
        else:
            self.tbicon = None
        self.SetName('CPA')
        self.Center(wx.HORIZONTAL)
        self.CreateStatusBar()

        #
        # Setup toolbar
        #
        tb = self.CreateToolBar(wx.TB_HORZ_TEXT|wx.TB_FLAT)
        tb.SetToolBitmapSize((32,32))
        tb.SetSize((-1,132))
        tb.AddLabelTool(ID_CLASSIFIER, 'Classifier', icons.classifier.ConvertToBitmap(), shortHelp='Classifier', longHelp='Launch Classifier')
        tb.AddLabelTool(ID_PLATE_VIEWER, 'PlateViewer', icons.platemapbrowser.ConvertToBitmap(), shortHelp='Plate Viewer', longHelp='Launch Plate Viewer')
        tb.AddLabelTool(ID_TABLE_VIEWER, 'TableViewer', icons.data_grid.ConvertToBitmap(), shortHelp='Table Viewer', longHelp='Launch TableViewer')
        tb.AddLabelTool(ID_IMAGE_VIEWER, 'ImageViewer', icons.image_viewer.ConvertToBitmap(), shortHelp='Image Viewer', longHelp='Launch ImageViewer')
        tb.AddLabelTool(ID_SCATTER, 'ScatterPlot', icons.scatter.ConvertToBitmap(), shortHelp='Scatter Plot', longHelp='Launch Scatter Plot')
        tb.AddLabelTool(ID_HISTOGRAM, 'Histogram', icons.histogram.ConvertToBitmap(), shortHelp='Histogram', longHelp='Launch Histogram')
        tb.AddLabelTool(ID_DENSITY, 'DensityPlot', icons.density.ConvertToBitmap(), shortHelp='Density Plot', longHelp='Launch Density Plot')
        tb.AddLabelTool(ID_BOXPLOT, 'BoxPlot', icons.boxplot.ConvertToBitmap(), shortHelp='Box Plot', longHelp='Launch Box Plot')
        tb.Realize()
        # TODO: IMG-1071 - The following was meant to resize based on the toolbar size but GetEffectiveMinSize breaks on Macs
        #self.SetDimensions(-1, -1, tb.GetEffectiveMinSize().width, -1, wx.SIZE_USE_EXISTING)

        #
        # Setup menu items
        #
        self.SetMenuBar(wx.MenuBar())
        fileMenu = wx.Menu()
        savePropertiesMenuItem = fileMenu.Append(-1, 'Save properties\tCtrl+S', help='Save the properties.')
##        loadWorkspaceMenuItem = fileMenu.Append(-1, 'Load properties\tCtrl+O', help='Open another properties file.')
        fileMenu.AppendSeparator()
        saveWorkspaceMenuItem = fileMenu.Append(-1, 'Save workspace\tCtrl+Shift+S', help='Save the currently open plots and settings.')
        loadWorkspaceMenuItem = fileMenu.Append(-1, 'Load workspace\tCtrl+Shift+O', help='Open plots saved in a previous workspace.')
        fileMenu.AppendSeparator()
        saveLogMenuItem = fileMenu.Append(-1, 'Save log', help='Save the contents of the log window.')
        fileMenu.AppendSeparator()
        self.exitMenuItem = fileMenu.Append(wx.ID_EXIT, 'Exit\tCtrl+Q', help='Exit classifier')
        self.GetMenuBar().Append(fileMenu, 'File')

        toolsMenu = wx.Menu()
        classifierMenuItem  = toolsMenu.Append(ID_CLASSIFIER, 'Classifier\tCtrl+Shift+C', help='Launches Classifier.')
        plateMapMenuItem    = toolsMenu.Append(ID_PLATE_VIEWER, 'Plate Viewer\tCtrl+Shift+P', help='Launches the Plate Viewer tool.')
        dataTableMenuItem   = toolsMenu.Append(ID_TABLE_VIEWER, 'Data Table\tCtrl+Shift+T', help='Launches the Data Table tool.')
        imageViewerMenuItem = toolsMenu.Append(ID_IMAGE_VIEWER, 'Image Viewer\tCtrl+Shift+I', help='Launches the ImageViewer tool.')
        scatterMenuItem     = toolsMenu.Append(ID_SCATTER, 'Scatter Plot\tCtrl+Shift+A', help='Launches the Scatter Plot tool.')
        histogramMenuItem   = toolsMenu.Append(ID_HISTOGRAM, 'Histogram Plot\tCtrl+Shift+H', help='Launches the Histogram Plot tool.')
        densityMenuItem     = toolsMenu.Append(ID_DENSITY, 'Density Plot\tCtrl+Shift+D', help='Launches the Density Plot tool.')
        boxplotMenuItem     = toolsMenu.Append(ID_BOXPLOT, 'Box Plot\tCtrl+Shift+B', help='Launches the Box Plot tool.')
        self.GetMenuBar().Append(toolsMenu, 'Tools')

        logMenu = wx.Menu()        
        debugMenuItem    = logMenu.AppendRadioItem(-1, 'Debug\tCtrl+1', help='Logging window will display debug-level messages.')
        infoMenuItem     = logMenu.AppendRadioItem(-1, 'Info\tCtrl+2', help='Logging window will display info-level messages.')
        warnMenuItem     = logMenu.AppendRadioItem(-1, 'Warnings\tCtrl+3', help='Logging window will display warning-level messages.')
        errorMenuItem    = logMenu.AppendRadioItem(-1, 'Errors\tCtrl+4', help='Logging window will display error-level messages.')
        criticalMenuItem = logMenu.AppendRadioItem(-1, 'Critical\tCtrl+5', help='Logging window will only display critical messages.')
        infoMenuItem.Check()
        self.GetMenuBar().Append(logMenu, 'Logging')

        advancedMenu = wx.Menu()
        normalizeMenuItem = advancedMenu.Append(-1, 'Launch feature normalization tool', help='Launches a tool for generating normalized values for measurement columns in your tables.')
        queryMenuItem = advancedMenu.Append(-1, 'Launch SQL query tool', help='Opens a tool for making SQL queries to the CPA database. Advanced users only.')
        clearTableLinksMenuItem = advancedMenu.Append(-1, 'Clear table linking information', help='Removes the tables from your database that tell CPA how to link your tables.')
        self.GetMenuBar().Append(advancedMenu, 'Advanced')

        helpMenu = wx.Menu()
        aboutMenuItem = helpMenu.Append(-1, text='About', help='About CPA 2.0')
        self.GetMenuBar().Append(helpMenu, 'Help')

        # console and logging
        self.console = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE|wx.TE_READONLY)
        self.console.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
        self.console.SetBackgroundColour('#111111')

        self.console.SetForegroundColour('#DDDDDD')
        log_level = logging.DEBUG
        self.logr = logging.getLogger()
        self.set_log_level(log_level)
        self.log_text = ''
        def update(x):
            self.log_text += x+'\n'
        hdlr = FuncLog(update)
#        hdlr.setFormatter(logging.Formatter('[%(levelname)s] %(message)s'))
#        hdlr.setFormatter(logging.Formatter('%(levelname)s | %(name)s | %(message)s [@ %(asctime)s in %(filename)s:%(lineno)d]'))
        self.logr.addHandler(hdlr)
        # log_levels are 10,20,30,40,50
        logMenu.GetMenuItems()[(log_level/10)-1].Check()

        self.Bind(wx.EVT_MENU, lambda(_):self.set_log_level(logging.DEBUG), debugMenuItem)
        self.Bind(wx.EVT_MENU, lambda(_):self.set_log_level(logging.INFO), infoMenuItem)
        self.Bind(wx.EVT_MENU, lambda(_):self.set_log_level(logging.WARN), warnMenuItem)
        self.Bind(wx.EVT_MENU, lambda(_):self.set_log_level(logging.ERROR), errorMenuItem)
        self.Bind(wx.EVT_MENU, lambda(_):self.set_log_level(logging.CRITICAL), criticalMenuItem)
        self.Bind(wx.EVT_MENU, self.on_save_properties, savePropertiesMenuItem)
        self.Bind(wx.EVT_MENU, self.on_save_workspace, saveWorkspaceMenuItem)
        self.Bind(wx.EVT_MENU, self.on_load_workspace, loadWorkspaceMenuItem)        
        self.Bind(wx.EVT_MENU, self.save_log, saveLogMenuItem)
        self.Bind(wx.EVT_MENU, self.launch_normalization_tool, normalizeMenuItem)
        self.Bind(wx.EVT_MENU, self.clear_link_tables, clearTableLinksMenuItem)
        self.Bind(wx.EVT_MENU, self.launch_query_maker, queryMenuItem)
        self.Bind(wx.EVT_MENU, self.on_show_about, aboutMenuItem)
        self.Bind(wx.EVT_TOOL, self.launch_classifier, id=ID_CLASSIFIER)
        self.Bind(wx.EVT_TOOL, self.launch_plate_map_browser, id=ID_PLATE_VIEWER)
        self.Bind(wx.EVT_TOOL, self.launch_table_viewer, id=ID_TABLE_VIEWER)
        self.Bind(wx.EVT_TOOL, self.launch_image_viewer, id=ID_IMAGE_VIEWER)        
        self.Bind(wx.EVT_TOOL, self.launch_scatter_plot, id=ID_SCATTER)
        self.Bind(wx.EVT_TOOL, self.launch_histogram_plot, id=ID_HISTOGRAM)
        self.Bind(wx.EVT_TOOL, self.launch_density_plot, id=ID_DENSITY)
        self.Bind(wx.EVT_TOOL, self.launch_box_plot, id=ID_BOXPLOT)
        self.Bind(wx.EVT_MENU, self.on_close, self.exitMenuItem)
        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(wx.EVT_IDLE, self.on_idle)
コード例 #4
0
ファイル: cpa.py プロジェクト: yoanisgil/CellProfiler-Analyst
    def __init__(self, properties, parent, id=-1, **kwargs):
        wx.Frame.__init__(self,
                          parent,
                          id=id,
                          title='CellProfiler Analyst 2.0 (r%s)' %
                          (__version__),
                          **kwargs)

        self.properties = properties
        self.SetIcon(get_cpa_icon())
        if not sys.platform.startswith('win'):
            # this is good for Mac, but on windows creates a (currently) unused icon in the system tray
            self.tbicon = wx.TaskBarIcon()
            self.tbicon.SetIcon(get_cpa_icon(), 'CellProfiler Analyst 2.0')
        else:
            self.tbicon = None
        self.SetName('CPA')
        self.Center(wx.HORIZONTAL)
        self.CreateStatusBar()

        #
        # Setup toolbar
        #
        tb = self.CreateToolBar(wx.TB_HORZ_TEXT | wx.TB_FLAT)
        tb.SetToolBitmapSize((32, 32))
        tb.SetSize((-1, 132))
        tb.AddLabelTool(ID_CLASSIFIER,
                        'Classifier',
                        icons.classifier.ConvertToBitmap(),
                        shortHelp='Classifier',
                        longHelp='Launch Classifier')
        tb.AddLabelTool(ID_PLATE_VIEWER,
                        'PlateViewer',
                        icons.platemapbrowser.ConvertToBitmap(),
                        shortHelp='Plate Viewer',
                        longHelp='Launch Plate Viewer')
        tb.AddLabelTool(ID_TABLE_VIEWER,
                        'TableViewer',
                        icons.data_grid.ConvertToBitmap(),
                        shortHelp='Table Viewer',
                        longHelp='Launch TableViewer')
        tb.AddLabelTool(ID_IMAGE_VIEWER,
                        'ImageViewer',
                        icons.image_viewer.ConvertToBitmap(),
                        shortHelp='Image Viewer',
                        longHelp='Launch ImageViewer')
        tb.AddLabelTool(ID_SCATTER,
                        'ScatterPlot',
                        icons.scatter.ConvertToBitmap(),
                        shortHelp='Scatter Plot',
                        longHelp='Launch Scatter Plot')
        tb.AddLabelTool(ID_HISTOGRAM,
                        'Histogram',
                        icons.histogram.ConvertToBitmap(),
                        shortHelp='Histogram',
                        longHelp='Launch Histogram')
        tb.AddLabelTool(ID_DENSITY,
                        'DensityPlot',
                        icons.density.ConvertToBitmap(),
                        shortHelp='Density Plot',
                        longHelp='Launch Density Plot')
        tb.AddLabelTool(ID_BOXPLOT,
                        'BoxPlot',
                        icons.boxplot.ConvertToBitmap(),
                        shortHelp='Box Plot',
                        longHelp='Launch Box Plot')
        tb.Realize()
        # TODO: IMG-1071 - The following was meant to resize based on the toolbar size but GetEffectiveMinSize breaks on Macs
        #self.SetDimensions(-1, -1, tb.GetEffectiveMinSize().width, -1, wx.SIZE_USE_EXISTING)

        #
        # Setup menu items
        #
        self.SetMenuBar(wx.MenuBar())
        fileMenu = wx.Menu()
        savePropertiesMenuItem = fileMenu.Append(-1,
                                                 'Save properties\tCtrl+S',
                                                 help='Save the properties.')
        ##        loadWorkspaceMenuItem = fileMenu.Append(-1, 'Load properties\tCtrl+O', help='Open another properties file.')
        fileMenu.AppendSeparator()
        saveWorkspaceMenuItem = fileMenu.Append(
            -1,
            'Save workspace\tCtrl+Shift+S',
            help='Save the currently open plots and settings.')
        loadWorkspaceMenuItem = fileMenu.Append(
            -1,
            'Load workspace\tCtrl+Shift+O',
            help='Open plots saved in a previous workspace.')
        fileMenu.AppendSeparator()
        saveLogMenuItem = fileMenu.Append(
            -1, 'Save log', help='Save the contents of the log window.')
        fileMenu.AppendSeparator()
        self.exitMenuItem = fileMenu.Append(wx.ID_EXIT,
                                            'Exit\tCtrl+Q',
                                            help='Exit classifier')
        self.GetMenuBar().Append(fileMenu, 'File')

        toolsMenu = wx.Menu()
        classifierMenuItem = toolsMenu.Append(ID_CLASSIFIER,
                                              'Classifier\tCtrl+Shift+C',
                                              help='Launches Classifier.')
        plateMapMenuItem = toolsMenu.Append(
            ID_PLATE_VIEWER,
            'Plate Viewer\tCtrl+Shift+P',
            help='Launches the Plate Viewer tool.')
        dataTableMenuItem = toolsMenu.Append(
            ID_TABLE_VIEWER,
            'Data Table\tCtrl+Shift+T',
            help='Launches the Data Table tool.')
        imageViewerMenuItem = toolsMenu.Append(
            ID_IMAGE_VIEWER,
            'Image Viewer\tCtrl+Shift+I',
            help='Launches the ImageViewer tool.')
        scatterMenuItem = toolsMenu.Append(
            ID_SCATTER,
            'Scatter Plot\tCtrl+Shift+A',
            help='Launches the Scatter Plot tool.')
        histogramMenuItem = toolsMenu.Append(
            ID_HISTOGRAM,
            'Histogram Plot\tCtrl+Shift+H',
            help='Launches the Histogram Plot tool.')
        densityMenuItem = toolsMenu.Append(
            ID_DENSITY,
            'Density Plot\tCtrl+Shift+D',
            help='Launches the Density Plot tool.')
        boxplotMenuItem = toolsMenu.Append(ID_BOXPLOT,
                                           'Box Plot\tCtrl+Shift+B',
                                           help='Launches the Box Plot tool.')
        self.GetMenuBar().Append(toolsMenu, 'Tools')

        logMenu = wx.Menu()
        debugMenuItem = logMenu.AppendRadioItem(
            -1,
            'Debug\tCtrl+1',
            help='Logging window will display debug-level messages.')
        infoMenuItem = logMenu.AppendRadioItem(
            -1,
            'Info\tCtrl+2',
            help='Logging window will display info-level messages.')
        warnMenuItem = logMenu.AppendRadioItem(
            -1,
            'Warnings\tCtrl+3',
            help='Logging window will display warning-level messages.')
        errorMenuItem = logMenu.AppendRadioItem(
            -1,
            'Errors\tCtrl+4',
            help='Logging window will display error-level messages.')
        criticalMenuItem = logMenu.AppendRadioItem(
            -1,
            'Critical\tCtrl+5',
            help='Logging window will only display critical messages.')
        infoMenuItem.Check()
        self.GetMenuBar().Append(logMenu, 'Logging')

        advancedMenu = wx.Menu()
        normalizeMenuItem = advancedMenu.Append(
            -1,
            'Launch feature normalization tool',
            help=
            'Launches a tool for generating normalized values for measurement columns in your tables.'
        )
        queryMenuItem = advancedMenu.Append(
            -1,
            'Launch SQL query tool',
            help=
            'Opens a tool for making SQL queries to the CPA database. Advanced users only.'
        )
        clearTableLinksMenuItem = advancedMenu.Append(
            -1,
            'Clear table linking information',
            help=
            'Removes the tables from your database that tell CPA how to link your tables.'
        )
        self.GetMenuBar().Append(advancedMenu, 'Advanced')

        helpMenu = wx.Menu()
        aboutMenuItem = helpMenu.Append(-1, text='About', help='About CPA 2.0')
        self.GetMenuBar().Append(helpMenu, 'Help')

        # console and logging
        self.console = wx.TextCtrl(self,
                                   -1,
                                   '',
                                   style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.console.SetFont(
            wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL))
        self.console.SetBackgroundColour('#111111')

        self.console.SetForegroundColour('#DDDDDD')
        log_level = logging.DEBUG
        self.logr = logging.getLogger()
        self.set_log_level(log_level)
        self.log_text = ''

        def update(x):
            self.log_text += x + '\n'

        hdlr = FuncLog(update)
        #        hdlr.setFormatter(logging.Formatter('[%(levelname)s] %(message)s'))
        #        hdlr.setFormatter(logging.Formatter('%(levelname)s | %(name)s | %(message)s [@ %(asctime)s in %(filename)s:%(lineno)d]'))
        self.logr.addHandler(hdlr)
        # log_levels are 10,20,30,40,50
        logMenu.GetMenuItems()[(log_level / 10) - 1].Check()

        self.Bind(wx.EVT_MENU, lambda (_): self.set_log_level(logging.DEBUG),
                  debugMenuItem)
        self.Bind(wx.EVT_MENU, lambda (_): self.set_log_level(logging.INFO),
                  infoMenuItem)
        self.Bind(wx.EVT_MENU, lambda (_): self.set_log_level(logging.WARN),
                  warnMenuItem)
        self.Bind(wx.EVT_MENU, lambda (_): self.set_log_level(logging.ERROR),
                  errorMenuItem)
        self.Bind(wx.EVT_MENU, lambda
                  (_): self.set_log_level(logging.CRITICAL), criticalMenuItem)
        self.Bind(wx.EVT_MENU, self.on_save_properties, savePropertiesMenuItem)
        self.Bind(wx.EVT_MENU, self.on_save_workspace, saveWorkspaceMenuItem)
        self.Bind(wx.EVT_MENU, self.on_load_workspace, loadWorkspaceMenuItem)
        self.Bind(wx.EVT_MENU, self.save_log, saveLogMenuItem)
        self.Bind(wx.EVT_MENU, self.launch_normalization_tool,
                  normalizeMenuItem)
        self.Bind(wx.EVT_MENU, self.clear_link_tables, clearTableLinksMenuItem)
        self.Bind(wx.EVT_MENU, self.launch_query_maker, queryMenuItem)
        self.Bind(wx.EVT_MENU, self.on_show_about, aboutMenuItem)
        self.Bind(wx.EVT_TOOL, self.launch_classifier, id=ID_CLASSIFIER)
        self.Bind(wx.EVT_TOOL,
                  self.launch_plate_map_browser,
                  id=ID_PLATE_VIEWER)
        self.Bind(wx.EVT_TOOL, self.launch_table_viewer, id=ID_TABLE_VIEWER)
        self.Bind(wx.EVT_TOOL, self.launch_image_viewer, id=ID_IMAGE_VIEWER)
        self.Bind(wx.EVT_TOOL, self.launch_scatter_plot, id=ID_SCATTER)
        self.Bind(wx.EVT_TOOL, self.launch_histogram_plot, id=ID_HISTOGRAM)
        self.Bind(wx.EVT_TOOL, self.launch_density_plot, id=ID_DENSITY)
        self.Bind(wx.EVT_TOOL, self.launch_box_plot, id=ID_BOXPLOT)
        self.Bind(wx.EVT_MENU, self.on_close, self.exitMenuItem)
        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(wx.EVT_IDLE, self.on_idle)
コード例 #5
0
    def __init__(self, properties=None, parent=None, id=ID_IMAGE_GALLERY, **kwargs):

        if properties is not None:
            global p
            p = properties
            global db
            db = dbconnect.DBConnect.getInstance()

        wx.Frame.__init__(self, parent, id=id, title='CPA/ImageGallery - %s' % \
                                                     (os.path.basename(p._filename)), size=(800, 600), **kwargs)
        if parent is None and not sys.platform.startswith('win'):
            self.tbicon = wx.TaskBarIcon()
            self.tbicon.SetIcon(icons.get_cpa_icon(), 'CPA/ImageGallery')
        else:
            self.SetIcon(icons.get_cpa_icon())
        self.SetName('ImageGallery')

        db.register_gui_parent(self)

        global dm
        dm = DataModel.getInstance()

        if not p.is_initialized():
            logging.critical('ImageGallery requires a properties file. Exiting.')
            raise Exception('ImageGallery requires a properties file. Exiting.')

        self.pmb = None
        self.worker = None
        self.trainingSet = None
        self.classBins = []
        self.binsCreated = 0
        self.chMap = p.image_channel_colors[:]
        self.toggleChMap = p.image_channel_colors[
                           :]  # used to store previous color mappings when toggling colors on/off with ctrl+1,2,3...
        self.brightness = 1.0
        self.scale = 1.0 
        
        self.contrast = 'Linear'
        self.defaultTSFileName = None
        self.defaultModelFileName = None
        self.lastScoringFilter = None

        self.menuBar = wx.MenuBar()
        self.SetMenuBar(self.menuBar)
        self.CreateMenus()

        self.CreateStatusBar()

        #### Create GUI elements
        # Top level - three split windows
        self.splitter = wx.SplitterWindow(self, style=wx.NO_BORDER | wx.SP_3DSASH)
        self.fetch_and_rules_panel = wx.Panel(self.splitter)
        self.bins_splitter = wx.SplitterWindow(self.splitter, style=wx.NO_BORDER | wx.SP_3DSASH)

        # fetch & rules
        self.fetch_panel = wx.Panel(self.fetch_and_rules_panel)
        self.find_rules_panel = wx.Panel(self.fetch_and_rules_panel)

        # sorting bins
        self.gallery_panel = wx.Panel(self.bins_splitter)
        o_label = p.object_name[0] if p.classification_type == 'image' else '' + ' image gallery'
        self.gallery_box = wx.StaticBox(self.gallery_panel, label=o_label)
        self.gallery_sizer = wx.StaticBoxSizer(self.gallery_box, wx.VERTICAL)
        self.galleryBin = sortbin.SortBin(parent=self.gallery_panel,
                                               classifier=self,
                                               label='image gallery',
                                               parentSizer=self.gallery_sizer)
        self.gallery_sizer.Add(self.galleryBin, proportion=1, flag=wx.EXPAND)
        self.gallery_panel.SetSizer(self.gallery_sizer)
        self.objects_bin_panel = wx.Panel(self.bins_splitter)

        # fetch objects interface
        self.startId = wx.TextCtrl(self.fetch_panel, id=-1, value='1', size=(60, -1), style=wx.TE_PROCESS_ENTER)
        self.endId = wx.TextCtrl(self.fetch_panel, id=-1, value='100', size=(60, -1), style=wx.TE_PROCESS_ENTER)
        self.fetchChoice = wx.Choice(self.fetch_panel, id=-1, choices=['range','all','individual'])
        self.fetchChoice.SetSelection(0)
        self.filterChoice = wx.Choice(self.fetch_panel, id=-1,
                                      choices=['experiment'] + p._filters_ordered + p._groups_ordered + [
                                          CREATE_NEW_FILTER])
        self.fetchFromGroupSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.fetchBtn = wx.Button(self.fetch_panel, -1, 'Fetch!')

        #### Create Sizers
        self.fetchSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.find_rules_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.fetch_and_rules_sizer = wx.BoxSizer(wx.VERTICAL)
        self.classified_bins_sizer = wx.BoxSizer(wx.HORIZONTAL)

        #### Add elements to sizers and splitters
        # fetch panel
        self.fetchSizer.AddStretchSpacer()
        self.fetchSizer.Add(wx.StaticText(self.fetch_panel, -1, 'Fetch '), flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchSizer.Add(self.fetchChoice, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchTxt = wx.StaticText(self.fetch_panel, -1, label='of image IDs:')
        self.fetchSizer.Add(self.fetchTxt, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchSizer.Add(self.startId, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchTxt2 = wx.StaticText(self.fetch_panel, -1, label='to')
        self.fetchSizer.Add(self.fetchTxt2, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchSizer.Add(self.endId, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        #self.fetchSizer.Add(self.obClassChoice, flag=wx.ALIGN_CENTER_VERTICAL)
        #self.fetchSizer.AddSpacer((5, 20))
        self.fetchTxt3 = wx.StaticText(self.fetch_panel, -1, label='images')
        self.fetchSizer.Add(self.fetchTxt3, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchSizer.Add(wx.StaticText(self.fetch_panel, -1, 'from'), flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchSizer.Add(self.filterChoice, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((10, 20))
        self.fetchSizer.Add(self.fetchFromGroupSizer, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddSpacer((5, 20))
        self.fetchSizer.Add(self.fetchBtn, flag=wx.ALIGN_CENTER_VERTICAL)
        self.fetchSizer.AddStretchSpacer()
        self.fetch_panel.SetSizerAndFit(self.fetchSizer)

        # fetch and rules panel
        self.fetch_and_rules_sizer.Add((5, 5))
        self.fetch_and_rules_sizer.Add(self.fetch_panel, flag=wx.EXPAND)
        self.fetch_and_rules_sizer.Add((5, 5))
        self.fetch_and_rules_panel.SetSizerAndFit(self.fetch_and_rules_sizer)

        # classified bins panel
        self.objects_bin_panel.SetSizer(self.classified_bins_sizer)

        # splitter windows
        self.splitter.SplitHorizontally(self.fetch_and_rules_panel, self.bins_splitter,
                                        self.fetch_and_rules_panel.GetMinSize()[1])
        self.bins_splitter.SplitHorizontally(self.gallery_panel, self.objects_bin_panel)

        self.splitter.SetSashGravity(0.0)
        self.bins_splitter.SetSashGravity(0.5)

        self.splitter.SetMinimumPaneSize(max(50, self.fetch_and_rules_panel.GetMinHeight()))
        self.bins_splitter.SetMinimumPaneSize(50)
        self.SetMinSize((self.fetch_and_rules_panel.GetMinWidth(), 4 * 50 + self.fetch_and_rules_panel.GetMinHeight()))

        # Set initial state
        self.filterChoice.SetSelection(0)

        # JEN - Start Add
        # self.openDimensReduxBtn.Disable()
        # JEN - End Add
        self.fetchSizer.Hide(self.fetchFromGroupSizer)

        #####################
        #### GUI Section ####
        #####################

        # add the default classes
        #for class in range(1, num_classes+1):
        self.AddSortClass('objects of selected image')
        #self.AddSortClass('negative')

        self.Layout()

        self.Center()
        self.MapChannels(p.image_channel_colors[:])
        self.BindMouseOverHelpText()

        #self.Bind(wx.EVT_BUTTON, self.OnInspect, self.inspectBtn)
        # JEN - Start Add
        # self.Bind(wx.EVT_BUTTON, self.OpenDimensRedux, self.openDimensReduxBtn)
        # JEN - End Add
        self.Bind(wx.EVT_BUTTON, self.OnFetch, self.fetchBtn)
        self.startId.Bind(wx.EVT_TEXT, self.ValidateIntegerField)
        self.startId.Bind(wx.EVT_TEXT_ENTER, self.OnFetch)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_CHAR, self.OnKey)  # Doesn't work for windows
        tilecollection.EVT_TILE_UPDATED(self, self.OnTileUpdated)
        self.Bind(sortbin.EVT_QUANTITY_CHANGED, self.QuantityChanged)

        self.Bind(wx.EVT_CHOICE, self.OnSelectFetchChoice, self.fetchChoice)
        self.Bind(wx.EVT_CHOICE, self.OnSelectFilter, self.filterChoice)