binary_threshold (Image, Region, 'max_separability', 'light', UsedThreshold)
connection (Region, ConnectedRegions)
closing_circle (ConnectedRegions, RegionClosing, 120)
opening_circle (RegionClosing, RegionOpening, 3.5)
dilation_rectangle1 (RegionOpening, RegionDilation, 11, 11)
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
gen_rectangle1 (Rectangle, Row1, Column1, Row2, Column2)
reduce_domain (Image, Rectangle, ImageReduced)
edges_sub_pix (ImageReduced, Edges, 'canny', 1, 20, 40)
segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 2)
select_shape_xld (ContoursSplit, SelectedXLD, 'phi', 'and', -2, 2)
select_obj (SelectedXLD, ObjectSelected1, 1)
fit_line_contour_xld (ObjectSelected1, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
gen_contour_polygon_xld (Contour1, [RowBegin,RowEnd+500], [ColBegin,ColEnd])
select_obj (SelectedXLD, ObjectSelected2, 2)
fit_line_contour_xld (ObjectSelected2, 'tukey', -1, 0, 5, 2, RowBegin1, ColBegin1, RowEnd1, ColEnd1, Nr1, Nc1, Dist1)
gen_contour_polygon_xld (Contour2, [RowBegin1,RowEnd1+500] ,[ColBegin1,ColEnd1])
distance_cc (Contour1, Contour2, 'point_to_point', DistanceMin, DistanceMax)
disp_message (WindowHandle, DistanceMin, 'window', 50, 50, 'black', 'true')