Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: regionmanager.displayedplane - Function Up: regionmanager - Tool Previous: regionmanager.deletefromtable - Function


regionmanager.difference - Function



Package general
Module images
Tool regionmanager


Create the difference of two world regions


Synopsis
difference(region1, region2, comment)


Arguments

region1 in The first world region
    Allowed: Region tool
region2 in The second world region
    Allowed: Region tool
comment in A comment stored with the region
    Allowed: String


Returns
Region tool or fail



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.



Example
- im := image('hcn')
- cs := im.coordsys()
- drm.setcoordinates(cs)
-
- blc := "10pix 10pix"
- trc := "60pix 60pix"
- r1 := drm.wbox(blc,trc,[1,2])
-
- blc := "50pix 50pix"
- trc := "80pix 80pix"
- r2 := drm.wbox(blc, trc, [1,2])
- 
- r3 := drm.difference(r1, r2)                 # r1 - r2
-
- im.stats(region=r1)                          # Some output discarded 
Selected bounding box [10, 10] to [60, 60]
No pts   = 2601
-
- im.stats(region=r3)                          # Some output discarded 
Selected bounding box [10, 10] to [60, 60]
No pts   = 2480
-
-
- r4 := drm.difference(r2, r1)                 # r2 - r1
-
- im.stats(region=r2)                          # Some output discarded 
Selected bounding box [50, 50] to [80, 80]
No pts   = 961
-
- im.stats(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 r1 by an area of 11 x 11 = 121 pixels. Therefore, the difference region r3 has 2601 - 121 = 2480 pixels in it. For difference region r4, the region of overlap is the bottom left corner area of region r2 and still contains 121 pixels. We expect 961 - 121 = 840 pixels in the differnce region.





next up previous contents index
Next: regionmanager.displayedplane - Function Up: regionmanager - Tool Previous: regionmanager.deletefromtable - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01