According to one embodiment, a data processing method is used for processing collected data acquired with respect to each A-line by swept-source OCT using a wavelength sweeping light source having a predetermined wavelength sweeping range. The data processing method detects a reference signal assigned in advance to a clock, the wavenumber of which linearly varies along the time axis, in a predetermined wavelength position within the predetermined wavelength sweeping range. Then, the data processing method sequentially performs sampling of the collected data based on the clock with reference to the predetermined wavelength position where the reference signal detected is assigned. Further, the data processing method forms an image of a corresponding A-line based on the sampled collected data.