In this example we rotate a linefinder tool around a circle calculating
the min and max radius of the circle. The following tools are present in the
toolbox:
- mref - MoveReference - use to rotate the reference system
- lf - LineFinder - finds a straight line at the outer edges of the
circle
- d1 - PointDistanceTool - calcalulates the distance from radius
center to the center of linefinder line
The rotated linefinder
Example: mref = GetTool('mref')
lf = GetTool('lf')
d1 = GetTool('d1')
img = GetImageMatr('Images')
radius = []
for angle in range(0,360,10): # steps from 0 to 360 degrees in
anglesteps of 10
SetConfigValue('mref.Rotation',angle)
mref.execute(img)
lf.execute(img)
d1.execute(img)
d = d1.getValue('Distance')
if d > 5 :
radius.append(d) # appends valid radiuses to list
print 'angle - ',angle,' - d = ',d
print ' list ',radius, ' min - ',min(radius),' max -
',max(radius)
SetValue('Min.Value',min(radius))
SetValue('Max.Value',max(radius)) |