.help fregcon Feb96 ftools.heasarc
.ih
NAME
fixregion --> image region file converter from the image file it was extracted, to 
another instrument/detector system. 
.ih
USAGE
regfile 1 imgfile convfile[extnum] out_regfile 

or

regfile 2 cdelt1 cdelt2 crpix1 crpix2 crval1 crval2 crota2 ctype1 convfile[extnum] out_regfile
.ih
DESCRIPTION
This task converts a region from one system (system1) of observation to another
(system2) based on the reference coordinates in  the FITS files of the two 
systems of observations.  The region file is produced by SAOimage and save the image
file before exiting SAOimage.  This image file is then input file for the converter.
The convfile is the file containing the coordinate information (CDELT*, CRPIX*, CRVAL*, 
CROTA*, CTYPE*) to be converted to.  NOTE: BE SURE WHILE RUNNING FIXREGION, THIS FILE
SHOULD BE SUPPLIED WITH APPROPRIATE EXTENSION NUMBER (e.g. filename[extnum]).
The usefulness of the region converter is that
selected region from one image file can be used in another
system, provided the reference coordinates in both systems are known. 
The maximum no. of regions to be selected in the region file is 40.  
This task is introduced to mask nearby 
sources.  The acceptable shapes for the regions are the following:

.nf
circle
box
ellipse
point
annulus

The following reference keywords and their values are read from the FITS files.

They are passed to the ftwldp.f and xy2sky.f routines which compute the new
coordinates.

CRPIX1  =  X axis reference pixel
CRPIX2  =  Y axis reference pixel
CRVAL1  =  Sky coord of X ref pixel (degrees)
CRVAL2  =  Sky coord of Y ref pixel (degrees)
CDELT1  =  X axis increment (degrees)
CDELT2  =  Y axis increment (degrees)
CROTA2  =  Rotation angle
CTYPE1  =  RA projection type 

If the input system1 file (imgfile) is not present then it asks for these 
relevant keywords from the user.  


.fi
.ih
PARAMETERS
.ls regfile [character string]
The region file containing region file data to be converted.
.le
.ls option [integer]
Either 1 or 2 depending on if one has the image file (option=1) or
if one supplies the coordinates CRPIX*, CRVAL*, CDELT*, CROTA2, CTYPE1 (option=2)
of the image file from which region is being extracted.
.le                                                                 
.ls imgfile [character string]
The input FITS file for system1 coordinate system to be converted from.
.le                                                                 
.ls convfile [character string]
The input FITS file for system2 coordinate system to be converted to WITH EXTENSION
NUMBER.
.le                                                                 
.ls out_regfile [character string]
The output file containing converted region file data.
.le
.ls cdelt1 [real]
X-axis increment value.
.le
.ls cdelt2 [real]
Y-axis increment value.
.le
.ls crpix1 [real]
X-axis reference pixel
.le
.ls crpix2 [real]
Y-axis reference pixel
.le
.ls crval1 [real] 
Sky coordinate of X reference pixel in degrees
.le
.ls crval2 [real]
Sky coordinate of Y reference pixel in degrees
.le
.ls crota2 [real] 
Rotation angle
.le
.ls ctype1 [character string]
Type of projection for RA.  e.g. -TAN,-SIN etc.
.le
.ls (chatter=9) [integer]
Flag to set the chattyness at execution.  Default value is set to 9,
which gives the user the task version and few warnings.  Lower/higher
values produces quieter/verbose output on the screen.
.le
.ls (clobber = false) [boolean]
Flag specifying whether or not a pre-existing file with the same name
as that requested as the output file from this task will be overwritten.
.le                                                                 
.ih
BUGS
None known. The convfile should be used with its extension number where the coordinate
information to be found. 
.ih
SEE ALSO
help on fregcon, ftwldp.f, xy2sky.f
.ih
EXAMPLE:

For example, if the region filename is REG.IN, image filename is REG.IMG, the
convfile name is CONV.FITS with primary extension for coordinate information,
the outfile name REG.OUT, then the command line


fixregion reg.in 1 reg.img[0] convfile=conv.fits out_regfile=reg.out
.br 
.ih
LOG OF SIGNIFICANT CHANGES:
.nj
v1.1.0 (July, 1996) provision to handle any type of convfile
.br
v1.0.0 (May, 1996) created
.ih
PRIMARY AUTHOR:
.nj
Banashree Mitra Seifert
.br
.nj
HEASARC, NASA/GSFC
.br
.nj
http://heasarc.gsfc.nasa.gov/cgi-bin/ftoolshelp
.br
.nj
(301).286.5307
.ju

.endhelp
