
			        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, PLOT2D, 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 460x400 pixels. The actual TV area is centered in
the drawing area with 300x300 pixels with equal left, right boundary 
margin of 80 pixels, and top, bottom of 50 pixels.
 

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. 


		  	   COLOR SCHEME

If view2d is invoked by the runtime version of data catcher, only 32 color 
numbers are used by the view2D. Otherwise as many colors as available by 
the IDL are used. For 24 bit visual display it uses 256 colors. 

If the color table has not been loaded into the IDL when view2d is invoked, 
the default color table 39 (rainbow plus white) will be loaded into IDL 
by view2d. Otherwise the current color table used by IDL will be used. 

Three color schemes allowed, The default option is same as the IDL TVSCL 
color scheme.  The maximum value is displayed in color of the largest 
index of the color table , the minimum value is displayed in color of the
lowest index of the color table.

IDL provides 40 conveninent color tables.  A user can use the Color Menu 
in view2d to change the color table to fit his/her desire. 

			   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 
	'x_desc'    - X positioner DESC of scan 1 record
	'y_desc'    - Y positioner DESC of scan 2 record
	'd_desc'    - detector DESC 

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 ...',
'Save Image for AIM', 'Save as TIFF','Save as R-TIFF','Save as XDR',
'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 'Save Image for AIM' button exports the image data in a save file
which is ready to load into another IDL image program, AIM .
The 'Save as TIFF' button save the current image as a TIFF data.
The 'Save as R-TIFF' button save the current image as a reverse TIFF data.
The 'Save as XDR' button save the current image as a XDR array .

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.


				Printer ...

This button brings up the setup PS printer dialog. View2d automatically 
uses the color PS device with 8 bit depth and the default printer attached
to the workstation is used. This dialog allows the user to override the
default settings. If printer name is not set the default is assumed.

Starting View2d Version 2.3, the TV plot title and legend are using the 
first color from the color table. If the selected color table with first
color as white, even though the TV plot shown as fine on the user visual 
display, the white plot title and legend are not readable on the PS plot. 
If this is the case the gv (ghostview) is automatically invoked by the 
printer setup to let user preview the PS plot. If text is not shown on the
gv display, the user has to select the reverse legend color to 'Y' on 
printer setup dialog then re-send the PS plot again.


				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
        PLOT2D      - view data through PLOT2D 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 - Xaxix 

The droplist allows the user pick the X axis to be plotted. 
A temporary image file 'tmp.image' will be used for storing image file.
If the picked positioner is not defined in the scan, the index vector 
is used for X axis.

	P1 - Positioner 1 label and engu as x-axis
	P2 - Positioner 2 label and engu as x-axis
	P3 - Positioner 3 label and engu as x-axis
	P4 - Positioner 4 label and engu as x-axis

			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 image data corresponding to x, y values. Then it pops up 
a scroll terminal to show the contents of the ASCII file. 

A text field is provided which allows the user to control the column format
for the display output.


			   ReNew Button

Press the 'ReNew' 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. The XL,XR,YL,YR reflects the scan range of each scan. 



			    Drawing Area


The drawing area is used for displaying TV, SURFACE, CONTOUR, and SHOW3 
plot.  The PLOT2D 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.  The XL,XR,YL,YR fields will reflects the new zoom region.


			    --IMAGE-- Values Area 

This area consists of values of Min Z, Max Z, Cursor @ X, Cursor @Y,
and  Z at cursor. 


			    Set New P1PV & P1CP
 
If view2d is running from the data catcher two additional push buttons 
'Set New P1PV' and 'Set NewP1CP' are available. Press the 'Set New P1PV' 
button will move the positioner P1PV of scan1 and scan2 records to the 
cursor @ X, Y value respectively.  Press the 'Set New P1CP' button 
will set the center position of the positioner P1 of scan1 and scan2
records to the cursor @ X, Y value respectively.


			   XL, XR, YL, YR Fields 

The XL,YL, XR,YR fields initially reflects the scan image start and
end ranges. The zoom box mode will re-set the region of interest XL,XR,YL,YR. 
The XL,YL, XR,YR fields show the bounding box zoom region of 2D interested 
range. The values of these fields will be automatically updated if the Right
Mouse Button is pressed consecutively in the drawing area.



			   Set New 2D Scan Ranges 

This button accepts the values of the XL, XR, YL, and YR fields and put these
new values to the scan1.P1SP, scan1.P1EP, scan2.P1SP, and scan2.P1EP. This
dynamically reset the scan range of the positioner P1 in scan1 and scan2 record.




			    X, Y Plot Ranges

Four text fields Xmin, Xmax, Ymin, Ymax are settable by the user
which specifies the image index ranges shown in the drawing area. 
The default user plot range is same as the 2D image dimension. 
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.


                            Z Scale Color Range 

These fields are tightly coupled with the 'Image Color Scheme ...' dialog.
They are settable by the user only when it is in the UserScaled color mode.

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. 



                             PanImage Menu 

The PanImages sub menu provides the option of popping up / save TIFF or XDR
of 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.

The Calibration... option calls the image calibration program for user.


                             2D-ROI Menu 

The 2D-ROI menu consists of entries of various functions of generating 
2D region of interest reports: Help..., ViewRpt..., AppendRpt..., 
ReplaceRpt..., and RenameRpt...  

Any of the entry item will invoke the 2D-ROI program for user.  The ROI 
definition file name is suffixed with '_roi.txt', the ROI report file 
name is suffixed with '_roi.rpt'.

Help...         Pop up the help info window of 2D-ROI program
ViewRpt...      Select the desired ROI report for display
AppendRpt...    Append new ROI report to the current ROI report setting
ReplaceRpt...   Replace the content of the current setting ROI report
                by the new report calculation
RenameRpt...    Rename the current ROI report to a new name



			    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.


