Hi
I think there are two things that may have created your confusion:
1) Matlab uses the mathematical convention whereas FSL uses the physics convention
2) Matlab uses “elevation” as opposed to “polar” angle, which is why you have the pi/2-angle
Like I said it is easy to go from matlab to fsl using the transform I sent (which is not the same as you have written in (2) below).
Here it is again:
% this will give you FSL’s definition of theta and phi
[ph,th] = cart2sph(x,y,z);
th=pi/2-th;
Cheers
Saad
> On 4 Oct 2017, at 15:25, Max Wichmann <[log in to unmask]> wrote:
>
> Thank you for this quick reply,
> Still I am a bit confused
>
>
> Matlab says:
> azimuth = theta
> elevation = phi
>
> function [az,elev,r] = cart2sph(x,y,z)
> %CART2SPH Transform Cartesian to spherical coordinates.
> % [TH,PHI,R] = CART2SPH(X,Y,Z) transforms corresponding elements of
> % data stored in Cartesian coordinates X,Y,Z to spherical
> % coordinates (azimuth TH, elevation PHI, and radius R)
>
>
> Fsl
>
> azimuth = phi
> elevation = theta
>
> So in case I want to have phi, theta for further fsl calculations I have to do:
>
> 1. Calculating via [azimuth,elvation] = cart2sph(x,y,z) phi and theta
>
> and then I get the fsl coordinates like:
>
> 2. phi(fsl)=pi/2-th(matlab)
> theta(fsl)=phi(matlab)
>
>
> Sorry for asking again but its a bit confusing and I have to be sure before I continue with my calculations.
> Thank you
> Best
> Max
|