Patent ID: 8465421

Claim:
Medical device, comprising: an endoscope, comprising an insertion tube, having a proximal end and a distal end, which is configured for insertion into a body cavity of a subject, and containing a working channel, which is configured to convey a fluid from the proximal end to a target region in the body cavity adjacent to the distal end; a fluid sensor, which is configured to measure a characteristic of a flow of the fluid in the working channel; and a control unit, which is configured to regulate the flow of the fluid in the working channel responsively to the measured characteristic; wherein the endoscope comprises an optical assembly contained in the distal end and configured to form an image of the target region, and wherein the control unit is configured to process the image and to regulate the flow of the fluid through the working channel responsively to a quality of the image; and wherein the control unit is configured to set the flow automatically, responsively to the measured characteristic and the quality of the image, so as to maximize a contrast of the image while minimizing a rate of the flow, within respective, predetermined upper and lower limits of the rate and contrast.