qBar $SMEI/ucsd/sat/idl/widget/qbar/qbar.pro
[Previous] [Next]
 NAME:
	qBar
 PURPOSE:
	Make bar graph or histogram plot
 CATEGORY:
	Widget
 CALLING SEQUENCE:
	qBar, array [, /histogram, xtitle=xtitle, ytitle=ytitle, title=title]
 INPUTS:
	array		array; type: any
			    array for which a bargraph or histogram is to be made
 OPTIONAL INPUT PARAMETERS:
	/histogram	if set, the IDL histogram is called with argument 'array'
			    The output from histogram is plotted as bargraph
	title =title	scalar; type: string; default: BIN
			    main plot title (at top of plot)
	xtitle=xtitle	scalar; type: string
			    title for x-axis
	ytitle=ytitle	scalar; type: string
			    title for y-axis
 OUTPUTS:
	(plot in widget)
 CALLS: ***
	CW_FIELD, FILEPATH, InitVar, IsDisplay, IsType, QBAR_EVENT, QBAR_REDRAW, XMANAGER
	XREGISTERED, bargraph, qBar_Print
 CALLED BY:
	qGlitch_Show, qImage_cw_Histogram, qRemoteView_Histogram, vu_whatis
 RESTRICTIONS:
	The average and median are calculated over the bins actually
	displayed. Note that this will only be part of the total
	distribution depending on how the minimum and maximum bin
	values are selected.
 PROCEDURE:
	bargraph does the actual plotting
 MODIFICATION HISTORY:
	APR-2000, Paul Hick (UCSD/CASS)
	SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added max keyword to IDL histogram calls


qBar_Print $SMEI/ucsd/sat/idl/widget/qbar/qbar_print.pro
[Previous] [Next]
 NAME:
	qBar_Print
 PURPOSE:
	Print current qBar display
 CATEGORY:
	Widget qBar
 CALLING SEQUENCE:
	qBar_Print, state
 INPUTS:
	state		array[1]; type: structure
			    qPlot state structure
 OUTPUTS:
	(hardcopy or EPS file)
 CALLS: ***
	QBAR_REDRAW, get_page, qset_page
 CALLED BY:
	qBar
 PROCEDURE:
	Call qset_page to set up output device.
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qEphem $SMEI/ucsd/sat/idl/widget/qimage_cw/qephem/qephem.pro
[Previous] [Next]
 NAME:
	qEphem
 PURPOSE:
	Retrieves ephemeris information
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
	event	    array[1]; type: structure
			event from state.wid_smei button
 OUTPUTS:
	Result	    scalar; type: byte
			1B: display needs to be refreshed completely
			    (by call to qImage_cw_Set_Value)
			0B: display does not need to be redrawn
 CALLS: ***
	CW_FIELD, FILEPATH, InitVar, IsType, QEPHEM_EVENT, TimeGet, TimeSystem, TimeUnit
	XMANAGER, qEphem_State, unexpected_event
 CALLED BY:
	qImage_cw_Ephem
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qEphem_State $SMEI/ucsd/sat/idl/widget/qimage_cw/qephem/qephem_state.pro
[Previous] [Next]
 NAME:
	qEphem_State
 PURPOSE:
	Gets positions from ephemeris
 CATEGORY:
	sat/widget/qephem
 CALLING SEQUENCE:
	FUNCTION qEphem_State, state, event, send=send, silent=silent
 INPUTS:
	state
 OPTIONAL INPUT PARAMETERS:
	/send
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	AngleUnits, BadValue, InitVar, IsType, TimeSet, big_eph, jpl_body, jpl_mag
	smei_star_info, smei_star_list
 CALLED BY:
	qEphem, qImage_cw_Ephem
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qFramestamp $SMEI/ucsd/sat/idl/widget/qview/qframestamp.pro
[Previous] [Next]
 NAME:
	qFramestamp
 PURPOSE:
	Calles compound widget to prompt for frame stamping information
 CATEGORY:
	Compound widget
 CALLING SEQUENCE:
	val = qFramestmap(chk_time)
 INPUTS:
	chk_time	    integer 0 or 1
			will determine if the checkbox
			for 'Timestamp' is able to be
			manipulated.
			Call with 0 if frames do not have
			timestamp data available.
			Call with 1 if they do.
 OUTPUTS:
	Result		    integer 0 if canceled or exited.
			array[3] with 3 string values
			Null if the checkbox is un-selected
			otherwise they contain the position
			for the timestamp in cardinal coords
			northeast, northwest, southeast, southwest
			the last element contains the user
			inputted string to be placed in
			the image frames.
 CALLS:
 CALLED BY
	mk_flick


qGlitch $SMEI/ucsd/sat/idl/widget/qglitch/qglitch.pro
[Previous] [Next]
 NAME:
	qGlitch
 PURPOSE:
	Search and (optionally) remove glitches from an image cube
 CATEGORY:
	Widget qGlitch
 CALLING SEQUENCE:
	qGlitch, group=group, frames, wid_frames=wid_frames, img_offset=img_offset, $
	    img_id=img_id, mask_smei_fov=mask_smei_fov
 INPUTS:
	group=group	scalar; type: long integer
			    group leader passed to XMANAGER
	frames		array[n,m,k]; type: any
			    image cube of k images of n x m pixels
 OPTIONAL INPUT PARAMETERS:
	wid_frames=wid_frames
			scalar; type: long integer
			    if this is the widget ID of a valid ID then the user value
			    of this widget should be an image cube.
			    This image cube is used instead of the 'frames' argument.
	img_offset=img_offset
			array[2]; type: integer
			    offset of images in cube; the offset is added to all pixel
			    coordinates displayed in the qImage_cw compound widget.
	img_id=img_id	array[k]; type: integer
			    by default images are numbered 0..k in the display made
			    by qGlitch_Show. If img_id is specified then img_id[0,,k]
			    is used instead
	/mask_smei_fov	if set the SMEI fov is not searched for glitches
 OUTPUTS:
	(to widgets)
 CALLS: ***
	CW_FIELD, FILEPATH, QGLITCH_EVENT, XMANAGER, qGlitch_Run, qImage_cw
 CALLED BY:
	qImage_Clean, qView_Glitch
 PROCEDURE:
	The state structure is as follows:

	state = {STATE_QGLITCH,     $
	wid_done	: 0L,		$	'Done' button
						user value: img_id; argument to qGlitch
	wid_run 	: 0L,		$	'Run' button
						user value: frames array; only if 'frames' is specified
						    as argument to qGlitch instead of 'wid_frames'
	wid_sum 	: 0L,		$	cw_field
						user value: none
	wid_spot	: 0L,		$	cw_field
						user value: none
	wid_sigma	: 0L,		$	cw_field
						user value: Loc array; output from Find2DGlitch
	wid_min 	: 0L,		$	cw_field
						user value: none
	wid_exclude	: 0L,		$	non-exclusive button
						user value: on/off status
	wid_remove	: 0L,		$	non-exclusive button
						user value: on/off status
	wid_qimage_cw	: 0L,		$	widget ID of qImage_cw compound widget
						user value: mask_smei_fov; keyword to qGlitch
	wid_frames	: 0L		$	widget ID of widget with the 'frames' array as user value.
						This may be state.wid_run (if the 'frames' array was
						passed as argument to qGlitch) or it may be the ID
						of some external widget (e.g, the wid_data widget
						from qView) if keyword 'wid_frames' was used.
	}
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qGlitch_Run $SMEI/ucsd/sat/idl/widget/qglitch/qglitch_run.pro
[Previous] [Next]
 NAME:
	qGlitch_Run
 PURPOSE:
	Search for glitches through an image cube
 CATEGORY:
	Widget qGlitch
 CALLING SEQUENCE:
	qGlitch_Run, state, event
 INPUTS:
	state	    array[1]; type: structure
			qGlitch state structure
 OUTPUTS:
	(none)
 CALLS: ***
	BadValue, CV_COORD, Find2DGlitch, Inside_Wedge, destroyvar, gridgen, qGlitch_Show
	smei_camera
 CALLED BY:
	qGlitch
 SIDE EFFECTS:
 RESTRICTIONS:
	Find2DGlitch is incredibly memory intensive ....
 PROCEDURE:
	The call to Find2DGlitch is set up using values from the qGlitch widgets.
	The output of Find2DGlitch is passed to qGlitch_Show for display.
 STATE INFO USED:
	widget_control, state.wid_frames , get_uvalue=frames, /no_copy
	widget_control, state.wid_sum	 , get_value = SumWidth
	widget_control, state.wid_spot	 , get_value = SpotWidth
	widget_control, state.wid_sigma  , get_value = SigmaThreshold
	widget_control, state.wid_min	 , get_value = MinThreshold
	widget_control, state.wid_exclude, get_uvalue= exclude
	widget_control, state.wid_remove , get_uvalue= remove
	widget_control, state.wid_qimage_cw, get_uvalue=mask_smei_fov
 STATE INFO MODIFIED:
	widget_control, state.wid_sigma  , set_uvalue=Loc   , /no_copy
	widget_control, state.wid_frames , set_uvalue=frames, /no_copy
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qGlitch_Show $SMEI/ucsd/sat/idl/widget/qglitch/qglitch_show.pro
[Previous] [Next]
 NAME:
	qGlitch_Show
 PURPOSE:
	Display results of a search for glitches through an image cube
 CATEGORY:
	Widget qGlitch
 CALLING SEQUENCE:
	qGlitch_Show, state, nGroup, pGroup, lGroup
 INPUTS:
	state		array[1]; type: structure
			    qGlitch state structure
	nGroup		scalar; type: integer
	pGroup		array[nGroup]; type: integer
	lGroup		array[nGroup]; type: integer
			    output from Find2DGlitch (called in qGlitch_Run)
			    contains a description of the glitches found.
	fGroup
 OUTPUTS:
	(to qImage_cw compound widget)
 CALLS: ***
	ArrayLocation, Reset_Colors, qBar
 CALLED BY:
	qGlitch_Run
 PROCEDURE:
	The information returned from Find2DGlitch describes the glitches:
	there are nGroup glitches of lGroup pixels. The locations are
	specified in pGroup as indices into the Loc array stored as user
	value to state.wid_frames (also return from Find2DGlitch).
	For each glitch a circle is drawn on an image plane with the
	same size as the images searched for glitches. The image number
	is plotted next to the glitch.
 STATE INFO USED:
	widget_control, state.wid_sigma , get_uvalue=Loc   , /no_copy
	widget_control, state.wid_frames, get_uvalue=frames, /no_copy
 STATE INFO MODIFIED:
	widget_control, state.wid_frames, set_uvalue=frames, /no_copy
	widget_control, state.wid_sigma , set_uvalue=Loc   , /no_copy
	widget_control, state.wid_qimage_cw, set_value=template
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage $SMEI/ucsd/sat/idl/widget/qimage/qimage.pro
[Previous] [Next]
 NAME:
	qImage
 PURPOSE:
	Widget 'wrapper' for the compound widget qImage_cw
 CATEGORY:
	Widgets
 CALLING SEQUENCE:
	qImage, filter, image=image, group=group, img_offset=img_offset, wid_base=wid_base
 INPUTS:
	filter		scalar; type: string; default: *.*
			    file name filter for file selection
			    If the filter does not contain a wildcard (i.e. is the
			    name of a single file) then an attempt is made to load
			    the image from the file.
 OPTIONAL INPUT PARAMETERS:
	group=group	scalar; type: long integer
			    group leader passed to XMANAGER
	image=image	array[n,m]; type: any
			    image array to be displayed. If specified this image
			    is displayed, overriding the filter specification.
	wid_base=wid_base
			scalar; type: long integer
			    if this is the widget ID of a valid widget, then
			    qImage assumes that it is an existing instance of
			    itself and will use it to display the image
			    Otherwise qImage will create a new instance.
 OUTPUTS:
	(to widget)
 CALLS: ***
	CW_FIELD, FILEPATH, GetFileSpec, IsType, QIMAGE_EVENT, SetFileSpec, XMANAGER, hide_env
	qImage_Clean, qImage_FileInfo, qImage_Gain, qImage_Pick, qImage_Save, qImage_Send
	qImage_TrackPeak, qImage_cw, unexpected_event
 CALLED BY:
	qImage_cw_Where, qView_Image, qView_SetBox
 PROCEDURE:
	The state structure is as follows:

	state = {STATE_QIMAGE,	$
	    wid_send	    : 0L,   $	    Row base widget
					    user value: widget ID of widget to receive QIMAGE_SEND
						events (set by qImage_SendDestination)
	    wid_exit	    : 0L,   $	    'Done' button
					    user value: none
	    wid_pick	    : 0L,   $	    'Image' button for selection of image file
					    user value: none
	    wid_filter	    : 0L,   $	    cw_field for entering file filter for image file selection
					    user value: none
	    wid_qimage_cw   : 0L,   $	    compound widget qimage_cw
					    user value: none
	    wid_info	    : 0L,   $	    'Info' button to display information about the current image
					    user value: string array containing information about image
	    wid_clean	    : 0L,   $
	    wid_save	    : 0L,   $
	    foreign	    : 0     $	    set by qImage_SendDestination using keyword 'foreign'; controls how
					    qImage reacts to QIMAGE_CW_UPDATE events from qImage_cw compound widget.
					    foreign=0: ignore events
					    foreign=1,2: call qImage_TrackPeak (used by the 'Track' option in qView).
	    boxes	    : fltarr(2,2,2)	$
	    }
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_Clean $SMEI/ucsd/sat/idl/widget/qimage/qimage_clean.pro
[Previous] [Next]
 NAME:
	qImage_Clean
 PURPOSE:
	Removes glitches from single image
 CATEGORY:
	Widget qImage
 CALLING SEQUENCE:
	qImage_Clean, state, event
 INPUTS:
	state	    array[1]; type: structure
			qImage state structure
	event	    array[1]; type: structure
			event structure send by 'Clean' widget
 OUTPUTS:
	(none)
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	qGlitch, qImage_cw_Box, qImage_cw_BoxImage
 CALLED BY:
	qImage
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	APR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw.pro
[Previous] [Next]
 NAME:
	qImage_cw
 PURPOSE:
	Also contains qImage_cw_Event
	Display and manipulate single image
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	wid = qImage_cw(wid_parent, uvalue=uvalue)
 INPUTS:
	wid_parent	    scalar; type: long integer
			    ID of the parent widget
 OPTIONAL INPUT PARAMETERS:
	uvalue=uvalue	anything; user-defined
 OUTPUTS:
	(none)
 CALLS: ***
	CW_FIELD, InitVar, IsType, QIMAGE_CW_EVENT, qImage_cw_Box, qImage_cw_CrossSection
	qImage_cw_Ephem, qImage_cw_Mouse, qImage_cw_SMEI, qImage_cw_Save
	qImage_cw_Slider, qImage_cw_SmeiMask, qImage_cw_Tool, qImage_cw_Update
	qImage_cw_WedgeSection, qImage_cw_Where, qImage_cw_ZUpdate, qTool_State [1]
	qTool_State [2], unexpected_event
 EXTERNAL:
	qImage_cw_state__define
 CALLED BY:
	qGlitch, qImage, qsmei_sky
 PROCEDURE:
	The state structure used is the following:

	state = {STATE_QIMAGE_CW,	$

	    wid_win	    : lonarr( 2),   $	    cw_field's for window size (horizontal and vertical)
						    user value: actual size of current window
	    wid_xyz	    : lonarr(10),   $	    cw_field's for positional and intensity (z-value)
						    image information
						    user value: none
		    wid_xyz[8]	    x-coordinate of center of mass (centroid)
					user value: array[2]; type: double: the centroid again
		    wid_xyz[9]	    y-coordinate of center of mass (centroid)
					user value: array[3]; type: float; background used for centroid
					    calculation, # pixels in center area, # pixels in background area
	    wid_draw_wrap   : 0L,	    $
	    wid_draw	    : 0L,	    $	    draw widget; main display
	    wid_blowup	    : 0L,	    $	    draw widget; displays a small blowup centered on the current box
						    user value: none
	    wid_xcross	    : 0L,	    $	    draw widget; displays horizontal cross section
						    user value: none
	    wid_ycross	    : 0L,	    $	    draw widget: displays vertical cross section
						    user value: none
	    wid_image	    : 0L,	    $	    base widget; 2nd child of the root widget
						    user value: array[*,*,2], the image
	    wid_xslide	    : 0L,	    $	    slider for moving the center of the display horizontally
						    user value: scalar; horizontal index of pixel in magnified image
							    at lower left corner of window
	    wid_yslide	    : 0L,	    $	    slider for moving the center of the display vertically
						    user value: scalar; vertical index of pixel in magnified image
							    at lower left corner of window

	    wid_tool	    : 0L,	    $	    non-exclusive button: on/off button for tool widget
						    user value: the state of the tool widget
	    wid_smei	    : 0L,	    $	    non-exclusive button; on/off button for using wedge instead of square
						    user value: 0 or 1; updated when button is pressed
	    wid_smei_base   : 0L,	    $
	    wid_prorate     : lonarr(3),    $	    non-exclusive button: on/off button for pro-rating z-values
						    user value: 0 or 1; updated when button is pressed
	    wid_center	    : lonarr(2),    $	    cw_field's for the center of the SMEI fov
						    get: qimage_cw_box, qimage_zupdate
						    user value: none
	    wid_phi	    : lonarr(4),    $	    cw_field's for setting the azimuthal extent of a wedge
						    (min- and max azimuth, azimuth step size
						    [0:1]: min & max azimuth: get/set in qimage_cw_box
						    [2	]  azimuthal step size: get in qimage_cw_wedgesection
						    [3	]: centroid azimuth : set in qimage_cw_zupdate
						    user value: none
	    wid_rad	    : lonarr(4),    $	    cw_field's for setting the radial extent of a wedge
						    (min- and max radius, radial step size
						    [0:1]: min & max radius : get/set in qimage_cw_box
						    [2	]: radial step size : get in qimage_cw_wedgesection
						    [3	]: centroid radius  : set in qimage_cw_zupdate
						    user value: none
	    wid_azimuthal   : 0L,	    $	    button for initiating qLine widget for azimuthal section
						    user value: none
	    wid_radial	    : 0L,	    $	    button for initiating qLine widget for radial section
						    user value: none
	    wid_smeifov     : 0L,	    $	    button for resetting wedge size to the full SMEI fov
						    user value: none
	    wid_smeimask    : 0L,	    $	    user value: none
						    button for writing mask for SMEI fov to file
	    wid_cos	    : 0L,	    $	    non-exclusive button for activating cosine correction
						    user-value: current setting
	    wid_axis	    : lonarr(2),    $	    cw_field widgets for position of optical axis
						    user value: none
	    wid_background  : 0L,	    $	    cw_field widgets for constant pedestal
						    user value: extra pedestal used for centroid calculation
	    wid_zavg2back   : 0L,	    $	    button for transferring current average to wid_background
						    user value: none
	    img_size	    : intarr(2),    $	    array[2]; dimensions of the image on display
							set: qImage_cw, qImage_cw_Set_Value
	    img_offset	    : intarr(2)     $	    array[2]; position of lower left corner of image
							on display if extracted from a larger image
							the offset iz [0,0] unless set by the widget
							calling qImage_cw
	}
 MODIFICATION HISTORY:
	JAN-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Blowup $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_blowup.pro
[Previous] [Next]
 NAME:
	qImage_cw_Blowup
 PURPOSE:
	Get small portion of image in main draw widget and put it in the small
	draw widget at the top right
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_Blowup, state, image, edge
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
 OUTPUTS:
	(to state.wid_blowup draw widget)
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	MagnifyArray, qImage_cw_Box, qImage_cw_BoxImage, qImage_cw_Property
	qImage_cw_Transform
 CALLED BY:
	qImage_cw_Update
 PROCEDURE:
	The current box setting is setting is extracted using qImage_cwBox.
	A small section centered on the box center is extracted from the curren
	image and is put in the blowup draw widget.
	If the current box is very close to the edge than the blowup will be
	shifted relative to the center to prevent it from moving outside the
	image boundary.
 STATE INFO USED:
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Box $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_box.pro
[Previous] [Next]
 NAME:
	qImage_cw_Box
 PURPOSE:
	Set or retrieve the values of the current box boundaries
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_Box, state, box, fullsize=fullsize, oldbox=oldbox, get=get, nobox=nobox
	qImage_cw_Box, state, box, /center
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
	box		array[2,2]; type: integer
			    defines two corners of box in the form [ [x1,y1], [x2,y2] ]
 OPTIONAL INPUT PARAMETERS:
	/polar		get a box in polar coordinates; then use it to update
			the box widgets.
			The box in polar coordinates is selected as
			- keyword p_box if /put is set
			- set to the SMEI fov is /smeifov is set
			- read from the polar box widgets in the SMEI widget section
			The polar box is then used to update all box widgets as if
			/put was set.

	If /put and /polar are set:

	p_box=p_box	array[2,2]; float
			    limiting values in azimuth and radius of the wedge-shaped
			    area corresponding to the two corners of 'box'
			    in the form [[angle1,radius1],[angle2,radius2]].
			    Angle1 and angle2 are in radians between [-!pi,+!pi].
			    The wedge runs counterclockwise from 'angle1' to 'angle2'
			    over less than 180 degrees: either angle2 > angle1 with
			    angle2-angle1 < !pi or angle2 < angle1 with
			    angle+2*!pi-angle1 < !pi. Always radius1 < radius2.

			    The pixel coordinates of the two corners are rounded to the
			    nearest integer value.

	/smeifov	setting /smeifov, implies setting /polar and /put.
			    Selects the full SMEI fov (retrieved from the widget).

	/fullsize	setting this keyword is the same as setting box to the full size of the
			    image: box = [ [0,0], [state.img_size-1] ]
	/get		retrieves the current settings, and returns them in 'box'
	/put		updates the current setting using the values in 'box'
			    (this is the default if neither /put nor /get are set)
	/center 	if set then the center for polar transformations is returned
			    (with the state.img_offset subtracted) in 'box'.
			    'p_box' returns the full SMEI FOV.

 OUTPUTS:
	If keyword /get is set:

	box		array[2,2]; type: integer
			    defines two corners of box in the form [ [x1,y1], [x2,y2] ]
	p_box=p_box	array[2,2]; float
			    limiting values in azimuth and radius of the wedge-shaped
			    area corresponding to the two corners of 'box'
			    in the form [[angle1,radius1],[angle2,radius2]].
			    Angle1 and angle2 are in radians between [-!pi,+!pi].
			    The wedge runs counterclockwise from 'angle1' to 'angle2'
			    over less than 180 degrees: either angle2 > angle1 with
			    angle2-angle1 < !pi or angle2 < angle1 with
			    angle+2*!pi-angle1 < !pi. Always radius1 < radius2.

	If keyword /center is set:

	box		array[2]; type: integer
			    the pixel coordinates of the center used for polar transformations
	p_box=p_box	array[2,2]; float
			    limiting values in azimuth and radius of the fov
			    in the form [[angle1,radius1],[angle2,radius2]].
			    Angle1 and angle2 are in radians between [-!pi,+!pi].
			    The fov runs counterclockwise from 'angle1' to 'angle2'.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CV_COORD, InitVar
 CALLED BY:
	qImage_Clean, qImage_Gain, qImage_SendInfo, qImage_TrackPeak, qImage_cw
	qImage_cw_Blowup, qImage_cw_BoxCosine, qImage_cw_CrossSection
	qImage_cw_DrawCross, qImage_cw_Ellipse, qImage_cw_Histogram, qImage_cw_Mouse
	qImage_cw_SMEI, qImage_cw_Set_Value, qImage_cw_Show, qImage_cw_Slider
	qImage_cw_SmeiMask, qImage_cw_Tool, qImage_cw_Update, qImage_cw_Wedge
	qImage_cw_WedgeSection, qImage_cw_ZEllipse, qImage_cw_ZUpdate
	qImage_cw_ZWedge
 SIDE EFFECTS:
	The pixel values displayed in the widget are usually pixel coordinates in the draw widget
	where the image is displayed. If state.img_offset is set to a non-zero value this will
	be added to the displayed numbers.

	Generally the state.img_offset is set by the calling widget to a non-zero value when
	the image fed to qImage_cw is a portion of a bigger image, and the user wants to see
	pixel location in the bigger array displayed by qImage_cw (rather than pixel
	locations in the smaller subimage).
 PROCEDURE:
 >	Modification and retrieval of values in the widgets controlling the position of the box
	should be made with this routine only !!!
 >	All sanity checks are made when the fields are updated. Retrieval is just a matter of
	reading the values of the wid_xyz[0:3] widgets.

 >	The numbers in the x,y widget represent a square section in the image, specified as
	minimum and maximum x and y values. The values are usually input by two mouse
	clicks, i.e. two opposite corners of the square as pairs [x1,y1] and [x2,y2].
	The point are then stored in the appropriate minimum and maximum x,y widgets.

 > The two corners of the box define a wedge-shaped area. The area is bounded by two
	circles and two radii (defined relative to the image center defined in the widget).
	Two of the corners of the wedge coincide with the two corners of 'box'.
 STATE INFO USED:
	widget_control, state.wid_xyz[0], get_value=get_value0
	widget_control, state.wid_xyz[1], get_value=get_value2
	widget_control, state.wid_xyz[2], get_value=get_value1
	widget_control, state.wid_xyz[3], get_value=get_value3

	state.img_size		dimensions of array on display
	state.img_offset	an offset between the pixel numbers displayed in the
				x,y widgets and the pixel coordinate in the image
				(see SIDE EFFECTS above).
 STATE INFO MODIFIED:
	widget_control, state.wid_xyz[0], set_value=set_value[0]
	widget_control, state.wid_xyz[2], set_value=set_value[1]
	widget_control, state.wid_xyz[1], set_value=set_value[2]
	widget_control, state.wid_xyz[3], set_value=set_value[3]
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_BoxCosine $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_boxcosine.pro
[Previous] [Next]
 NAME:
	qImage_cw_BoxCosine
 PURPOSE:
	Applies geometric corrections to intensities in SMEI fov
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	img_box = qImage_cw_BoxCosine(state, img_box, box)
	img_box = qImage_cw_BoxCosine(state, img_box, pfov=pfov)
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
	img_box 	array[n,m]; type: float
			pixel values in area to be corrected
	box	    array[2,2]; type: integer
			pixel coordinates of lower-left and upper-right corners
			of area to be corrected. The coordinates must be
			relative to the lower-left corner of the image on display
			(i.e. after subtracting state.img_offset)
	pfov	    array[2,n,m]; type: float
			polar coordinates of pixels in img_box
			Pixels outside the field of view should be marked with
			BadValue(0.0)
			If 'pfov' is used then 'box' is not used and need not be present
 OUTPUTS:
	img_box
		    array[*,*]; type: same as input 'img_box'
			corrected subarray
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CV_COORD, InitVar, Inside_Wedge, IsType, SubArray, SuperArray, gridgen, qImage_cw_Box
 CALLED BY:
	qImage_cw_BoxImage, qView_PlotSeries
 PROCEDURE:
 STATE INFO USED:
	widget_control, state.wid_axis[0], get_value=phi
	widget_control, state.wid_axis[0], get_value=phi
	widget_control, state.wid_axis[1], get_value=rad
 MODIFICATION HISTORY:
	MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_BoxImage $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_boximage.pro
[Previous] [Next]
 NAME:
	qImage_cw_BoxImage
 PURPOSE:
	Extracts an area from the current image
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	status = qImage_cw_BoxImage(state, box, sub_img=sub_img, sub_box=sub_box)
	status = qImage_cw_BoxImage(state, box, image=image, sub_img=sub_img)
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
	box	    array[2,2]; type: integer
			area to be extracted from the original image
			if not specified then box = [[0,0], [n-1,m-1]] (the full
			image or screen) is assumed.

			/screen NOT set:
			The box is specified as pixel indices into the original
			image, but can extend outside the image, or even lie
			completely outside the image.
 OPTIONAL INPUT PARAMETERS:
	/screen     if set the extraction is done for the byte-scaled image on the display
			rather than the raw image
	image=image array[n,m]; type: float
			array to be used as current image, instead of the user value
			of state.wid_image
			(this keyword is used only in qImage_cw_Set_Value)
 OUTPUTS:
	status	    scalar; type: byte
			0: if 'box' does not include any pixels inside the image
			1: if a valid 'sub_img' was extracted
 OPTIONAL OUTPUT PARAMETERS:
	sub_img=sub_img
		    array[*,*]; type: same as current image
			subarray containing requested area
	sub_box=sub_box
		    array[2,2]; box with indices into 'image' of elements
			returned in sub_img
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, IsType, qImage_cw_BoxCosine, qImage_cw_Property
 CALLED BY:
	qImage_Clean, qImage_cw_Blowup, qImage_cw_CrossSection, qImage_cw_DrawCross
	qImage_cw_Histogram, qImage_cw_Set_Value, qImage_cw_Update, qImage_cw_ZEllipse
	qImage_cw_ZUpdate, qImage_cw_ZWedge
 PROCEDURE:
	The pedestal from the value of the state.background widget is subtracted
 STATE INFO USED:
	widget_control, state.wid_background, get_value=pedestal1
	widget_control, state.wid_image, get_uvalue=image, /no_copy
 STATE INFO MODIFIED:
	widget_control, state.wid_image, set_uvalue=image, /no_copy
 MODIFICATION HISTORY:
	MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_BoxZoom $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_boxzoom.pro
[Previous] [Next]
 NAME:
	qImage_cw_BoxZoom
 PURPOSE:
	Prepare zoomed part of image that fits on screen
 CATEGORY:
 CALLING SEQUENCE:
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
	sub_img 	array[n,m]; type: any
			    part of original image to be put on screen
	sub_box 	array[2,2]; type: integer
			    box with indices of part of original image
			    stored in sub_img
	screen		array[2]; type: integer
			    screen size (# hor and vert pixels)
	zoom		scalar; type: integer
			    the zoom factor (can be < 0)
 OPTIONAL INPUT PARAMETERS:
	/xzoom
	/yzoom
 OUTPUTS:
	sub_img 	array[n,m]; type: any
	sub_box 	    box with location on screen where sub_img is
			    to put.
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 EXTERNAL:
 CALLS: ***
	InitVar, MagnifyArray, qImage_cw_Transform
 CALLED BY:
	qImage_cw_DrawCross, qImage_cw_Set_Value
 PROCEDURE:
 MODIFICATION HISTORY:
	MAY-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_CrossSection $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_crosssection.pro
[Previous] [Next]
 NAME:
	qImage_cw_CrossSection
 PURPOSE:
	Displays the horizontal and vertical cross-sections in a separate qLine widget.
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
	event	    array[1]; type: structure
			event from state.wid_xcross or state.wid_ycross widgets
 OUTPUTS:
	(to qLine)
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	qImage_cw_Box, qImage_cw_BoxImage, qImage_cw_Property, qLine
 CALLED BY:
	qImage_cw
 PROCEDURE:
	The cross section is calculate the same way as for the curves
	plotted along the main draw widget in qImage_cw.
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_ctable $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_ctable.pro
[Previous] [Next]
 NAME:
	qImage_cw_ctable
 PURPOSE:
	Change color table used in draw widget
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_ctable, state
 INPUTS:
	state		scalar, structure
			contains IDs for all qView widgets
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType, LOADCT
 CALLED BY:
	qImage_cw_Set_Value, qImage_cw_Show, qImage_cw_Tool
 PROCEDURE:
 MODIFICATION HISTORY:
	MAY-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_DrawCross $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_drawcross.pro
[Previous] [Next]
 NAME:
	qImage_cw_DrawCross
 PURPOSE:
	Draw cross section across top and along left edge of main draw widget
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_DrawCross, state
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	BadValue, IsType, qImage_cw_Box, qImage_cw_BoxImage, qImage_cw_BoxZoom
	qImage_cw_MinMax, qImage_cw_Property, qImage_cw_Transform
 CALLED BY:
	qImage_cw_Update
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 STATE INFO USED:
	widget_control, state.wid_xcross , get_value=window_number
	widget_control, state.wid_ycross , get_value=window_number
	widget_control, state.wid_xcross, get_uvalue=x, /no_copy
	widget_control, state.wid_ycross, get_uvalue=y, /no_copy
	widget_control, state.wid_tool	, get_uvalue=tool
 STATE INFO MODIFIED:
	widget_control, state.wid_xcross, set_uvalue=x, /no_copy
	widget_control, state.wid_ycross, set_uvalue=y, /no_copy
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_DrawEphem $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_drawephem.pro
[Previous] [Next]
 NAME:
	qImage_cw_DrawEphem
 PURPOSE:
	Mark locations in ephemeris on screen
 CATEGORY:
	sat/widget/qimage_cw
 CALLING SEQUENCE:
	PRO qImage_cw_DrawEphem, state, color=color
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	color=color	scalar; type: integer
			    color in which to label locations
			    (will be either !p.color or !p.background)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType, TimeOp, TimeSet, TimeUnit, big_eph, cvsmei, destroyvar, qImage_cw_Ephem
	qImage_cw_Property, qImage_cw_Transform, smei_frm_where
 CALLED BY:
	qImage_cw_Update
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS)
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added print statement for RA/dec of bodies


qImage_cw_Ellipse $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_ellipse.pro
[Previous] [Next]
 NAME:
	qImage_cw_Ellipse
 PURPOSE:
	Calculate boundary and bounding box for a wedge specified as two points
	in polar coordinates
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	Result = qImage_cw_Wedge(state, p_box, )
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	p_box	    array[2,2]; type: float
			limiting values in phase angle and radius of the wedge
			in the form [[angle1,radius1],[angle2,radius2]].
			Angle1 and angle2 are in radians between [-!pi,+!pi].
			The wedge runs counterclockwise from 'angle1' to 'angle2'
			over less than 180 degrees: either angle2 > angle1 with
			angle2-angle1 < !pi or angle2 < angle1 with
			angle+2*!pi-angle1 < !pi. Always radius1 < radius2.

			If polar_box is not specified then the wedge specified in
			the qImage_cw widget is used.

			If polar_box is specified then the value is processed by qImage_cw_Box.
			This will update the qImage_cw widget, but will also slightly modify
			polar_box in such a way that the two corners of the wedge coincide with
			integer pixel locations (the values returned in 'box')
			(set /noupdate to bypass this step)
	/noupdate	Only used if polar_box is specified. Bypasses a call to
			qImage_cw_Box (which updates the position widgets).
 OUTPUTS:
	result	    array[2,2]; type: integer
			corners of the smallest square in the image that completely encloses
			the wedge in pixel coordinates in the form [[x1,y1],[x2,y2].
			Always x1 <= x2, y1 <= y2.
 OPTIONAL OUTPUT PARAMETERS:
	wedge	    array[2,n]; type: float
			boundary of wedge as a closed array (first=last point)
			in rectangular (pixel) coordinates.
	box	    array[2,2]; type: float; default: content of X,Y position widgets in
			qImage_cw. Two points in the image plane, specified as pixel coordinate
			values in the same form as the bounding box.
			'box' is obtained by a call to qImage_cw_Box, and is not modified.
			If /noupdate is set then qImage_cw_Box is not called and 'box' will be undefined.
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	CV_COORD, InitVar, IsType, REVERSE, qImage_cw_Box
 PROCEDURE:
	The origin of the rectangular to polar transformation is the value of
	the state.wid_center widgets
	If p_box is specified, and keywords /noupdate and img_center are used then the state structure
	is not accessed.
 STATE INFO USED:
 STATE INFO MODIFIED:
	(none)
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Ephem $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_ephem.pro
[Previous] [Next]
 NAME:
	qImage_cw_Ephem
 PURPOSE:
	Handles ephemeris access qImage_cw widget
 CATEGORY:
	sat/idl/widget/qimage_cw
 CALLING SEQUENCE:
	FUNCTION qImage_cw_Ephem, state, event, update=update
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, IsType, TimeSet, destroyvar, qEphem, qEphem_State, qImage_cw_Property
 CALLED BY:
	qImage_cw, qImage_cw_DrawEphem
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS)
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added pnt_raded to ephem_state structure


qImage_cw_EphemKill [1] $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_ephemkill.pro
[Previous] [Next]
 NAME:
	qImage_cw_EphemKill
 PURPOSE:
	Destroys heap variables associated with qephem widget
 CATEGORY:
 CALLING SEQUENCE:
	PRO qImage_cw_EphemKill, wid_ephem
 INPUTS:
	wid_ephem
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType, destroyvar
 PROCEDURE:
 MODIFICATION HISTORY:
	SEP-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added documentation


qImage_cw_EphemKill [2] $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_toolkill.pro
[Previous] [Next]
 NAME:
	qImage_cw_EphemKill
 PURPOSE:
	Destroys heap variables associated with qtool widget
 CATEGORY:
 CALLING SEQUENCE:
	PRO qImage_cw_ToolKill, wid_tool
 INPUTS:
	wid_tool
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	QIMAGE_CW_TOOLKILL, destroyvar
 PROCEDURE:
 MODIFICATION HISTORY:
	SEP-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added documentation


qImage_cw_Histogram $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_histogram.pro
[Previous] [Next]
 NAME:
	qImage_cw_Histogram
 PURPOSE:
	Starts the qBar widget in histogram mode using the section of the
	current image defined by the current box
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_Histogram, state
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	qBar, qImage_cw_Box, qImage_cw_BoxImage
 CALLED BY:
	qImage_cw_Show, qImage_cw_Tool
 PROCEDURE:
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_MinMax $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_minmax.pro
[Previous] [Next]
 NAME:
	qImage_cw_MinMax
 PURPOSE:
	Scale an array of function values to a given range
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	Result = qImage_cw_MinMax(state, fnc_val)
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
	fnc_val 	array; type: any
 OUTPUTS:
	Results 	array; type; same as fnc_val
			    function values scaled to given range
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, IsType
 CALLED BY:
	qImage_cw_DrawCross, qImage_cw_Set_Value, qView_Movie, qView_Save2File
	qView_Wall
 PROCEDURE:
	If the 'FixZ' option is off then the minimum and maximum used are the minimum and
	maximum of the fnc_val array. If 'FixZ' is on the the values from the qTool widget
	are used.
	The returned array is
	    (fnc_val < zmax) > zmin
	or (if log scale is used, as indicated by the state.wid_tool widget)
	    (alog10((fnc_val-zmin+1) > 1)) < alog10(zmax-zmin+1)
 STATE INFO USED:
	widget_control, state.wid_tool, get_uvalue=tool_state, /no_copy
 STATE INFO MODIFIED:
	(none)
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Mouse $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_mouse.pro
[Previous] [Next]
 NAME:
	qImage_cw_Mouse
 PURPOSE:
	Processes mouse press, release and motion messages from the draw widget.
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_Mouse, state, event
 INPUTS:
	state		scalar, structure
			contains IDs for all qView widgets
	event		scalar, structure
			event structure passed to qView_Event by XManager
 OUTPUTS:
	Updates the current box in the X,Y widgets, and update the user value
	of the state.wid_blowup widget
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	CV_COORD, qImage_cw_Box, qImage_cw_Transform, qImage_cw_Update
 CALLED BY:
	qImage_cw
 PROCEDURE:
	First mouse click defines the first corner of a box,
	The box boundary changes tracking dragging of the mouse.
	The second click defines the second corner.
	Roam mode:
	    when the box is completed (2nd click), then continued dragging
	    causes the current box to track the mouse motion
	NOT in roam mode:
	    fixes the box and leaves in the same position until the
	    next click (which starts a new box).
 STATE INFO USED:
	widget_control, state.wid_tool, get_uvalue=tool, /no_copy
	widget_control, state.wid_smei, get_uvalue=set
 STATE INFO MODIFIED:
	widget_control, state.wid_tool, set_uvalue=tool, /no_copy
 MODIFICATION HISTORY:
	JAN-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Property $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_property.pro
[Previous] [Next]
 NAME:
	qImage_cw_Property
 PURPOSE:
	Extracts widget properties from state vector
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	FUNCTION qImage_cw_Property, state  , $
	    screen_size     = screen_size   , $
	    slider_origin   = slider_origin , $
	    blowup_size     = blowup_size   , $
	    image_size	    = image_size    , $
	    window_nr	    = window_nr     , $
	    image_name	    = image_name    , $
	    no_extension    = no_extension  , $
	    image_time	    = image_time    , $
	    quaternion	    = quaternion
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OUTPUTS:
	result	    depends on keyword selected
 OPTIONAL OUTPUT PARAMETERS:
	window_nr=window_nr
		    window of draw widget (/screen_size set) or
		    blowup window (/blowup_size set)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	GetFileSpec, InitVar, IsType, TimeGet, smei_filename, smei_getfile, smei_property
	smei_sky_field
 CALLED BY:
	qImage_cw_Blowup, qImage_cw_BoxImage, qImage_cw_CrossSection
	qImage_cw_DrawCross, qImage_cw_DrawEphem, qImage_cw_Ephem, qImage_cw_Save
	qImage_cw_Set_Value, qImage_cw_SmeiMask, qImage_cw_Transform, qImage_cw_Where
 PROCEDURE:
 MODIFICATION HISTORY:
	MAY-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Save $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_save.pro
[Previous] [Next]
 NAME:
	qImage_cw_Save
 PURPOSE:
	Handles saving of image in image file
 CATEGORY:
	sat/idl/widget/qimage_cw
 CALLING SEQUENCE:
	PRO qImage_cw_Save, state, event
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	GetFileSpec, qImage_cw_Property, qSave2File
 CALLED BY:
	qImage_cw
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Set_Value $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_set_value.pro
[Previous] [Next]
 NAME:
	qImage_cw_Set_Value
 PURPOSE:
	'Set Value' function called by the widget event function when
	widget_control is used to set the value of the compound widget
 CATEGORY:
	Compound widget qImage
 CALLING SEQUENCE:
	PRO qImage_cw_Set_Value, wid_root, image
 INPUTS:
	wid_root	scalar; type: long integer
			    window ID of base widget of pImage
	image		array[n,m] or array[n,m,2]
			    the image to be displayed
			    array[n,m,1] contains the input image (without modifications)
			    array[n,m,2] contains the input image (or a subsection
				if the zoom factor is unequal 1) converted to byte
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	BadValue, IsType, Reset_Colors, qImage_cw_Box, qImage_cw_BoxImage
	qImage_cw_BoxZoom, qImage_cw_MinMax, qImage_cw_Property, qImage_cw_Tool
	qImage_cw_Transform, qImage_cw_ctable
 PROCEDURE:

 STATE INFO USED:
	widget_info( wid_root, /child )
	widget_control, wid_child, get_uvalue=state, /no_copy
	widget_info(state.wid_draw,/valid_id)
	widget_control, state.wid_win[0], get_value=ix
	widget_control, state.wid_win[1], get_value=iy
	widget_control, state.wid_tool, get_value=tool_state, /no_copy
	widget_control, state.wid_zoomout, set_uvalue=anchor, /no_copy
	widget_control, state.wid_draw, get_value=wnew
 STATE INFO UPDATED:
	widget_control, state.wid_tool , set_uvalue=tool, /no_copy
	widget_control, state.wid_image, set_uvalue=image, /no_copy
	widget_control, wid_child      , set_uvalue=state, /no_copy
	widget_control, wid_root, send_event={QIMAGE_CW_UPDATE, id:0L, top:0L, handler:wid_root}

	state.img_size	    image dimensions
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
	MAR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Bug fix. User value of slider widgets were not
	    updated when zoom factor changes.


qImage_cw_Show $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_show.pro
[Previous] [Next]
 NAME:
	qImage_cw_Show
 PURPOSE:
	Handles zooming and rebinning in qImage_cw
 CATEGORY:
	sat/idl/widget/qimage_cw
 CALLING SEQUENCE:
	qImage_cw_Show, state, event
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, qImage_cw_Box, qImage_cw_Histogram, qImage_cw_Update, qImage_cw_ctable
	qShow
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Slider $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_slider.pro
[Previous] [Next]
 NAME:
	qImage_cw_Slider
 PURPOSE:
	Process messages from the slider widgets
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	Result = qImage_cw_Slider(state)
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OUTPUTS:
	Result	    scalar; type: byte
			1B: display needs to be refreshed completely
			    (by call to qImage_cw_Set_Value)
			0B: display does not need to be redrawn
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	qImage_cw_Box
 CALLED BY:
	qImage_cw
 PROCEDURE:
 STATE INFO USED:
	widget_control, state.wid_tool, get_uvalue=tool
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_SMEI $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_smei.pro
[Previous] [Next]
 NAME:
	qImage_cw_SMEI
 PURPOSE:
	Creates/destroys the SMEI section of the qImage_cw widget
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	Result = qImage_cw_SMEI(state, event)
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
	event	    array[1]; type: structure
			event from state.wid_smei button
 OUTPUTS:
	Result	    scalar; type: byte
			1B: display needs to be refreshed completely
			    (by call to qImage_cw_Set_Value)
			0B: display does not need to be redrawn
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	CW_FIELD, destroyvar, qImage_cw_Box, qImage_cw_Update, qImage_cw_smei_frm
	smei_camera
 CALLED BY:
	qImage_cw
 PROCEDURE:
	The SMEI button function acts as a toggle to create/destroy the
	SMEI section of the qImage_cw compound widget.
	While the SMEI section exists qImage_cw uses wedges instead of squares
	to calculate pixel values, centroids, etc.
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
	NOV-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added state.wid_corner fields


qImage_cw_smei_frm $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_smei_frm.pro
[Previous] [Next]
 NAME:
	qImage_cw_smei_frm
 PURPOSE:
 CATEGORY:
	sat/idl/widget/qimage_cw
 CALLING SEQUENCE:
	qImage_cw_smei_frm, state, event
 INPUTS:
	state		scalar, structure
			contains IDs for all pView widgets
	event		scalar, structure
			event structure passed to pView_Event by XManager
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, IsType, flt_string
 CALLED BY:
	qImage_cw_SMEI
 RESTRICTIONS:
	What happens if image offset is non-zero?
 PROCEDURE:
 STATE INFO USED:
 STATE INFO MODIFIED:
 MODIFICATION HISTORY:
	MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_SmeiMask $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_smeimask.pro
[Previous] [Next]
 NAME:
	qImage_cw_SmeiMask
 PURPOSE:
	Write bitmap to file specifying the current SMEI fov
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_SmeiMask, state
 INPUTS:
	state		array[1]; type: structure
			    qImage_cw state structure
	event		array[1]; type: structure
			    event structure
 OUTPUTS:
	(binary file containing FOV mask)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CV_COORD, CheckDir, FILEPATH, GetFileSpec, Inside_Wedge, SetFileSpec, bin_write
	gridgen, qImage_cw_Box, qImage_cw_Property
 CALLED BY:
	qImage_cw
 SEE ALSO:
	smei_camera
 PROCEDURE:
	The output file will always have the extension .pph

	The file written contains a byte array with the dimensions of the input
	images (the FULL image, even if only a part of the image is being processed).
	The mask value will be zero outside and 1 inside the FOV.

	The FOV center and optical axis are taken from the appropriate widgets.
	The FOV size is determined from a call to SMEI_camera.
 MODIFICATION HISTORY:
	JAN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_state__define $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_state__define.pro
[Previous] [Next]
 NAME:
	qImage_cw_state__define
 PURPOSE:
	Defines the state structure for the qImage_cw compound widget
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	state = {qImage_cw}
 INPUTS:
	parent		scalar; type: long integer
			    ID of the parent widget
 OUTPUTS:
	(state structure)
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 EXTERNAL BY:
	qImage_cw
 PROCEDURE:
	The fields in the state structure are explained in qImage_cw (compound widget)
 MODIFICATION HISTORY:
	JAN-2000, Paul Hick (UCSD/CASS)
	JAN-2003, Paul Hick (UCSD/CASS)
	    Changed structure elements img_size and img_offset from short to long integer.
	    The short integer caused problems for large zoom factors: zoom*img_size gets very big.
	    Added wid_smeimask.
	NOV-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added wid_corner


qImage_cw_Tool $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_tool.pro
[Previous] [Next]
 NAME:
	qImage_cw_Tool
 PURPOSE:
	Handles zooming and rebinning in qImage_cw
 CATEGORY:
	sat/idl/widget/qimage_cw
 CALLING SEQUENCE:
	qImage_cw_Tool, state, event
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, qImage_cw_Box, qImage_cw_Histogram, qImage_cw_Update, qImage_cw_ctable
	qTool
 CALLED BY:
	qImage_cw, qImage_cw_Set_Value
 PROCEDURE:
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Transform $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_transform.pro
[Previous] [Next]
 NAME:
	qImage_cw_Transform
 PURPOSE:
	Coordinate transformation needed by qImage_cw widget
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	pnt_out = qImage_cw_Transfor(state, fromimage=pnt_in, /toscreen)
 INPUTS:
	state	    array[1]: type: structure
			state structure of the qImage_cw compound widget
 OPTIONAL INPUT PARAMETERS:
	One of the following three MUST be specified:
	The units for all positions are the indices of the corresponding arrays.

	FromImage	array[2], array[2,n]; type: integer or float
			    x and y position on the image displayed
	FromScreen	array[2], array[2,n]; type: integer or float
	FromBigImage	array[2], array[2,n]; type: integer or float

	Only one of the following should be specified
	/toimage	Convert to Image coordinates
	/tobigimage	Convert to BigImage coordinates
	/toscreen	Convert to Screen coordinates
			/image is the default if none is specified

	/parent 	Only used when transforming TO Image coordinates
			i.e. if /toimage is set.
			If set then Screen or BigImage input coordinates are
			converted to the parent pixels in the original image in
			which they lie (this amounts to a 'round' operation).
	/boxedge	Should only be used when transforming a box (an integer 2x2
			element vector of the form [[xmin,ymin],[ymin,ymax]])
			in Image coordinates to Screen or BigImage coordinates.
			The result is a box in Screen or BigImage coordinates
			which bounds the area represented by the Image box.
 OUTPUTS:
	pnt_out     array[2] or array[2,*]; type: float
			requested coordinates. The array will have the same structure
			as the input array
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, IsType, SyncDims, qImage_cw_Property
 CALLED BY:
	qImage_cw_Blowup, qImage_cw_BoxZoom, qImage_cw_DrawCross, qImage_cw_DrawEphem
	qImage_cw_Mouse, qImage_cw_Set_Value, qImage_cw_Update, qImage_cw_WedgeSection
	qImage_cw_Where
 PROCEDURE:
 >	Image[n,m]: this is the image fed to the qImage_cw
	    (stored in the user value of state.wid_image)

	BigImage[N,M]: this is a magnified version of the input Image
	    For magnification with factor zoom: N=zoom*n, M=zoom*m
	    The zoom factor is stored in the struct in the user value of state.wid_tool.
	    The coordinates of BigImage are related to the coordinates in Image by:

		pnt(BigImage) = (zoom-1)/2.0+zoom*pnt(Image)

	If zoom is odd then a pixel in Image (with integer coordinate values)
	is mapped exactly to a pixel in BigImage.

	If zoom is even then each pixel in Image is mapped midway between to
	pixels in the BigImage array.

	Screen[n,m]: this is the section of BigImage that is being displayed.

 STATE INFO USED:
	widget_control, state.wid_tool, get_uvalue=tool
 STATE INFO MODIFIED:
	None

 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Update $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_update.pro
[Previous] [Next]
 NAME:
	qImage_cw_Update
 PURPOSE:
	Update display after the box in the x,y widgets is modified
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_Update, state [, /fresh]
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	/fresh	    If not set infomation from a previous qImage_cw_Update
		    is used to redraw portions of the screen: an existing
		    box, and the cross section at top and right are erased.
		    If set then these redraw operations are not done. This
		    options is used when a full screen has been redrawn
		    after a call to qImage_cw_Set_Value.
 OUTPUTS:
	(screen updates)
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, IsType, qImage_cw_Blowup, qImage_cw_Box, qImage_cw_BoxImage
	qImage_cw_DrawCross, qImage_cw_DrawEphem, qImage_cw_Transform, qImage_cw_Wedge
	qImage_cw_ZUpdate
 CALLED BY:
	qImage_Gain, qImage_TrackPeak, qImage_cw, qImage_cw_Mouse, qImage_cw_SMEI
	qImage_cw_Show, qImage_cw_Tool
 PROCEDURE:
	Once an image is put on the display by qImage_cw_Set_Value all updates
	to the display are made by calls to this procedure.
 STATE INFO USED:
	widget_info(state.wid_draw,/valid_id)
	widget_control, state.wid_tool , get_uvalue=tool, /no_copy
	widget_control, state.wid_draw , get_value=wdraw_main
	widget_control, state.wid_draw , get_uvalue=image_box, /no_copy
	widget_control, state.wid_smei , get_uvalue=set
 STATE INFO MODIFIED:
	widget_control, state.wid_draw , set_uvalue=image_box, /no_copy

	state.img_wedge is set to 0 or 1 depending on whether or not a
	    wedge was drawn on the display
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Wedge $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_wedge.pro
[Previous] [Next]
 NAME:
	qImage_cw_Wedge
 PURPOSE:
	Calculate boundary and bounding box for a wedge specified as two points
	in polar coordinates
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	Result = qImage_cw_Wedge(state, p_box, /noupdate, wedge-wedge, box-box)
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	p_box	    array[2,2]; type: float
			limiting values in phase angle and radius of the wedge
			in the form [[angle1,radius1],[angle2,radius2]].
			Angle1 and angle2 are in radians between [-!pi,+!pi].
			The wedge runs counterclockwise from 'angle1' to 'angle2'
			over less than 180 degrees: either angle2 > angle1 with
			angle2-angle1 < !pi or angle2 < angle1 with
			angle+2*!pi-angle1 < !pi. Always radius1 < radius2.

			If p_box is not specified then the wedge specified in
			the qImage_cw widget is used.

			If p_box is specified then the value is processed by qImage_cw_Box.
			This will update the qImage_cw widget, but will also slightly modify
			p_box in such a way that the two corners of the wedge coincide with
			integer pixel locations (the values returned in 'box')
			(set /noupdate to bypass this step)
	/noupdate	Only used if p_box is specified. Bypasses a call to
			qImage_cw_Box (which updates the position widgets).
 OUTPUTS:
	result	    array[2,2]; type: integer
			corners of the smallest square in the image that completely encloses
			the wedge in pixel coordinates in the form [[x1,y1],[x2,y2].
			Always x1 <= x2, y1 <= y2.
 OPTIONAL OUTPUT PARAMETERS:
	wedge	    array[2,n]; type: float
			boundary of wedge as a closed array (first=last point)
			in rectangular (pixel) coordinates.
	box	    array[2,2]; type: float; default: content of X,Y position widgets in
			qImage_cw. Two points in the image plane, specified as pixel coordinate
			values in the same form as the bounding box.
			'box' is obtained by a call to qImage_cw_Box, and is not modified.
			If /noupdate is set then qImage_cw_Box is not called and 'box' will be undefined.
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, IsType, qImage_cw_Box, wedge_bounding_box
 CALLED BY:
	qImage_cw_Update, qImage_cw_ZEllipse, qImage_cw_ZWedge, qView_PlotSeries
 PROCEDURE:
	The origin of the rectangular to polar transformation is the value of
	the state.wid_center widgets
	If p_box is specified, and keywords /noupdate and img_center are used then the state structure
	is not accessed.
 STATE INFO USED:
 STATE INFO MODIFIED:
	(none)
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
	FEB-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Split off the bounding box calculation into separate routine (wedge_bounding_box)


qImage_cw_WedgeSection $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_wedgesection.pro
[Previous] [Next]
 NAME:
	qImage_cw_WedgeSection
 PURPOSE:
	Calculate cross section in the azimuthal or radial directions in a wedge
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_WedgeSection, state, f_values [, /radial, /azimuthal]
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	/azimuthal  if set then a cross section in the azimuthal direction is returned
	/radial     if set then a cross section in the radial direction is returned
			if neither or both are specified then both cross sections
			are returned
 OUTPUTS:
	result	    array[4,*] or array[4,*,2]; type: float
			minimum, maximum, average and standard deviation are returned
			in array[0..3,*,*], respectively.
			If both /radial and /azimuthal then array[4,*,0] contains
			the azimuthal cross section and array[4,*,1] the azimuthal
			cross section.
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	InitVar, qImage_cw_Box, qImage_cw_Transform, qImage_cw_ZWedge, qLine
 CALLED BY:
	qImage_cw
 PROCEDURE:
 STATE INFO USED:
	state.img_wedge 	used to determine whether a valid wedge is available
				from the last call to qImage_cw_Update
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_Where $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_where.pro
[Previous] [Next]
 NAME:
	qImage_cw_Where
 PURPOSE:
	Processes mouse press and release messages from the draw widget
	for the right mouse button only.
 CATEGORY:
	sat/idl/widget/qimage_cw
 CALLING SEQUENCE:
	FUNCTION qImage_cw_Where, state, event
 INPUTS:
	state		scalar, structure
			contains IDs for all pView widgets
	event		scalar, structure
			event structure passed to pView_Event by XManager
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
	@smei_roi_mask.pro
 CALLS: ***
	AngleUnits, ArrayLocation, IsTime, MagnifyArray, SMEI_SKY_ATLOCATION, TimeGet
	TimeSet, cvsmei, qImage, qImage_cw_Property, qImage_cw_Transform, smei_frm_where
	smei_property, smei_setup_roi, smei_sgp4_quat, smei_sky_field, who_am_i
 CALLED BY:
	qImage_cw
 RESTRICTIONS:
	What happens if image offset is non-zero?
 PROCEDURE:
 STATE INFO USED:
 STATE INFO MODIFIED:
 MODIFICATION HISTORY:
	MAY-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_ZEllipse $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_zellipse.pro
[Previous] [Next]
 NAME:
	qImage_cw_ZEllipse
 PURPOSE:
	Calculates the Z-values min, max, average and standard deviations
	for an ellipse in the image plane
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	qImage_cw_ZEllipse, state, box, zval=zval
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	box	    array[2,2]; type:float
			limiting values in phase angle and radius of the wedge
			in the form [[angle1,radius1],[angle2,radius2]].
			Angle1 and angle2 are in radians between [-!pi,+!pi].
			The wedge runs counterclockwise from 'angle1' to 'angle2'
			over less than 180 degrees: either angle2 > angle1 with
			angle2-angle1 < !pi or angle2 < angle1 with
			angle+2*!pi-angle1 < !pi. Always radius1 < radius2.

			If p_box is not specified then the wedge specified in
			the qImage_cw widget is used.

	exclude_box=exclude_box
		array[2,2; type: float
			another wedge specified in the same way as p_box.
			This wedge should lie completely inside the p_box wedge.
			If this box is specified than the return values refer to the
			area in between the two wedges. This box is passed unmodified to
			Inside_Wedge.
			!!!!! If exclude_p_box is set then also /noupdate should be set:
			if /noupdate NOT set then p_box will be slightly modified, and
			exclude_p_box won't.

	/noupdate	Only used if polar_box is specified. This argument is passed to
			qImage_cw_Wedge where it bypasses a call to qImage_cw_Box
			(which updates the position widgets).

 OPTIONAL OUTPUT PARAMETERS:
	zval	    array[4]; float
			minimum, maximum, average and standard deviation across the wedge
			if the wedge is empty then 4 x !values.f_nan is returned
	zpix	    scalar; type: float or integer
			# pixels in wedge (non-integer values result from pro-rating)
			if the wedge is empty then zero is returned
	wedge	    array[2,n]; type: float
			boundary of wedge as a closed array (first=last point)
			in rectangular (pixel) coordinates (output from qImage_cw_Wedge)
	centroid    array[2]; type: float
			centroid of the wedge
			if the wedge is empty then 2 x !values.f_nan is returned
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CV_COORD, CenterOfMass, Inside_Wedge, IsType, STDDEV, SuperArray, gridgen
	qImage_cw_Box, qImage_cw_BoxImage, qImage_cw_Wedge
 PROCEDURE:
 >	qImage_cw_Wedge is used to limit the part of the image to be included to the smallest
	square box including the whole wedge.
 >	Inside_Wedge applied to pixel centers (integer coordinate values) is used to find
	pixels entirely lying inside the wedge.
 > A similar test on pixel corners (half-integer coordinate values) in combination with
	the previous test is used to locate pixels which lie across the wedge boundary.
 >	These last group of pixels is subdivided in a 10x10 array of subpixels. A test on the
	centers on these subpixels is used to prorate the pixels with the ratio of subpixels
	inside the wedge and total number of pixels.
 >	The prorating can be switched of by setting the user value of state.wid_prorate to 0.
 >	Prorating is done only for the average value. Minimum, maximum and standard deviation
	are calculated with all pixels with centers inside the wedge weighted the same.
 STATE INFO USED:
	widget_control, state.wid_prorate, get_uvalue=set
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_cw_ZUpdate $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_zupdate.pro
[Previous] [Next]
 NAME:
	qImage_cw_ZUpdate
 PURPOSE:
	Updates fields in widget that need to be updated every time the selected
	box changes. This includes the Z-value widgets (Z-min, Z-max, Z-avg, Z-std)
	and the centroid widgets X-com, Y-com
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	PRO qImage_cw_ZUpdate, state
 INPUTS:
	state	    array[1]; type: structure
			pImage state structure
 OUTPUTS:
	(none)
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	BadValue, CV_COORD, CenterOfMass, MEAN, STDDEV, qImage_cw_Box, qImage_cw_BoxImage
	qImage_cw_ZWedge
 CALLED BY:
	qImage_cw, qImage_cw_Update
 PROCEDURE:
	state.img_wedge is checked to find out if the last call to
	qImage_cw_Update plotted a valid widget, instead of a square box.
	If it did then qImage_cw_ZWedge is called to calculate Z-values
	for the wedge. If not then Z-values are calculate using
	IDL function min, max, mean, and stddev (with the /nan keyword set).
 STATE INFO USED:
	widget_control, state.wid_smei, get_uvalue=smei_set
	widget_control, state.wid_center[0], get_value=x
	widget_control, state.wid_center[1], get_value=y
 STATE INFO MODIFIED:
	widget_control, state.wid_xyz[i+4], set_value=zval[i], i=0,3
	widget_control, state.wid_phi[3], set_value=centroid[0]*!radeg
	widget_control, state.wid_rad[3], set_value=centroid[1]
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
	NOV-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Fixed bug in calculating standard deviation (make sure there
	    are at least two good values to work with).


qImage_cw_ZWedge $SMEI/ucsd/sat/idl/widget/qimage_cw/qimage_cw_zwedge.pro
[Previous] [Next]
 NAME:
	qImage_cw_ZWedge
 PURPOSE:
	Calculates the Z-values min, max, average and standard deviations
	for a wedge in the image plane
 CATEGORY:
	Compound widget qImage_cw
 CALLING SEQUENCE:
	FUNCTION qImage_cw_ZWedge, state, p_box , $
	    exclude_p_box   = exclude_p_box	, $
	    noupdate	    = noupdate		, $
	    zval	    = zval		, $
	    wedge	    = wedge		, $
	    centroid	    = centroid		, $
	    image	    = image		, $
	    img_center	    = img_center	, $
	    img_prorate     = img_prorate
 INPUTS:
	state	    array[1]; type: structure
			qImage_cw state structure
 OPTIONAL INPUT PARAMETERS:
	p_box	    array[2,2]; type:float
			limiting values in phase angle and radius of the wedge
			in the form [[angle1,radius1],[angle2,radius2]].
			Angle1 and angle2 are in radians between [-!pi,+!pi].
			The wedge runs counterclockwise from 'angle1' to 'angle2'
			over less than 180 degrees: either angle2 > angle1 with
			angle2-angle1 < !pi or angle2 < angle1 with
			angle+2*!pi-angle1 < !pi. Always radius1 < radius2.

			If p_box is not specified then the wedge specified in
			the qImage_cw widget is used.

	exclude_p_box=exclude_p_box
		    array[2,2; type: float
			another wedge specified in the same way as p_box.
			This wedge should lie completely inside the p_box wedge.
			If this box is specified than the return values refer to the
			area in between the two wedges. This box is passed unmodified to
			wedge_content.
			!!!!! If exclude_p_box is set then also /noupdate should be set:
			if /noupdate NOT set then p_box will be slightly modified, and
			exclude_p_box won't.

	/noupdate	Only used if polar_box is specified. This argument is passed to
			qImage_cw_Wedge where it bypasses a call to qImage_cw_Box
			(which updates the position widgets).

	img_prorate=img_prorate
		    array[2]; type: integer
			if set then pixels straddling the wedge boundary will be prorated
			by dividing them into img_prorate[0] x img_prorate[1] subpixels.
 OUTPUTS:
	zpix	    scalar; type: float or integer
			# pixels in wedge (non-integer values result from pro-rating)
			if the wedge is empty then zero is returned
 OPTIONAL OUTPUT PARAMETERS:
	zval	    array[4]; float
			minimum, maximum, average and standard deviation across the wedge
			if the wedge is empty then 4 x !values.f_nan is returned
	wedge	    array[2,n]; type: float
			boundary of wedge as a closed array (first=last point)
			in rectangular (pixel) coordinates (output from qImage_cw_Wedge)
	centroid    array[2]; type: float
			centroid of the wedge
			if the wedge is empty then 2 x !values.f_nan is returned
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	BadValue, InitVar, IsType, qImage_cw_Box, qImage_cw_BoxImage, qImage_cw_Wedge
	wedge_content
 CALLED BY:
	qImage_cw_WedgeSection, qImage_cw_ZUpdate
 PROCEDURE:
 >	qImage_cw_Wedge is used to limit the part of the image to be included to the smallest
	square box including the whole wedge.
 >	Inside_Wedge applied to pixel centers (integer coordinate values) is used to find
	pixels entirely lying inside the wedge.
 > A similar test on pixel corners (half-integer coordinate values) in combination with
	the previous test is used to locate pixels which lie across the wedge boundary.
 >	These last group of pixels is subdivided in a 10x10 array of subpixels. A test on the
	centers on these subpixels is used to prorate the pixels with the ratio of subpixels
	inside the wedge and total number of pixels.
 >	The prorating can be switched of by setting the user value of state.wid_prorate to 0.
 >	Prorating is done only for the average value. Minimum, maximum and standard deviation
	are calculated with all pixels with centers inside the wedge weighted the same.
 STATE INFO USED:
	widget_control, state.wid_prorate, get_uvalue=set
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_FileInfo $SMEI/ucsd/sat/idl/widget/qimage/qimage_fileinfo.pro
[Previous] [Next]
 NAME:
	qImage_FileInfo
 PURPOSE:
	Display information about current image file
 CATEGORY:
	Widget qImage
 CALLING SEQUENCE:
	qImage_FileInfo, state
 INPUTS:
	state	    array[1]; type: structure
			qImage state structure
 OUTPUTS:
	(to message dialog)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType
 CALLED BY:
	qImage
 PROCEDURE:
	Displays the string stored in the user value of state.wid_info in
	a message dialog box when the state.wid_info is pushed.
	The user value is set by qImage_Pick.
 STATE INFO USED:
	widget_control, state.wid_info, get_uvalue=info
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_Gain $SMEI/ucsd/sat/idl/widget/qimage/qimage_gain.pro
[Previous] [Next]
 NAME:
	qImage_Gain
 PURPOSE:
	Assist qView widget in correcting for different gain through a sequence of images.
 CATEGORY:
	Widget qImage
 CALLING SEQUENCE:
	qImage_Gain, state
 INPUTS:
	state		array[1]; type: structure
			    qImage state structure
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	qImage_cw_Box, qImage_cw_Update
 CALLED BY:
	qImage
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
	STILL UNDER DEVELOPMENT
 PROCEDURE:
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


qImage_Pick $SMEI/ucsd/sat/idl/widget/qimage/qimage_pick.pro
[Previous] [Next]
 NAME:
	qImage_Pick
 PURPOSE:
	Called by qImage_Event to select a new image using the IDL 'pickfile' dialog.
 CATEGORY:
	sat/idl/widget/qimage
 CALLING SEQUENCE:
	FUNCTION qImage_Pick, state, image
 INPUTS:
	state		scalar, type: structure
			    the state structure for the qIma