A method and an apparatus for automatically maintaining the Doppler sample gate position at a pre-selected vessel position in B-mode or color flow images during tissue or probe motion. The sample gate (34, 36) is locked onto the selected vessel (30) automatically when the vessel position has changed. Optionally, the vessel slope cursor (28) is automatically updated when the vessel position has changed. The method employs pattern matching of images from successive frames to determine how much a vessel in the image frame has been translated and rotated from one frame to the next. Preferably, either a cross-correlation method is applied to the imaging data in the spatial domain to determine the relative object translation and/or rotation between image frames, or a matched filtering method is applied to the imaging data in the frequency (i.e., Fourier) domain to determine the relative object translation and/or rotation between image frames.