A robust algorithm for nondestructive testing of weld seams