|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
regionmanager.fromrecordtotable - Function
1.1.2 Save regions stored in a record into a Table
Description
This function saves regions into an casa Table For the tablename argument
the user should be the name of an existing CASA Table on disk (any kind of
table).
If the parameter asmask is True then the table has to be an image table. A mask makes sense with an image only.
You can specify the name the region will have (regionname) when it is saved in the Table. If you don’t specify this, a digit based name is assigned to it or if specify a name that already exists a new one will be generated which is close but different. The function returns you the name the region is assigned
Arguments
Inputs |
| ||
tablename |
| The table | |
| allowed: | string |
|
| Default: | Image tool, table tool or String |
|
regionname |
| Name(s) of the region(s) when saved in the table
| |
| allowed: | any |
|
| Default: | variant Vector of strings |
|
regionrec |
| Region(s) to save
| |
| allowed: | record |
|
| Default: | Record of region tool(s) |
|
asmask |
| save region as a mask rather than region
| |
| allowed: | bool |
|
| Default: | false false |
|
verbose |
| Report successful saves
| |
| allowed: | bool |
|
| Default: | true True |
|
string
Example
- ia.open(’hcn’)
- cs=ia.coordsys()
- blc = "16:28:25.50 +040.49.05.61"
- trc = "16:24:28.67 +041.45.28.43"
- r1 = rg.wbox(blc="10pix 20pix",trc="30pix 40pix",pixelaxes=[0,1],csys=cs.torecord())
- r2 = rg.wbox(blc=blc,trc=trc,pixelaxes=[0,1],csys=cs.torecord())
- rg.fromrecordtotable(’hcn’, "x", r1)
x
- rg.fromrecordtotable(’hcn’, "x", r2)
x0
- rg.namesintable(’hcn’)
x x0
Example
2 CASA image files on disk ’hcn1’ ’hcn2’
- names = rg.namesintable(’hcn1’)
- r = rg.fromtabletorecord(’hcn1’, names[0])
- rg.namesintable(’hcn2’)
- rg.fromrecordtotable(’hcn2’, names[0], r)
In this example, we recover a region into a record
from one image, and then copy them to another.
Example
####In this example a region is saved as a mask
ia.open(’myfancy.image’)
csys=ia.coordsys()
ia.done()
##Lets make a world-box region
wbox=rg.wbox([’10pix’, ’10pix’, ’0pix’, ’0pix’], [’20pix’, ’20pix’, ’0pix’, ’0pix’], csys=csys.torecord())
###save that into the image as a mask rather than just a region and assign it the name
###mask1
rg.fromrecordtotable(’myfancy.image’, ’mask1’, wbox, asmask=True)
###now let us set that as default mask
ia.open(’myfancy.image’)
ia.maskhandler(’set’, ’mask1’)
ia.done()
###and now let us view that image
viewer(’myfancy.image’)
__________________________________________________________________
More information about CASA may be found at the
CASA web page
Copyright © 2016 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense
Home |
Contact Us |
Directories |
Site Map |
Help |
Privacy Policy |
Search