Hi,
The fslcreatehd command was originally created when we
dealt with analyze images (that had an origin) and has
kept backward-compatible syntax ever since. You can
set the effective origin in a nifti image by making sure that
desired voxel coordinate (i,j,k) maps to the mm coordinate
(0,0,0).
To do this, find which of the qform or sform has a code that
is non-zero (zero for the code means that the matrix is considered
"Unknown" and the values are unused). If both have non-zero
codes then use the sform.
Take the matrix, and the desired origin coordinate (i,j,k)
and multiply them (say in matlab). The result is the
mm coordinate of the (i,j,k) coordinate. Note that you
need to make a 4x1 vector which is [i j k 1]' in matlab
notation. To make this the origin you simply need to
subtract the result from the translation part of the matrix
(the fourth column). Leave the fourth row as it is though.
Once you've subtracted the relevant quantities from the
fourth column then you can save the whole matrix as the
new sform (or qform) matrix using fslorient and the
-setsform (or -setqform) command.
I hope this is clear and useful.
All the best,
Mark
On 19 Nov 2009, at 21:04, Sebastian Rodrigo wrote:
> Dear Jesper,
>
> you are probably right. But, as FSL addict, I was little confused
> about the
> options from fslcreathd. This command allows to set the origin but, as
> discussed above, it's not not the best way and the more secure to do
> so as I
> want to preserve the original orientation.
>
> Best regards
>
> Sebastian Rodrigo
>
|