the colin27 samples do not specify the offset (translation) in the SForm
Closed this issue · 1 comments
robertoostenveld commented
this is what I expect
>> mri = ft_read_mri('~/matlab/fieldtrip/template/anatomy/single_subj_T1_1mm.nii')
the coordinate system appears to be 'scanras'
mri =
struct with fields:
dim: [181 217 181]
anatomy: [181×217×181 double]
hdr: [1×1 struct]
transform: [4×4 double]
unit: 'mm'
>> mri.transform
ans =
1 0 0 -91
0 1 0 -127
0 0 1 -73
0 0 0 1
and this is what I get
>> mri = ft_read_mri('colin27_zlib.jnii')
mri =
struct with fields:
hdr: [1×1 struct]
anatomy: [181×217×181 uint8]
dim: [181 217 181]
unit: 'mm'
coordsys: 'scanras'
transform: [4×4 double]
>> mri.transform
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
fangq commented
The issue was caused by the fact that these .jnii/.bnii files were generated from a generic 3D array from a .mat file using this script
https://github.com/fangq/jnifti/blob/master/samples/colin27/create_jnii.m
so the header was created from scratch using jniicreate()
.
I added this line to manually fix this issue: https://github.com/fangq/jnifti/blob/master/samples/colin27/create_jnii.m#L4
however, a better solution would be coping the .nii.gz file and load from it to keep all the original nii headers.