~ubuntu-branches/ubuntu/vivid/nip2/vivid-proposed

« back to all changes in this revision

Viewing changes to share/nip2/compat/7.14/Math.def

  • Committer: Bazaar Package Importer
  • Author(s): Michael Terry
  • Date: 2009-05-12 09:26:46 UTC
  • mfrom: (1.2.11 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090512092646-j8lb1w2x69pvgma4
Tags: 7.18.1-1ubuntu1
* Merge from debian unstable (LP: #375435), remaining changes:
  - debian/control: Also Recommend abrowser

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Math_arithmetic_item = class 
 
2
        Menupullright "_Arithmetic" "basic arithmetic for objects" {
 
3
        Add_item = class
 
4
                Menuaction "_Add" "add a and b" {
 
5
                action a b = map_binary add a b;
 
6
        }
 
7
 
 
8
        Subtract_item = class
 
9
                Menuaction "_Subtract" "subtract b from a" {
 
10
                action a b = map_binary subtract a b;
 
11
        }
 
12
 
 
13
        Multiply_item = class
 
14
                Menuaction "_Multiply" "multiply a by b" {
 
15
                action a b = map_binary multiply a b;
 
16
        }
 
17
 
 
18
        Divide_item = class
 
19
                Menuaction "_Divide" "divide a by b" {
 
20
                action a b = map_binary divide a b;
 
21
        }
 
22
 
 
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;
 
27
        }
 
28
 
 
29
        sep1 = Menuseparator;
 
30
 
 
31
        Absolute_value_item = class
 
32
                Menuaction "A_bsolute Value" "absolute value of x" {
 
33
                action x = map_unary abs x;
 
34
        }
 
35
 
 
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;
 
40
        }
 
41
 
 
42
        Sign_item = class
 
43
                Menuaction "S_ign" "unit vector" {
 
44
                action x = map_unary sign x;
 
45
        }
 
46
 
 
47
        Negate_item = class
 
48
                Menuaction "_Negate" "multiply by -1" {
 
49
                action x = map_unary unary_minus x;
 
50
        }
 
51
}
 
52
 
 
53
Math_trig_item = class 
 
54
        Menupullright "_Trigonometry" "trigonometry operations (all in degrees)" {
 
55
        Sin_item = class
 
56
                Menuaction "_Sine" "calculate sine x" {
 
57
                action x = map_unary sin x;
 
58
        }
 
59
 
 
60
        Cos_item = class
 
61
                Menuaction "_Cosine" "calculate cosine x" {
 
62
                action x = map_unary cos x;
 
63
        }
 
64
 
 
65
        Tan_item = class
 
66
                Menuaction "_Tangent" "calculate tangent x" {
 
67
                action x = map_unary tan x;
 
68
        }
 
69
 
 
70
        sep1 = Menuseparator;
 
71
 
 
72
        Asin_item = class
 
73
                Menuaction "Arc S_ine" "calculate arc sine x" {
 
74
                action x = map_unary asin x;
 
75
        }
 
76
 
 
77
        Acos_item = class
 
78
                Menuaction "Arc C_osine" "calculate arc cosine x" {
 
79
                action x = map_unary acos x;
 
80
        }
 
81
 
 
82
        Atan_item = class
 
83
                Menuaction "Arc T_angent" "calculate arc tangent x" {
 
84
                action x = map_unary atan x;
 
85
        }
 
86
 
 
87
        sep2 = Menuseparator;
 
88
 
 
89
        Rad_item = class
 
90
                Menuaction "_Degrees to Radians" "convert degrees to radians" {
 
91
                action x = map_unary rad x;
 
92
        }
 
93
 
 
94
        Deg_item = class
 
95
                Menuaction "_Radians to Degrees" "convert radians to degrees" {
 
96
                action x = map_unary deg x;
 
97
        }
 
98
 
 
99
        sep3 = Menuseparator;
 
100
 
 
101
        Angle_range_item = class
 
102
                Menuaction "Angle i_n Range" 
 
103
                        "is angle within t degrees of r, mod 360" {
 
104
                action t r angle
 
105
                      = clock (max - angle) < 2*r
 
106
                {
 
107
                        max = clock (t + r);
 
108
 
 
109
                        clock a 
 
110
                              = a + 360, a < 0;
 
111
                              = a - 360, a >= 360;
 
112
                              = a;
 
113
                }
 
114
        }
 
115
}
 
116
 
 
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;
 
122
        }
 
123
 
 
124
        Log_natural_item = class
 
125
                Menuaction "Natural _Log" "log base e of x" {
 
126
                action x = map_unary log x;
 
127
        }
 
128
 
 
129
        sep1 = Menuseparator;
 
130
 
 
131
        Exponential10_item = class
 
132
                Menuaction "E_xponential base 10" "calculate 10 ** x" {
 
133
                action x = map_unary (power 10) x;
 
134
        }
 
135
 
 
136
        Log10_item = class
 
137
                Menuaction "L_og Base 10" "log base 10 of x" {
 
138
                action x = map_unary log10 x;
 
139
        }
 
140
 
 
141
        sep2 = Menuseparator;
 
142
 
 
143
        Raise_to_power_item = class
 
144
                Menuaction "_Raise to Power" "calculate x ** y" {
 
145
                action x y = map_binary power x y;
 
146
        }
 
147
}
 
148
 
 
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" {
 
153
                Real_item = class 
 
154
                        Menuaction "_Real" 
 
155
                                "extract real part of complex" {
 
156
                        action in = map_unary re in;
 
157
                }
 
158
 
 
159
                Imaginary_item = class 
 
160
                        Menuaction "_Imaginary" 
 
161
                                "extract imaginary part of complex" {
 
162
                        action in = map_unary im in;
 
163
                }
 
164
        }
 
165
 
 
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;
 
169
        }
 
170
 
 
171
        sep1 = Menuseparator;
 
172
 
 
173
        Polar_item = class 
 
174
                Menuaction "_Polar" 
 
175
                        "convert real and imag to amplitude and phase" {
 
176
                action a = map_unary polar a;
 
177
        }
 
178
 
 
179
        Rectangular_item = class 
 
180
                Menuaction "_Rectagular" 
 
181
                        ("convert (amplitude, phase) image to rectangular " ++
 
182
                        "coordinates") {
 
183
                action x = map_unary rectangular x;
 
184
        }
 
185
 
 
186
        sep2 = Menuseparator;
 
187
 
 
188
        Conjugate_item = class 
 
189
                Menuaction "_Conjugate" "invert imaginary part" {
 
190
                action x = map_unary conj x;
 
191
        }
 
192
}
 
193
 
 
194
Math_boolean_item = class 
 
195
        Menupullright "_Boolean" "bitwise boolean operations for integer objects" {
 
196
        And_item = class 
 
197
                Menuaction "_And" "bitwise and of a and b" {
 
198
                action a b = map_binary bitwise_and a b;
 
199
        }
 
200
 
 
201
        Or_item = class 
 
202
                Menuaction "_Or" "bitwise or of a and b" {
 
203
                action a b = map_binary bitwise_or a b;
 
204
        }
 
205
 
 
206
        Eor_item = class 
 
207
                Menuaction "E_xclusive Or" "bitwise exclusive or of a and b" {
 
208
                action a b = map_binary eor a b;
 
209
        }
 
210
 
 
211
        Not_item = class 
 
212
                Menuaction "_Not" "invert a" {
 
213
                action a = map_unary not a;
 
214
        }
 
215
 
 
216
        sep1 = Menuseparator;
 
217
 
 
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;
 
221
        }
 
222
 
 
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;
 
226
        }
 
227
 
 
228
        sep2 = Menuseparator;
 
229
 
 
230
        If_then_else_item = class 
 
231
                Menuaction "_If Then Else" 
 
232
                        "b where a is non-zero, c elsewhere" {
 
233
                action a b c 
 
234
                        = map_trinary ite a b c
 
235
                {
 
236
                        // can't use if_then_else, we need a true trinary
 
237
                        ite a b c = if a then b else c;
 
238
                }
 
239
        }
 
240
 
 
241
        Band_or_item = class 
 
242
                Menuaction "Band O_r" "or the bands of an image together" {
 
243
                action im = map_unary (foldr1 bitwise_or @ bandsplit) im;
 
244
        }
 
245
 
 
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;
 
249
        }
 
250
}
 
251
 
 
252
Math_relational_item = class 
 
253
        Menupullright "R_elational" "comparison operations" {
 
254
        Equal_item = class 
 
255
                Menuaction "_Equal to" "test a equal to b" {
 
256
                action a b = map_binary equal a b;
 
257
        }
 
258
 
 
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;
 
262
        }
 
263
 
 
264
        sep1 = Menuseparator;
 
265
 
 
266
        More_item = class 
 
267
                Menuaction "_More Than" "test a strictly greater than b" {
 
268
                action a b = map_binary more a b;
 
269
        }
 
270
 
 
271
        Less_item = class 
 
272
                Menuaction "_Less Than" "test a strictly less than b" {
 
273
                action a b = map_binary less a b;
 
274
        }
 
275
 
 
276
        sep2 = Menuseparator;
 
277
 
 
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;
 
282
        }
 
283
 
 
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;
 
288
        }
 
289
}
 
290
 
 
291
Math_list_item = class 
 
292
        Menupullright "L_ist" "operations on lists" {
 
293
        Head_item = class 
 
294
                Menuaction "_Head" "first element in list" {
 
295
                action x = map_unary hd x;
 
296
        }
 
297
 
 
298
        Tail_item = class 
 
299
                Menuaction "_Tail" "list without the first element" {
 
300
                action x = map_unary tl x;
 
301
        }
 
302
 
 
303
        Last_item = class 
 
304
                Menuaction "_Last" "last element in list" {
 
305
                action x = map_unary last x;
 
306
        }
 
307
 
 
308
        Init_item = class 
 
309
                Menuaction "_Init" "list without the last element" {
 
310
                action x = map_unary init x;
 
311
        }
 
312
 
 
313
        sep1 = Menuseparator;
 
314
 
 
315
        Reverse_item = class 
 
316
                Menuaction "_Reverse" "reverse order of elements in list" {
 
317
                action x = map_unary reverse x;
 
318
        }
 
319
 
 
320
        Sort_item = class 
 
321
                Menuaction "_Sort" "sort list into ascending order" {
 
322
                action x = map_unary sort x;
 
323
        }
 
324
 
 
325
        Make_set_item = class 
 
326
                Menuaction "_Make Set" "remove duplicates from list" {
 
327
                action x = map_unary mkset equal x;
 
328
        }
 
329
 
 
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;
 
334
        }
 
335
 
 
336
        Concat_item = class 
 
337
                Menuaction "_Concat" 
 
338
                        "flatten a list of lists into a single list" {
 
339
                action l = map_unary concat l;
 
340
        }
 
341
 
 
342
        sep2 = Menuseparator;
 
343
 
 
344
        Length_item = class 
 
345
                Menuaction "L_ength" "find the length of list" {
 
346
                action x = map_unary len x;
 
347
        }
 
348
 
 
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;
 
353
        }
 
354
 
 
355
        Take_item = class 
 
356
                Menuaction "_Take" "take the first n elements of list x" {
 
357
                action n x = map_binary take n x;
 
358
        }
 
359
 
 
360
        Drop_item = class 
 
361
                Menuaction "_Drop" "drop the first n elements of list x" {
 
362
                action n x = map_binary drop n x;
 
363
        }
 
364
 
 
365
        sep3 = Menuseparator;
 
366
 
 
367
        Join_item = class 
 
368
                Menuaction "_Join" "join two lists end to end" {
 
369
                action a b = map_binary join a b;
 
370
        }
 
371
 
 
372
        Cons_item = class 
 
373
                Menuaction "C_ons" "put element a on the front of list x" {
 
374
                action a x = map_binary cons a x;
 
375
        }
 
376
 
 
377
        Zip_item = class 
 
378
                Menuaction "_Zip" "join two lists, pairwise" {
 
379
                action a b = map_binary zip2 a b;
 
380
        }
 
381
}
 
382
 
 
383
Math_round_item = class 
 
384
        Menupullright "_Round" "various rounding operations" {
 
385
        /* smallest integral value not less than x 
 
386
         */
 
387
        Ceil_item = class 
 
388
                Menuaction "_Ceil" "smallest integral value not less than x" {
 
389
                action x = map_unary ceil x;
 
390
        }
 
391
 
 
392
        Floor_item = class 
 
393
                Menuaction "_Floor" 
 
394
                        "largest integral value not greater than x" {
 
395
                action x = map_unary floor x;
 
396
        }
 
397
 
 
398
        Rint_item = class 
 
399
                Menuaction "_Round to Nearest" "round to nearest integer" {
 
400
                action x = map_unary rint x;
 
401
        }
 
402
}
 
403
 
 
404
Math_fourier_item = class 
 
405
        Menupullright "_Fourier" "Fourier transform" {
 
406
        Forward_item = class 
 
407
                Menuaction "_Forward" "fourier transform of image" {
 
408
                action a = map_unary (rotquad @ fwfft) a;
 
409
        }
 
410
 
 
411
        Reverse_item = class 
 
412
                Menuaction "_Reverse" "inverse fourier transform of image" {
 
413
                action a = map_unary (invfft @ rotquad) a;
 
414
        }
 
415
 
 
416
        Rotate_quadrants_item = class 
 
417
                Menuaction "Rotate _Quadrants" "rotate quadrants" {
 
418
                action a = map_unary rotquad a;
 
419
        }
 
420
}
 
421
 
 
422
Math_stats_item = class 
 
423
        Menupullright "_Statistics" "measure various statistics of objects" {
 
424
        Mean_item = class 
 
425
                Menuaction "_Mean" "arithmetic mean value" {
 
426
                action a = map_unary mean a;
 
427
        }
 
428
 
 
429
        Gmean_item = class 
 
430
                Menuaction "_Geometric Mean" "geometric mean value" {
 
431
                action a = map_unary meang a;
 
432
        }
 
433
 
 
434
        Zmean_item = class 
 
435
                Menuaction "_Zero-excluding Mean" "mean value of non-zero elements" {
 
436
                action a = map_unary meanze a;
 
437
        }
 
438
 
 
439
        Deviation_item = class 
 
440
                Menuaction "_Standard Deviation" "standard deviation of object" {
 
441
                action a = map_unary deviation a;
 
442
        }
 
443
 
 
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;
 
448
        }
 
449
 
 
450
        Stats_item = class 
 
451
                Menuaction "Ma_ny Stats" "calculate many stats in a single pass" {
 
452
                action a = map_unary stats a;
 
453
        }
 
454
 
 
455
        sep1 = Menuseparator;
 
456
 
 
457
        Max_item = class 
 
458
                Menuaction "M_aximum" "maximum of object" {
 
459
                action a = map_unary max a;
 
460
        }
 
461
 
 
462
        Min_item = class 
 
463
                Menuaction "M_inimum" "minimum of object" {
 
464
                action a = map_unary min a;
 
465
        }
 
466
 
 
467
        Maxpos_item = class 
 
468
                Menuaction "_Position of Maximum" "position of maximum in object" {
 
469
                action a = map_unary maxpos a;
 
470
        }
 
471
 
 
472
        Minpos_item = class 
 
473
                Menuaction "P_osition of Minimum" "position of minimum in object" {
 
474
                action a = map_unary minpos a;
 
475
        }
 
476
 
 
477
        Gravity_item = class 
 
478
                Menuaction "Centre of _Gravity" "position of centre of gravity" {
 
479
                action a = map_unary gravity a;
 
480
        }
 
481
 
 
482
        sep2 = Menuseparator;
 
483
 
 
484
        Count_set_item = class 
 
485
                Menuaction "_Non-zeros" "number of non-zero elements in object" {
 
486
                action a 
 
487
                        = map_unary cset a
 
488
                {
 
489
                        cset i = (mean (i != 0) * i.width * i.height) / 255;
 
490
                }
 
491
        }
 
492
 
 
493
        Count_clear_item = class 
 
494
                Menuaction "_Zeros" "number of zero elements in object" {
 
495
                action a 
 
496
                        = map_unary cclear a
 
497
                {
 
498
                        cclear i = (mean (i == 0) * i.width * i.height) / 255;
 
499
                }
 
500
        }
 
501
 
 
502
        Count_edges_item = class 
 
503
                Menuaction "_Edges" 
 
504
                        "count average edges across or down image" {
 
505
                action x = class  
 
506
                        _result {
 
507
                        _vislevel = 3;
 
508
        
 
509
                        edge = Option "Count" [
 
510
                                "Horizontal lines", 
 
511
                                "Vertical lines"
 
512
                        ] 0;
 
513
        
 
514
                        _result
 
515
                                = map_unary process x
 
516
                        {
 
517
                                process image = Number (edge.labels?edge) 
 
518
                                        (im_cntlines image.value edge.value);
 
519
                        }
 
520
                }
 
521
        }
 
522
 
 
523
        sep3 = Menuseparator;
 
524
 
 
525
        Linear_regression_item = class
 
526
                Menuaction "_Linear Regression" "fit a line to a set of points" {
 
527
                action xes yes = linreg xes yes;
 
528
        }
 
529
 
 
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;
 
534
        }
 
535
}
 
536
 
 
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;
 
542
        }
 
543
 
 
544
        Binary_item = class 
 
545
                Menuaction "_Binary" "convert to binary (base 2)" {
 
546
                action a = map_unary (print_base 2) a;
 
547
        }
 
548
 
 
549
        Octal_item = class 
 
550
                Menuaction "_Octal" "convert to octal (base 8)" {
 
551
                action a = map_unary (print_base 8) a;
 
552
        }
 
553
}