Hello again,
First up, are you definitely using SPM5? (.nii won't work with 2)
I'm puzzled by this:
> The dim is from an .img image: dim 1 0 0 .. I guess I should change that
> for nii
V.dim should be the image dimensions, in SPM5 it's usually a three
vector of [Nx Ny Nz] where these are the number of voxels the volume
contains in that dimension. In SPM2 there is a fourth element for the
data-type.
The [1 0 0] you refer to sounds a lot more like V.pinfo which gives
intensity scaling and a byte-offset into the file where the image data
begins (in SPM5), but this is just a guess.
I can't think why spm_write_vol would complain about the dimensions
with nii but not with img, since the dimensions of the data (check
with size(Y)) should match the V.dim field with either format.
And V.pinfo=[1 0 0] (if it's pinfo as I think it is) should be fine.
> I simply do the following
> V = spm_read_vols(P)
> Info = V(1)
As Marko pointed out, this must be from spm_vol if this contains
things like Info.fname etc. spm_read_vols would take Info from spm_vol
and return the actual image intensity data in a matrix.
Double check your code, have a read of "help spm_vol" and please say
if things still aren't working!
Best,
Ged.
|