| Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
| Version 1.9 Build 1556 |
|
Note that LEL is readonly; i.e. it does not change any value in the images given. A function in the image client has to be used to do something with the result (e.g. storing in another image).
Here follows a sample Glish session showing some of the LEL capabilities and how Glish variables can be used in LEL.
duw01> glish -l image.g
- a := array(1:50,5,10) # make some data
- global im1 := imagefromarray('im1', a); # fill an image with it
- im1.shape()
[5 10]
- local pixels, mask
- im1.getregion(pixels, mask); # get pixels and mask
- mask[1,1] := F # set some mask elements to False
- mask[3,4] := F
- im1.putregion(mask=mask); # put new mask back
- global reg:=drm.box([1,1],[4,4]); # a box region
- im2 := imagecalc(pixels='$im1[$reg]') # read-only image applying region
- local pixels2, mask2
- im2.getregion(pixels2, mask2); # get the pixels and mask
- print pixels2
[[1:4,]
1 6 11 16
2 7 12 17
3 8 13 18
4 9 14 19]
- print mask2
[[1:4,]
F T T T
T T T T
T T T F
T T T T]
- im1.replacemaskedpixels ('mean(im2)'); # replace masked-off values
- im1.getregion (pixels2, mask2); # by mean of masked-on in im2
- print pixels2
[[1:5,]
10.0714283 6 11 16 21 26 31 36 41 46
2 7 12 17 22 27 32 37 42 47
3 8 13 10.0714283 23 28 33 38 43 48
4 9 14 19 24 29 34 39 44 49
5 10 15 20 25 30 35 40 45 50]