Hi Mark and company,
I just tried the command 'fslmeants --showall myfile.nii.gz -o tvmatrix' which I can tell has more or less the expected shape, but I can't tell how the file is organized. There are 1452 timepoints, but 1455 lines, so I'm assuming there is an extra line for each of the three coordinate directions, but I'm having trouble figuring out which lines correspond to times and which to coordinates -- I'm trying to use a combination of 'head' and 'cut' to view windows of the file, but without success, so I wonder whether I'm getting the delimiter wrong. I'd be grateful for any help sorting this out!
Thanks,
Dav
Hi,
You can use fslmeants with --showall to get a text output of all voxel values, including the coordinates.
The coordinates will be in voxel coordinates. If you want mm coordinates then you'll need to use img2stdcoord and std2imgcoord to convert between them. There is documentation on the wiki for these.
As for the SPM info - I believe that you are looking at the SPM registration information, which is not part of the native image (although I confess that I am not an SPM expert!). The only coordinate information that is available to FSL is that stored in the NIFTI files, and not in any mat file, as these mat files are not understood by FSL.
All the best,
Mark
On 18 Apr 2013, at 18:31, David Romano <[log in to unmask]> wrote:
> Hi everyone,
>
> I have an fMRI nifti file which I'd like to eventually be able to:
>
> 1) convert into a time by voxel matrix, and
> 2) create a dictionary that records the MNI coordinates of each voxel (column).
>
> I've tried fsl2ascii, which produces a separate matrix for each timepoint, but these (data) matrices are stripped of any coordinate information; in my case the spatial dimensions are 40x64x64, and the corresponding ascii matrices are 4096x40, so I can only tell that the x-coordinates correspond to columns, but that's it. I've also tried to use fslhd to identify the coordinate transformation matrix that corresponds to the original fMRI data, but it seems that information about the MNI origin is missing, or at least at odds with what I get from SPM; I've included the fslhd and SPM output below.
>
> In short, I have the following questions:
>
> A) Is there a way within FSL to convert the image at a timepoint into a (brain) vector (which I can then concatenate with others)?
> B) How does one extract the array-coordinates-to-MNI-coordinates matrix from an fMRI nifti file in FSL?
>
> I'd be grateful for any help or direction on these questions.
>
> Thanks,
> David Romano
>
> ---- SPM output ----
> >> testvolume(1).mat
>
> ans =
>
> -3.5000 0 0 71.7500
> 0 3.7500 0 -121.8750
> 0 0 3.7500 -121.8750
> 0 0 0 1.0000
> ---- fslhd output ----
> dromano$ fslhd bold.nii.gz
> filename bold.nii.gz
>
> sizeof_hdr 348
> data_type INT16
> dim0 4
> dim1 40
> dim2 64
> dim3 64
> dim4 1452
> dim5 1
> dim6 1
> dim7 1
> vox_units mm
> time_units s
> datatype 4
> nbyper 2
> bitpix 16
> pixdim0 0.0000000000
> pixdim1 3.5000000000
> pixdim2 3.7500000000
> pixdim3 3.7500000000
> pixdim4 2.5000000000
> pixdim5 0.0000000000
> pixdim6 0.0000000000
> pixdim7 0.0000000000
> vox_offset 352
> cal_max 2753.0000
> cal_min 0.0000
> scl_slope 1.000000
> scl_inter 0.000000
> phase_dim 0
> freq_dim 0
> slice_dim 0
> slice_name Unknown
> slice_code 0
> slice_start 0
> slice_end 0
> slice_duration 0.000000
> time_offset 0.000000
> intent Unknown
> intent_code 0
> intent_name
> intent_p1 0.000000
> intent_p2 0.000000
> intent_p3 0.000000
> qform_name Unknown
> qform_code 0
> qto_xyz:1 3.500000 0.000000 0.000000 0.000000
> qto_xyz:2 0.000000 3.750000 0.000000 0.000000
> qto_xyz:3 0.000000 0.000000 3.750000 0.000000
> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
> qform_xorient Left-to-Right
> qform_yorient Posterior-to-Anterior
> qform_zorient Inferior-to-Superior
> sform_name Unknown
> sform_code 0
> sto_xyz:1 0.000000 0.000000 0.000000 0.000000
> sto_xyz:2 0.000000 0.000000 0.000000 0.000000
> sto_xyz:3 0.000000 0.000000 0.000000 0.000000
> sto_xyz:4 0.000000 0.000000 0.000000 0.000000
> sform_xorient Unknown
> sform_yorient Unknown
> sform_zorient Unknown
> file_type NIFTI-1+
> file_code 1
> descrip FSL4.0
> aux_file
>
>
>