1. An image processing apparatus that generates a virtual endoscopic image from a three-dimensional image representing a tubular organ, the apparatus comprising: a viewpoint setting unit that sets viewpoints at different positions in a lumen region of the tubular organ; a region identification unit that sets, in the three-dimensional image, a predetermined range in a vicinity of each of the set viewpoints, and identifies each of the 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 an 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, wherein the opacity curve is set for each of the set viewpoints; and a virtual endoscopic image generation unit that generates the virtual endoscopic image for each of the set viewpoints from the three-dimensional image by volume rendering using the set opacity curve for each of the set viewpoints, wherein the predetermined range comprises a visual field range determined based on each of the set viewpoints, an observation direction and a visual field angle, and wherein the opacity curve setting unit stores a base viewpoint and an opacity curve at the base viewpoint, and sets a tolerable amount of change in opacity in such a manner that the tolerable amount is smaller as a distance, along the direction of a course of the tubular organ, between each of the set viewpoints and the base viewpoint is shorter, and sets an opacity curve at each of the set viewpoints in such a manner that a difference between an opacity value in the opacity curve at each of the set viewpoints and an opacity value in the opacity curve at the base viewpoint corresponding to a same voxel value does not exceed the set tolerable amount of change.