Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
Package | general | |
Module | images | |
Tool | regionmanager |
... | in | World regions and comment | |
Allowed: | Region tools or record of region tools, and String |
This function takes a minimum of two world regions and creates a region which is the union of the given regions. The input regions can themselves be compound regions (such as the union or intersection etc). The input regions can be provided as individual region tools, or a record of region tools (see examples).
For arcane Glish language reasons, the usual comment keyword is not provided. But if you provide a string somewhere in the call sequence, it will be treated as the comment.
- im := image('onno') - cs := im.coordsys() - x := dq.quantity([3,6,9,6,5,5,3],'pix') - y := dq.quantity([3,4,7,9,7,5,5],'pix') - r1 := drm.wpoly(x,y,[1,2],cs) - - blc := "17:42:29.303 -28.59.18.600" - trc := "17:42:28.303 -28.59.10.600" - r2 := drm.wbox(blc,trc,[1,2],cs) - - r3 := drm.union(r1,r2,'The mysteries of Glish') - - im.shape() [155 178 256] - im.boundingbox(r1) [blc=[3 3 1] , trc=[9 9 256] , inc=[1 1 1] , bbShape=[7 7 256] , regionShape=[7 7 256] , imageShape=[155 178 256] ] - im.boundingbox(r2) [blc=[90 90 1] , trc=[103 98 256] , inc=[1 1 1] , bbShape=[14 9 256] , regionShape=[14 9 256] , imageShape=[155 178 256] ] - im.boundingbox(r3) [blc=[3 3 1] , trc=[103 98 256] , inc=[1 1 1] , bbShape=[101 96 256] , regionShape=[101 96 256] , imageShape=[155 178 256] ] - - im.stats(region=r1) Selected bounding box [3, 3, 1] to [9, 9, 256] Number points = 6400 - - im.stats(region=r2) Selected bounding box [90, 90, 1] to [103, 98, 256] Number points = 32256 - - im.stats(region=r3) Selected bounding box [3, 3, 1] to [103, 98, 256] Number points = 38656
When the polygon only is applied, it is auto extended along the third axis. The statistics function finds 6400 pixels in the region, which is 6400/256 = 25 pixels per plane. Likewise, when the box only is applied, the statistics function finds 32256 pixels in the region, which is 32256/256 = 126 pixels per plane. When the union is applied, the statistics function finds 38656 pixels in the region. First it finds the union of the polygon and box (which are specified only in the XY plane) and that union is extended. Thus we expect (25 + 126)*256 = 38656 pixels in the region of the union, as found.
- im := image('onno') - cs := im.coordsys() - x := dq.quantity([3,6,9,6,5,5,3],'pix') - y := dq.quantity([3,4,7,9,7,5,5],'pix') - - regions := [=]; - regions[1] := drm.wpoly(x,y,[1,2],cs) - - blc := "17:42:29.303 -28.59.18.600" - trc := "17:42:28.303 -28.59.10.600" - regions[2] := drm.wbox(blc,trc,[1,2],cs) - - r3 := drm.union(regions,'The mysteries of Glish')
This example is the same as the prevoius one, except the regions are provided to the union function in a record, rather than directly in the call sequence.