NRAO Home > CASA > CASA Toolkit Reference Manual
regionmanager.difference - Function

1.1.2 Create the difference of two world regions


Description

This function (short-hand name diff) creates a region which is the difference of two world regions. The order of the regions is important.

The difference consists of all pixels masked-on in the first region and not masked-on in the second region.

Arguments





Inputs

region1

The first world region

allowed:

record

Default:

region2

The second world region

allowed:

record

Default:

Region tool

comment

A comment stored with the region

allowed:

string

Default:

String

Returns
record

Example

 
 
- ia.open(’hcn’)  
- csys = ia.coordsys()  
- rg.setcoordinates(csys.torecord())  
-  
- blc = "10pix 10pix"  
- trc = "60pix 60pix"  
- r1 = rg.wbox(blc,trc,[0,1])  
-  
- blc = "50pix 50pix"  
- trc = "80pix 80pix"  
- r2 = rg.wbox(blc, trc, [0,1])  
-  
- r3 = rg.difference(r1, r2)                        # r1 - r2  
-  
- ia.statistics(region=r1)                          # Some output discarded  
Selected bounding box [10, 10] to [60, 60]  
No pts   = 2601  
-  
- ia.statistics(region=r3)                          # Some output discarded  
Selected bounding box [10, 10] to [60, 60]  
No pts   = 2480  
-  
-  
- r4 = rg.difference(r2, r1)                        # r2 - r1  
-  
- ia.statistics(region=r2)                          # Some output discarded  
Selected bounding box [50, 50] to [80, 80]  
No pts   = 961  
-  
- ia.statistics(region=r4)                          # Some output discarded  
Selected bounding box [50, 50, 1] to [80, 80, 64]  
No pts   = 840  
 
 
We use pixel units and boxes in this example to make it clear what is  
happening.  The two regions overlap in the top right corner area of  
region {\stf r1} by an area of $11\times11=121$~pixels.  Therefore, the  
difference region {\stf r3} has $2601-121=2480$~pixels in it.  For  
difference region {\stf r4}, the region of overlap is the bottom left  
corner area of region {\stf r2} and still contains 121~pixels.  We expect  
$961-121=840$~pixels in the differnce region.  
 

__________________________________________________________________


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