Open Lestropie opened 1 year ago
Here's a summary of some of the different conventions I've dealt with across different tools over the years. Not particularly helpful for the tasks listed above, but it's good to know what users may or may not be assuming when mixing tools/packages...
Source | XY plane | Z axis | Order |
---|---|---|---|
ScipyΒ sph_harm |
π½ "azimuth" [0,2Ο] |
π "polar" [0,Ο] |
[az, pol] |
Dipy sphere2cart / cart2sphere |
π "azimuth" [-Ο,Ο] |
π½ "incl/polar" [0,Ο] |
[r, pol, az] |
Descoteaux 2006 | π [0,2Ο] |
π½ [0,Ο] |
|
matlab cart2sph |
"azimuth" [-Ο,Ο] |
"elevation" [-Ο/2, Ο/2] |
[az, el, r] |
CSD matlab s2c |
"azimuth" [-Ο,Ο] |
"elevation" [0,Ο] |
[el, az, r] |
True; might we worth expanding the scope of the issue to cover the order of coefficients. The expected ranges should ideally not be of consequence since they should wash out in any relevant calculations; what matters most is the definition of where zero is. For inclination vs elevation as polar angle in particular, there should be a bunch of cos()
/ acos()
vs. sin()
/ asin()
calls in conversions to / from Cartesian.
The inhomogeneity certainly justifies my assertion of enforcing ISO in BEP016... π
The expected ranges should ideally not be of consequence since they should wash out in any relevant calculations
Indeed, and I was thinking that some functions may enforce the ranges through input checks, but for example even though the scipy sph_harm
documentation says "must be in [0, 2*pi]
", it looks like that isn't actually inforced and it accepts negative values just fine...
I've been aware of this one for a while, but didn't realise that I had not listed it. Has come back to the front of my mind due to playing with particularly #2626.
Spherical coordinates can be defined using different conventions, in terms or presence or absence of elements / ordering of elements / symbols for elements / reference & range for quantities. In BIDS BEP016 I've stuck to ISO standard as much as possible. In MRtrix3 code, one frequently sees references in this context to "az_el", ie. azimuth-elevation pairs. However the
cos
/acos
transformations indicate that the origin of the second spherical angle is the z-axis. This would make it an inclination rather than elevation angle: the former uses the angle from the zenith direction, the latter uses the angle from the reference plane.MR::Math::Sphere
. I've already done this a little in #2626 and related, but it needs a more exhaustive search.