Computing diameter-lines of a 3D spherical mask Computing diameter-lines of a 3D spherical mask numpy numpy

Computing diameter-lines of a 3D spherical mask


I propose to change the coordinate system to spherical coordinates. Thus, you will choose your 2D circle by an azimuthal angle, and a line then is defined by additionally choosing a polar angle. The variable along the line is then just the radius, and you can use ´numpy.linspace´ to discretize it. Doing so might also save time during calculation.

You can switch your coordinate system any time by using the bijective relation which is implemented e.g. here or here.