# Function iaramp

namespace: ia636 iaramp

# Description

Create an 1, 2 or 3-dimensional image with increasing gray value bands. The function receives the output dimension, the number of increasing bands, and the range of values variation in each direction.

# Synopse

Creates a 1D/2D/3D gray scale image with dimensions given by s, with n increasing gray scale bands with values varying from the specified range

• g = iaramp(s, n, range)
• g: Image.
• s: [S H W]: slices, height and width output image dimensions.
• n: [nz ny nx]: number of bands.
• range: [kz_min, kz_max,ky_min,ky_max,kx_min,kx_max], minimum and maximum gray scale values on z,y and x dimension.
```01. from numpy import *
02.
03. def iaramp(s, n, range=[0,255]):
04.     aux = array(n)
05.     s_orig = s
06.
07.     if len(aux.shape) == 0:
08.         s = [1,s[0],s[1]]
09.         n = [0,0,n]
10.         range = [0,0,0,0,range[0],range[1]]
11.
12.     slices,rows, cols = s[0], s[1], s[2]
13.     z,y,x = indices((slices,rows,cols))
14.     gz = z*n[0]/slices * (range[1]-range[0]) / (n[0]-1) + range[0]
15.     gy = y*n[1]/rows * (range[3]-range[2]) / (n[1]-1) + range[2]
16.     gx = x*n[2]/cols * (range[5]-range[4]) / (n[2]-1) + range[4]
17.     return (gz+gy+gx).reshape(s_orig)```

# Examples

## Numeric example

```01. from ia636 import *
02.
03. F = iaramp([5,7], 3, [4,10])
04. print F
05. print
06. print
07. F = iaramp((1,5,7),(0,3,0), [0,0,4,10,0,0])
08. print F
09. print
10. print
11. F = iaramp([1,5,7],[3,0,0], [4,10,0,0,0,0])
12. print F```
```[[ 4  4  4  7  7 10 10]
[ 4  4  4  7  7 10 10]
[ 4  4  4  7  7 10 10]
[ 4  4  4  7  7 10 10]
[ 4  4  4  7  7 10 10]]

[[[ 4  4  4  4  4  4  4]
[ 4  4  4  4  4  4  4]
[ 7  7  7  7  7  7  7]
[ 7  7  7  7  7  7  7]
[10 10 10 10 10 10 10]]]

[[[4 4 4 4 4 4 4]
[4 4 4 4 4 4 4]
[4 4 4 4 4 4 4]
[4 4 4 4 4 4 4]
[4 4 4 4 4 4 4]]]
```

## Image example

```01. from ia636 import *
02.
03. F = iaramp([1,200,300], [0,10,0], [0,0,0,255,0,0])
05. print
06. F = iaramp([200,300], 10, [0,255])
08. print
09. F = iaramp([1,200,300], [10,0,0], [0,255,0,0,0,0])

## Image example - 3D

```01. from ia636 import *
02.
03. F = iaramp([50,100,200], [20,10,0], [0,255,0,255,0,0])
05. print
06. F = iaramp([50,100,200], [20,0,10], [0,255,0,0,0,255])
08. print
09. F = iaramp([50,100,200], [0,10,20], [0,0,0,255,0,255])

## Image example 2 - 3D

```01. from ia636 import *
02.
03. F = iaramp([10,20,30], [10,20,30], [0,255,0,255,0,255])