Size: 562
Comment: converted to 1.6 markup
|
Size: 1217
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
{{{ [someone@localhost]$ e2.py |
The following example shows various ways of adding and multiplying images. The given example uses 3D images but the functionality generalizes for 2D images. = Set up 2 identical images = {{{#!python [someone@localhost] e2.py |
Line 12: | Line 15: |
In [5]: f = e.copy() | In [5]: e.process_inplace('testimage.axes') |
Line 14: | Line 17: |
In [5]: e.process_inplace('testimage.axes') | In [6]: f = e.copy() # f is precise replica of e |
Line 16: | Line 19: |
''or try e.process_inplace('testimage.scurve') or e.process_inplace('testimage.gradient')'' {{{ In [6]: t = Transform3D(90,30,90) |
''or try a = test_image_3d(2), a = test_image(0) etc - see'' |
Line 20: | Line 21: |
In [7]: t.set_posttrans(1,-2,5) | = Make e different to f = |
Line 22: | Line 23: |
In [8]: t.set_pretrans(2,10,-20) | {{{#!python In [7]: t = Transform({"type":"eman","alt":45,"phi":20,"az":11}) |
Line 24: | Line 26: |
In [9]: e.rotate_translate(t) | In [8]: t.set_trans(1,-2,5) |
Line 26: | Line 28: |
In [10]: e.mult(2.5) | In [9]: t.set_mirror(True) |
Line 28: | Line 30: |
In [11]: g = f + e | In [10]: e.transform(t) |
Line 30: | Line 32: |
In [12]: display(g) | In [11]: e.mult(2.5) # multiply all pixel values by 2.5 |
Line 32: | Line 34: |
In [12]: e.add(13) # Adds 13 to all pixels | |
Line 33: | Line 36: |
= Add and multiply images = {{{#!python In [13]: g = f + e # add two images, the result is stored in g In [14]: display(g) # observe g In [15]: f.add(e) # Add the pixels of e into f directly In [16]: f.mult(e) # Multiple the pixels in f by the pixels in e In [17]: g = f * e # Multiple the pixels in f by the pixels in e and store the result in g }}} |
The following example shows various ways of adding and multiplying images. The given example uses 3D images but the functionality generalizes for 2D images.
Set up 2 identical images
or try a = test_image_3d(2), a = test_image(0) etc - see
Make e different to f
Add and multiply images
1 In [13]: g = f + e # add two images, the result is stored in g
2
3 In [14]: display(g) # observe g
4
5 In [15]: f.add(e) # Add the pixels of e into f directly
6
7 In [16]: f.mult(e) # Multiple the pixels in f by the pixels in e
8
9 In [17]: g = f * e # Multiple the pixels in f by the pixels in e and store the result in g