# Function iaendpoints

namespace: morph iaendpoints

# Synopse

Interval to detect end-points.

• Iab = iaendpoints(OPTION="LOOP")
• Iab: Interval
• OPTION: String 'LOOP' or 'HOMOTOPIC'
```01. from numpy import *
02. from string import upper
03.
04. def iaendpoints(OPTION="LOOP"):
05.     from iase2hmt import iase2hmt
06.     from iabinary import iabinary
07.
08.
09.     Iab = None
10.     OPTION = upper(OPTION)
11.     if OPTION == 'LOOP':
12.         Iab = iase2hmt( iabinary([[0,0,0],
13.                                   [0,1,0],
14.                                   [0,0,0]]),
15.                         iabinary([[0,0,0],
16.                                   [1,0,1],
17.                                   [1,1,1]]))
18.     elif OPTION == 'HOMOTOPIC':
19.         Iab = iase2hmt( iabinary([[0,1,0],
20.                                   [0,1,0],
21.                                   [0,0,0]]),
22.                         iabinary([[0,0,0],
23.                                   [1,0,1],
24.                                   [1,1,1]]))
25.
26.
27.     return Iab```

# Description

iaendpoints creates an interval that is useful to detect end-points of curves (i.e., one pixel thick connected components) in binary images. It can be used to prune skeletons and to mark objects transforming them in a single pixel or closed loops if they have holes. There are two options available: LOOP, deletes all points but preserves loops if used in iathin; HOMOTOPIC, deletes all points but preserves the last single point or loops.

# Examples

## Example 1

```1. from ia870 import iaendpoints
2. from ia870 import iaintershow
3.
4.
5. print iaintershow( iaendpoints())```
```. . .
0 0 0
0 0 0
```

## Example 2

`1. print iaintershow( iaendpoints('HOMOTOPIC'))`
```. 0 .
0 0 0
0 0 0
```

## Example 3

```1. from ia870 import iathin
2.
3.
5. mmshow(f)
6. f1 = iathin(f)
7. mmshow(f1)
8. f2 = iathin(f1,iaendpoints(),20)
9. mmshow(f2)```

## Example 4

```1. from ia870 import iadil
2.
3.
4. fn = iathin(f1,iaendpoints('HOMOTOPIC'))