Extended IDL Help

scan2d__define.pro

At present this program is installed in the /usr/local/epics/extensions/idllib directory for EPICS R3.14. This program is written in IDL object programming language . It allows the IDL user easily to access 2D scan data captured by the data catcher.

In order to access scan2d object from other IDL program, a user has to make sure that the following environment variable is set before invoking IDL :

     setenv EPICS_EXTENSIONS  /usr/local/epics/extensions 
     setenv IDL_STARTUP /usr/local/epics/extensions/idllib/viewer_startup.pro 

and make sure including the directory /usr/local/epics/extensions/idllib in his/her IDL search path.

From the unix operating system to access IDL scan2d object class by entering :

     idl  go_scan2d

The files u_read.pro, and scan2d__define.pro are automatically loaded into IDL for user.

For an example to create a 'scan2d' object with variable name as v2, where the 2D catcher data is saved in the file 'junk2.image':

     v2 = obj_new('scan2d',file='junk2.image')

To view the image number 135 from the file:

     v2->view,135 

List of Routines


Routine Descriptions

SCAN2D::ASCII

[Next Routine] [List of Routines]
 NAME:
	scan2d::ASCII

 PURPOSE:
       This method allows the user to create a list of ASCII data files
       based on the user specified list of image numbers. The name convention
       of each ASCII file will be the image file suffixed with its 4 digit 
       image number.

 CALLING SEQUENCE:
       Obj->[scan2d::]ASCII, List, /NOWIN  [,FORMAT=format]

 ARGUMENTS:
     List:      List is used to specify the sequence of image files to be
                generated. It can be a list of short integers which 
                explicitly specify the desired images or it can be 
                string variable. If it is a string, it will be parsed
                into a list of image number first by this method.
                The user has to insure that the number entered is valid
                for normal operation of this method.

 KEYWORDS:
     NOWIN:     If specified, only the ASCII files will be created but the
                xdisplayfile window will not be shown. 
     FORMAT:    If specified, override the default output format
     GROUP:     Specifies the parent group ID, the destroy of parent window 
                results the destroy of this child window

 EXAMPLE:
     Example 1 creates the ASCII data files for the image [10,20,30] from the
         'junk2.image', and each file will be displayed automatically. 
         The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->ASCII,[10,20,30]

     Example 2 creates the ASCII data files for the images 10, 20 to 30, and
         40 from the 'junk2.image', and no ASCII file will be displayed. 

         v2->ASCII,'10,20-30,40',/NOWIN

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
       01-21-2000      Use current image # of the defined object 

(See scan2d__define.pro)


SCAN2D::ASCII1D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::ASCII1D

 PURPOSE:
       This method allows the user to extract all detectors data 
       from a 2D scan. The name convention of ASCII file will be the 
       image file suffixed with its corresponding 1D scan sequence number.

 CALLING SEQUENCE:
       Obj->[scan2d::]ASCII1D [,Lineno] [,Endno=endno] [,/ALL] $
                  [,/NOWIN]  [,FORMAT=format] [,GROUP=group]

 ARGUMENTS:
     Lineno:    Specifies the 1D line scan # to be extracted from a 
                given 2D scan.

 KEYWORDS:
     ENDNO:     If specified, ASCII files from the 1D scan lineno to the
                endno will be created
     ALL:       If specified, ASCII files for all 1D scan lines from a 
                given 2D scan will be created.
     NOWIN:     If specified, only the ASCII files will be created but the
                xdisplayfile window will not be shown. 
     FORMAT:    If specified, override the default output format
     GROUP:     Specifies the parent group ID, the destroy of parent window 
                results the destroy of this child window

 EXAMPLE:
     Example 1 extracts the 10th scan line from the current 2D scan. 
     Example 2 generates all the 1D scan data file without displaying window. 
     Example 3 extracts the 1D scan 3 to 5 from the current 2D scan.

         v2->ASCII1D,10
         v2->ASCII1D,/ALL,/NOWIN
         v2->ASCII1D,3,endno=5

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Feb 18, 2000.
       xx-xx-xxxx  xxx comment   

(See scan2d__define.pro)


SCAN2D::ASCII2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::ASCII2D

 PURPOSE:
       This method allows the user to create the 2D ASCII data file(s)
       for the selected detector number. The ASCII file created will be
       automatically suffixed with its 4 digit image sequence number and
       '.txt' 

 CALLING SEQUENCE:
       Obj->[scan2d::]ASCII2D, Detno [,/ALL] [,/NOWIN] [,FORMAT=format]
                             [,/WHOLE] [,GROUP=group]

 ARGUMENTS:
     Detno:     Specify the detector number desired for current opened
                2D scan, default 1.

 KEYWORDS:
     WHOLE:     If specified, pick all detectors from the current 2D scan #
     ALL:       If specified, pick all images from the 2D image file
     PICK:      If specified, pick the same detno out of every 2D scan
     NOWIN:     If specified, only the ASCII files will be created but the
                xdisplayfile window will not be shown. 
     FORMAT:    If specified, override the default output format
     GROUP:     Specifies the parent group ID, the destroy of parent window 
                results the destroy of this child window

 EXAMPLE:
     Example 1 generates ASCII report for detector 5 for the current 2D scan #

               v2->ascii2d,5

     Example 2 generates ASCII report for detector 5 for every 2D scan 
       contained in the image file.

               v2->ascii2d,5,/PICK

(See scan2d__define.pro)


SCAN2D::BINDIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::bindImage

 PURPOSE:
       This method combines images from two different 2D scan object and
       create a new 2D image and saved the combined images into a new file.
       The output file inheritates the scan number and detector number 
       from the FILE1 for the combined images.

       If the 2D image file1 and file2 are same then 2 scans from the same 
       file is combined into one scan.

 CALLING SEQUENCE:
       Obj->[scan2d::]bindImage,File1=file1, im1=im1, 
                  File2=file2, im2=im2, outfile='...'

 ARGUMENTS:
    None.

 KEYWORDS:
  OUTFILE:   Specifies the output file for combined 2D images
  FILE1:     Specifies the 2D image file1 
  Im1:       Specifies the starting image seq # of the first scan 
  Im2:       Specifies the starting image seq # of the second scan
  FILE2:     If specified, the Im2 is from a different 2D image file2 
  S1:        If specified, it returns the 2D scan # for Im1 
  S2:        If specified, it returns the 2D scan # for Im2 
  h1s:       Optional, specifies the y1 start index, defaults 0
  h1e:       Optional, specifies the y1 end index, defaults height
  h2s:       Optional, specifies the y2 start index, defaults 0
  h2e:       Optional, specifies the y2 end index, defaults height

 RESTRICTION:
  The number of detectors must be exactly same in both files.
  The obj variable names internally used by this routine are
  cv1,cv2,cv3, a user have to avoid to use these name.

 EXAMPLE:
    Following example binds the images of 2D # 31 with
    images of 2D scan # 33 from the same file. The starting image # 
    of scan # 31 is 205. The starting image # of scan # 33 is 217. 
    We want to bind these two scans into one new 2D scan. The new 2D 
    scan for each detector will be saved in 'new.image'. 
    The new scan will inherit the scan description from the 2D scan # 31.

    The object v2 need to be defined only if it is not yet defined.

    filename1='/home/sricat/CHA/user/s2idd/15nov98_data.01.image' 

    v2 = obj_new('scan2d',file=filename1)
    v2->view,205,/noplot
    v2->point_lun,204
    v2->bindimage,file1=filename1, im1=205, im2=217, $
	 	outfile='new.image'

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, April 16, 1999
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::CALIBRATION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::CALIBRATION

 PURPOSE:
       This method calls the 2D image calibration program for a given
       2D scanno. It allows the user flexiblely to select the images
       and define the calibration function, calculate and displaying
       the resultant image.

       If the 2D scanno # is not specified, then the current 2D scan 
       sequence number is assumed.

 CALLING SEQUENCE:
       Obj->[scan2d::]CALIBRATION [,Scanno]

 ARGUMENTS:
  Scanno:     Specifies the 2D scan sequence #

 KEYWORDS:
    FORMAT    Specifies the calibration output format.
    GROUP:    Specifies the parent widget ID..

 EXAMPLE:
     Following example calls the image calibration program for the 
     2D scanno 10 from the image file 'junk2.image'
     The object v2 need to be defined only if it is not yet defined.

     	v2 = obj_new('scan2d',file='junk2.image')
	v2->Calibration,10

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Nov 11, 1999.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::DATATOTEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::DataToText

 PURPOSE:
       For the current scan2d object, this method creates its tabulated 2D 
       image data in a disk file and uses the xdisplayfile command to 
       show the contents of the created ASCII file.

       If the outfile is not specified it will try to create the ASCII 
       file in the following order: try the data directory first, 
       if failed then try the user starting directory, if still failed 
       then try the  user home directory.

 CALLING SEQUENCE:
       Obj->[scan2d::]DataToText, Data, Px, Py, OUTFILE='outfile', /NOWIN

 ARGUMENTS:
     Data:      Optional output variable, gives the output image data array. 
     Px:        Optional output variable, gives the X positioner vector. 
     Py:        Optional output variable, gives the Y positioner vector. 

 KEYWORDS:
     OUTFILE:   If not specified, the default outfile text file name with
                'view2d_data.txt' will be used.

                If OUTFILE=1 is specified, then the outfile name will be
                generated from the image file name suffixed with 4 digit
                image number plus '.txt'.

                If OUTFILE='anyname' then the outfile name suffixed with
                '.txt' will be used by the text file. 

     NOWIN:     If specified, the xdisplayfile window will not be shown. 
     FORMAT:    If specified, override the default F17.7 format. 
     GROUP:     Specifies the parent group widget ID.

 EXAMPLE:
     Following example reads and plots the 135th image from file 'junk2.image'
         and generates an ASCII outfile with file name 'junk2.image.0135'.
         The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->View,135
         v2->datatotext,/OUTFILE


 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
      05-15-1998  bkc  Catch error for openw
      05-11-1998  bkc  Add fileSeqString routine, add suffix '.txt' to seqno
                       If outfile specified, no directory check will be done.
      02-17-2000  bkc  Add format keyword, default suffix use scan # and
                       detector#  '.S#D#' 

(See scan2d__define.pro)


SCAN2D::FIRST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::First

 PURPOSE:
       This method points to the first set of 2D scan images 

 CALLING SEQUENCE:
       Obj->[scan2d::]First [,Seqno] [,Filename] [,ERROR=error]

 ARGUMENTS:
     SEQNO     - specifies/returns the 2D scanno
     FILENAME  - returns the opened filename

 KEYWORD:
     ERROR     - returns the error code, non-zero if error found

 EXAMPLE:
    Example points to the first set of 2D scan images.

         v2->First

 MODIFICATION HISTORY:
       Written by:     Ben-chin Cha, Feb 19, 2000.
       xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::IMAGES

 PURPOSE:
       For a given 2D scan number this method allows the user to extract the 
       image_array for all the detectors from a 2D catcher file.

 CALLING SEQUENCE:
       Obj->[scan2d::]IMAGES, Scanno, Image_array, Def, Vmax, Vmin,/PAN ,/PRINT

 ARGUMENTS:
       Scanno:        Specifies the 2D scan # to be extracted.
       Image_array:   Image_array(*,*,15) is used to return all 15 detectors 
                      image array for a picked 2D scan
       Def[15]:       If specified, it returns the detector definition array
                      for a scan record. 1 is defined, 0 is not defined
       Vmax[15]:      If specified, it returns the maximum value of the 2D
                      detector image array
       Vmin[15]:      If specified, it returns the minimum value of the 2D
                      detector image array
 
 KEYWORDS:
	PANIMAGE:      If specified, the panimage window of the 2D scanno
                      will be displayed.
       X:             If specified, it returns the X vector
       Y:             If specified, it returns the Y vector
       PRINT:         If specified, the Def, Vmax, Vmin vectors will be
                      printed.
       ZDESC:         If specified, it returns the detector description array
 EXAMPLE:
    This example extracts all the detector images for the 2D scan # 15 from
    the 2D image file 'junk2.image'. The panimage window is desired to
    show the 2D scanno read in.
    The object v2 need to be defined only if it is not yet defined.

        v2 = obj_new('scan2d',file='junk2.image')
        v2->IMAGES, 15, image_arrays, /PAN

 MODIFICATION HISTORY:
        Written by:     Ben-chin Cha, Nov 9, 1999.
        xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::INDEX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Index

 PURPOSE:
       This method explicitly reads in the whole 2D image file and creates 
       the index structure for the image file. It then moves the file pointer 
       at the beginning of the file. 
 
       This method is automatcally called by the obj_new creation if the file
       keyword is specified on the object creation. 

 CALLING SEQUENCE:
       Obj->[scan2d::]Index, Filename

 ARGUMENTS:
  FILENAME:  Specifies name of the 2D image file (generated by the data catcher) 

 KEYWORDS:
     None.   

 EXAMPLE:
    Following example shows how to open and index the 2D image file  with
    name 'junk2.image', and the file pointer is positioned at the beginning
    of the file.
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d')
         v2->index, 'junk2.image'

    The above example is equivalent to the following example.

         v2 = obj_new('scan2d',file='junk2.image')

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::LAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::Last

 PURPOSE:
       This method points to the last set of 2D scan images 

 CALLING SEQUENCE:
       Obj->[scan2d::]Last [,Seqno] [,Filename] [,ERROR=error]

 ARGUMENTS:
     SEQNO     - specifies/returns the 2D scanno
     FILENAME  - returns the opened filename

 KEYWORD:
     ERROR     - returns the error code, non-zero if error found

 EXAMPLE:
    Example points to the last set of 2D scan images.

         v2->Last

 MODIFICATION HISTORY:
       Written by:     Ben-chin Cha, Feb 19, 2000.
       xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::NEWPOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      	scan2d::NEWPOS

 PURPOSE:
 	This method allows the user generate a new 2D image file with
       new postioner selected instead of default positioner P1

 ARGUMENTS:
    POS_ID:  New positioner # selected (must > 1 and < 5)
             default is positioner 2.

 KEYWORD:
    OUTFILE: Specifies the output image file, default is the
             temporary file name 'tmp.image' is used.

 RESTRICTION:
    The positioner id entered must be defined for the scan1 record. 

 EXAMPLES
    In this example the orignal 1D and 2D scan data are stored in 'junk2' 
    and 'junk2.image'. The purpose is to create a new image file with
    positioner2 values as the X vector, the new image file will be saved
    as 'junk2.image_2'. The v3 object is used to varify the new image file.

 	v2 = obj_new('scan2d',file='junk2.image')
       v2->newPos,2

       v3 = obj_new('scan2d',file='junk2.image_2')
       v3->view,1

(See scan2d__define.pro)


SCAN2D::NEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::Next

 PURPOSE:
       This method points to the next set of 2D scan images or to the 
       specified 2D scan seqno set of 2D images.

 CALLING SEQUENCE:
       Obj->[scan2d::]Next [,Seqno] [,Filename] [,ERROR=error]

 ARGUMENTS:
     SEQNO     - jumps to the specified 2D scan # if it is specified.
     FILENAME  - returns the opened filename

 KEYWORD:
     ERROR     - returns the error code, non-zero if error found

 EXAMPLE:
    Example points to the next set of 2D scan images.
    Example 2 jumps to the 2D scan number 10. 

         v2->Next
         v2->Next,10

 MODIFICATION HISTORY:
       Written by:     Ben-chin Cha, Feb 19, 2000.
       xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::OPEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Open

 PURPOSE:
       This method opens the 2D image file according to the data binary type.
       It supports both native binary type and XDR binary type. 

	This method is automatically called by the object creation method.

 CALLING SEQUENCE:
       Obj->[scan2d::]Open, Filename [,Wid]

 ARGUMENTS:
  FILENAME:  Specifies the 2D image file (generated by the data catcher) 
  WID:       Optional input, specifies the input droplist widget ID to 
             reflect the binary TYPE in an existing widget program 

 KEYWORDS:
     None.   

 EXAMPLE:
    Following example shows how to explicitly open the 2D image file  with
    name 'junk2.image', and the file pointer is positioned at the beginning
    of the file.
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d')
         v2->open, 'junk2.image'

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::PANIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::panImage

 PURPOSE:
       This method pops up a new PanImage window for a given 2D scan #.
       If the 2D scan # is not specified, then the 2D scanno # will be
       calculated from the current 2D image sequence number.

 CALLING SEQUENCE:
       Obj->[scan2d::]panImage [,Scanno] [,Factor] [,TIFF='tifname',/reverse]
                 [,GIF='gifname']

 ARGUMENTS:
  Scanno:  Specifies the 2D scan # 
  Factor:  Optional input, to specify the panImage window ratio factor 

 KEYWORDS:
     GIF   : specifies the output gif filename. If specified the
              panImage window will be saved in the gif output file.
     TIFF   : specifies the output tiff filename. If specified the
              panImage window will be saved in the tiff output file.
     REVERSE: specifies whether the reverse tiff should be saved.

 EXAMPLE:
    Following example shows how to get the panImage of all detectors 
    for 2D scan #2, #3, and # 5 from the 2D image file 'junk2.image'.
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->read
	  v2->panImage,2
	  v2->panImage,3
	  v2->panImage,5

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Nov 19, 1998.
	11-23-99  bkc  add option of saving panImage as TIFF/GIF file 

(See scan2d__define.pro)


SCAN2D::POINT_LUN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Point_lun

 PURPOSE:
       The method moves the 2D image file pointer to the end of the 
       specified record.

 CALLING SEQUENCE:
       Obj->[scan2d::]Point_lun, SEQNO

 ARGUMENTS:
     SEQNO:   Specifies the zero based image sequence number.

 KEYWORDS:
     None.   

 EXAMPLE:
    Following example moves the file pointer to the end of the 10th record
    of the 2D image file 'junk2.image'.
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->point_lun,10

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
      05-15-1998  bkc  Add message dialog if illegal number entered

(See scan2d__define.pro)


SCAN2D::PREV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::Prev

 PURPOSE:
       This method points to the prev set of 2D scan images or to the 
       specified 2D scan seqno set of 2D images.

 CALLING SEQUENCE:
       Obj->[scan2d::]Prev [,Seqno] [,Filename] [,ERROR=error]

 ARGUMENTS:
     SEQNO     - jumps to the specified 2D scan # if it is specified.
     FILENAME  - returns the opened filename

 KEYWORD:
     ERROR     - returns the error code, non-zero if error found

 EXAMPLE:
    Example points to the previous set of 2D scan images.
    Example 2 jumps to the 2D scan number 10. 

         v2->Prev
         v2->Prev,10

 MODIFICATION HISTORY:
       Written by:     Ben-chin Cha, Feb 19, 2000.
       xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::PRINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Print

 PURPOSE:
       This method prints the current key variables for the object structure. 
       It prints the starting and data directory, image filename, total #
       of 2D scan, totol # of images, current 2D Scan #, detector #, and
       image seq # at current image pointer, and the image seq array to
       corresponding to detector 1.

 CALLING SEQUENCE:
       Obj->[scan2d::]Print

 ARGUMENTS:
     None.

 KEYWORDS:
     None.

 EXAMPLE:
    Following example shows current key variables of the object v2. 

         v2->print

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::READ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Read

 PURPOSE:
       This method reads in one set of image record from the current file
       pointer.

 CALLING SEQUENCE:
       Obj->[scan2d::]Read, /VIEW, WIDTH=width, HEIGHT=height, $
          DETECTOR=detector, SCANNO_2D=scanno_2d, X=x, Y=y, IM=im

 ARGUMENTS:
     None.

 KEYWORDS:
     VIEW:     If specified, the read in 2D image will also be displayed on the
               plot window.   
     X:        If specified, it returns the X vector values.
     Y:        If specified, it returns the Y vector values.
     IM:       If specified, it returns the 2D IM array values.
     WIDTH:    It specified, it returns the X vector size.
     HEIGHT:   It specified, it returns the Y vector size.
     SCANNO_2D:If specified, it returns the corresponding 2D scan number.
     DETECTOR: If specified, it returns the detector number for the image.

 EXAMPLE:
    Following example reads the 136th image from the input image file and also
    plot the 2D image. 
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->point_lun,135
         v2->read,/view

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::ROI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       scan2d::ROI

 PURPOSE:
       This method calls the 2D image Region of Interest program (scan2d_ROI)
       and calculates the 2D statistics of the interested ROI.

       If the 2D image # is not specified, then the current 2D image 
       sequence number is assumed.

 CALLING SEQUENCE:
       Obj->[scan2d::]ROI [,no] [,/DEBUG]

 ARGUMENTS:
  No:      Specifies the 2D image sequence #

 KEYWORDS:
     DEBUG    If specified, the selected region of interest pixel values
              and the corresponding X,Y index value will be printed.
    HEADER    If specified, the header will be used in report generation
              for the specified image

 SIDE EFFECTS:
     The upper bound of rigion of intestest may be off by 1 pixel due to the 
     rounding off the ratio of pixel/factor.

     All ROI files will be created under the current working directory.
     The default filename used for rectangle ROI is composed of 
     'ROI/'+image_filename+'_roi.xdr' 
     The default filename used for polygon ROI is composed of 
     'ROI/'+image_filename+'_roi.xdr.poly' 
     The default filename used for ROI report is composed of 
     'ROI/'+image_filename+'_roi.rpt' 
     
 EXAMPLE:
     Following example calls the 2D ROI program for the 101th image from 
     file 'junk2.image'
     The object v2 need to be defined only if it is not yet defined.

     	v2 = obj_new('scan2d',file='junk2.image')
	v2->ROI,101


 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, May 21, 1999.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::ROIRPT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::ROIRPT

 PURPOSE:
       For a specified 2D scan # and ROI, this method generates the complete
       2D statistic report for all the detectors defined in a 2D scan.

 CALLING SEQUENCE:
       Obj->[scan2d::]ROIRPT [,Scanno] [,Ref=Ref] [,Roifile=Roifile] $
	[,Rptfile=Rptfile] [,header=header] [,comment=comment] [,append=append]

 ARGUMENTS:
  Scanno:  Specifies the 2D scan # 

 KEYWORDS:
     Ref:      Specifies reference detector # for image normalization
     Roifile:  Specifies the filename for ROI
               which was previously created by the obj->ROI method.
     Rptfile:  Specifies the filename for ROI report
     Header:   Specifies the header description to be provided by the user 
     Comment:  Specifies the comment string to be provided by the user
     Append:   If specified, the new report will be appended to the file 
               instead of save as new.
     Mode:     Specifies the type of ROI file, 0 - RectROI, 2 - PolyROI

 RESTRICTION:
     The 2D scanno, the detector Ref # must be a valid number.
     If no ROI is found, then whole image area is assumed as ROI.

     All the ROI files will be created under current working directory.
     The default filename used for rectangle ROI is composed of 
     'ROI/'+image_filename+'_roi.xdr' 
     The default filename used for polygon ROI is composed of 
     'ROI/'+image_filename+'_roi.xdr.poly' 
     The default filename used for ROI report is composed of 
     'ROI/'+image_filename+'_roi.rpt' 

 EXAMPLE:
    
    Following example shows how to get the ROIRPT of all detectors 
    for 2D scan #2, #3, and # 5 from the 2D image file 'junk2.image'.
    The scan #5 is normalized agaist the detector # 2.
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
	  v2->roirpt,2
	  v2->roirpt,3
	  v2->roirpt,5,Ref=2

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, June 1, 1999.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::SAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Save

 PURPOSE:
       This method allows the user read the next image record and save the
       data to a save file. The saved file can be restored by the restore
       command. Two type of variables can be saved by this command: 
       either save the whole object or just save the x,y,im arrays.
       The data saved will be in XDR format.

 CALLING SEQUENCE:
       Obj->[scan2d::]Save, No, FILE=file, /VERBOSE, /OBJECT

 ARGUMENTS:
     No       Specifies the desired sequence number of the image record 
              to be read. If not specified then the next record is assumed.

 KEYWORDS:
     FILE:    Specifies the save file name, it defaults to 'idlsave.dat'.
     VERBOSE: If specified, the verbose mode is assumed, the variables
              saved will be listed.
     OBJECT:  If specified, the complete data object is saved. Otherwise
              only the NO, X, Y, IM variables are saved for the record.

 EXAMPLE:
    Example 1 - Saves the X,Y,IM arrays for the 135th record 
    in 'junk2.image.s0135', also list the variables saved.
    The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->save,135,file='junk2.image.s0135',/verbose

    Example 2 - Saves all the variables for the 135th record 
    in 'junk2.image.s0135', also list the variables saved

         v2->save,135,file='junk2.image.s0135',/verbose,/object

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::VALID

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scan2d::Valid

 PURPOSE:
       This method checks whether the input image no is valid.

 CALLING SEQUENCE:
       Obj->[scan2d::]Valid,No,CODE=code

 ARGUMENTS:
     No       Specifies the image record number. 

 KEYWORDS:
     CODE:    Returns the return code, 0 if valid, -1 if invalid.

 EXAMPLE:
     Following example checks whether image number 130 is a valid request
     for the 'junk2.image' file
     The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->Valid,130,code=code

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	xx-xx-xxxx      comment

(See scan2d__define.pro)


SCAN2D::VIEW

[Previous Routine] [List of Routines]
 NAME:
	scan2d::View

 PURPOSE:
       This method lets the user view any valid 2D image from the 2D data
       catcher image file.
 
       It also automatically pops up the flexible 2D plot package, it allows
       the user view 2D image in TV, SURFACE, CONTOUR, and SHADE_SURF and
       generated the printer copy from the PS file, idl.ps, if desired.

 CALLING SEQUENCE:
       Obj->[scan2d::]View [,No] [,Rscanno] [,Rdetno] 
               [,SCANNO=scanno] [,DETECTOR=detector] [,NOREAD=noread]

 ARGUMENTS:
     No       Specifies the sequence number of the image record. 
     Rscanno  Returns the 2D scanno number of the image record. 
     Rdecno   Returns the detector number of the image record. 

 KEYWORDS:
     SCANNO:    It specifies the 2D scan number. If specified,it ignore the 
                'No' specification. Valid SCANNO range:
                [1 - self.scanno_2d_last] 
     DETECTOR:  It specifies the desired detector number from the 2D scan.
                If not specified, and SCANNO is given, detector 1 is assumed.
     NOREAD:    If specified, no reading from the file pointer is done, 
                only plot the current object is performed.
     NOPLOT:    If specified, 2D flexible plotting package is not desired.
     TYPE:      Specifies the string of plot type: CONTOUR,SURFACE,SHADE_SURF
                the defualt is the TV plot
     WINID:     If specified, the plot is send to the destination window

 EXAMPLE:
     Example 1 reads and plots the 135th image from the 'junk2.image'
         The object v2 need to be defined only if it is not yet defined.

         v2 = obj_new('scan2d',file='junk2.image')
         v2->View,135

     Example 2 reads and plots the image of detector 7 of the 21th 2D scan
         from the 'junk2.image' file

         v2->View,scanno=21,detector=7

 MODIFICATION HISTORY:
 	Written by:	Ben-chin Cha, Jan 19, 1998.
	12-16-1998      Add flexible 2D TV, SURFACE, CONTOUR,SHADE_SURF 
                       plot option
	05-11-1999      Add plot TYPE keyword for window 0 
                       Add NOPLOT keyword to bypass plot2d function call

(See scan2d__define.pro)