# Function iacthin

namespace: morph iacthin

# Synopse

Image transformation by conditional thinning.

• y = iacthin(f, g, Iab=ia_homothin(), n=-1, theta=45, DIRECTION="CLOCKWISE")
• y: Image
• f: Image
• g: Image
• Iab: Interval
• n: Double Number of iterations.
• theta: Double Degrees of rotations: 45, 90, or 180.
• DIRECTION: String Direction of rotation: 'CLOCKWISE' or ' ANTI-CLOCKWISE'.
```01. from numpy import *
02. from string import upper
03.
04. def iacthin(f, g, Iab=None, n=-1, theta=45, DIRECTION="CLOCKWISE"):
05.     from iaisbinary import iaisbinary
06.     from iasupgen import iasupgen
07.     from iainterot import iainterot
08.     from iaunion import iaunion
09.     from iasubm import iasubm
10.     from iaisequal import iaisequal
11.     from iahomothin import iahomothin
12.     if Iab is None:
13.         Iab = iahomothin()
14.
15.     DIRECTION = upper(DIRECTION)
16.     assert iaisbinary(f),'f must be binary image'
17.     if n == -1: n = product(f.shape)
18.     y = f
19.     old = y
20.     for i in range(n):
21.         for t in range(0,360,theta):
22.             sup = iasupgen( y, iainterot(Iab, t, DIRECTION))
23.             y = iaunion( iasubm( y, sup),g)
24.         if iaisequal(old,y): break
25.         old = y
26.
27.     return y```

# Description

iacthin creates the binary image y by performing a thinning of the binary image f conditioned to the binary image g. The number of iterations of the conditional thinning is n and in each iteration the thinning is characterized by rotations of theta of the interval Iab.

# Algorithm

```function y = iacthin_equ( f, g, Iab, n, theta, DIRECTION )
y = f;
for i=1:n
for alpha=0:theta:360-theta
Iab = iainterot(Iab, alpha, DIRECTION);
y = iaunion(iasubm(y,iasupgen(y,Iab)),g);
end;
end;
```