Print

Print


Hi
In FDT, the polar coordinates are defined as:  [ sin(theta) * cos(phi) ; sin(theta)*sin(phi) ; cos(theta) ]

So in order to flip the x axis, you can simply multiply both theta and phi by -1.

Cheers
Saad



On 26 Feb 2014, at 13:29, Andrew Lawrence <[log in to unmask]<mailto:[log in to unmask]>> wrote:

Hi FSL-list,

I'm trying to work my way around a problem in my data without rerunning bedpostx, and would be very grateful if someone familiar with this program's innards could check my working.

I've just spotted that subject 1 of a large batch being bedpostx'd at the moment (~300 subjects) was not correctly converted from DICOM and as a result is x-flipped relative to the bvecs. All other subjects appear to be correct.

I can fix most images for this subject using fslswapdim, but I'd like to work out a way to avoid rerunning the bedpostx program as it takes 24+ hours in my data and aside from the x-flip the results should still be good to use.

I believe that for dyads?.nii.gz I can just swap the sign for volume 0 (x-direction) to correct this:

fslsplit dyads1.nii.gz
fslmaths vol0000.nii.gz -mul -1 vol0000.nii.gz
fslmerge -t dyads1.nii.gz vol000?.nii.gz

The results look correct in fslview as the lines show a simple reflection in the x-dimension which then agrees with the anatomy.

dyads?_dispersion, f?samples and S0samples should be rotationally invariant and valid to just x-flip, which leaves the ph?_samples and th?_samples (merged and mean).

I'm not familiar with polar spherical co-ordinates, and don't have any relevant textbooks lying around, but looking over wikipedia (http://en.wikipedia.org/wiki/Spherical_coordinate_system) it seems that phi is the azimuthal angle and theta the polar angle, so only phi will be affected by x-flipping.

if phi = arctan(y / x) then the corrected phi` = arctan(y / -x) and so I should do the following:

fslmaths <phi_image> -tan -mul -1 -atan <corrected_phi_image>

Should this work? The only way I can think to test it would be to run probtrackx from equivalent voxels and see which gives more reasonable results, but I'm not sure this will be conclusive.

Help much appreciated.

Best,

Andrew Lawrence






--
Saad Jbabdi
University of Oxford, FMRIB Centre

JR Hospital, Headington, OX3 9DU, UK
(+44)1865-222466  (fax 717)
www.ndcn.ox.ac.uk/team/researchers/saad-jbabdi<http://www.ndcn.ox.ac.uk/team/researchers/saad-jbabdi>