Your script seems to be written for SPM99 and your data are probably
SPM99 as well, not SPM2...
Either switch back to SPM99 or replace spm_create_image with
spm_create_vol in your script.
Volkmar
On Fri, 4 May 2007, Jaclyn Billington wrote:
> Dear all,
>
> I'm using a simple script (spm_flip.m) to flip my SPM T1 template. However,
> I am getting the following message
>
> Warning: Ignoring hdr.hist.orient field of "/xxx/xxx/T1_spm2.hdr".
>> In /app/spm/spm2/spm_vol_ana.m at line 78
> In /app/spm/spm2/spm_vol.m (subfunc) at line 93
> In /app/spm/spm2/spm_vol.m (subfunc1) at line 62
> In /app/spm/spm2/spm_vol.m (subfunc2) at line 51
> In /app/spm/spm2/spm_vol.m at line 37
> In /xxx/xxx/my_matlab_scripts/spm_flip.m at line 1
> Warning: Assuming a scalefactor of 1 for
> "/data2/jb434/sbrain_avg152T1_spm2.img".
>> In /app/spm/spm2/spm_vol_ana.m at line 129
> In /app/spm/spm2/spm_vol.m (subfunc) at line 93
> In /app/spm/spm2/spm_vol.m (subfunc1) at line 62
> In /app/spm/spm2/spm_vol.m (subfunc2) at line 51
> In /app/spm/spm2/spm_vol.m at line 37
> In /xxx/xxx/my_matlab_scripts/spm_flip.m at line 1
> ??? Undefined function or variable 'spm_create_image'.
>
> Error in ==> /data/jb434/my_matlab_scripts/spm_flip.m
> On line 8 ==> VO = spm_create_image(VO);
>
>
> This is probably a very simple problem but I can't work why it won't create
> the flipped image.
>
> The script is below.
>
> Thanks in advance. Jac
>
>
> V=spm_vol(spm_get(Inf,'*.img'));
> for i=1:length(V),
> VI = V(i);
> VO = VI;
> [pth,nm,xt,vr] = fileparts(deblank(VO.fname));
> VO.fname = fullfile(pth,['f' nm xt vr]);
> VO.descrip = [VO.descrip ' - flipped'];
> VO = spm_create_image(VO);
> for j=1:VI.dim(3),
> M = spm_matrix([0 0 j]);
> img = spm_slice_vol(VI,M,VI.dim(1:2),0);
> img = flipud(img);
> VO = spm_write_plane(VO,img,j);
> end;
> end;
>
>
--
Volkmar Glauche
-
Department of Neurology [log in to unmask]
Universitaetsklinikum Freiburg Phone 49(0)761-270-5331
Breisacher Str. 64 Fax 49(0)761-270-5416
79106 Freiburg http://fbi.uniklinik-freiburg.de/
|