1regalgebra(n) SAORD Documentation regalgebra(n)
2
3
4
6 RegAlgebra: Boolean Algebra on Spatial Regions
7
9 This document describes the boolean arithmetic defined for region
10 expressions.
11
13 When defining a region, several shapes can be combined using boolean
14 operations. The boolean operators are (in order of precedence):
15
16 Symbol Operator Associativity
17 ------ -------- -------------
18 ! not right to left
19 & and left to right
20 ^ exclusive or left to right
21 ⎪ inclusive or left to right
22
23 For example, to create a mask consisting of a large circle with a
24 smaller box removed, one can use the and and not operators:
25
26 CIRCLE(11,11,15) & !BOX(11,11,3,6)
27
28 and the resulting mask is:
29
30 1234567890123456789012345678901234567890
31 ----------------------------------------
32 1:1111111111111111111111..................
33 2:1111111111111111111111..................
34 3:11111111111111111111111.................
35 4:111111111111111111111111................
36 5:111111111111111111111111................
37 6:1111111111111111111111111...............
38 7:1111111111111111111111111...............
39 8:1111111111111111111111111...............
40 9:111111111...1111111111111...............
41 10:111111111...1111111111111...............
42 11:111111111...1111111111111...............
43 12:111111111...1111111111111...............
44 13:111111111...1111111111111...............
45 14:111111111...1111111111111...............
46 15:1111111111111111111111111...............
47 16:1111111111111111111111111...............
48 17:111111111111111111111111................
49 18:111111111111111111111111................
50 19:11111111111111111111111.................
51 20:1111111111111111111111..................
52 21:1111111111111111111111..................
53 22:111111111111111111111...................
54 23:..11111111111111111.....................
55 24:...111111111111111......................
56 25:.....11111111111........................
57 26:........................................
58 27:........................................
59 28:........................................
60 29:........................................
61 30:........................................
62 31:........................................
63 32:........................................
64 33:........................................
65 34:........................................
66 35:........................................
67 36:........................................
68 37:........................................
69 38:........................................
70 39:........................................
71 40:........................................
72
73 A three-quarter circle can be defined as:
74
75 CIRCLE(20,20,10) & !PIE(20,20,270,360)
76
77 and looks as follows:
78
79 1234567890123456789012345678901234567890
80 ----------------------------------------
81 1:........................................
82 2:........................................
83 3:........................................
84 4:........................................
85 5:........................................
86 6:........................................
87 7:........................................
88 8:........................................
89 9:........................................
90 10:........................................
91 11:...............111111111................
92 12:..............11111111111...............
93 13:............111111111111111.............
94 14:............111111111111111.............
95 15:...........11111111111111111............
96 16:..........1111111111111111111...........
97 17:..........1111111111111111111...........
98 18:..........1111111111111111111...........
99 19:..........1111111111111111111...........
100 20:..........1111111111111111111...........
101 21:..........1111111111....................
102 22:..........1111111111....................
103 23:..........1111111111....................
104 24:..........1111111111....................
105 25:...........111111111....................
106 26:............11111111....................
107 27:............11111111....................
108 28:..............111111....................
109 29:...............11111....................
110 30:........................................
111 31:........................................
112 32:........................................
113 33:........................................
114 34:........................................
115 35:........................................
116 36:........................................
117 37:........................................
118 38:........................................
119 39:........................................
120 40:........................................
121
122 Two non-intersecting ellipses can be made into the same region:
123
124 ELL(20,20,10,20,90) ⎪ ELL(1,1,20,10,0)
125
126 and looks as follows:
127
128 1234567890123456789012345678901234567890
129 ----------------------------------------
130 1:11111111111111111111....................
131 2:11111111111111111111....................
132 3:11111111111111111111....................
133 4:11111111111111111111....................
134 5:1111111111111111111.....................
135 6:111111111111111111......................
136 7:1111111111111111........................
137 8:111111111111111.........................
138 9:111111111111............................
139 10:111111111...............................
140 11:...........11111111111111111............
141 12:........111111111111111111111111........
142 13:.....11111111111111111111111111111......
143 14:....11111111111111111111111111111111....
144 15:..11111111111111111111111111111111111...
145 16:.1111111111111111111111111111111111111..
146 17:111111111111111111111111111111111111111.
147 18:111111111111111111111111111111111111111.
148 19:111111111111111111111111111111111111111.
149 20:111111111111111111111111111111111111111.
150 21:111111111111111111111111111111111111111.
151 22:111111111111111111111111111111111111111.
152 23:111111111111111111111111111111111111111.
153 24:.1111111111111111111111111111111111111..
154 25:..11111111111111111111111111111111111...
155 26:...11111111111111111111111111111111.....
156 27:.....11111111111111111111111111111......
157 28:.......111111111111111111111111.........
158 29:...........11111111111111111............
159 30:........................................
160 31:........................................
161 32:........................................
162 33:........................................
163 34:........................................
164 35:........................................
165 36:........................................
166 37:........................................
167 38:........................................
168 39:........................................
169 40:........................................
170
171 You can use several boolean operations in a single region expression,
172 to create arbitrarily complex regions. With the important exception
173 below, you can apply the operators in any order, using parentheses if
174 necessary to override the natural precedences of the operators.
175
176 NB: Using a panda shape is always much more efficient than explicitly
177 specifying "pie & annulus", due to the ability of panda to place a
178 limit on the number of pixels checked in the pie shape. If you are
179 going to specify the intersection of pie and annulus, use panda
180 instead.
181
182 As described in "help regreometry", the PIE slice goes to the edge of
183 the field. To limit its scope, PIE usually is is combined with other
184 shapes, such as circles and annuli, using boolean operations. In this
185 context, it is worth noting that that there is a difference between
186 -PIE and &!PIE. The former is a global exclude of all pixels in the PIE
187 slice, while the latter is a local excludes of pixels affecting only
188 the region(s) with which the PIE is combined. For example, the follow‐
189 ing region uses &!PIE as a local exclude of a single circle. Two other
190 circles are also defined and are unaffected by the local exclude:
191
192 CIRCLE(1,8,1)
193 CIRCLE(8,8,7)&!PIE(8,8,60,120)&!PIE(8,8,240,300)
194 CIRCLE(15,8,2)
195
196 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
197 - - - - - - - - - - - - - - -
198 15: . . . . . . . . . . . . . . .
199 14: . . . . 2 2 2 2 2 2 2 . . . .
200 13: . . . 2 2 2 2 2 2 2 2 2 . . .
201 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
202 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
203 10: . . . . 2 2 2 2 2 2 2 . . . .
204 9: . . . . . . 2 2 2 . . . . 3 3
205 8: 1 . . . . . . . . . . . . 3 3
206 7: . . . . . . 2 2 2 . . . . 3 3
207 6: . . . . 2 2 2 2 2 2 2 . . . .
208 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
209 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
210 3: . . . 2 2 2 2 2 2 2 2 2 . . .
211 2: . . . . 2 2 2 2 2 2 2 . . . .
212 1: . . . . . . . . . . . . . . .
213
214 Note that the two other regions are not affected by the &!PIE, which
215 only affects the circle with which it is combined.
216
217 On the other hand, a -PIE is an global exclude that does affect other
218 regions with which it overlaps:
219
220 CIRCLE(1,8,1)
221 CIRCLE(8,8,7)
222 -PIE(8,8,60,120)
223 -PIE(8,8,240,300)
224 CIRCLE(15,8,2)
225
226 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
227 - - - - - - - - - - - - - - -
228 15: . . . . . . . . . . . . . . .
229 14: . . . . 2 2 2 2 2 2 2 . . . .
230 13: . . . 2 2 2 2 2 2 2 2 2 . . .
231 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
232 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
233 10: . . . . 2 2 2 2 2 2 2 . . . .
234 9: . . . . . . 2 2 2 . . . . . .
235 8: . . . . . . . . . . . . . . .
236 7: . . . . . . 2 2 2 . . . . . .
237 6: . . . . 2 2 2 2 2 2 2 . . . .
238 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
239 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
240 3: . . . 2 2 2 2 2 2 2 2 2 . . .
241 2: . . . . 2 2 2 2 2 2 2 . . . .
242 1: . . . . . . . . . . . . . . .
243
244 The two smaller circles are entirely contained within the two exclude
245 PIE slices and therefore are excluded from the region.
246
248 See funtools(n) for a list of Funtools help pages
249
250
251
252version 1.4.0 August 15, 2007 regalgebra(n)