Print

Print


Hi - This is the bit of code in FSL that carries out the transformation.

In the below, “dir” is the dyadic vector and (th,ph) are the polar angles.

I hope that clarifies things?

Cheers
Saad


void cart2sph(const ColumnVector& dir, float& th, float& ph)
{
  float mag=sqrt(dir(1)*dir(1)+dir(2)*dir(2)+dir(3)*dir(3));
  if(mag==0){
    ph=M_PI/2;
    th=M_PI/2;
  }
  else{

    if(dir(1)==0 && dir(2)>=0) ph=M_PI/2;
    else if(dir(1)==0 && dir(2)<0) ph=-M_PI/2;
    else if(dir(1)>0) ph=atan(dir(2)/dir(1));
    else if(dir(2)>0) ph=atan(dir(2)/dir(1))+M_PI;
    else ph=atan(dir(2)/dir(1))-M_PI;

    if(dir(3)==0) th=M_PI/2;
    else if(dir(3)>0) th=atan(sqrt(dir(1)*dir(1)+dir(2)*dir(2))/dir(3));
    else th=atan(sqrt(dir(1)*dir(1)+dir(2)*dir(2))/dir(3))+M_PI;
  }
}






On 12 Nov 2016, at 08:16, mangan bvb <[log in to unmask]<mailto:[log in to unmask]>> wrote:

Hi Saad,
thank you for this information, but this image explains just spherical coordinates and not how I can get the angle values from the data.
Has somebody else an idea?
Best,
Max

2016-11-10 15:58 GMT+01:00 Saad Jbabdi <[log in to unmask]<mailto:[log in to unmask]>>:
Hi
This page explains how the angles relate to the dyads: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FDT/UserGuide?action=AttachFile&do=view&target=fdt_spherical_polars.gif


Cheers
Saad






On 10 Nov 2016, at 14:29, Max Wichmann <[log in to unmask]<mailto:[log in to unmask]>> wrote:

Dear all,
I'm new to Fsl and in general to neuroscience so I already say sorry if my question is not that precisely.
Anyway this is my question:

I would like to compare the direct information (dyads) for different measurements (b-values). Therefore I need to know the scalar value of the two angles presenting the orientation of one dyad in a voxel.

1. So first of all is it right that ph1samples, th1samples presenting the angles in spherical coordinates for dayd1 which can be understand as the main direction in a given voxel?
2. How can I find out the the scalar values of both angles given in one voxel?

I tried to open the ph1samples, th1samples in fslview and check the histogram. But actually I do not understand the distribution. I was thinking the x-axis represents the different angles and the y-axis their related frequency. But I cant find some information in that distribution about the given angles. Maybe the scaling is weird. But I also changed it to something like -pi to pi or -180 to 180. But still the meaning is not clear.

So I guess I have some false idea about the outputs? Maybe somebody can help me with this?

Thank you very much

best

Max