# retrieve tool objects
ref = GetTool('Reference')
innerRadius = GetTool('FindInnerCircle')
outerRadius = GetTool('FindOuterCircle')
#get image handle
img = GetImageMatr('Image')
#init state values
largeRing = 0
smallRing = 0for no in range(int(GetValue('ObjectLocator.Count'))):
# get results from blob
x = GetValue('ObjectLocator.CenterOfGravity[%.0f]_x' % (no))
y = GetValue('ObjectLocator.CenterOfGravity[%.0f]_y' % (no))
# set position to reference
ref.setValue('Value_x',x)
ref.setValue('Value_y',y)
ref.execute(img)
# execute radialarc finders
innerRadius.execute(img)
iRadius = innerRadius.getValue('Radius')
outerRadius.execute(img)
oRadius = outerRadius.getValue('Radius')
#print results
print iRadius,oRadius
#classify results
if not largeRing:
largeRing = (iRadius < 4.75) and (oRadius > 7.0)
if not smallRing:
smallRing = (iRadius > 4.75 ) and (oRadius < 7.0 )
# set external state
SetValue('LargeRing.Value',largeRing)
SetValue('SmallRing.Value',smallRing) |