# Synopse

Reconstructive Alternating Sequential Filtering

• y = iaasfrec(f, SEQ="OC", b=ia_secross(NULL), bc=ia_secross(NULL), n=1)
• y: Image
• f: Image
• SEQ: String Values: "OC" or "CO".
• b: Structuring Element
• bc: Structuring Element
• n: Double (number of iterations).
```01. from numpy import *
02. from string import upper
03. from iasecross import iasecross
04.
05. def iaasfrec(f, SEQ="OC", b=iasecross(), bc=iasecross(), n=1):
06.     from iasesum import iasesum
07.     from iacloserec import iacloserec
08.     from iaopenrec import iaopenrec
09.
10.     SEQ = upper(SEQ)
11.     y = f
12.     if SEQ == 'OC':
13.         for i in range(1,n+1):
14.             nb = iasesum(b,i)
15.             y = iacloserec(y,nb,bc)
16.             y = iaopenrec(y,nb,bc)
17.     elif SEQ == 'CO':
18.         for i in range(1,n+1):
19.             nb = iasesum(b,i)
20.             y = iaopenrec(y,nb,bc)
21.             y = iacloserec(y,nb,bc)
22.     else:
23.         assert 0,'Only accepts OC or CO for SEQ parameter'
24.
25.     return y```

# Description

None creates the image y by filtering the image f by n iterations of the close by reconstruction and open by reconstruction alternating sequential filter characterized by the structuring element b. The structure element bc is used in the reconstruction. The sequence of opening and closing is controlled by the parameter SEQ. 'OC' performs opening after closing, and 'CO' performs closing after opening.

# Examples

## Example 1

```1. from ia870 import iaasfrec
2. from ia870 import iasecross
3.