
			        VIEW2D
                  (Data Catcher 2D Image  Displayer)

				OVERVIEW

VIEW2D is a complete mouse driven 2D image browser for 2D data
catcher.  It provides very flexible 2D scan image accessing and
displaying. It also provides automatical hard copy generation.

For each 2D image it provides following types of IDL plot : TV, SURFACE, 
CONTOUR, SHOW3, XSURFACE, and TV Equal Aspect Ratio. The TV, surface and 
contour plot can either plot vs X,Y index or vs real X,Y values. 

For TV plot, it can be user scaled drawing area image or the actual 
pixel image. It defaults to drawing area scaled TV aspect ratio and the 
corresponding axis values are also plotted. It also provides various 
types of image data query options for user scaled equal TV plot. 

The drawing area is 400x400 pixels. The actual TV area is centered in
the drawing area with 300x300 pixels with equal boundary margin of 50 
pixels.
 
If view2d is invoked by the data catcher, only 32 color numbers are used 
by the view2D. Otherwise as many color as available by the IDL is used. 
The default color table used is rainbow plus white. Three color schemes
allowed, The default option is same as the IDL TVSCL color scheme.
The maximum values is displayed in white, the 0 value is in black. 

The PS output for TV plot is in reverse video.

This program takes the 2D image file which is automatically generated by
the data catcher program, CATCHER_V1. The acquired 2D scan image are 
saved sequentially.  The number of images saved for a given scan depends 
on the number of detector PV names defined for the first (inner loop) 
scan record. For a given 2D scan number there are at most 15 images.
Through a set of selection buttons, it allows the user freely to point 
to any scan set, and any image data in the scan set. 


			   IMAGE FILE 

The 2D image file used by VIEW2D must be created by the data catcher 
through monitoring a 2D scan. Both 1D and 2D data are saved by the data
catcher. The filename for 1D and 2D data share the same root name. 
For example, if the 1D scan data is saved in the 'catch1d.trashcan', 
then the 2D image data will be save in the 'catch1d.trashcan.image'. 
Only the 2D image file is used by VIEW2D.

The default image file name is 'catch1d.trashcan.image'.

			  IMAGE DATA SET

For simplicity in the following x represents the inner loop ( the first 
scan) and y represents for the outer loop ( the second scan).
For any image data set it consists of the following data entities:

String Array:
	'x_pv'      - x scan pvname (inner loop)
	'y_pv'      - y scan pvname (outer loop)
	'file1d'    - the filename used for saving 1D scan data 

Integer Array:
	scan #      - the current 1D scan number in 'file1d' as the 2D 
	              image is saved
	width       - the acquired x dim or width of the image
	height	    - the acquired y dim or height of the image
	detector #  - the corresponding detector number in 'x_pv' scan record 
	2D scan #   - the current 2d scan number
	y_req_npts  - the requested y dim data points

X Positioner Array:
	x_pos       - the x position array

Y Positioner Array:
	y_pos       - the y position array

2D Image Array:
	image       - the image array for the detector



			    USER INTERFACE

The user interface is very simple, first use the File->Open menu to
select the image file, then the total number of 2D scans and the total
number of 2D images found in the file are printed and the data is
properly setup. Then a user has to select the 2D scan number first, the
first image in the scan will be displayed in the drawing area. If more 
then one images (detectors) were saved, the user can use the image 
button to access the remaining images within the scan.

The function of each widget is briefly given below.

				File

The File pulldown menu consists of four selection items: 'Open ...',
'Printer ...', 'Print', 'PS_close', and 'Quit'.

The 'Open ...' button pops up the IDL file selection box which allows the 
user to select the 2D image file for viewing.  The default setting is
'catch1d.trashcan.image'.  

The 'Printer ...' button allows the user to override the default printer
for the postscript plot. Default color postscript file is generated.

The 'Print' button will create a post script plot 'view2d.ps' and 
send a copy to the user's default printer. 

The 'PS_close' button closes the post script plot device, and restores
the X window plot device.
 
The 'Quit' button exits the VIEW2D program.


				Color

This menu allows the user dynamically to load and change the color table 
used by the program. The default color table used by view2d is 'Rainbow+
white'.

The Color pulldown menu consists of four selection items: 
'Save Private Color Table', 'Load Private Color Table',
'Change Color Table ...', and 'Z-range Scheme' sub-menu.

The 'Save Private Color Table' button will save the current color table
'pvtcolors.dat' at the startup directory.

The 'Load Private Color Table' button will load the private color table
'pvtcolors.dat' into IDL from the startup directory.

The 'Change Color Table ...' button pops up the IDL XLOADCT program which
allows the user have very flexible control on the color table used for 
current IDL session.

The 'Image Color Scheme ...' button pops up the image color scheme dialog.
There are three schemes: 'Auto Scaled", 'User Scaled', and 'Normalized'.
The auto scaled scheme uses the z-max and z-min of the data image.
The user scaled scheme let the user enter arbitrary Zmin/Zmax values for
linear color table translation. The normalized color scheme, let user
pick a detector then every value will be normalized against the value of
the selected detector. 


				Help

This menu gives this on-line help information.



			DROPLIST - View as

	TV 	    - view data as a 2D image
	Eq.TV.AspRt - view data as a 2D image with equal X,Y TV aspect 
		      ratio
	SURFACE     - view data as a surface plot
	CONTOUR     - view data as a contour plot
	SHOW3       - view TV + SURFACE + CONTOUR plot all together
        XSURFACE    - view data through XSURFACE which provides more viewing
                      controls 



			DROPLIST - Pixel

	By User  - TV image plot scaled pixel vs X and Y data ranges 
	By Image - TV image plot as real pixel 


			DROPLIST - Plot vs

	Values  - plot vs the x and y position values (SURFACE/CONTOUR)
	Step #  - plot vs the x and y step number (SURFACE/CONTOUR)


			DROPLIST - Binary/XDR

	BIN - Data catcher image file is in machine dependent binary form 
	XDR - Data catcher image file is in platform independent XDR binary 
	      form 


			ASCII ... Dialog

This button saves a ASCII file 'view2d_data.txt' in the startup directory,
which shows the image data corresponding the x, y values. Then it pops up 
a scroll terminal to show the contents of the ASCII file. 


			   Refresh Button

Press the 'Refresh' button turns off the zoom mode and the TV 
image will be drawn in the original VIEW2D default setting.


			   SCAN # CONTROLS 

This row of widgets provides the user with various controls of positioning 
the scan number in the image file.  It consists of 'First','Next','Prev',
'Last' buttons, Scan # entry text field, and a slider bar.  The result of
any of these Scan # control widgets always points to the first image of the 
selected scan set. Use the image group buttons to select desired detector
out of the the scan.


			   Images Group 

Images group consists of 15 buttons. For a given scan set at most
15 images can be saved. The actaul images saved depend on the scan 
record setup.  If the selected button with image it will be plotted right
away, it the selected button without image the error message window will
pop up. 



			    Drawing Area


The drawing area is used for displaying TV, SURFACE, CONTOUR, and SHOW3 
plot.  The XSURFACE uses its own drawing window.

In TV image mode, clicking the Left Mouse Button (LMB) in the drawing area 
will redraw the cursor cross-hair and update the X, Y, Z value widgets.

In TV image mode, click the Middle Mouse Button (MMB) in the drawing area 
will popup the XZ and YZ image value query windows and update the image 
information widgets: cursor location X, Y, and Z value.

In TV image mode, click the right mouse button in the drawing area will
draw a bounding box which can be re-sized and re-positioned by the mouse.
Click the right mouse button again will zoom the region enclosed by the
bounding box. 


			    PROBE XZ Button

The XZ button turns on the XZ query mode, a user must use the left mouse
button to query the X and Z values in the XZ profile window. The values 
at the cursor are updated beneath the XZ button.  The middle or right mouse 
button terminates this query mode.



			    PROBE YZ Button

The YZ button turns on the YZ query mode, a user must use the left mouse
button to query the Y and Z values in the YZ profile window. The values 
at the cursor are updated beneath the YZ button.  The middle or right mouse 
button terminates this query mode.


			    User Entered Plot Ranges

Four text fields Xmin, Xmax, Ymin, Ymax are settable by the user
which specifies the image data index range used in 'By User' scale. 
The default user plot range is Ymin=0, Ymax=100, Xmin=0, Xmax=100. 
The new value will be in effect as soon as the carriage return
is pressed.

Proper range must be entered.  If the values entered are outside the
x and y index range, the IDL will not be able to show the data.


                            User Scaled Color Scheme

The Zmin and Zmax text fields are used for linear color translation.
The Zmin is assigned to the first color, and Zmax is assigned to the 
last color. The TV value below Zmin will be shown in same color as Zmin,
above Zmax will be shown in same color as Zmax. 



                             PanImages Button

The PanImages Button pops up / updates the image-strip window to show 2D 
image of all detectors defined. Each detector has its own 2D TV image
based on its own data range. If no data available for the detector 
the text 'Di' is drawn instead. For detailed TV image use the image
button to select the desired detecor.


			    Information Block

The information block shows the information about current displayed
image. They include scan #, detector #, scan record PV names, 
1D root filename used, corresponding 1D scan range, image width, and 
height.


