Detection of bubbles in blood vessels and extracorporeal circuits