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 (short-hand name int) creates a region which is the intersection of the given world 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('hcn') - cs := im.coordsys() - drm.setcoordinates(cs) - - blc := "10pix 10pix 1pix" - trc := "60pix 60pix 1pix" - r1 := drm.wbox(blc=blc, trc=trc, pixelaxes=[1,2,3]) - - x := dq.quantity([50,55,58,65,58,53,50], 'pix') - y := dq.quantity([50,53,69,70,63,58,55], 'pix') - r2 := drm.wpolygon(x=x, y=y, pixelaxes=[1,2]) - - r3 := drm.intersection(r1, r2, 'This is the comment') - - im.boundingbox(r1) [blc=[10 10 1] , trc=[60 60 256] , regionShape=[51 51 256] , imageShape=[155 178 256] ] - im.boundingbox(r2) [blc=[50 50 1] , trc=[65 70 256] , regionShape=[16 21 256] , imageShape=[155 178 256] ] - im.boundingbox(r3) [blc=[50 50 1] , trc=[60 60 256] , regionShape=[11 11 256] , imageShape=[155 178 256] ] - - im.stats(region=r3) # Some output discarded NORMAL: Selected bounding box [50, 50, 1] to [60, 60, 1] Number points = 51
In this example, we use pixel coordinates so that it is clear what is happening. You can see that the number of pixels in the intersection (51) is less than the number in the bounding box of the intersection (121) because the intersection is actually polygonal and does not fill the bounding box.
- 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.intersection(regions,'The mysteries of Glish')
This example is the same as the prevoius one, except the regions are provided to the intersection function in a record, rather than directly in the call sequence.