# Synopse

Intensity image transform.

• g = iaapplylut(fi, it)
• g: Image.
• fi: Image. input image, gray scale or index image.
• it: Image. Intensity transform. Table of one or three columns.
```1. import numpy as np
2.
3. def iaapplylut(fi, it):
4.     g = it[fi]
5.     if len(g.shape) == 3:
6.         g = np.swapaxes(g, 0,2)
7.         g = np.swapaxes(g, 1,2)
8.     return g```

# Description

Apply an intensity image transform to the input image. The input image can be seen as an gray scale image or an index image. The intensity transform is represented by a table where the input (gray scale) color address the table line and its column contents indicates the output (gray scale) image color. The table can have one or three columns. If it has three columns, the output image is a three color band image. This intensity image transformation is very powerful and can be use in many applications involving gray scale and color images. If the input image has an index (gray scale color) that is greater than the size of the intensity table, an error is reported.

# Examples

## Example 1

This first example shows a simple numeric 2 lines, 3 columns image with sequential pixel values. First the identity table is applied and image g is generated with same values of f. Next, a new table, itn = 5 - it is generated creating a negation table. The resultant image gn has the values of f negated.

```01. from ia636 import iaapplylut
02.
03. f = array([[0,1,2], [3,4,5]])
04. print 'f=\n',f
05. it = array(range(6)) # identity transform
06. print 'it=',it
07. g = iaapplylut(f, it)
08. print 'g=\n',g
09. itn = 5 - it  # negation
10. print 'itn=',itn
11. gn = iaapplylut(f, itn)
12. print 'gn=\n',gn```
```f=
[[0 1 2]
[3 4 5]]
it= [0 1 2 3 4 5]
g=
[[0 1 2]
[3 4 5]]
itn= [5 4 3 2 1 0]
gn=
[[5 4 3]
[2 1 0]]
```

## Example 2

This example shows the negation operation applying the intensity transform through a negation grayscale table: it = 255 - i.

```1. f = adreadgray('cameraman.pgm')
2. it = (255 - arange(256)).astype('uint8')
3. g = iaapplylut(f, it)
4. adshow(f)
5. adshow(g)```  ## Example 3

```1. f = array([[0,1,2],
2.            [2,0,1]])
3. ct = array([[100,101,102],
4.             [110,111,112],
5.             [120,121,122]])
6. #print iaimginfo(ct)
7. g = iaapplylut(f,ct)
8. print g```
```[[[100 110 120]
[120 100 110]]

[[101 111 121]
[121 101 111]]

[[102 112 122]
[122 102 112]]]
```

## Example 4

```1. f = adreadgray('cameraman.pgm')
2. aux = resize(range(256), (256,1))
3. ct = concatenate((aux, zeros((256,2))), 1)
4. g = iaapplylut(f, ct)
5. adshow(f)
6. adshow(g)```  # Equation  