Hey fslexperts, hey Stam
thank you for your request.
So I know how the spherical angles are defined but I still do not get to know how I can get from the bedpostx output the angle information from a single dyad. I want to estimate the accuracy of the direction information (dyads/voxel) for different measurements (b-values) in a given roi. Therefore I need a kind of reference value so that I can compare the direction information within a voxel for different measurements. I was thinking maybe it is the easiest to calculate the spherical angles of each dyads/voxel and compare them thus I can say something about my accuracy and precision. 
So it would be nice if somebody has another good approach or idea how to compare measurements (different b-values) regarding to the direction information in a given roi or can tell me how to get the angles as values of a given dyad.

Anyway thank you again.
Best 
Max


2016-11-14 12:46 GMT+01:00 Stamatios Sotiropoulos <[log in to unmask]>:
Hi Max

The dyads is the only information you need for visualisation. 

If you indeed need the angles for some reason, then theta and phi are the spherical angles in radians. These are defined as in the sketch that Saad sent, i.e phi is the angle from a reference axis on the xy plane and theta is the angle from that plane.

Finally, if you need to read values out of a nifti file, then in general you can either use Matlab or use fslmeants —showall. 

Hope this helps
Stam


On 14 Nov 2016, at 11:07, mangan bvb <[log in to unmask]> wrote:

Hi and thank you again for your help,
but for me this looks like a code which represents the transformation between spherical and cartesian coordinate system. Sorry but I don't know how I can use this code to get my direction information (angles ind rad or degree) from my dayds (ph1samples, th1samples files)? I still do not understand how I get the angle values of my dayds? In addition I do not understand the files ph1samples, th1samples. In the documentation it is said that these files including the angle information for the dayds? But how is it possible to read them out of a nifti file such as ph1samples, th1samples. 
Thank you 
Best
Max 


2016-11-12 11:29 GMT+01:00 Saad Jbabdi <[log in to unmask]>:
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]> 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]>:
Hi


Cheers
Saad






On 10 Nov 2016, at 14:29, Max Wichmann <[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