1. An image processing apparatus that generates a virtual endoscopic image from a three-dimensional image representing a tubular organ, the apparatus comprising: a region identification unit that sets, in the three-dimensional image, a predetermined range in the vicinity of a viewpoint that has been set in advance, and identifies each of a lumen region of the tubular organ in the set range and a wall region of the tubular organ in the set range; an opacity curve setting unit that obtains, based on information about voxel values in the identified lumen region and information about voxel values in the identified wall region, a voxel value or a voxel value interval constituting a boundary between a range of voxel values in the identified lumen region and a range of voxel values in the identified wall region, and sets an opacity curve representing a relationship between voxel values and opacity in such a manner that the opacity changes from a value representing a transparent state to a value representing an opaque state at the voxel value or in the voxel value interval; and a virtual endoscopic image generation unit that generates the virtual endoscopic image from the three-dimensional image by volume rendering using the set viewpoint and the set opacity curve.