Dear Sam,
Thanks for the feedback. While I still don't understand how it could
work on one computer and not on another if both were using the latest
version of SPM12, the fact that everything works fine with r7219 sent me
in the right direction and I found where the issue was coming from (that
was my fault): there was a typo in the name of a macro for the
compilation on Windows, effectively disabling large file support. I will
send you a link to a new version of SPM12 where the MEX files have been
recompiled. Anyone else coming across the same issue is welcome to email
me until I release the new files somewhere.
Best regards,
Guillaume.
On 04/04/2019 14:08, Sam Gijsen wrote:
> Dear Guillaume,
>
> I'm happy to say that the model estimation runs without problems on
> SPMv7219! Additionally, CheckReg works as well on this version. Does
> this perhaps give you any clue as to what has changed between these two
> versions that causes the issue? For now, I'll stick to 7219 for this
> work and do everything else with the newest version.
>
> I indeed have not played around with any of the MEX files. Please find
> below the output from your proposed lines.
>
> Many thanks and best wishes,
> Sam
>
>
> (In 2018b, 'ls' seems to only take one input argument and returns the
> filename (condition_1.nii))
>
> struct with fields:
>
> sizeof_hdr: 348
> data_type: ' '
> db_name: ' '
> extents: 0
> session_error: 0
> regular: 'r'
> dim_info: 0
> dim: [4 32 32 308 3901 1 1 1]
> intent_p1: 0
> intent_p2: 0
> intent_p3: 0
> intent_code: 0
> datatype: 16
> bitpix: 32
> slice_start: 0
> pixdim: [0 1 1 1 0 0 0 0]
> vox_offset: 352
> scl_slope: 1
> scl_inter: 0
> slice_end: 0
> slice_code: 0
> xyzt_units: 10
> cal_max: 0
> cal_min: 0
> slice_duration: 0
> toffset: 0
> glmax: 0
> glmin: 0
> descrip: 'NIFTI-1
> Image '
> aux_file: ' '
> qform_code: 0
> sform_code: 2
> quatern_b: 0
> quatern_c: 0
> quatern_d: 0
> qoffset_x: 0
> qoffset_y: 0
> qoffset_z: 0
> srow_x: [4.2500 0 0 -63.7500]
> srow_y: [0 5.3750 0 -94.6250]
> srow_z: [0 0 1.9531 0]
> intent_name: ' '
> magic: 'n+1 '
>
>
> ans =
>
> fname: 'condition_1.nii'
> dim: [32 32 308 3901]
> dtype: 'FLOAT32-LE'
> offset: 352
> scl_slope: 1
> scl_inter: 0
>
> Op wo 3 apr. 2019 om 19:01 schreef Flandin, Guillaume
> <[log in to unmask] <mailto:[log in to unmask]>>:
>
> Dear Sam,
>
> I don't manage to make sense of this - especially the fact that it works
> differently on two separate Windows 64 bit machines.
>
> Could you run the following on one of your large files and let me know
> what is returned?
>
> file = 'large_file.nii';
> ls(file,'-l')
> N = nifti(file);
> N.hdr
> N.dat
>
> Could you also try again CheckReg and model estimation (classical) with
> the previous version of SPM12?
> https://github.com/spm/spm12/archive/r7219.zip
> I assume that the MEX files are those provided with the SPM12 archive
> and that you didn't compile them by yourself?
>
> Best regards,
> Guillaume.
>
>
> On 03/04/2019 14:37, Sam Gijsen wrote:
> > Dear Guillaume,
> >
> > Thanks so much for your response and initial ideas on what to test.
> >
> > To briefly clarify on the size of the images; we want to do
> single-trial
> > analysis on our EEG data, which has many short trials (4000 trials
> each
> > 750ms). When we downsample our data from 2KHz to 512Hz and use SPM to
> > image-convert and interpolate the data to 32x32(x308 timebins) we
> end up
> > with these large NIFTI files. I expect the mismatch in
> spm_spm_vb.m is a
> > result of a small edit in this script to make it work with the
> > spatiotemporal EEG data as we want to produce log-evidence maps
> for RFX
> > Bayesian model selection. (This pipeline runs succesfully on my
> > colleagues' machines.) However, the current issue extents beyond the
> > Bayesian analysis as described below.
> >
> > To hopefully make things as straightforward as possible, I ran some
> > tests using a newly downloaded SPM12 that's installed outside the
> MATLAB
> > folders (thanks for the tip!).
> >
> > Using the fresh SPM12, I first attempt to display various images in a
> > single-subject NIFTI file, which in total contains 3901 images (4000
> > trials - 99 bad trials). Using 'Check Reg', I selected images 1, 100,
> > 250, 500, 1000, 2000, 3000. As per the attached image, only the first
> > couple of hundred images are able to be displayed; as already the
> 500th
> > image is not displayed and instead returns the previously listed "File
> > too small." error.
> >
> > Then, using the SPM12 EEG GUI I attempt to do model specification for
> > the 3901 images (and a constant regressor). This does not produce any
> > succesful output or error messages, instead, the machine slows
> down and
> > eventually freezes over the course of a minute. I have attached an
> image
> > that shows memory being slowly filled and reaching saturation.
> There are
> > no problems when I run this for the first 2000 images only (but it
> does
> > freeze the machine when using 3000 images).
> >
> > Interestingly, performing the model specification from script is
> > succesful for all 3901 images.
> > matlabbatch{1}.spm.stats.factorial_design.des.mreg.mcov.c
> = cov';
> >
> matlabbatch{1}.spm.stats.factorial_design.des.mreg.mcov.cname =
> > model;
> >
> matlabbatch{1}.spm.stats.factorial_design.des.mreg.mcov.iCC = 1;
> > matlabbatch{1}.spm.stats.factorial_design.des.mreg.incint = 1;
> > matlabbatch{1}.spm.stats.factorial_design.cov =
> struct('c', {},
> > 'cname', {}, 'iCFI', {}, 'iCC', {});
> > matlabbatch{1}.spm.stats.factorial_design.multi_cov =
> > struct('files', {}, 'iCFI', {}, 'iCC', {});
> > matlabbatch{1}.spm.stats.factorial_design.masking.tm
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffactorial_design.masking.tm&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7C23d9b1e5654d41261e2208d6b8fe89b2%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636899800705523044&sdata=Bj8VWX3bOzDl95fljp%2FpZ1Uuaa7RjbyKb3gCO1LrCbI%3D&reserved=0>.tm_none
> = 1;
> > matlabbatch{1}.spm.stats.factorial_design.masking.im
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fspm.stats.factorial_design.masking.im&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7C23d9b1e5654d41261e2208d6b8fe89b2%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636899800705523044&sdata=1JbVC84OhCZuoFQpjTUCVdeZbK4L9ziaPAOuAZnS4ok%3D&reserved=0>
> >
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fspm.stats.factorial_design.masking.im&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7Cad0d4a1a14784a27129808d6b8396c27%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636898954108090328&sdata=yOPZq%2Bapkx1kd4nCpwsxUpFASkb1HX5QAVaG%2FLr43ko%3D&reserved=0
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fspm.stats.factorial_design.masking.im&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7C23d9b1e5654d41261e2208d6b8fe89b2%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636899800705533049&sdata=A0aXt20804xwf9vsx8iE22CxaM24hkPBn1av7OEeciE%3D&reserved=0>>
> > = 1;
> > matlabbatch{1}.spm.stats.factorial_design.masking.em = {''};
> > matlabbatch{1}.spm.stats.factorial_design.globalc.g_omit = 1;
> >
> matlabbatch{1}.spm.stats.factorial_design.globalm.gmsca.gmsca_no
> > = 1;
> > matlabbatch{1}.spm.stats.factorial_design.globalm.glonorm = 1;
> >
> > spm_jobman('run', matlabbatch);
> >>
> >
> > When I attempt to do Classical estimation, whether via GUI or script,
> > the following error is thrown:
> > Chunk 1/19 :
> > ...processing03-Apr-2019 12:49:39 - Failed 'Model estimation'
> > Error using file2mat
> > File is smaller than the dimensions say it should be.
> > In file "D:\Toolbox\spm12\@file_array\subsref.m" (v7439), function
> > "multifile2mat" at line 179.
> > In file "D:\Toolbox\spm12\@file_array\subsref.m" (v7439), function
> > "subfun" at line 99.
> > In file "D:\Toolbox\spm12\@file_array\subsref.m" (v7439), function
> > "subsref" at line 65.
> > In file "D:\Toolbox\spm12\@nifti\subsref.m" (v7147), function "rec" at
> > line 221.
> > In file "D:\Toolbox\spm12\@nifti\subsref.m" (v7147), function
> "subsref"
> > at line 45.
> > In file "D:\Toolbox\spm12\spm_data_read.m" (v6486), function
> > "spm_data_read" at line 62.
> > In file "D:\Toolbox\spm12\spm_spm.m" (v7120), function "spm_spm"
> at line
> > 589.
> > In file "D:\Toolbox\spm12\config\spm_run_fmri_est.m" (v7354), function
> > "spm_run_fmri_est" at line 36.
> >
> > The following modules did not run:
> > Failed: Model estimation
> >>
> >
> > Again, this does run succesfully when I tried to it with a smaller
> > number of images (1000 seemed fine). I then proceeded to copy the used
> > NIFTI file and repeat the above steps on two of my colleagues' PC's,
> > where the model specification and estimation ran without problems
> (only
> > tested in GUI) for all 3901 images on, as far as I can tell, highly
> > similar machines (incl. 16GB RAM).
> >
> > Once more, many thanks for your help and please let me know if I can
> > provide any other information.
> >
> > Best wishes,
> > Sam
> >
> > Op di 2 apr. 2019 om 18:05 schreef Flandin, Guillaume
> > <[log in to unmask] <mailto:[log in to unmask]>
> <mailto:[log in to unmask] <mailto:[log in to unmask]>>>:
> >
> > Dear Sam,
> >
> > I was hoping never to see this error message again...
> >
> > First, I wonder whether you should end up with data of this
> size. If
> > they correspond to scalp-time images, what's the time step and
> would it
> > make sense to downsample before interpolating?
> >
> > I also notice that you are running a Bayesian GLM estimation
> > (spm_spm_vb): is this really what you want to do? It is usually an
> > option in the context of an fMRI model.
> >
> > Now, I would be curious to know what happens if you do a Classical
> > estimation: the library used to read the data from disk will be a
> > different one so it will be a useful diagnostic.
> >
> > Also, you say that it works fine on another computer: is this
> with the
> > same (copied over) NIfTI files? This would help to know
> whether the
> > issue is with reading or writing files, or both.
> >
> > Make also sure to use the latest version of SPM12: this seems
> to be the
> > case according to the version numbers in the error message but
> there is
> > a mismatch with the line number:
> > https://github.com/spm/spm12/blob/r7487/spm_spm_vb.m#L640
> > In particular, be careful if SPM is installed in the `toolbox`
> directory
> > of the MATLAB installation as there is a caching mechanism:
> >
> >
> https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Windows#Preamble
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikibooks.org%2Fwiki%2FSPM%2FInstallation_on_64bit_Windows%23Preamble&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7C23d9b1e5654d41261e2208d6b8fe89b2%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636899800705543058&sdata=LpKMc6397UQObLzZpl96shasiAfcjRPy%2FnLPy8%2BWvJo%3D&reserved=0>
> >
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikibooks.org%2Fwiki%2FSPM%2FInstallation_on_64bit_Windows%23Preamble&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7Cad0d4a1a14784a27129808d6b8396c27%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636898954108090328&sdata=toPWAUMryFEI2YUnJcT%2FTXdJUfr0Tp73W2akuFqMOfQ%3D&reserved=0
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikibooks.org%2Fwiki%2FSPM%2FInstallation_on_64bit_Windows%23Preamble&data=02%7C01%7Cg.flandin%40ucl.ac.uk%7C23d9b1e5654d41261e2208d6b8fe89b2%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C636899800705543058&sdata=LpKMc6397UQObLzZpl96shasiAfcjRPy%2FnLPy8%2BWvJo%3D&reserved=0>>
> >
> > Best regards
> > Guillaume.
> >
> > On 02/04/2019 11:55, Sam Gijsen wrote:
> > > Dear all,
> > >
> > > I am currently running into issues using NIFTI files
> (ranging from 1gb
> > > to 5gb in size) which are obtained by interpolating EEG data.
> > Whenever I
> > > perform steps such as model estimation, it returns "File too
> small."
> > > errors. I am attempting this on a 64bit Windows 10 machine
> running
> > 64bit
> > > Matlab 2018b with SPM12. However, these files can be used by SPM
> > without
> > > problems on two other, very similar machines (all having
> 16GB RAM).
> > >
> > > This "File too small." error is thrown also when displaying
> images
> > using
> > > the larger files, while for the smaller files it only
> happens for
> > things
> > > like model estimation. Please find below examples of the error
> > messages
> > > returned in Matlab. Any help in enabling SPM to use these files
> > would be
> > > greatly appreciated.
> > >
> > > Many thanks and best wishes,
> > > Sam
> > >
> > >
> > > *Model estimation:*
> > > Calculating mask: 1/308 Could not access file
> > > Error using spm_sample vol
> > > File too small
> > > In file "C:\MATLAB\R2018b\toolbox\spm12\spm_get_data.m" (v7385),
> > > function "spm_get_data" at line 46.
> > > In file "C:\MATLAB\R2018b\toolbox\spm12\spm_spm_vb.m" (v5655),
> > function
> > > "spm_spm_vb" at line 640.
> > > In file
> "C:\MATLAB\R2018b\toolbox\spm12\config\spm_run_fmri_est.m"
> > > (v7354), function "spm_run_fmri_est" at line 296.
> > >
> > > *Display*, e.g.:*:*
> > > filepath\condition_1.nii,901
> > > Cannot access file "filepath\condition_1.nii".
> > > Error using spm_slice_vol
> > > File too small.
> > > Cannot access file filepath\condition_1.nii".
> > > Error using spm_slice_vol
> > > File too small.
> >
> > --
> > Guillaume Flandin, PhD
> > Wellcome Centre for Human Neuroimaging
> > UCL Queen Square Institute of Neurology
> > London WC1N 3BG
> >
>
> --
> Guillaume Flandin, PhD
> Wellcome Centre for Human Neuroimaging
> UCL Queen Square Institute of Neurology
> London WC1N 3BG
>
--
Guillaume Flandin, PhD
Wellcome Centre for Human Neuroimaging
UCL Queen Square Institute of Neurology
London WC1N 3BG
|