I'm guessing that this is from the glitch in write_hdr_raw.m, which we had to
work around because of some MATLAB behaviour that appeared to be a bit
unpredictable. Guillaume found and fixed the problem for Updates_1111 (and
I managed to temporarily break a version of SPM by trying to fix it). Can
anyone spot the bug in the first version (below)?
-ok = true;
-fp = fopen(hname,'r+',mach);
-if fp==-1
- fp = fopen(hname,'w+',mach);
- if fp==-1
- ok = false;
- return;
- end;
-end;
+ok = true;
+if exist(hname,'file'),
+ fp = fopen(hname,'r+',mach);
+else
+ fp = fopen(hname,'w+',mach);
+end
+if fp == -1,
+ ok = false;
+ return;
+end
All the best,
-John
On Friday 15 February 2008 09:41, Thomas Nichols wrote:
> John & Unal,
>
> Just for the record, I get this error too
> Error running job:
> Error using ==> @nifti/private/read_hdr
> Error reading header file "RPV.hdr"
> with a 1st level fMRI job. I've ruled out file permissions problems, and
> what's really strange is that (1) the job seems to complete normally with
> no errors otherwise, and (2) when I repeat the run with 'debug error' on,
> the error isn't caught.
>
> However, I get this with a fairly elderly version of SPM5, highest version
> id 570, dating from 2006-07-05 (that's my favorite SPM5 vintage, I must
> say, before all the changes last summer :) which could be the source of the
> problem.
>
> -Tom
>
>
> On Wed, Jan 16, 2008 at 1:16 PM, John Ashburner <[log in to unmask]>
>
> wrote:
> > I could only replicate this problem by removing write-permission from the
> > file. If this is not the cause, then it could be useful to know which
> > release of SPM5 you are using, which MATLAB version and what sort of
> > computer
> > you are running it on.
> > Best regards,
> > -John
> >
> > > I am running a routine that uses spm function spm_read_vols and on one
> >
> > data
> >
> > > folder (namely, E04), it runs fine, but on another (namely E06) I get
> >
> > the
> >
> > > following error message. Both folders contain similarly processed data
> > > (that is, realigned and resliced nifti volume files).
> > >
> > > --------Error message: -----
> > > Found 104 ruvol*.* images in the folder ...\NiftiFiles\func-MoCoed\E06
> > >
> > > ??? Error using ==> @nifti\private\read_hdr
> > > Error reading header file "ruvol_001.nii"
> > >
> > > Error in ==> nifti.nifti at 27
> > > vol = read_hdr(fname);
> > >
> > > Error in ==> spm_vol_nifti at 16
> > > N = nifti(fname);
> > >
> > > Error in ==> spm_vol>subfunc at 121
> > > if isempty(n), V = spm_vol_nifti(p);
> > >
> > > Error in ==> spm_vol>subfunc1 at 83
> > > v = subfunc(P(i,:));
> > >
> > > Error in ==> spm_vol>subfunc2 at 71
> > > V = subfunc1(P);
> > >
> > > Error in ==> spm_vol at 57
> > > V = subfunc2(P);
> > >
> > > Error in ==> US_BOLD_Nifti at 91
> > > [CubeRaw_unrotated,XYZ]=spm_read_vols(spm_vol(ruvol_files));
> > > ----error message end ----
> > >
> > > Seems like the function read_hdr has some problem with the volume's
> > > header, but I don't see a reason why.
> > > I am just puzzled, I would appreciate any help. I am also attaching
> > > ruvol_001.nii.
> > > Thanks,
|