# Function iais

namespace: morph iais

# Synopse

Verify if a relationship among images is true or false.

• y = iais(f1, oper, f2=NULL, oper1=NULL, f3=NULL)
• y: Double
• f1: Image
• oper: String relationship from: '==', '~=', '<','<=', '>', '>=', 'binary', 'gray'.
• f2: Image
• oper1: String relationship from: '==', '~=', '<','<=', '>', '>='.
• f3: Image
```01. from numpy import *
02. from string import upper
03.
04. def iais(f1, oper, f2=None, oper1=None, f3=None):
05.     from iaisbinary import iaisbinary
06.     from iaisequal import iaisequal
07.     from iaislesseq import iaislesseq
08.     from ianeg import ianeg
10.     from iabinary import iabinary
11.
12.
13.     if f2 == None:
14.         oper=upper(oper);
15.         if   oper == 'BINARY': return iaisbinary(f1)
16.         elif oper == 'GRAY'  : return not iaisbinary(f1)
17.         else:
18.             assert 0,'oper should be BINARY or GRAY, was'+oper
19.     elif oper == '==':    y = iaisequal(f1, f2)
20.     elif oper == '~=':    y = not iaisequal(f1,f2)
21.     elif oper == '<=':    y = iaislesseq(f1,f2)
22.     elif oper == '>=':    y = iaislesseq(f2,f1)
23.     elif oper == '>':     y = iaisequal( ianeg( iathreshad(f2,f1)),iabinary(1))
24.     elif oper == '<':     y = iaisequal( ianeg( iathreshad(f1,f2)),iabinary(1))
25.     else:
26.         assert 0,'oper must be one of: ==, ~=, >, >=, <, <=, it was:'+oper
27.     if oper1 != None:
28.         if   oper1 == '==': y = y and iaisequal(f2,f3)
29.         elif oper1 == '~=': y = y and (not iaisequal(f2,f3))
30.         elif oper1 == '<=': y = y and iaislesseq(f2,f3)
31.         elif oper1 == '>=': y = y and iaislesseq(f3,f2)
32.         elif oper1 == '>':  y = y and iaisequal( ianeg( iathreshad(f3,f2)),iabinary(1))
33.         elif oper1 == '<':  y = y and iaisequal( ianeg( iathreshad(f2,f3)),iabinary(1))
34.         else:
35.             assert 0,'oper1 must be one of: ==, ~=, >, >=, <, <=, it was:'+oper1
36.
37.
38.     return y```

# Description

Verify if the property or relatioship between images is true or false. The result is true if the relationship is true for all the pixels in the image, and false otherwise. (Obs: This function replaces None).

# Examples

## Example 1

```01. from ia870 import iais
02. from ia870 import iabinary
03.
04.
05. fbin=iabinary([0, 1])
06. f1=uint8([1, 2, 3])
07. f2=uint8([2, 2, 3])
08. f3=uint8([2, 3, 4])
09. iais(fbin,'binary')
10. iais(f1,'gray')
11. iais(f1,'==',f2)
12. iais(f1,'<',f3)
13. iais(f1,'<=',f2)
14. iais(f1,'<=',f2,'<=',f3)```