Example #1
0
File: Main.py Project: cliburn/flow
    def __init__(self, parent=None, id=-1,
                 pos=wx.DefaultPosition,
                 title="Histogram"):
        VizFrame.__init__(self, parent, id, pos, title)
        self.box = wx.BoxSizer(wx.HORIZONTAL)
        self.panel = wx.Panel(self,-1)

        self.widget = HistogramPanel(self, None)
        self.widget.draw()
        
        self.MenuBar = wx.MenuBar()
        self.FileMenu = wx.Menu()
        self.MenuBar.Append(self.FileMenu, "File")
        self.SetMenuBar(self.MenuBar)
        export = self.FileMenu.Append(-1, "Export graphics")
        self.Bind(wx.EVT_MENU, self.OnExport, export)
        self.AddMenu = wx.Menu()
        self.MenuBar.Append(self.AddMenu, "Add histograms")
        self.AddHist = self.AddMenu.Append(-1, "Add New Histogram")
        self.Bind(wx.EVT_MENU, self.OnAddHist, self.AddHist)
        self.AddMenu.AppendSeparator()
        self.ExtraHists = []

        self.RadioButtons(['none'])
        self.box.Add(self.panel,0,wx.EXPAND)
        self.box.Add(self.widget,1,wx.EXPAND)
        self.SetSizer(self.box)
        self.Show()
Example #2
0
File: Main.py Project: cliburn/flow
    def __init__(self, parent=None, id=-1,
                 pos=wx.DefaultPosition,
                 title="3D Density"):
        VizFrame.__init__(self, parent, id, pos, title)
        self.widget = wxVTKRenderWindowInteractor(self,-1)
        style = vtk.vtkInteractorStyleTrackballCamera()
        self.widget.SetInteractorStyle(style)

        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.1, 0.1, 0.7)
        self.widget.GetRenderWindow().AddRenderer(self.ren)


        self.data = None
        self.colors = None
        
        # layout the frame
        self.box = wx.BoxSizer(wx.HORIZONTAL)
        self.leftPanel = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.box)
        self.box.Add(self.leftPanel,0, wx.EXPAND)
        self.box.Add(self.widget,1,wx.EXPAND)
        self.Layout()

        self.MenuBar = wx.MenuBar()
        self.FileMenu = wx.Menu()
        self.GateMenu = wx.Menu()
        self.MenuBar.Append(self.FileMenu, "File")
        self.MenuBar.Append(self.GateMenu, "Gating")
        self.SetMenuBar(self.MenuBar)
        export = self.FileMenu.Append(-1, "Export graphics")
        self.Bind(wx.EVT_MENU, self.OnExport, export)
        self.colorGate = self.GateMenu.Append(-1, "Gate on visible colors only")
        self.Bind(wx.EVT_MENU, self.GateByColor, self.colorGate)
        self.colorGate.Enable(False)
        gate = self.GateMenu.Append(-1, "Capture gated events")
        self.boxAddMenuItem = self.GateMenu.Append(-1, "Add box gate")
        self.GateMenu.AppendSeparator()
        self.boxes = []
        self.Bind(wx.EVT_MENU, self.OnBox, self.boxAddMenuItem)
        
        self.Bind(wx.EVT_MENU, self.Gate, gate)

        self.selectActor = vtk.vtkLODActor()
        self.planes = {} #vtk.vtkPlanes()
        self.clipper = vtk.vtkClipPolyData()
        
        self.boxCount = 1
        self.boxIds = {}

        self.Show()
        self.SendSizeEvent()
Example #3
0
    def __init__(self, parent=None, id=-1, pos=wx.DefaultPosition, title="Box and Whiskers"):
        VizFrame.__init__(self, parent, id, pos, title)
        self.box = wx.BoxSizer(wx.HORIZONTAL)
        self.panel = wx.Panel(self, -1)

        self.widget = BoxWhiskersPanel(self)
        self.widget.draw()

        self.MenuBar = wx.MenuBar()
        self.FileMenu = wx.Menu()
        self.MenuBar.Append(self.FileMenu, "File")
        self.SetMenuBar(self.MenuBar)
        export = self.FileMenu.Append(-1, "Export graphics")
        self.Bind(wx.EVT_MENU, self.OnExport, export)

        self.box.Add(self.panel, 0, wx.EXPAND)
        self.box.Add(self.widget, 1, wx.EXPAND)
        self.SetSizer(self.box)
        self.Show()
Example #4
0
    def __init__(self, parent=None, id=-1,
                 pos=wx.DefaultPosition,
                 title="Flow Control Window"):
        """creates main frame for user interface"""
        VizFrame.__init__(self, parent, id, pos, title)
        self.sp = wx.SplitterWindow(self, -1)
        self.p1 = wx.Panel(self.sp, -1)
        self.p2 = wx.Panel(self.sp, -1)
        self.tree = wx.TreeCtrl(self.p1, -1, wx.DefaultPosition, wx.DefaultSize,
                                wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS)
        self.tree.SetDimensions(0, 0, 100, 100)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEdit, self.tree)
        self.root = self.tree.AddRoot('root')

        self.log = wx.TextCtrl(self.p2, -1, "",
                                       style=wx.TE_RICH|wx.TE_MULTILINE|wx.TE_READONLY, size=(200,100))
        # current server URL
        self.server = 'http://localhost/'

        menubar = wx.MenuBar()


        transforms = {}
        transforms['clip'] = (self.OnClip, "Clip transform")
        transforms['scale'] = (self.OnScale, "Scale transform")
        transforms['normal_scale'] = (self.OnNormalScale, "Normal scale transform")
        transforms['linear'] = (self.OnLinear, "Linear transform")
        transforms['quadratic'] = (self.OnQuadratic, "Quadtratic transform")
        transforms['log'] = (self.OnLog, "Log10 transform")
        transforms['logn'] = (self.OnLogn, "LogN transform")
        transforms['biexponential'] = (self.OnBiexponential, "Biexponential transform")
        transforms['logicle'] = (self.OnLogicle, "Logicle transform")
        transforms['heyperlog'] = (self.OnHyperlog, "Hyperlog transform")
        transforms['arcsinh'] = (self.OnArcsinh, "Arcsinh transform")
        # transform menu
        self.transformMenu = wx.Menu()
        for i in transforms.keys():
            menuitem = self.transformMenu.Append(-1, transforms[i][1])
            self.Bind(wx.EVT_MENU, transforms[i][0], menuitem)

        # filter menu
        self.filterMenu = wx.Menu()
        self.channels = self.filterMenu.Append(-1, "Sub-Sample by channel")
        self.filterMenu.AppendSeparator()
        self.events_index = self.filterMenu.Append(-1, "Sub-Sample events: index")
        self.events_random = self.filterMenu.Append(-1, "Sub-Sample events: random choice without replacement")
        self.events_replace = self.filterMenu.Append(-1, "Sub-Sample events: random choice with replacement")

        # bind filter menuitems
        self.Bind(wx.EVT_MENU, self.OnChannels, self.channels)
        self.Bind(wx.EVT_MENU, self.OnEventsIndex, self.events_index)
        self.Bind(wx.EVT_MENU, self.OnEventsRandom, self.events_random)
        self.Bind(wx.EVT_MENU, self.OnEventsReplace, self.events_replace)

        # ontology menu
        self.ontologyMenu = wx.Menu()
        loadOntology = self.ontologyMenu.Append(-1, "Load OBO file")
        self.Bind(wx.EVT_MENU, self.OnLoadOntology, loadOntology)

        # remote process menu
        self.remoteProcessMenu = wx.Menu()
        submit_job = self.remoteProcessMenu.Append(-1, "Submit job to remote process")
        submit_batch = self.remoteProcessMenu.Append(-1, "Submit batch jobs to remote process")
        self.Bind(wx.EVT_MENU, self.OnSubmitJob, submit_job)
        self.Bind(wx.EVT_MENU, self.OnSubmitBatch, submit_batch)

        self.SetMenuBar(menubar)
        #statusbar = self.CreateStatusBar()
        # createEdit needs to be called before CreatePopup
        # to ensure menu's wx.IDs are consistent
        self.edit = self.CreateEdit()
        self.popup = self.CreatePopup()
        self.zPopMenuItem = None
        self.Bind(wx.EVT_CONTEXT_MENU, self.OnShowPopup)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnShowPopup, self.tree)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnDisplayItem, self.tree)

        # default dir for OBO files
        self.defaultOBOdir = "."
        self.exportDir = self.io.defaultDir.replace('results','data')
Example #5
0
    def __init__(self, parent=None, id=-1, pos=wx.DefaultPosition, title="2D Density", show=True):

        VizFrame.__init__(self, parent, id, pos, title)
        # self.widget = TwoDPanel(None, 1, 1,self)
        self.widget = TwoDPanel(self, None, None)

        # layout the frame
        self.box = wx.BoxSizer(wx.HORIZONTAL)
        self.leftPanel = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.box)
        self.box.Add(self.leftPanel, 0, wx.EXPAND)
        self.box.Add(self.widget, 1, wx.EXPAND)
        self.Layout()
        # self.widget.draw()

        self.MenuBar = wx.MenuBar()
        self.FileMenu = wx.Menu()
        self.EditMenu = wx.Menu()
        self.VisualMenu = wx.Menu()
        self.GateMenu = wx.Menu()
        self.MenuBar.Append(self.FileMenu, "File")
        self.MenuBar.Append(self.EditMenu, "Edit")
        self.MenuBar.Append(self.VisualMenu, "Visuals")
        self.MenuBar.Append(self.GateMenu, "Gating")
        self.SetMenuBar(self.MenuBar)
        self.widget.scatter = self.VisualMenu.AppendCheckItem(-1, "Scatter Plot")
        self.widget.scatter.Check(True)
        self.widget.contour = self.VisualMenu.AppendCheckItem(-1, "Contour Plot")
        self.widget.ellipse = self.VisualMenu.AppendCheckItem(-1, "Confidence Ellipse")
        edit_fig = self.EditMenu.Append(-1, "Change figure attributes")
        edit_labels = self.EditMenu.Append(-1, "Change cell subset labels")
        self.Bind(wx.EVT_MENU, self.OnChangeFigAttr, edit_fig)
        self.Bind(wx.EVT_MENU, self.OnZLabel, edit_labels)

        self.colorGate = self.GateMenu.Append(-1, "Gate on visible colors only")
        polyGate = self.GateMenu.Append(-1, "Add 4-polygon gate")
        quadGate = self.GateMenu.Append(-1, "Add quadrant gate")
        removePolyGate = self.GateMenu.Append(-1, "Remove 4-polygon gate")
        removeQuadGate = self.GateMenu.Append(-1, "Remove quadrant gate")
        gate = self.GateMenu.Append(-1, "Capture gated events")
        self.ellipses = self.GateMenu.Append(-1, "Specify ellipse confidence")

        self.GateMenu.AppendSeparator()
        copyGate = self.GateMenu.Append(-1, "Copy 4-polygon gate")
        pasteGate = self.GateMenu.Append(-1, "Paste 4-polygon gate")

        self.Bind(wx.EVT_MENU, self.GateByColor, self.colorGate)
        self.colorGate.Enable(False)
        self.Bind(wx.EVT_MENU, self.OnEllipses, self.ellipses)
        self.Bind(wx.EVT_MENU, self.OnAddPolyGate, polyGate)
        self.Bind(wx.EVT_MENU, self.OnAddQuadGate, quadGate)
        self.Bind(wx.EVT_MENU, self.OnRemovePolyGate, removePolyGate)
        self.Bind(wx.EVT_MENU, self.OnRemoveQuadGate, removeQuadGate)
        self.Bind(wx.EVT_MENU, self.Gate, gate)
        self.Bind(wx.EVT_MENU, self.OnCopyGate, copyGate)
        self.Bind(wx.EVT_MENU, self.OnPasteGate, pasteGate)

        # try to save figures
        export = self.FileMenu.Append(-1, "Export graphics")
        self.Bind(wx.EVT_MENU, self.OnExport, export)

        self.Bind(wx.EVT_MENU, self.OnMenuSwitch, self.widget.scatter)
        self.Bind(wx.EVT_MENU, self.OnMenuSwitch, self.widget.contour)
        self.Bind(wx.EVT_MENU, self.OnMenuSwitch, self.widget.ellipse)
        if show:
            self.Show()
            self.SendSizeEvent()
        self.model = None