1
Math_arithmetic_item = class
2
Menupullright "_Arithmetic" "basic arithmetic for objects" {
4
Menuaction "_Add" "add a and b" {
5
action a b = map_binary add a b;
9
Menuaction "_Subtract" "subtract b from a" {
10
action a b = map_binary subtract a b;
14
Menuaction "_Multiply" "multiply a by b" {
15
action a b = map_binary multiply a b;
19
Menuaction "_Divide" "divide a by b" {
20
action a b = map_binary divide a b;
23
Remainder_item = class
24
Menuaction "_Remainder"
25
"remainder after integer division of a by b" {
26
action a b = map_binary remainder a b;
31
Absolute_value_item = class
32
Menuaction "A_bsolute Value" "absolute value of x" {
33
action x = map_unary abs x;
36
Absolute_value_vector_item = class
37
Menuaction "Absolute Value _Vector"
38
"like Absolute Value, but treat pixels as vectors" {
39
action x = map_unary abs_vec x;
43
Menuaction "S_ign" "unit vector" {
44
action x = map_unary sign x;
48
Menuaction "_Negate" "multiply by -1" {
49
action x = map_unary unary_minus x;
53
Math_trig_item = class
54
Menupullright "_Trigonometry" "trigonometry operations (all in degrees)" {
56
Menuaction "_Sine" "calculate sine x" {
57
action x = map_unary sin x;
61
Menuaction "_Cosine" "calculate cosine x" {
62
action x = map_unary cos x;
66
Menuaction "_Tangent" "calculate tangent x" {
67
action x = map_unary tan x;
73
Menuaction "Arc S_ine" "calculate arc sine x" {
74
action x = map_unary asin x;
78
Menuaction "Arc C_osine" "calculate arc cosine x" {
79
action x = map_unary acos x;
83
Menuaction "Arc T_angent" "calculate arc tangent x" {
84
action x = map_unary atan x;
90
Menuaction "_Degrees to Radians" "convert degrees to radians" {
91
action x = map_unary rad x;
95
Menuaction "_Radians to Degrees" "convert radians to degrees" {
96
action x = map_unary deg x;
101
Angle_range_item = class
102
Menuaction "Angle i_n Range"
103
"is angle within t degrees of r, mod 360" {
105
= clock (max - angle) < 2*r
117
Math_log_item = class
118
Menupullright "_Log" "logarithms and anti-logs" {
119
Exponential_item = class
120
Menuaction "_Exponential" "calculate e ** x" {
121
action x = map_unary (power e) x;
124
Log_natural_item = class
125
Menuaction "Natural _Log" "log base e of x" {
126
action x = map_unary log x;
129
sep1 = Menuseparator;
131
Exponential10_item = class
132
Menuaction "E_xponential base 10" "calculate 10 ** x" {
133
action x = map_unary (power 10) x;
137
Menuaction "L_og Base 10" "log base 10 of x" {
138
action x = map_unary log10 x;
141
sep2 = Menuseparator;
143
Raise_to_power_item = class
144
Menuaction "_Raise to Power" "calculate x ** y" {
145
action x y = map_binary power x y;
149
Math_complex_item = class
150
Menupullright "_Complex" "operations on complex numbers and images" {
151
Complex_extract = class
152
Menupullright "_Extract" "extract fields from complex" {
155
"extract real part of complex" {
156
action in = map_unary re in;
159
Imaginary_item = class
160
Menuaction "_Imaginary"
161
"extract imaginary part of complex" {
162
action in = map_unary im in;
166
Complex_build_item = class
167
Menuaction "_Build" "join a and b to make a complex" {
168
action a b = map_binary comma a b;
171
sep1 = Menuseparator;
175
"convert real and imag to amplitude and phase" {
176
action a = map_unary polar a;
179
Rectangular_item = class
180
Menuaction "_Rectagular"
181
("convert (amplitude, phase) image to rectangular " ++
183
action x = map_unary rectangular x;
186
sep2 = Menuseparator;
188
Conjugate_item = class
189
Menuaction "_Conjugate" "invert imaginary part" {
190
action x = map_unary conj x;
194
Math_boolean_item = class
195
Menupullright "_Boolean" "bitwise boolean operations for integer objects" {
197
Menuaction "_And" "bitwise and of a and b" {
198
action a b = map_binary bitwise_and a b;
202
Menuaction "_Or" "bitwise or of a and b" {
203
action a b = map_binary bitwise_or a b;
207
Menuaction "E_xclusive Or" "bitwise exclusive or of a and b" {
208
action a b = map_binary eor a b;
212
Menuaction "_Not" "invert a" {
213
action a = map_unary not a;
216
sep1 = Menuseparator;
218
Right_shift_item = class
219
Menuaction "Shift _Right" "shift a right by b bits" {
220
action a b = map_binary right_shift a b;
223
Left_shift_item = class
224
Menuaction "Shift _Left" "shift a left by b bits" {
225
action a b = map_binary left_shift a b;
228
sep2 = Menuseparator;
230
If_then_else_item = class
231
Menuaction "_If Then Else"
232
"b where a is non-zero, c elsewhere" {
234
= map_trinary ite a b c
236
// can't use if_then_else, we need a true trinary
237
ite a b c = if a then b else c;
242
Menuaction "Band O_r" "or the bands of an image together" {
243
action im = map_unary (foldr1 bitwise_or @ bandsplit) im;
246
Band_and_item = class
247
Menuaction "Band A_nd" "and the bands of an image together" {
248
action im = map_unary (foldr1 bitwise_and @ bandsplit) im;
252
Math_relational_item = class
253
Menupullright "R_elational" "comparison operations" {
255
Menuaction "_Equal to" "test a equal to b" {
256
action a b = map_binary equal a b;
259
Not_equal_item = class
260
Menuaction "_Not Equal to" "test a not equal to b" {
261
action a b = map_binary not_equal a b;
264
sep1 = Menuseparator;
267
Menuaction "_More Than" "test a strictly greater than b" {
268
action a b = map_binary more a b;
272
Menuaction "_Less Than" "test a strictly less than b" {
273
action a b = map_binary less a b;
276
sep2 = Menuseparator;
278
More_equal_item = class
279
Menuaction "M_ore Than or Equal to"
280
"test a greater than or equal to b" {
281
action a b = map_binary more_equal a b;
284
Less_equal_item = class
285
Menuaction "L_ess Than or Equal to"
286
"test a less than or equal to b" {
287
action a b = map_binary less_equal a b;
291
Math_list_item = class
292
Menupullright "L_ist" "operations on lists" {
294
Menuaction "_Head" "first element in list" {
295
action x = map_unary hd x;
299
Menuaction "_Tail" "list without the first element" {
300
action x = map_unary tl x;
304
Menuaction "_Last" "last element in list" {
305
action x = map_unary last x;
309
Menuaction "_Init" "list without the last element" {
310
action x = map_unary init x;
313
sep1 = Menuseparator;
316
Menuaction "_Reverse" "reverse order of elements in list" {
317
action x = map_unary reverse x;
321
Menuaction "_Sort" "sort list into ascending order" {
322
action x = map_unary sort x;
325
Make_set_item = class
326
Menuaction "_Make Set" "remove duplicates from list" {
327
action x = map_unary mkset equal x;
330
Transpose_list_item = class
331
Menuaction "Tr_anspose"
332
"exchange rows and columns in a list of lists" {
333
action x = map_unary transpose x;
338
"flatten a list of lists into a single list" {
339
action l = map_unary concat l;
342
sep2 = Menuseparator;
345
Menuaction "L_ength" "find the length of list" {
346
action x = map_unary len x;
349
Subscript_item = class
350
Menuaction "S_ubscript"
351
"return element n from list (index from zero)" {
352
action n x = map_binary subscript n x;
356
Menuaction "_Take" "take the first n elements of list x" {
357
action n x = map_binary take n x;
361
Menuaction "_Drop" "drop the first n elements of list x" {
362
action n x = map_binary drop n x;
365
sep3 = Menuseparator;
368
Menuaction "_Join" "join two lists end to end" {
369
action a b = map_binary join a b;
373
Menuaction "C_ons" "put element a on the front of list x" {
374
action a x = map_binary cons a x;
378
Menuaction "_Zip" "join two lists, pairwise" {
379
action a b = map_binary zip2 a b;
383
Math_round_item = class
384
Menupullright "_Round" "various rounding operations" {
385
/* smallest integral value not less than x
388
Menuaction "_Ceil" "smallest integral value not less than x" {
389
action x = map_unary ceil x;
394
"largest integral value not greater than x" {
395
action x = map_unary floor x;
399
Menuaction "_Round to Nearest" "round to nearest integer" {
400
action x = map_unary rint x;
404
Math_fourier_item = class
405
Menupullright "_Fourier" "Fourier transform" {
407
Menuaction "_Forward" "fourier transform of image" {
408
action a = map_unary (rotquad @ fwfft) a;
412
Menuaction "_Reverse" "inverse fourier transform of image" {
413
action a = map_unary (invfft @ rotquad) a;
416
Rotate_quadrants_item = class
417
Menuaction "Rotate _Quadrants" "rotate quadrants" {
418
action a = map_unary rotquad a;
422
Math_stats_item = class
423
Menupullright "_Statistics" "measure various statistics of objects" {
425
Menuaction "_Mean" "arithmetic mean value" {
426
action a = map_unary mean a;
430
Menuaction "_Geometric Mean" "geometric mean value" {
431
action a = map_unary meang a;
435
Menuaction "_Zero-excluding Mean" "mean value of non-zero elements" {
436
action a = map_unary meanze a;
439
Deviation_item = class
440
Menuaction "_Standard Deviation" "standard deviation of object" {
441
action a = map_unary deviation a;
444
Zdeviation_item = class
445
Menuaction "Z_ero-excluding Standard Deviation"
446
"standard deviation of non-zero elements" {
447
action a = map_unary deviationze a;
451
Menuaction "Ma_ny Stats" "calculate many stats in a single pass" {
452
action a = map_unary stats a;
455
sep1 = Menuseparator;
458
Menuaction "M_aximum" "maximum of object" {
459
action a = map_unary max a;
463
Menuaction "M_inimum" "minimum of object" {
464
action a = map_unary min a;
468
Menuaction "_Position of Maximum" "position of maximum in object" {
469
action a = map_unary maxpos a;
473
Menuaction "P_osition of Minimum" "position of minimum in object" {
474
action a = map_unary minpos a;
478
Menuaction "Centre of _Gravity" "position of centre of gravity" {
479
action a = map_unary gravity a;
482
sep2 = Menuseparator;
484
Count_set_item = class
485
Menuaction "_Non-zeros" "number of non-zero elements in object" {
489
cset i = (mean (i != 0) * i.width * i.height) / 255;
493
Count_clear_item = class
494
Menuaction "_Zeros" "number of zero elements in object" {
498
cclear i = (mean (i == 0) * i.width * i.height) / 255;
502
Count_edges_item = class
504
"count average edges across or down image" {
509
edge = Option "Count" [
515
= map_unary process x
517
process image = Number (edge.labels?edge)
518
(im_cntlines image.value edge.value);
523
sep3 = Menuseparator;
525
Linear_regression_item = class
526
Menuaction "_Linear Regression" "fit a line to a set of points" {
527
action xes yes = linreg xes yes;
530
Weighted_linear_regression_item = class
531
Menuaction "_Weighted Linear Regression"
532
"fit a line to a set of points and deviations" {
533
action xes yes devs = linregw xes yes devs;
537
Math_base_item = class
538
Menupullright "Bas_e" "convert number bases" {
539
Hexadecimal_item = class
540
Menuaction "_Hexadecimal" "convert to hexadecimal (base 16)" {
541
action a = map_unary (print_base 16) a;
545
Menuaction "_Binary" "convert to binary (base 2)" {
546
action a = map_unary (print_base 2) a;
550
Menuaction "_Octal" "convert to octal (base 8)" {
551
action a = map_unary (print_base 8) a;