def initialize(self):
        leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
        sb = wx.StaticBox(self, -1, 'Mosaics')
        sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL)

        choices = self.node.calclients.keys()
        self.widgets['calibration parameter'] = Choice(self,
                                                       -1,
                                                       choices=choices)
        self.widgets['scale image'] = wx.CheckBox(self, -1, 'Scale image to')
        self.widgets['scale size'] = IntEntry(self, -1, min=1, chars=4)
        self.widgets['create on tile change'] = Choice(
            self, -1, choices=['all', 'final', 'none'])

        self.bcreate = wx.Button(self, -1, 'Create')
        self.bsave = wx.Button(self, -1, 'Save')

        szp = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Calibration parameter')
        szp.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szp.Add(self.widgets['calibration parameter'], (0, 1), (1, 1),
                wx.ALIGN_CENTER_VERTICAL)

        szs = wx.GridBagSizer(5, 5)
        szs.Add(self.widgets['scale image'], (0, 0), (1, 1),
                wx.ALIGN_CENTER_VERTICAL)
        szs.Add(self.widgets['scale size'], (0, 1), (1, 1),
                wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, 'pixels in largest dimension')
        szs.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)

        szb = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Mosaic image:')
        szb.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szb.Add(self.bcreate, (0, 1), (1, 1), wx.ALIGN_CENTER)
        szb.Add(self.bsave, (0, 2), (1, 1), wx.ALIGN_CENTER)

        szc = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Auto create mosaic for new tiles')
        szc.Add(label, (0, 0), (1, 1))
        szc.Add(self.widgets['create on tile change'], (0, 1), (1, 1),
                wx.ALIGN_CENTER_VERTICAL)

        sz = wx.GridBagSizer(5, 5)
        sz.Add(szp, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(szs, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(szc, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(szb, (3, 0), (1, 1), wx.ALIGN_CENTER)

        sbsz.Add(sz, 1, wx.EXPAND | wx.ALL, 5)

        self.bcreate.Enable(self.node.mosaic.hasTiles())
        self.bsave.Enable(self.node.hasMosaicImage())

        self.Bind(wx.EVT_BUTTON, self.onCreateButton, self.bcreate)
        self.Bind(wx.EVT_BUTTON, self.onSaveButton, self.bsave)

        return [sbsz]
        def addBasicSettings(self):
                # move type
                movetypes = self.node.getMoveTypes()
                self.widgets['move type'] = Choice(self, -1, choices=movetypes)
                szmovetype = wx.GridBagSizer(5, 5)
                szmovetype.Add(wx.StaticText(self, -1, 'Use'),
                                                                                (0, 0), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL)
                szmovetype.Add(self.widgets['move type'],
                                                                                (0, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL)
                szmovetype.Add(wx.StaticText(self, -1, 'to move to target'),
                                                                                (0, 2), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL)
                # pause time
                self.widgets['pause time'] = FloatEntry(self, -1,
                                                                                                                                                min=0.0,
                                                                                                                                                allownone=False,
                                                                                                                                                chars=4,
                                                                                                                                                value='0.0')
                szpausetime = wx.GridBagSizer(5, 5)
                szpausetime.Add(wx.StaticText(self, -1, 'Wait'),
                                                                (0, 0), (1, 1),
                                                                wx.ALIGN_CENTER_VERTICAL)
                szpausetime.Add(self.widgets['pause time'],
                                                                (0, 1), (1, 1),
                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE)
                szpausetime.Add(wx.StaticText(self, -1, 'seconds before acquiring image'),
                                                                (0, 2), (1, 1),
                                                                wx.ALIGN_CENTER_VERTICAL)
                # process
                self.widgets['wait for process'] = wx.CheckBox(self, -1,
                                                                                                                                                                'Wait for a node to process the image')
                # transform
                self.widgets['adjust for transform'] = Choice(self, -1, choices=['no', 'one', 'all'])
                sz_transform = wx.GridBagSizer(0, 0)
                label = wx.StaticText(self, -1, 'Adjust target using')
                sz_transform.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sz_transform.Add(self.widgets['adjust for transform'], (0, 1), (1, 1),
                                                wx.ALIGN_CENTER_VERTICAL)
                label = wx.StaticText(self, -1, 'ancestor(s)')
                sz_transform.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                # preset order
                presets = self.node.presetsclient.getPresetNames()
                self.widgets['preset order'] = EditPresetOrder(self, -1)
                self.widgets['preset order'].setChoices(presets)

                szleft = wx.GridBagSizer(3, 10)
                szleft.Add(szmovetype, (0, 0), (1, 2), wx.ALIGN_LEFT|wx.ALL)
                szleft.Add(szpausetime, (1, 0), (1, 2), wx.ALIGN_LEFT|wx.ALL)
                szleft.Add(self.widgets['wait for process'], (2, 0), (1, 2), wx.ALIGN_LEFT|wx.ALL)
                szleft.Add(sz_transform, (3, 0), (1, 2), wx.ALIGN_LEFT|wx.ALL)

                sz = wx.GridBagSizer(3, 3)
                sz.Add(szleft, (0, 0), (4, 2), wx.ALIGN_CENTER)
                sz.Add(self.widgets['preset order'], (0, 2), (4, 2), wx.ALIGN_CENTER)
                return sz
Ejemplo n.º 3
0
        def initialize(self):
                sizers = leginon.gui.wx.Acquisition.ScrolledSettings.initialize(self)
                sb = wx.StaticBox(self, -1, 'Tilt Imaging and Correlation')
                sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL)

                sizer = wx.GridBagSizer(5, 5)
                self.widgets['tableau type'] = Choice(self, -1, choices=self.node.tableau_types)
                label = wx.StaticText(self, -1, 'Tableau Type (method-display):')
                sizer.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['tableau type'], (0, 1), (1, 1), wx.ALIGN_CENTER)

                self.widgets['beam tilt'] = FloatEntry(self, -1, min=0.0, allownone=False, chars=6, value='0.005')
                bt_sizer = wx.GridBagSizer(5, 5)
                bt_sizer.Add(self.widgets['beam tilt'], (0, 0), (1, 1),
                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE)
                bt_sizer.Add(wx.StaticText(self, -1, 'radian'), (0, 1), (1, 1),
                                                wx.ALIGN_CENTER_VERTICAL)
                label = wx.StaticText(self, -1, 'Beam Tilt:')
                sizer.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(bt_sizer, (1, 1), (1, 1), wx.ALIGN_CENTER)

                self.widgets['sites'] = IntEntry(self, -1, min=0, allownone=False, chars=4, value='0')
                label = wx.StaticText(self, -1, 'Number of tilt directions:')
                sizer.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['sites'], (2, 1), (1, 1), wx.ALIGN_CENTER)

                self.widgets['startangle'] = FloatEntry(self, -1, min=0, allownone=False, chars=4, value='0')
                label = wx.StaticText(self, -1, 'Start Angle:')
                sizer.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['startangle'], (3, 1), (1, 1), wx.ALIGN_CENTER)
                label = wx.StaticText(self, -1, 'degrees')
                sizer.Add(label, (3, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)

                self.widgets['correlation type'] = Choice(self, -1, choices=self.node.correlation_types)
                label = wx.StaticText(self, -1, 'Correlation Type:')
                sizer.Add(label, (4, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['correlation type'], (4, 1), (1, 1), wx.ALIGN_CENTER)

                self.widgets['tableau binning'] = IntEntry(self, -1, min=1, allownone=False, chars=4, value='2')
                label = wx.StaticText(self, -1, 'Tableau Binning:')
                sizer.Add(label, (5, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['tableau binning'], (5, 1), (1, 1), wx.ALIGN_CENTER)

                self.widgets['beam tilt count'] = IntEntry(self, -1, min=1, allownone=False, chars=4, value='1')
                label = wx.StaticText(self, -1, 'Beam Tilt Count:')
                sizer.Add(label, (6, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['beam tilt count'], (6, 1), (1, 1), wx.ALIGN_CENTER)

                self.widgets['tableau split'] = IntEntry(self, -1, min=1, allownone=False, chars=4, value='8')
                label = wx.StaticText(self, -1, 'Tableau Split:')
                sizer.Add(label, (7, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sizer.Add(self.widgets['tableau split'], (7, 1), (1, 1), wx.ALIGN_CENTER)

                sbsz.Add(sizer, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)
                self.widgets['tableau type'].Bind(wx.EVT_CHOICE, self.onTableauTypeChoice)

                return sizers + [sbsz]
Ejemplo n.º 4
0
        def initialize(self):
                leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
                sb = wx.StaticBox(self, -1, 'Threshold')
                sbszthreshold = wx.StaticBoxSizer(sb, wx.VERTICAL)

                self.widgets['threshold'] = FloatEntry(self, -1, chars=9)

                szthreshold = wx.GridBagSizer(5, 5)
                self.widgets['threshold method'] = Choice(self, -1, choices=(
                        "Threshold = mean + A * stdev",
                        "Threshold = A"))
                szthreshold.Add(self.widgets['threshold method'], (0,0), (1,2))
                label = wx.StaticText(self, -1, 'A:')
                szthreshold.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szthreshold.Add(self.widgets['threshold'], (1, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                szthreshold.AddGrowableCol(1)

                sbszthreshold.Add(szthreshold, 1, wx.EXPAND|wx.ALL, 5)

                self.btest = wx.Button(self, -1, 'Test')
                szbutton = wx.GridBagSizer(5, 5)
                szbutton.Add(self.btest, (0, 0), (1, 1),
                                                                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szbutton.AddGrowableCol(0)

                self.Bind(wx.EVT_BUTTON, self.onTestButton, self.btest)

                return [sbszthreshold, szbutton]
Ejemplo n.º 5
0
    def initialize(self):
        leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
        sb = wx.StaticBox(self, -1, 'Transform Management')
        sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.widgets['min mag'] = IntEntry(self, -1, min=1, chars=9)
        #self.instrumentselection = leginon.gui.wx.Instrument.SelectionPanel(self, passive=True)
        #self.panel.setInstrumentSelection(self.instrumentselection)
        #self.widgets['camera settings'] = leginon.gui.wx.Camera.CameraPanel(self)
        #self.widgets['camera settings'].setSize(self.node.instrument.camerasize)

        regtypes = self.node.getRegistrationTypes()
        self.widgets['registration'] = Choice(self, -1, choices=regtypes)

        szminmag = wx.GridBagSizer(5, 5)

        label = wx.StaticText(self, -1, 'Minimum Magnification')
        szminmag.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szminmag.Add(self.widgets['min mag'], (0, 1), (1, 1),
                     wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)

        label = wx.StaticText(self, -1, 'Register images using')
        szminmag.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szminmag.Add(self.widgets['registration'], (1, 1), (1, 1),
                     wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)

        sz = wx.GridBagSizer(5, 10)
        sz.Add(szminmag, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        #sz.Add(self.instrumentselection, (1, 0), (1, 1), wx.EXPAND)
        #sz.Add(self.widgets['camera settings'], (2, 0), (1, 1), wx.EXPAND)

        sbsz.Add(sz, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        return [sbsz]
    def initialize(self):
        leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
        sb = wx.StaticBox(self, -1, 'Settings')
        sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL)

        sz = wx.GridBagSizer(5, 10)

        label = wx.StaticText(self, -1, 'Mask Run Name:')
        masknames = self.node.getMaskRunNames()
        self.widgets['mask run'] = Choice(self, -1, choices=masknames)
        sz.Add(label, (0, 0), (1, 1))
        sz.Add(self.widgets['mask run'], (0, 1), (1, 1))

        label = wx.StaticText(self, -1, 'Assessor Run Name:')
        self.widgets['run'] = Entry(self, -1)
        sz.Add(label, (1, 1), (1, 1))
        sz.Add(self.widgets['run'], (1, 2), (1, 1))

        self.widgets['continueon'] = wx.CheckBox(self, -1, 'Continue')
        sz.Add(self.widgets['continueon'], (2, 0), (1, 1))

        self.widgets['jump filename'] = Entry(self, -1, chars=12)
        label = wx.StaticText(self, -1, 'Image to Jump to:')
        sz.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(self.widgets['jump filename'], (3, 1), (1, 1),
               wx.ALIGN_CENTER | wx.FIXED_MINSIZE)

        sbsz.Add(sz, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        return [
            sbsz,
        ]
Ejemplo n.º 7
0
	def initialize(self):
		leginon.gui.wx.Settings.ScrolledDialog.initialize(self)

		szcor = wx.GridBagSizer(5, 5)
		label = wx.StaticText(self, -1, 'Use')
		szcor.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		self.widgets['correlation type'] = Choice(self, -1, choices=self.node.cortypes)
		szcor.Add(self.widgets['correlation type'], (0, 1), (1, 1),
							wx.ALIGN_CENTER_VERTICAL)
		label = wx.StaticText(self, -1, 'correlation')
		szcor.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		label = wx.StaticText(self, -1, 'Correlation Low Pass')
		self.widgets['correlation lpf'] = FloatEntry(self, -1, min=0.0, chars=4)
		szcor.Add(label, (1,0), (1,1))
		szcor.Add(self.widgets['correlation lpf'], (1,1), (1,1))
		self.widgets['rotate'] = wx.CheckBox(self, -1, 'Rotate')
		szcor.Add(self.widgets['rotate'], (2,0), (1,1))

		label = wx.StaticText(self, -1, 'Angle Increment')
		self.widgets['angle increment'] = FloatEntry(self, -1, min=0.0, chars=4)
		szcor.Add(label, (3,0), (1,1))
		szcor.Add(self.widgets['angle increment'], (3,1), (1,1))

		label = wx.StaticText(self, -1, 'SNR Threshold')
		self.widgets['snr threshold'] = FloatEntry(self, -1, min=0.0, chars=4)
		szcor.Add(label, (4,0), (1,1))
		szcor.Add(self.widgets['snr threshold'], (4,1), (1,1))

		self.bcor = wx.Button(self, -1, 'Correlate')
		szbutton = wx.GridBagSizer(5, 5)
		szbutton.Add(self.bcor, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT)
		
		self.Bind(wx.EVT_BUTTON, self.onCorrelate, self.bcor)

		return [szcor, szbutton]
Ejemplo n.º 8
0
	def initialize(self):
		leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
		sb = wx.StaticBox(self, -1, 'Low Pass Filter (Phase Correlation)')
		sbszlpf = wx.StaticBoxSizer(sb, wx.VERTICAL)
		sb = wx.StaticBox(self, -1, 'Tilt Axis')
		sbszta = wx.StaticBoxSizer(sb, wx.VERTICAL)
		sb = wx.StaticBox(self, -1, 'Template Correlation')
		sbsztemplate = wx.StaticBoxSizer(sb, wx.VERTICAL)

		self.widgets['template lpf'] = {}
		self.widgets['template lpf']['sigma'] = FloatEntry(self, -1, min=0.0, chars=4)

		szlpf = wx.GridBagSizer(5, 5)
		label = wx.StaticText(self, -1, 'Sigma:')
		szlpf.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		szlpf.Add(self.widgets['template lpf']['sigma'], (0, 1), (1, 1),
						wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
		szlpf.AddGrowableCol(1)

		sbszlpf.Add(szlpf, 1, wx.EXPAND|wx.ALL, 5)

		self.widgets['tilt axis'] = FloatEntry(self, -1, chars=9)

		szta = wx.GridBagSizer(5, 5)
		label = wx.StaticText(self, -1, 'Tilt Axis:')
		szta.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		szta.Add(self.widgets['tilt axis'], (0, 1), (1, 1),
										wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
		szta.AddGrowableCol(1)

		sbszta.Add(szta, 1, wx.EXPAND|wx.ALL, 5)

		self.widgets['template rings'] = leginon.gui.wx.Rings.Panel(self)
		self.widgets['template type'] = Choice(self, -1, choices=self.node.cortypes)

		szcor = wx.GridBagSizer(5, 5)
		label = wx.StaticText(self, -1, 'Use')
		szcor.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		szcor.Add(self.widgets['template type'], (0, 1), (1, 1),
							wx.ALIGN_CENTER_VERTICAL)
		label = wx.StaticText(self, -1, 'correlation')
		szcor.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)

		sztemplate = wx.GridBagSizer(5, 5)
		sztemplate.Add(szcor, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		sztemplate.Add(self.widgets['template rings'], (1, 0), (1, 1),
										wx.ALIGN_CENTER|wx.FIXED_MINSIZE)

		sbsztemplate.Add(sztemplate, 1, wx.EXPAND|wx.ALL, 5)

		self.btest = wx.Button(self, -1, 'Test')
		szbutton = wx.GridBagSizer(5, 5)
		szbutton.Add(self.btest, (0, 0), (1, 1),
									wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
		szbutton.AddGrowableCol(0)

		self.Bind(wx.EVT_BUTTON, self.onTestButton, self.btest)

		return [sbsztemplate, sbszlpf, sbszta, szbutton]
Ejemplo n.º 9
0
 def createBadResponseSizer(self):
     self.widgets['bad stats response'] = Choice(
         self,
         -1,
         choices=['Continue', 'Pause', 'Recheck', 'Abort one', 'Abort all'])
     sz_response = wx.BoxSizer(wx.HORIZONTAL)
     sz_response.Add(self.widgets['bad stats response'])
     sz_response.Add(wx.StaticText(self, -1, ' target list(s)'))
     return sz_response
Ejemplo n.º 10
0
 def createMoverChoiceSizer(self):
     szmover = wx.GridBagSizer(5, 5)
     label = wx.StaticText(self, -1, 'Mover:')
     self.widgets['mover'] = Choice(
         self, -1, choices=['presets manager', 'navigator'])
     szmover.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
     szmover.Add(self.widgets['mover'], (0, 1), (1, 1),
                 wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)
     return szmover
Ejemplo n.º 11
0
    def addSettings(self):
        self.widgets['correlation type'] = Choice(self,
                                                  -1,
                                                  choices=self.node.cortypes)
        self.widgets['override preset'] = wx.CheckBox(self, -1,
                                                      'Override Preset')
        self.widgets['instruments'] = leginon.gui.wx.Instrument.SelectionPanel(
            self)
        self.panel.setInstrumentSelection(self.widgets['instruments'])
        self.widgets['camera settings'] = leginon.gui.wx.Camera.CameraPanel(
            self)
        self.widgets['camera settings'].setGeometryLimits({
            'size':
            self.node.instrument.camerasize,
            'binnings':
            self.node.instrument.camerabinnings,
            'binmethod':
            self.node.instrument.camerabinmethod
        })

        szcor = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Use')
        szcor.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szcor.Add(self.widgets['correlation type'], (0, 1), (1, 1),
                  wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'correlation')
        szcor.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)

        szlpf = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'phase correlation low pass filter')
        szlpf.Add(label, (0, 0), (1, 3), wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'sigma:')
        szlpf.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        self.widgets['phase corr lpf sigma'] = FloatEntry(self,
                                                          -1,
                                                          min=0.0,
                                                          chars=4)
        szlpf.Add(self.widgets['phase corr lpf sigma'], (1, 1), (1, 1),
                  wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'pixels')
        szlpf.Add(label, (1, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)

        sz = wx.GridBagSizer(5, 5)
        sz.Add(szcor, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(szlpf, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(self.widgets['override preset'], (2, 0), (1, 1),
               wx.ALIGN_CENTER_VERTICAL)
        sz.Add(self.widgets['instruments'], (3, 0), (1, 1),
               wx.ALIGN_CENTER_VERTICAL)
        sz.Add(self.widgets['camera settings'], (0, 1), (4, 1),
               wx.ALIGN_CENTER | wx.EXPAND)

        sz.AddGrowableRow(3)
        sz.AddGrowableCol(0)
        sz.AddGrowableCol(1)
        return sz
Ejemplo n.º 12
0
        def initialize(self):
                leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
                sb = wx.StaticBox(self, -1, 'Lattice Fitting')
                sbszlattice = wx.StaticBoxSizer(sb, wx.VERTICAL)
                sb = wx.StaticBox(self, -1, 'Hole Statistics')
                sbszstats = wx.StaticBoxSizer(sb, wx.VERTICAL)

                self.widgets['lattice spacing'] = FloatEntry(self, -1, chars=6)
                self.widgets['lattice tolerance'] = FloatEntry(self, -1, chars=6)
                self.widgets['lattice hole radius'] = FloatEntry(self, -1, chars=6)
                self.widgets['lattice zero thickness'] = FloatEntry(self, -1, chars=6)
                extendlabel = wx.StaticText(self, -1, 'Extend Lattice')
                self.widgets['lattice extend'] = Choice(self, -1, choices=self.node.extendtypes)

                szlattice = wx.GridBagSizer(5, 5)
                label = wx.StaticText(self, -1, 'Spacing:')
                szlattice.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szlattice.Add(self.widgets['lattice spacing'], (0, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)

                label = wx.StaticText(self, -1, 'Tolerance:')
                szlattice.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szlattice.Add(self.widgets['lattice tolerance'], (1, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)

                szlattice.Add(extendlabel, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szlattice.Add(self.widgets['lattice extend'], (2, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE)

                szlattice.AddGrowableCol(1)

                sbszlattice.Add(szlattice, 1, wx.EXPAND|wx.ALL, 5)

                szstats = wx.GridBagSizer(5, 5)
                label = wx.StaticText(self, -1, 'Radius:')
                szstats.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szstats.Add(self.widgets['lattice hole radius'], (0, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Reference Intensity:')
                szstats.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szstats.Add(self.widgets['lattice zero thickness'], (1, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                szstats.AddGrowableCol(1)

                sbszstats.Add(szstats, 1, wx.EXPAND|wx.ALL, 5)

                self.btest = wx.Button(self, -1, 'Test')
                szbutton = wx.GridBagSizer(5, 5)
                szbutton.Add(self.btest, (0, 0), (1, 1),
                                                                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szbutton.AddGrowableCol(0)

                self.Bind(wx.EVT_BUTTON, self.onTestButton, self.btest)

                return [sbszlattice, sbszstats, szbutton]
    def initialize(self):
        sb = wx.StaticBox(self, -1, 'Reference Target')
        sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL)

        move_types = self.node.calibration_clients.keys()
        move_types.sort()
        self.widgets['move type'] = Choice(self, -1, choices=move_types)
        szmovetype = wx.GridBagSizer(5, 5)
        szmovetype.Add(wx.StaticText(self, -1, 'Use'), (0, 0), (1, 1),
                       wx.ALIGN_CENTER_VERTICAL)
        szmovetype.Add(self.widgets['move type'], (0, 1), (1, 1),
                       wx.ALIGN_CENTER_VERTICAL)
        szmovetype.Add(
            wx.StaticText(self, -1, 'to move to the reference target'), (0, 2),
            (1, 1), wx.ALIGN_CENTER_VERTICAL)

        self.widgets['pause time'] = FloatEntry(self,
                                                -1,
                                                min=0.0,
                                                allownone=False,
                                                chars=4,
                                                value='0.0')
        szpausetime = wx.GridBagSizer(5, 5)
        szpausetime.Add(wx.StaticText(self, -1, 'Wait'), (0, 0), (1, 1),
                        wx.ALIGN_CENTER_VERTICAL)
        szpausetime.Add(self.widgets['pause time'], (0, 1), (1, 1),
                        wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)
        szpausetime.Add(
            wx.StaticText(self, -1, 'seconds before performing request'),
            (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)

        self.widgets['interval time'] = FloatEntry(self,
                                                   -1,
                                                   min=0.0,
                                                   allownone=False,
                                                   chars=4,
                                                   value='0.0')
        szintervaltime = wx.GridBagSizer(5, 5)
        szintervaltime.Add(
            wx.StaticText(self, -1, 'If request performed less than'), (0, 0),
            (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szintervaltime.Add(self.widgets['interval time'], (0, 1), (1, 1),
                           wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)
        szintervaltime.Add(
            wx.StaticText(self, -1, 'seconds ago, ignore request'), (0, 2),
            (1, 1), wx.ALIGN_CENTER_VERTICAL)

        sz = wx.GridBagSizer(5, 5)
        sz.Add(szmovetype, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(szpausetime, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz.Add(szintervaltime, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)

        sbsz.Add(sz, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        return [sbsz]
Ejemplo n.º 14
0
 def createProcessTargetTypeSizer(self):
     sz_target_type = wx.GridBagSizer(5, 5)
     label = wx.StaticText(self, -1, 'Process')
     sz_target_type.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
     self.widgets['process target type'] = Choice(
         self, -1, choices=leginon.targethandler.target_types)
     sz_target_type.Add(self.widgets['process target type'], (0, 1), (1, 1),
                        wx.ALIGN_CENTER)
     label = wx.StaticText(self, -1, 'targets')
     sz_target_type.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)
     return sz_target_type
Ejemplo n.º 15
0
 def createMoveTypeSizer(self):
     # move type
     movetypes = self.node.getMoveTypes()
     self.widgets['move type'] = Choice(self, -1, choices=movetypes)
     szmovetype = wx.GridBagSizer(5, 5)
     szmovetype.Add(wx.StaticText(self, -1, 'Use'), (0, 0), (1, 1),
                    wx.ALIGN_CENTER_VERTICAL)
     szmovetype.Add(self.widgets['move type'], (0, 1), (1, 1),
                    wx.ALIGN_CENTER_VERTICAL)
     szmovetype.Add(wx.StaticText(self, -1, 'to move to target'), (0, 2),
                    (1, 1), wx.ALIGN_CENTER_VERTICAL)
     return szmovetype
Ejemplo n.º 16
0
    def createTransformSizer(self):
        self.widgets['adjust for transform'] = Choice(
            self, -1, choices=['no', 'one', 'all'])

        sz_transform = wx.GridBagSizer(0, 0)
        label = wx.StaticText(self, -1, 'Adjust target using')
        sz_transform.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        sz_transform.Add(self.widgets['adjust for transform'], (0, 1), (1, 1),
                         wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'ancestor(s)')
        sz_transform.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        return sz_transform
Ejemplo n.º 17
0
 def createBadRangeSizer(self):
     self.widgets['bad stats type'] = Choice(self,
                                             -1,
                                             choices=['Mean', 'Slope'])
     # range sizer
     sz_range = wx.GridBagSizer(0, 0)
     sz_range.Add(wx.StaticText(self, -1, 'when image'), (0, 0), (1, 1),
                  wx.ALIGN_RIGHT)
     sz_range.Add(self.widgets['bad stats type'], (0, 1), (1, 1))
     sz_range.Add(wx.StaticText(self, -1, 'is NOT'), (0, 2), (1, 1),
                  wx.ALIGN_LEFT)
     return sz_range
Ejemplo n.º 18
0
	def __init__(self, parent, passive=False):
		'''
		passive means that selecting an instrument does not actually set the 
		parent node's instrument.  You still must get the selection and set
		your instrument yourself.  Also, if the node's instrument changes,
		this gui will not reflect that change.  Useful if you want an 
		instrument selection that is used conditionally.
		'''
		wx.Panel.__init__(self, parent, -1)
		sb = wx.StaticBox(self, -1, 'Instrument')
		self.sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL)

		self.nonestring = 'None'
		self.passive = passive

		self.ctem = Choice(self, -1, choices=[self.nonestring])
		self.cccdcamera = Choice(self, -1, choices=[self.nonestring])

		sz = wx.GridBagSizer(3, 3)
		label = wx.StaticText(self, -1, 'TEM')
		sz.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		sz.Add(self.ctem, (0, 1), (1, 1), wx.ALIGN_CENTER|wx.EXPAND)
		label = wx.StaticText(self, -1, 'Digital Camera')
		sz.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		sz.Add(self.cccdcamera, (1, 1), (1, 1), wx.ALIGN_CENTER|wx.EXPAND)

		sz.AddGrowableCol(1)

		self.sbsz.Add(sz, 0, wx.EXPAND|wx.ALL, 5)

		self.SetSizer(self.sbsz)
		self.SetAutoLayout(True)

		self.Bind(leginon.gui.wx.Events.EVT_SET_TEMS, self.onSetTEMs)
		self.Bind(leginon.gui.wx.Events.EVT_SET_CCDCAMERAS, self.onSetCCDCameras)
		if not passive:
			self.Bind(wx.EVT_CHOICE, self.onTEMChoice, self.ctem)
			self.Bind(wx.EVT_CHOICE, self.onCCDCameraChoice, self.cccdcamera)
			self.Bind(leginon.gui.wx.Events.EVT_SET_TEM, self.onSetTEM)
			self.Bind(leginon.gui.wx.Events.EVT_SET_CCDCAMERA, self.onSetCCDCamera)
    def onNodeInitialized(self):
        leginon.gui.wx.Instrument.SelectionMixin.onNodeInitialized(self)
        self.locationsdialog = StageLocationsDialog(self, self.node)

        movetypes = self.node.calclients.keys()
        self.cmovetype = Choice(self.toolbar, -1, choices=movetypes)
        self.cmovetype.SetStringSelection(self.node.settings['move type'])
        ## make sure node setting is a value that is in the choice list
        self.node.settings['move type'] = self.cmovetype.GetStringSelection()
        self.cmovetype.SetToolTip(wx.ToolTip('Navigion Parameter'))
        self.toolbar.InsertControl(2, self.cmovetype)

        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onSettingsTool,
                          id=leginon.gui.wx.ToolBar.ID_SETTINGS)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onAcquireTool,
                          id=leginon.gui.wx.ToolBar.ID_ACQUIRE)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onStageLocationsTool,
                          id=leginon.gui.wx.ToolBar.ID_STAGE_LOCATIONS)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onReproTest,
                          id=leginon.gui.wx.ToolBar.ID_MEASURE)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onResetXY,
                          id=leginon.gui.wx.ToolBar.ID_RESET_XY)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onResetZ,
                          id=leginon.gui.wx.ToolBar.ID_RESET_Z)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onResetAlpha,
                          id=leginon.gui.wx.ToolBar.ID_RESET_ALPHA)
        self.cmovetype.Bind(wx.EVT_CHOICE, self.onMoveTypeChoice)
        self.Bind(leginon.gui.wx.ImagePanelTools.EVT_IMAGE_CLICKED,
                  self.onImageClicked, self.imagepanel)
        self.test_dialog = ReproTestDialog(self)
        self.Bind(EVT_TEST, self.onReproTest, self)
Ejemplo n.º 20
0
	def createRegistrationSelector(self,start_position):
		# define widget
		regtypes = self.node.getRegistrationTypes()
		self.widgets['registration'] = Choice(self, -1, choices=regtypes)
		# make sizer
		sz = wx.GridBagSizer(5, 5)
		label = wx.StaticText(self, -1, 'Register images using')
		sz.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		sz.Add(self.widgets['registration'], (0, 1), (1, 1), wx.ALIGN_CENTER_VERTICAL)
		# add to main
		total_length = (1,1)
		self.szmain.Add(sz, start_position, total_length,
				  wx.ALIGN_CENTER)
		return start_position[0]+total_length[0],start_position[1]+total_length[1]
 def createAdjustMethodSelector(self, start_position):
     # define widget
     regtypes = self.node.getAdjustMethods()
     self.widgets['adjust method'] = Choice(self, -1, choices=regtypes)
     # make sizer
     sz = wx.GridBagSizer(5, 5)
     label = wx.StaticText(self, -1, 'Adjust exposure dose by changing')
     sz.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
     sz.Add(self.widgets['adjust method'], (0, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL)
     # add to main
     total_length = (1, 1)
     self.szsettings.Add(sz, start_position, total_length, wx.ALIGN_CENTER)
     return start_position[0] + total_length[0], start_position[
         1] + total_length[1]
Ejemplo n.º 22
0
 def createMoveTypeChoice(self, start_position):
     move_types = self.node.calibration_clients.keys()
     move_types.sort()
     self.widgets['move type'] = Choice(self, -1, choices=move_types)
     szmovetype = wx.GridBagSizer(5, 5)
     szmovetype.Add(wx.StaticText(self, -1, 'Use'), (0, 0), (1, 1),
                    wx.ALIGN_CENTER_VERTICAL)
     szmovetype.Add(self.widgets['move type'], (0, 1), (1, 1),
                    wx.ALIGN_CENTER_VERTICAL)
     szmovetype.Add(
         wx.StaticText(self, -1, 'to move to the reference target'), (0, 2),
         (1, 1), wx.ALIGN_CENTER_VERTICAL)
     self.sz.Add(szmovetype, start_position, (1, 1),
                 wx.ALIGN_CENTER_VERTICAL)
     return start_position[0] + 1, start_position[1] + 1
Ejemplo n.º 23
0
 def createTemplateCorrelationChoice(self, sz, start_position):
     # define widget
     self.widgets['template type'] = Choice(self,
                                            -1,
                                            choices=self.node.cortypes)
     # make sizer
     szcor = wx.GridBagSizer(5, 5)
     label = wx.StaticText(self, -1, 'Use')
     szcor.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
     szcor.Add(self.widgets['template type'], (0, 1), (1, 1),
               wx.ALIGN_CENTER_VERTICAL)
     label = wx.StaticText(self, -1, 'correlation')
     szcor.Add(label, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)
     # add to main
     total_length = (1, 2)
     return self.addToSizer(sz, szcor, start_position, total_length)
Ejemplo n.º 24
0
    def addBasicGonModelerSettings(self):
        sb = wx.StaticBox(self, -1, 'Measurement')
        sbszmeasure = wx.StaticBoxSizer(sb, wx.VERTICAL)
        sb = wx.StaticBox(self, -1, 'Modeling')
        sbszmodel = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.widgets['measure axis'] = Choice(self, -1, choices=self.node.axes)
        self.widgets['measure points'] = IntEntry(self, -1, min=2, chars=5)
        self.widgets['measure interval'] = FloatEntry(self, -1, chars=9)
        self.widgets['model mag only'] = wx.CheckBox(
            self, -1, 'Scale and Rotation Adjustment Only')
        self.widgets['model terms'] = IntEntry(self, -1, chars=2)

        szmeasure = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Axis:')
        szmeasure.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(self.widgets['measure axis'], (0, 1), (1, 1),
                      wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        label = wx.StaticText(self, -1, 'Points:')
        szmeasure.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(
            self.widgets['measure points'], (1, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, 'Interval')
        szmeasure.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(
            self.widgets['measure interval'], (2, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        sbszmeasure.Add(szmeasure, 1, wx.EXPAND | wx.ALL, 5)

        szmodel = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Terms:')
        szmodel.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmodel.Add(
            self.widgets['model terms'], (0, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        szmodel.Add(self.widgets['model mag only'], (1, 0), (1, 2),
                    wx.ALIGN_CENTER)
        szmodel.AddGrowableCol(1)

        sbszmodel.Add(szmodel, 1, wx.EXPAND | wx.ALL, 5)

        return [sbszmeasure, sbszmodel]
Ejemplo n.º 25
0
class ManualBeamTiltWobbleDialog(ManualFocusDialog):
        def moreOnInit(self):
                self.beamtilt = True
                self.settingsdialog = ManualBeamTiltWobbleSettingsDialog(self, 'Manual Beam Tilt Wobble Settings', 'Settings')

        def moreToolbar(self):
                bitmap = leginon.gui.wx.Icons.icon('beamtiltget')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_GET_BEAMTILT, bitmap, shortHelpString='Rotation Center From Scope')
                bitmap = leginon.gui.wx.Icons.icon('beamtiltset')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_SET_BEAMTILT, bitmap, shortHelpString='Rotation Center To Scope')

                self.toolbar.Bind(wx.EVT_TOOL, self.onRotationCenterFromScope, id=leginon.gui.wx.ToolBar.ID_GET_BEAMTILT)
                self.toolbar.Bind(wx.EVT_TOOL, self.onRotationCenterToScope, id=leginon.gui.wx.ToolBar.ID_SET_BEAMTILT)

        def initParameterChoice(self):
                self.parameter_choice = Choice(self.toolbar, -1, choices=['Beam Tilt X','Beam Tilt Y','Defocus', 'Stage Z'])
                par = 'Beam Tilt X'
                self.parameter_choice.SetStringSelection(par)
                threading.Thread(target=self.node.setParameterChoice, args=(par,)).start()

        def onSettingsTool(self, evt):
                self.settingsdialog.maskradius.SetValue(self.node.maskradius)
                self.settingsdialog.increment.SetValue(self.node.increment)
                self.settingsdialog.tiltdelta.SetValue(self.node.tiltdelta)
                #self.MakeModal(False)
                if self.settingsdialog.ShowModal() == wx.ID_OK:
                        self.node.maskradius = self.settingsdialog.maskradius.GetValue()
                        self.node.increment = self.settingsdialog.increment.GetValue()
                        self.node.increment = self.settingsdialog.increment.GetValue()
                        self.node.tiltdelta = self.settingsdialog.tiltdelta.GetValue()
                #self.MakeModal(True)

        def onRotationCenterToScope(self, evt):
                self._manualEnable(False)
                threading.Thread(target=self.node.rotationCenterToScope).start()

        def onRotationCenterFromScope(self, evt):
                self._manualEnable(False)
                threading.Thread(target=self.node.rotationCenterFromScope).start()
Ejemplo n.º 26
0
class ManualFocusDialog(wx.Frame):
        def __init__(self, parent, node, title='Manual Focus'):
                wx.Frame.__init__(self, parent, -1, title, size=(650,600),
                        style=wx.DEFAULT_FRAME_STYLE|wx.RESIZE_BORDER)
                self.node = node
                self.center = (256,256)
                self.toolbar = wx.ToolBar(self, -1)

                bitmap = leginon.gui.wx.Icons.icon('settings')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_SETTINGS, bitmap, shortHelpString='Settings')

                self.toolbar.AddSeparator()

                bitmap = leginon.gui.wx.Icons.icon('play')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_PLAY, bitmap, shortHelpString='Play')
                bitmap = leginon.gui.wx.Icons.icon('pause')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_PAUSE, bitmap, shortHelpString='Pause')
                bitmap = leginon.gui.wx.Icons.icon('stop')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_STOP, bitmap, shortHelpString='Stop')

                self.toolbar.AddSeparator()

                self.initParameterChoice()
                self.toolbar.AddControl(self.parameter_choice)
                bitmap = leginon.gui.wx.Icons.icon('plus')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_PLUS, bitmap,
                        shortHelpString='Increment up')
                bitmap = leginon.gui.wx.Icons.icon('minus')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_MINUS, bitmap,
                        shortHelpString='Increment down')

                self.toolbar.AddSeparator()

                self.value = FloatEntry(self.toolbar, -1, allownone=False, chars=6, value='0.0')
                self.toolbar.AddControl(self.value)
                # size is defined because some wxPython installation lack good wxDefaultSize
                self.toolbar.AddControl(wx.StaticText(self.toolbar, -1, ' m',size=(20,20)))
                bitmap = leginon.gui.wx.Icons.icon('instrumentset')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_VALUE, bitmap,
                        shortHelpString='Set instrument')

                self.toolbar.AddSeparator()

                bitmap = leginon.gui.wx.Icons.icon('instrumentsetnew')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_RESET, bitmap,
                        shortHelpString='Reset Defocus')

                self.toolbar.AddSeparator()

                bitmap = leginon.gui.wx.Icons.icon('instrumentget')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_GET_INSTRUMENT, bitmap,
                        shortHelpString='Eucentric from instrument')

                bitmap = leginon.gui.wx.Icons.icon('instrumentset')
                self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_SET_INSTRUMENT, bitmap,
                        shortHelpString='Eucentric to instrument')

                self.moreToolbar()

                self.SetToolBar(self.toolbar)
                self.toolbar.Realize()

                self.imagepanel = leginon.gui.wx.TargetPanel.FFTTargetImagePanel(self, -1,imagesize=(512,512))

                self.imagepanel.addTypeTool('Image', display=True)
                self.imagepanel.addTypeTool('Power', display=True)
                self.imagepanel.selectiontool.setDisplayed('Power', True)

                self.statusbar = wx.StatusBar(self, -1)
                self.SetStatusBar(self.statusbar)

                self.Fit()
                #self.SetAutoLayout(True)

                self.settingsdialog = ManualFocusSettingsDialog(self, 'Manual Focus Settings', 'Settings')

                self.Bind(leginon.gui.wx.Events.EVT_PLAYER, self.onPlayer)
                self.Bind(wx.EVT_TOOL, self.onSettingsTool, id=leginon.gui.wx.ToolBar.ID_SETTINGS)
                self.Bind(wx.EVT_TOOL, self.onPlayTool, id=leginon.gui.wx.ToolBar.ID_PLAY)
                self.Bind(wx.EVT_TOOL, self.onPauseTool, id=leginon.gui.wx.ToolBar.ID_PAUSE)
                self.Bind(wx.EVT_TOOL, self.onStopTool, id=leginon.gui.wx.ToolBar.ID_STOP)
                self.Bind(wx.EVT_TOOL, self.onPlusTool, id=leginon.gui.wx.ToolBar.ID_PLUS)
                self.Bind(wx.EVT_TOOL, self.onMinusTool, id=leginon.gui.wx.ToolBar.ID_MINUS)
                self.Bind(wx.EVT_TOOL, self.onValueTool, id=leginon.gui.wx.ToolBar.ID_VALUE)
                self.Bind(wx.EVT_TOOL, self.onResetTool, id=leginon.gui.wx.ToolBar.ID_RESET)
                self.Bind(wx.EVT_TOOL, self.onGetInstrumentTool, id=leginon.gui.wx.ToolBar.ID_GET_INSTRUMENT)
                self.Bind(wx.EVT_TOOL, self.onSetInstrumentTool, id=leginon.gui.wx.ToolBar.ID_SET_INSTRUMENT)
                self.Bind(wx.EVT_CLOSE, self.onClose)
                self.Bind(leginon.gui.wx.Events.EVT_SET_IMAGE, self.onSetImage)
                self.Bind(leginon.gui.wx.Events.EVT_MANUAL_UPDATED, self.onManualUpdated)
                self.Bind(leginon.gui.wx.ImagePanelTools.EVT_SHAPE_FOUND, self.onShapeFound, self.imagepanel)
                self.Bind(leginon.gui.wx.ImagePanelTools.EVT_IMAGE_CLICKED, self.onImageClicked,
                                                        self.imagepanel)
                self.parameter_choice.Bind(wx.EVT_CHOICE, self.onParameterChoice)
                self.moreOnInit()

        def moreToolbar(self):
                pass

        def moreOnInit(self):
                self.beamtilt = False
                pass

        def initParameterChoice(self):
                self.parameter_choice = Choice(self.toolbar, -1, choices=['Defocus', 'Stage Z'])
                par = 'Defocus'
                self.parameter_choice.SetStringSelection(par)
                threading.Thread(target=self.node.setParameterChoice, args=(par,)).start()

        def onParameterChoice(self,evt):
                par = self.parameter_choice.GetStringSelection()
                threading.Thread(target=self.node.setParameterChoice, args=(par,)).start()

        def onSettingsTool(self, evt):
                self.settingsdialog.maskradius.SetValue(self.node.maskradius)
                self.settingsdialog.increment.SetValue(self.node.increment)
                print 'set increment to ',self.node.increment
                #self.MakeModal(False)
                if self.settingsdialog.ShowModal() == wx.ID_OK:
                        self.node.maskradius = self.settingsdialog.maskradius.GetValue()
                        self.node.increment = self.settingsdialog.increment.GetValue()
                        self.node.increment = self.settingsdialog.increment.GetValue()
                #self.MakeModal(True)

        def onPlayTool(self, evt):
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PLAY, False)
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PAUSE, False)
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_STOP, False)
                self.node.manualplayer.play()

        def onPauseTool(self, evt):
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PLAY, False)
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PAUSE, False)
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_STOP, False)
                self.node.manualplayer.pause()

        def onStopTool(self, evt):
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PLAY, False)
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PAUSE, False)
                self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_STOP, False)
                self.node.manualplayer.stop()

        def onPlayer(self, evt):
                if evt.state == 'play':
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PLAY, False)
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PAUSE, True)
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_STOP, True)
                elif evt.state == 'pause':
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PLAY, True)
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PAUSE, False)
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_STOP, True)
                elif evt.state == 'stop':
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PLAY, True)
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_PAUSE, True)
                        self.toolbar.EnableTool(leginon.gui.wx.ToolBar.ID_STOP, False)

        def _manualEnable(self, enable):
                self.toolbar.Enable(enable)

        def onManualUpdated(self, evt):
                self._manualEnable(True)

        def manualUpdated(self):
                evt = leginon.gui.wx.Events.ManualUpdatedEvent()
                self.GetEventHandler().AddPendingEvent(evt)

        def onPlusTool(self, evt):
                self._manualEnable(False)
                par = self.parameter_choice.GetStringSelection()
                threading.Thread(target=self.node.onFocusUp, args=(par,)).start()

        def onMinusTool(self, evt):
                self._manualEnable(False)
                par = self.parameter_choice.GetStringSelection()
                threading.Thread(target=self.node.onFocusDown, args=(par,)).start()

        def onValueTool(self, evt):
                self._manualEnable(False)
                value = self.value.GetValue()
                threading.Thread(target=self.node.setFocus, args=(value,)).start()

        def onResetTool(self, evt):
                self._manualEnable(False)
                threading.Thread(target=self.node.onResetDefocus).start()

        def onGetInstrumentTool(self, evt):
                self._manualEnable(False)
                threading.Thread(target=self.node.onEucentricFromScope).start()

        def onSetInstrumentTool(self, evt):
                self._manualEnable(False)
                threading.Thread(target=self.node.onChangeToEucentric).start()

        def onClose(self, evt):
                self.node.manualplayer.stop()

        def onSetImage(self, evt):
                self.imagepanel.setImageType(evt.typename, evt.image)

        def onNewPixelSize(self, pixelsize,center,hightension):
                idcevt = leginon.gui.wx.ImagePanelTools.ImageNewPixelSizeEvent(self.imagepanel, pixelsize,center,hightension)
                self.imagepanel.GetEventHandler().AddPendingEvent(idcevt)
                self.center = center
                self.pixelsize = pixelsize
                self.hightension = hightension

        def onShapeFound(self, evt):
                centers = [(self.center['y'],self.center['x']),]
                idcevt = leginon.gui.wx.ImagePanelTools.ShapeNewCenterEvent(self.imagepanel, centers)
                self.imagepanel.GetEventHandler().AddPendingEvent(idcevt)
                threading.Thread(target=self.node.estimateAstigmation, args=(evt.params,)).start()

        def onImageClicked(self, evt):
                if not self.imagepanel.selectiontool.isDisplayed('Power'):
                        return
                resolution = 1/math.sqrt(((evt.xy[0]-self.center['x'])*self.pixelsize['x'])**2+((evt.xy[1]-self.center['y'])*self.pixelsize['y'])**2)
                defocus = fftfun.calculateDefocus(self.hightension,1/resolution)
                self.node.increment = defocus
                self.settingsdialog.increment.SetValue(self.node.increment)
Ejemplo n.º 27
0
 def initParameterChoice(self):
         self.parameter_choice = Choice(self.toolbar, -1, choices=['Beam Tilt X','Beam Tilt Y','Defocus', 'Stage Z'])
         par = 'Beam Tilt X'
         self.parameter_choice.SetStringSelection(par)
         threading.Thread(target=self.node.setParameterChoice, args=(par,)).start()
class Panel(leginon.gui.wx.Node.Panel,
            leginon.gui.wx.Instrument.SelectionMixin):
    icon = 'navigator'

    def __init__(self, *args, **kwargs):
        leginon.gui.wx.Node.Panel.__init__(self, *args, **kwargs)
        leginon.gui.wx.Instrument.SelectionMixin.__init__(self)

        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_SETTINGS,
                             'settings',
                             shortHelpString='Settings')
        self.toolbar.AddSeparator()
        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_ACQUIRE,
                             'acquire',
                             shortHelpString='Acquire')
        self.toolbar.AddSeparator()
        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_STAGE_LOCATIONS,
                             'stagelocations',
                             shortHelpString='Stage Locations')
        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_MEASURE,
                             'ruler',
                             shortHelpString='Test stage reproducibility')

        self.toolbar.AddSeparator()
        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_RESET_XY,
                             'xy',
                             shortHelpString='Reset stage X,Y to 0,0')
        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_RESET_Z,
                             'z',
                             shortHelpString='Reset stage Z to 0')
        self.toolbar.AddTool(leginon.gui.wx.ToolBar.ID_RESET_ALPHA,
                             'alpha',
                             shortHelpString='Reset stage alpha tilt to 0')

        # image
        self.imagepanel = leginon.gui.wx.TargetPanel.ClickAndTargetImagePanel(
            self, -1)
        self.imagepanel.addTypeTool('Image', display=True)
        self.imagepanel.selectiontool.setDisplayed('Image', True)
        self.imagepanel.addTypeTool('Correlation', display=True)
        self.imagepanel.addTargetTool('Peak', wx.Colour(255, 0, 0))

        self.szmain.Add(self.imagepanel, (0, 0), (1, 1), wx.EXPAND)

        self.szmain.AddGrowableRow(0)
        self.szmain.AddGrowableCol(0)

        self.SetSizer(self.szmain)
        self.SetAutoLayout(True)
        self.SetupScrolling()

        self.Bind(EVT_LOCATIONS, self.onLocations)

    def onNodeInitialized(self):
        leginon.gui.wx.Instrument.SelectionMixin.onNodeInitialized(self)
        self.locationsdialog = StageLocationsDialog(self, self.node)

        movetypes = self.node.calclients.keys()
        self.cmovetype = Choice(self.toolbar, -1, choices=movetypes)
        self.cmovetype.SetStringSelection(self.node.settings['move type'])
        ## make sure node setting is a value that is in the choice list
        self.node.settings['move type'] = self.cmovetype.GetStringSelection()
        self.cmovetype.SetToolTip(wx.ToolTip('Navigion Parameter'))
        self.toolbar.InsertControl(2, self.cmovetype)

        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onSettingsTool,
                          id=leginon.gui.wx.ToolBar.ID_SETTINGS)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onAcquireTool,
                          id=leginon.gui.wx.ToolBar.ID_ACQUIRE)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onStageLocationsTool,
                          id=leginon.gui.wx.ToolBar.ID_STAGE_LOCATIONS)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onReproTest,
                          id=leginon.gui.wx.ToolBar.ID_MEASURE)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onResetXY,
                          id=leginon.gui.wx.ToolBar.ID_RESET_XY)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onResetZ,
                          id=leginon.gui.wx.ToolBar.ID_RESET_Z)
        self.toolbar.Bind(wx.EVT_TOOL,
                          self.onResetAlpha,
                          id=leginon.gui.wx.ToolBar.ID_RESET_ALPHA)
        self.cmovetype.Bind(wx.EVT_CHOICE, self.onMoveTypeChoice)
        self.Bind(leginon.gui.wx.ImagePanelTools.EVT_IMAGE_CLICKED,
                  self.onImageClicked, self.imagepanel)
        self.test_dialog = ReproTestDialog(self)
        self.Bind(EVT_TEST, self.onReproTest, self)

    def onResetXY(self, evt):
        self.node.onResetXY()

    def onResetZ(self, evt):
        self.node.onResetZ()

    def onResetAlpha(self, evt):
        self.node.onResetAlpha()

    def onReproTest(self, evt):
        self.test_dialog.Show()

    def onMoveTypeChoice(self, evt):
        self.node.settings['move type'] = evt.GetString()

    def onSettingsTool(self, evt):
        dialog = SettingsDialog(self, show_basic=True)
        dialog.ShowModal()
        dialog.Destroy()

    def _acquisitionEnable(self, enable):
        self.toolbar.Enable(enable)

    def onAcquisitionDone(self, evt):
        self._acquisitionEnable(True)

    def onAcquireTool(self, evt):
        self._acquisitionEnable(False)
        threading.Thread(target=self.node.uiAcquireImage).start()

    def onStageLocationsTool(self, evt):
        self.locationsdialog.ShowModal()

    def onImageClicked(self, evt):
        self._acquisitionEnable(False)
        threading.Thread(target=self.node.navigate, args=(evt.xy, )).start()

    def navigateDone(self):
        evt = leginon.gui.wx.ImagePanel.ImageClickDoneEvent(self.imagepanel)
        self.imagepanel.GetEventHandler().AddPendingEvent(evt)
        self.acquisitionDone()

    def onLocations(self, evt):
        self.locationsdialog.setLocations(evt.locations)

    def locationsEvent(self, locations):
        evt = LocationsEvent(self, locations)
        self.GetEventHandler().AddPendingEvent(evt)
        def initialize(self):
                leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
                sb = wx.StaticBox(self, -1, 'Raster')
                sbszraster = wx.StaticBoxSizer(sb, wx.VERTICAL)
                sb = wx.StaticBox(self, -1, 'Spacing/Angle Calculator')
                sbszauto = wx.StaticBoxSizer(sb, wx.VERTICAL)

                self.widgets['raster spacing'] = IntEntry(self, -1, chars=4, min=1)
                self.widgets['raster spacing asymm'] = IntEntry(self, -1, chars=4)
                self.widgets['raster limit'] = IntEntry(self, -1, chars=4, min=1)
                self.widgets['raster limit asymm'] = IntEntry(self, -1, chars=4)
                self.widgets['raster angle'] = FloatEntry(self, -1, chars=4)
                self.widgets['raster center on image'] = wx.CheckBox(self, -1, 'Center on image')
                self.widgets['raster center x'] = IntEntry(self, -1, chars=4)
                self.widgets['raster center y'] = IntEntry(self, -1, chars=4)
                self.widgets['raster symmetric'] = wx.CheckBox(self, -1, '&Symmetric')

                ## auto raster
                self.autobut = wx.Button(self, -1, 'Calculate spacing and angle using the following parameters:')
                self.Bind(wx.EVT_BUTTON, self.onAutoButton, self.autobut)
                self.widgets['raster preset'] = PresetChoice(self, -1)
                presets = self.node.presetsclient.getPresetNames()
                self.widgets['raster preset'].setChoices(presets)
                self.widgets['raster overlap'] = FloatEntry(self, -1, chars=8)


                szauto = wx.GridBagSizer(5, 5)
                szauto.Add(self.autobut, (0, 0), (1, 2), wx.ALIGN_CENTER_VERTICAL)
                label = wx.StaticText(self, -1, 'Raster Preset')
                szauto.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szauto.Add(self.widgets['raster preset'], (1, 1), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                label = wx.StaticText(self, -1, 'Overlap percent')
                szauto.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szauto.Add(self.widgets['raster overlap'], (2, 1), (1, 1), wx.ALIGN_CENTER_VERTICAL)

                movetypes = self.node.calclients.keys()
                self.widgets['raster movetype'] = Choice(self, -1, choices=movetypes)
                label = wx.StaticText(self, -1, 'Move Type')
                szauto.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szauto.Add(self.widgets['raster movetype'], (3, 1), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sbszauto.Add(szauto, 1, wx.EXPAND|wx.ALL,5)

                szraster = wx.GridBagSizer(5, 5)

                label = wx.StaticText(self, -1, 'XY symmetry:')
                szraster.Add(label, (0,0), (1,1) , wx.ALIGN_CENTER_VERTICAL)

                self.Bind(wx.EVT_CHECKBOX, self.onToggleSymm, self.widgets['raster symmetric'])
                szraster.Add(self.widgets['raster symmetric'], (0,1), (1,2) , wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                self.widgets['raster symmetric'].SetMinSize((120,30))

                label = wx.StaticText(self, -1, 'Spacing (x,y):')
                szraster.Add(label, (1,0), (1,1), wx.ALIGN_CENTER_VERTICAL)
                szraster.Add(self.widgets['raster spacing'], (1,1), (1,1), 
                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szraster.Add(self.widgets['raster spacing asymm'], (1,2), (1,1), 
                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)

                label = wx.StaticText(self, -1, 'Num points (x,y):')
                szraster.Add(label, (2,0), (1,1), wx.ALIGN_CENTER_VERTICAL)
                szraster.Add(self.widgets['raster limit'], (2,1), (1,1),
                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szraster.Add(self.widgets['raster limit asymm'], (2,2), (1,1),
                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szraster.AddGrowableCol(1)

                label = wx.StaticText(self, -1, 'Angle:')
                szraster.Add(label, (3,0), (1,1), wx.ALIGN_CENTER_VERTICAL)
                szraster.Add(self.widgets['raster angle'], (3,1), (1,2), 
                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL)

                szraster.Add(self.widgets['raster center on image'], (4,0), (1,3), 
                        wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL)
                self.Bind(wx.EVT_CHECKBOX, self.onCheckBox, self.widgets['raster center on image'])

                label = wx.StaticText(self, -1, 'Center on x,y:')
                szraster.Add(label, (5,0), (1,1), wx.ALIGN_CENTER_VERTICAL)
                szraster.Add(self.widgets['raster center x'], (5,1), (1,1), wx.ALIGN_CENTER_VERTICAL)
                szraster.Add(self.widgets['raster center y'], (5,2), (1,1), wx.ALIGN_CENTER_VERTICAL)

                if self.widgets['raster center on image'].GetValue():
                        self.widgets['raster center x'].Enable(False)
                        self.widgets['raster center y'].Enable(False)

                if self.widgets['raster symmetric'].GetValue():
                        self.widgets['raster spacing asymm'].Enable(False)
                        self.widgets['raster limit asymm'].Enable(False)
                        self.widgets['raster spacing asymm'].SetValue(None)
                        self.widgets['raster limit asymm'].SetValue(None)
                else:
                        self.widgets['raster spacing asymm'].Enable(True)
                        self.widgets['raster limit asymm'].Enable(True)         

                sbszraster.Add(szraster, 1, wx.EXPAND|wx.ALL, 5)

                self.btest = wx.Button(self, -1, 'Test')
                szbutton = wx.GridBagSizer(5, 5)
                szbutton.Add(self.btest, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szbutton.AddGrowableCol(0)

                self.Bind(wx.EVT_BUTTON, self.onTestButton, self.btest)

                return [sbszauto,sbszraster, szbutton]
Ejemplo n.º 30
0
        def initialize(self):
                leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
                sb = wx.StaticBox(self, -1, 'Ice Thickness Threshold')
                sbszice = wx.StaticBoxSizer(sb, wx.VERTICAL)
                sb = wx.StaticBox(self, -1, 'Focus Template Thickness')
                sbszftt = wx.StaticBoxSizer(sb, wx.VERTICAL)
                sb = wx.StaticBox(self, -1, 'Target Template')
                sbsztt = wx.StaticBoxSizer(sb, wx.VERTICAL)

                self.widgets['ice min mean'] = FloatEntry(self, -1, chars=6)
                self.widgets['ice max mean'] = FloatEntry(self, -1, chars=6)
                self.widgets['ice max std'] = FloatEntry(self, -1, chars=6)
                self.widgets['focus hole'] = Choice(self, -1, choices=self.node.focustypes)
                self.widgets['target template'] = wx.CheckBox(self, -1,
                        'Use target template')
                self.widgets['focus template'] = leginon.gui.wx.TargetTemplate.Panel(self,
                        'Focus Target Template', autofill=True)
                self.widgets['acquisition template'] = leginon.gui.wx.TargetTemplate.Panel(self,
                        'Acquisition Target Template', autofill=True)
                self.widgets['focus template thickness'] = wx.CheckBox(self, -1,
                        'Use focus template thickness and limit to one focus target')
                self.widgets['focus stats radius'] = IntEntry(self, -1, chars=6)
                self.widgets['focus min mean thickness'] = FloatEntry(self, -1, chars=6)
                self.widgets['focus max mean thickness'] = FloatEntry(self, -1, chars=6)
                self.widgets['focus max stdev thickness'] = FloatEntry(self, -1, chars=6)

                szice = wx.GridBagSizer(5, 5)
                label = wx.StaticText(self, -1, 'Min. mean:')
                szice.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szice.Add(self.widgets['ice min mean'], (0, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Max. mean:')
                szice.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szice.Add(self.widgets['ice max mean'], (1, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Max. stdev.:')
                szice.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szice.Add(self.widgets['ice max std'], (2, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Focus hole selection:')
                szice.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szice.Add(self.widgets['focus hole'], (3, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szice.AddGrowableCol(1)

                sbszice.Add(szice, 1, wx.EXPAND|wx.ALL, 5)

                szftt = wx.GridBagSizer(5, 5)
                szftt.Add(self.widgets['focus template thickness'], (0, 0), (1, 2),
                                                                                wx.ALIGN_CENTER_VERTICAL)
                label = wx.StaticText(self, -1, 'Stats. radius:')
                szftt.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szftt.Add(self.widgets['focus stats radius'], (1, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Min. mean thickness:')
                szftt.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szftt.Add(self.widgets['focus min mean thickness'], (2, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Max. mean thickness:')
                szftt.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szftt.Add(self.widgets['focus max mean thickness'], (3, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                label = wx.StaticText(self, -1, 'Max. std. thickness:')
                szftt.Add(label, (4, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                szftt.Add(self.widgets['focus max stdev thickness'], (4, 1), (1, 1),
                                                                                wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE|wx.ALIGN_RIGHT)
                szftt.AddGrowableCol(1)

                sbszftt.Add(szftt, 1, wx.EXPAND|wx.ALL, 5)

                sztt = wx.GridBagSizer(5, 5)
                sztt.Add(self.widgets['target template'], (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
                sztt.Add(sbszftt, (1, 0), (3, 1), wx.ALIGN_CENTER)
                sztt.Add(self.widgets['focus template'], (0, 1), (2, 1), wx.ALIGN_CENTER|wx.EXPAND)
                sztt.Add(self.widgets['acquisition template'], (2, 1), (2, 1), wx.ALIGN_CENTER|wx.EXPAND)
                sztt.AddGrowableCol(1)
                sztt.AddGrowableRow(0)
                sztt.AddGrowableRow(2)

                sbsztt.Add(sztt, 1, wx.EXPAND|wx.ALL, 5)

                self.bice = wx.Button(self, -1, '&Test targeting')
                self.cice = wx.Button(self, -1, '&Clear targets')
                szbutton = wx.GridBagSizer(5, 5)
                szbutton.Add(self.cice, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT)
                szbutton.Add(self.bice, (0, 1), (1, 1), wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
                szbutton.AddGrowableCol(1)
                
                self.Bind(wx.EVT_BUTTON, self.onTestButton, self.bice)
                self.Bind(wx.EVT_BUTTON, self.onClearButton, self.cice)

                self.growrows = [False, True, False,]

                return [sbszice, sbsztt, szbutton]