;+ ; NAME: ; spheretool_widgets ; ; PURPOSE: ; Creates the widget hierarchy for SPHERETOOL ; ; CATEGORY: ; Digital holographic microscopy ; ; CALLING SEQUENCE: ; Internal rountine. Not intended to be called indpendently. ; w = spheretool_widgets(p, width, height) ; ; INPUTS: ; p: physical parameters describing the system ; width, height: dimensions of image window [pixels] ; ; OUTPUTS: ; w: structure containing references to the widget hierarchy ; ; REFERENCE: ; S. Lee, Y. Roichman, G. Yi, S. Kim, S. Yang, A. van Blaaderen, ; P. van Oostrum and D. G. Grier, ; Chararacterizing and tracking ; single colloidal particles with video holographic microscopy, ; Optics Express 15, 18275-18282 (2007) ; ; MODIFICATION HISTORY: ; 03/18/2009 David G. Grier, New York University, Separated from ; SPHERETOOL. ; 03/18/2009 DGG: widget layout cleanup and labeling. ; Updated for KP support. Removed support for BETA. ; 03/20/2009 DGG: Added COMPILE_OPT ; ; LICENSE ; ; This program is free software; you can redistribute it and/or ; modify it under the terms of the GNU General Public License as ; published by the Free Software Foundation; either version 2 of the ; License, or (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ; 02111-1307 USA ; ; If the Internet and WWW are still functional when you are using ; this, you shold be able to access the GPL here: ; http://www.gnu.org/copyleft/gpl.html ;- function spheretool_widgets, p, width, height compile_opt idl2, hidden ; The base widget: Contains the controls and the tabbed windows. base = WIDGET_BASE(TITLE = 'Sphere Tool', MBAR = bar, $ UVALUE = 'base', /COLUMN) file_menu = WIDGET_BUTTON(bar, VALUE = 'File', /MENU) file_bn = WIDGET_BUTTON(file_menu, VALUE = '&Save Values...', $ UVALUE = 'SAVEVALUES', ACCELERATOR = "Alt+S") file_bn = WIDGET_BUTTON(file_menu, VALUE = 'Save &Procedure...', $ UVALUE = 'SAVEPROGRAM', ACCELERATOR = "Alt+P") file_bn = WIDGET_BUTTON(file_menu, VALUE = '&Quit', $ UVALUE = 'QUIT', ACCELERATOR = "Alt+Q") ; tabbed windows showing results wtab = WIDGET_TAB(base) ; hologram tab: Show image wimagetab = WIDGET_BASE(wtab, TITLE='IMAGE', /COLUMN) wimage = WIDGET_DRAW(wimagetab, $ /BUTTON_EVENTS, UVALUE='IMAGE', $ xsize=width, ysize=height, RETAIN=2) void = WIDGET_LABEL(wimagetab, $ VALUE = 'Particle Position [pixels]', $ /ALIGN_LEFT) wparticle = WIDGET_BASE(wimagetab, COLUMN=3, /FRAME, /GRID_LAYOUT) wxc = CW_FIELD(wparticle, TITLE='xc', UVALUE='XC', /RETURN_EVENTS, $ /FLOATING, VALUE=p.rc[0]) wyc = CW_FIELD(wparticle, TITLE='yc', UVALUE='YC', /RETURN_EVENTS, $ /FLOATING, VALUE=p.rc[1]) wrad = CW_FIELD(wparticle, TITLE='radius', UVALUE='RAD', /RETURN_EVENTS, $ /INTEGER, VALUE=p.rad) void = WIDGET_LABEL(wimagetab, $ VALUE = 'Instrumental Parameters [micrometers]', $ /ALIGN_LEFT) winstrument = WIDGET_BASE(wimagetab, COLUMN=2, /FRAME, /GRID_LAYOUT) wlambda = CW_FIELD(winstrument, TITLE='lambda', UVALUE='LAMBDA', $ /RETURN_EVENTS, /FLOATING, VALUE=p.lambda) wmpp = CW_FIELD(winstrument, TITLE='mpp', UVALUE='MPP', $ /RETURN_EVENTS, /FLOATING, VALUE=p.mpp) ; profile tab: Interact with hologram's radial profile wprofiletab = WIDGET_BASE(wtab, TITLE='PROFILE', /COLUMN) wprofile = WIDGET_DRAW(wprofiletab, $ /BUTTON_EVENTS, UVALUE='IMAGEEVENT', $ xsize=width, ysize=height, RETAIN=2) bnames = ["ap","zp","np","nm","alpha","kp","deinterlace"] wbuttons = CW_BGROUP(wprofiletab, bnames, COLUMN=n_elements(bnames), $ /NONEXCLUSIVE, UVALUE='BUTTONS', $ LABEL_LEFT='Fixed parameters', $ SET_VALUE=p.fixed) wcontrols = WIDGET_BASE(wprofiletab, ROW=3) wap = CW_FSLIDER(wcontrols, TITLE="Particle Radius",$ FORMAT='("ap:", G13.6, " [um]")', $ MIN=0.1, MAX=10., /DRAG, /EDIT, $ UVALUE='AP', VALUE=p.ap, XSIZE=width/2) wzp = CW_FSLIDER(wcontrols, TITLE="Axial Position", $ FORMAT='("zp:", G13.6, " [pixels]")', $ MIN=10., MAX=500., /DRAG, /EDIT, $ UVALUE='ZP', VALUE=p.zp, XSIZE=width/2) wnp = CW_FSLIDER(wcontrols, TITLE="Particle Refractive Index", $ FORMAT='("np:", G13.6)', $ MIN=1., MAX=5., /DRAG, /EDIT, $ UVALUE='NP', VALUE=p.np, XSIZE=width/2) wkp = CW_FSLIDER(wcontrols, TITLE="Particle Extinction Coefficient", $ FORMAT='("kp:", G13.6)', $ MIN=0., MAX=5., /DRAG, /EDIT, $ UVALUE='KP', VALUE=p.kp, XSIZE=width/2) wnm = CW_FSLIDER(wcontrols, TITLE="Medium Refractive Index", $ FORMAT='("nm:", G13.6)', $ MIN=1., MAX=5., /DRAG, /EDIT, $ UVALUE='NM', VALUE=p.nm, XSIZE=width/2) walpha = CW_FSLIDER(wcontrols, TITLE="Amplitude", $ FORMAT='("alpha:", G13.6)', $ MIN=0., MAX=10., /DRAG, /EDIT, $ UVALUE='ALPHA', VALUE=p.alpha, XSIZE=width/2) ; structure containing identifiers for all widgets w = {base: base, $ ; the base widget wtab: wtab, $ ; top level widget containing tabbed widgets wimage: wimage, $ ; holographic image wprofile: wprofile, $ ; radial profile with controls wap: wap, $ ; particle radius control wzp: wzp, $ ; particle's axial position control wnp: wnp, $ ; particle index control wkp: wkp, $ ; particle extinction coefficient wnm: wnm, $ ; medium index control walpha: walpha, $ ; uniformity wxc: wxc, $ ; particle center, x wyc: wyc, $ ; particle center, y wrad: wrad, $ ; radius of region of interest wlambda: wlambda, $ ; wavelength of light wmpp: wmpp} ; micrometers per pixel return, w end