JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for SPM Archives


SPM Archives

SPM Archives


SPM@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

SPM Home

SPM Home

SPM  April 2019

SPM April 2019

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: 'File too small' error when loading NIFTI files

From:

"Flandin, Guillaume" <[log in to unmask]>

Reply-To:

Flandin, Guillaume

Date:

Tue, 9 Apr 2019 16:16:23 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1 lines)

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

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager