By members and collaborators of the Functional Imaging Laboratory
SPM'96:ftp://ftp.fil.ion.ucl.ac.uk/spm/spm96.tar.gz (4.59Mb)
Updates for SPM'96:ftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_updates
Basicrandom effects kit for SPM'96:ftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_RFX.tar.gz
Event relatedfMRI kit for SPM'96:ftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_ER.tar.gz
SPM96 is very old now. Consider usingSPM12.
The content of this page is not updated.
SPM96 is available via anonymous ftp atftp://ftp.fil.ion.ucl.ac.uk/spm/spm96.tar.gz (4.59Mb). For comprehensive download and installation instructions, review thedistribution page. The SCCS directory is available to developers on request to the authors.
An update file, updating SPM96b (thepublic beta release of SPM96) to SPM96, is available atftp://ftp.fil.ion.ucl.ac.uk/spm/spm96b_update.tar.gz (84Kb). This contains only files updated for SPM'96 since the beta release.
There may still be bugs, especially in the more esoteric parts of SPM that are infrequently visited. Please report bugs to <spm@fil.ion.ucl.ac.uk>. Peculiarities and general queries should be raised on the SPMdiscussion list. We will discuss problems on the list, with a summary appearing in theSPM96: Bugs & Fixes section of this page. Updated routines are available atftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_updates.
Note: SPM'96 was developed for Matlab4.2c on UNIX. SPM'96 will not work with Matlab5. We do not plan to release "patches" for SPM'96 to enable it to run under Matlab5.SPM'99 is a re-write of SPM for Matlab5
Initially, we didn't have time for a full two month period of internal beta testing and feature stabilisation. However, we felt that the software was stable enough to release, and that a public beta would iron out any remaining difficulties much more efficiently than internal testing, and provide an introduction to SPM96 without further delay.
Relatively few bugs were found during public beta testing: The majority are updates and bug-fixes as discussed on the SPMemail discussion list, and summarised in theSPM96b: Bugs & Fixes section of this page. The remaining modifications are largely cosmetic. TheContents.m
file in the SPM'96 distribution (& the update archive) details the affected files.
SPM96 is backward compatible, in that each module will read files from previous versions. (E.g. SPM96 statistics will read normalised images from SPM95) However, it is recommended that you don't mix versions of the same module in a single analysis. (E.g. Don't mix SPM96 and SPM95 spatial normalisations in the same study group - the templates are different!) You should identify which versions of SPM were used for which stages of analysis in any publications.
A version choosing routine, spm_choose, is provided in the distribution. This presents a graphical menu of versions, which set the MatLab path and start the appropriate spm. Type `spm_choose` to use this facility. (System administrators need to edit the version and path definitions in spm_choose.m for this to work.)
This section describes features of SPM'96, and is derived fromspm.man
v1.15
In addition, there are several minor extensions and additions that are not detailed here.
On invoking SPM96 you are asked to select one of two user-interfaces. The first is for SPECT, PET andfMRI data that can be considered a series of independent scans. The second is for fastfMRI that generates temporally correlated time-series. The interfaces are very similar and largely call upon the same routines. The differences between these two components of SPM96 are:
A new concept has been introduced into the alignment and coregistration parts of SPM. This is the storage of the alignment parameters in '.mat' files for use at a later time. It is no longer necessary to write out the realigned images before continuing on to the spatial normalisation stage. Since the realignment parameters are saved, they get incorporated straight into the affine part of the spatial normalisation*.
This is now optional*. The adjustment has also been modified so that it is more constrained.
*Note that to perform the adjustment, the resliced images must be written in the realignment stage.
The old "mri to pet" button has been replaced by a more general"coregister" button. To replicate what "mri to pet" did, specify:
Note that the MR images should NOT be 'scalp-edited' for coregistration.
The template images which are now provided in SPM are now based upon data provided by the MNI (ICBM, NIH P-20 project). These templates are slightly larger than those from previous versions of SPM, and so the default bounding box has been increased accordingly. No 'scalp-editing' is needed on any images which are to be spatially normalised - since the templates have scalp on them.
The two-dimensional nonlinear spatial normalisation has been extended into three dimensions. The (fourier-like) basis functions which are used are in fact 3D discrete cosine transform basis functions. The extension into the third dimension should eliminate the 'swirly' effects which many people reported at the tops of normalised brains.
Rather than being prompted during the 'statistics' module of SPM for the orientation of the images, the spatially normalised images should be in neurological convention (with the right side of the brain being at the right side of the image). The default orientation of the un- normalised images is specified by the global variable "sptl_Ornt" in spm_defaults.m.
The parameters which specify the spatial normalisation are saved to a '_sn3d.mat' file. They can be subsequently applied at any time to any images which have been coregistered to the image from which the parameters were determined.
Clearly statistics do not change...
The core routine (spm_spm) has now been consolidated to deal with both PET andfMRI data. The case of independent observations (PET) is now treated as a limiting [uncorrelated] case of 'serially correlated regression' as used forfMRI. spm_spm now samples little cubes of data (as opposed to planes). This allows very large data sets to be analysed (over 2000 64x64x64 voxel images) without two much paging or related memory problems.
The specification of thresholds for the maximum intensity projections is now more exhaustive and comprehensive. The height threshold is specified as before in terms of an uncorrected p value or Z score. If you only want to see clusters that survive a corrected p value (based on spatial extent) than the corrected p value you enter will specify the extent threshold employed. If however you choose to see all clusters you can specify an extent threshold in terms of an uncorrected p value (i.e. the probability of getting a cluster that size or larger, assuming it exists) or voxels. If you want to see all voxels simply enter 0 (i.e. SPM95 style). In this instance the 'set-level' inference can be considered an 'omnibus test' based on the number of clusters that obtain (see statistical inference below).
A suite of routines implementing non-parametric randomisation/permutation based tests for analysing PET/SPECT functional mapping experiments are now available. This approach combines the general linear model for computation of statistic with the non-parametric tests described by Holmes et al.
The software has been developed by Andrew Holmes and Tom Nichols (of Carnegie Mellon University). The approach is modular: Plug-in code modules are required for each type of design, defining the design matrix and possible permutations of appropriate labels on the data.
It is envisaged that the non-parametric approach (incorporating variance smoothing and 'pseudo' t-statistic images) will be most powerful for experiments yielding t-statistic images with low degrees of freedom, such as single subject experiments.
This SnPM suite is somewhat distinct from mainstream SPM, and is available as an add-on "toolbox". Seehttp://www.fil.ion.ucl.ac.uk/spm/snpm for further details.
The input routine which handles user questioning in the 'Interactive' SPM window has been improved: Default responses are available for button and menu type questions (if appropriate), and keyboard accelerators have been added. The text response for string and evaluated input may now be edited without having to click in the response widget (dedicated to Dan Pavel). View the help on spm_input.m for details.
The file selector dialog (spm_get.m) now gives "summary views" for directories with a large number of files (after filtering). The summary view shows blocks of files with similar filenames (e.g. s0095_*.img). These multi-file items can be selected, deleted, and expanded to permit selection of individual files. This dramatically speeds up file selection for large numbers of similarly named files, such as infMRI analysis.
SPM can now be switched between PET &fMRI "modes" using a pull-down menu on the SPM Menu window. This changes some of the Menu buttons, sets the MODALITY global variable, and sets the default values for the modality.
The initial splash screen can be bypassed with `spm pet` and `spm fmri` as appropriate.
The toolbar in the Graphics window has been improved.
An SPM version chooser function, spm_choose, is included to allow users to choose which SPM version to use without recourse to manually editing their MATLABPATH.
On startup, SPM'96 displays the "message of the day" filespm_motd.man
in the Graphics window, providing SPM administrators with a reliable communications channel.
The Help facility has been improved. A new help window is used for help display and interaction. A pull-down menu of previous topics is maintained in addition to a pulldown menu of topics referenced by the current topic, enhancing the recursive help facility. Long topics are paged, with page controls appearing in the bottom right when required. These multi-page help files now print properly.
Context sensitive help has been added in a number of locations.
The special "message of the day" help file (spm_motd.man) is displayed (if it exists in the SPM directory) in the Graphics window at startup.
Many of the Help pages have changed slightly so please take time to review them.
We now use SCCS source code control for SPM development. At it's most basic, this enables you to see the improvements/alterations between releases, and to compare any customised versions you may have with the SCCS history. SCCS was introduced after the release of SPM95, so most of SPM95's routines can be regarded as v1.1, although some were edited slightly between SPM95 release and the introduction of source control.
The SCCS subdirectory is *not* shipped with SPM (it's quite large), but will be made available to interested developers upon request.
The old defaults module has been changed drastically. Changes to any of these defaults should remain until the end of the SPM session. Resetting the defaults sets them back to those specified in the file spm_defaults.m.
The spm_defaults.m file is intended to be customised by whoever maintains SPM. It should be reasonably clear what the different options mean. Probably the most important default to check is "sptl_Ornt" which contains the orientation of the images before spatial normalisation.
Defaults now govern the way many routines behave, including how much control the user is given over the parameters of routines.
A wide variety or printing options are available, including EPS.
A "segment" button has been added to SPM for partitioning MR images into gray matter, white matter and CSF. These partitions may be used for voxel-based morphometrics, assisting scalp editing etc. The tissue classification module is also used by the between mode coregistration module.
The old "render" option has been replaced by a new one. This one simply renders blobs on to a 'standard' Talairach brain.
A simple image calculator has been included. For example, to add two images and divide by a third, this can be done with a simple expression like "(i1+i2)./i3".
SPM{F} now emulates SPM{Z} in providing summary data on the SPMs. P values corrected for the volume analysed are available for the SPM{F} based on peak height. P values based on spatial extent, or the number of clusters are not yet available and these fields are filled in with NaN at the present. 'Results' can now also handle SPM{F}, which allows you to display graphical and image data about selected clusters in the SPM{F}. This facility is in preparation for a more extented use of the SPM{F} particularly in relation to model selection andfMRI data analysis.
As noted above 'results' display now includes the facility to view SPM{F}s. The plotting routines have been generalised such that one can plot adjusted and fitted data against scan number, any specified covariate or specified ordinate. This should be useful for plotting responses against some parameter in parametric designs and nonlinear regressions. The table option has been removed. Adjusted and fitted data are contained in the variables y and Y following a plot of the voxel in question. These data are arranged in a matrix with data from each subject in a column. If the number of scans per subject is not constant then column vectors are returned. The variable Fnames contains the filenames of the associated data.
Dragging of the pointers in the MIP is now dynamic, and is faster. Coordinate information appears on printouts. Tables of maxima are "dynamic" - pressing the coordinates leads to the location being highlighted.
Tables of results may now occupy more than one page, allowing a full characterisation of all local maxima within a region. The first page of the table is displayed, and paging controls provided to move to subsequent pages. Printing a multi-page figure prints each page individually.
Filtered SPM{Z} can be written out to Analyze files (spm_projections_ui)
This has always been a difficult area for people analysing data. We have chosen the simplest option - namely orientate your images to the required convention at the point of spatial normalisation. Following this SPM will simply analyse what it is given. SPM does not know what is left or what is right but generally the neurological convention that right is right (i,e, looking at slices from the top) is preferred and is adopted by SPM.
See also note (i.c) above: Rather than being prompted during the 'statistics' module of SPM for the orientation of the images, the spatially normalised images should be in neurological convention (with the right side of the brain being at the right side of the image). The default orientation of the un- normalised images is specified by the global variable "sptl_Ornt" in spm_defaults.m.
The P values associated with the thresholds SPMs now include:
and corrected P values based on
It is important to distinguish between corrected and uncorrected P values (the former are only used if you did not have an apriori hypothesis) and the level of inference: voxel (1 and 3), cluster (2 and 4) and set [of clusters] (5). Two thresholds are now requested to define the excursion set (a height threshold and a spatial extent threshold). The default extent threshold is the expected number of voxels per cluster for both SPM{Z} and SPM{F}. Setting this threshold to 0 gives a SPM95-like profile. In this case the set level inference (5) corresponds to an omnibus test based on the observed number of clusters. The footnotes of the summary tables now include the expected number of clusters and voxels per cluster to guide your interpretation.
The p values are based on the probability of obtaining c, or more, clusters of k, or more, voxels above u, in the volume S analysed = P(u,k,c). For specified thresholds u, k, the set-level inference is based on the observed number of clusters C = P(u,k,C). For each cluster of size K the cluster-level inference is based on P(u,K,1) and for each voxel (or selected maxima) of height U, in that cluster, the voxel-level inference is based on P(U,0,1). All three levels of inference are supported with a tabular presentation of the p values and the underlying statistic (u, k or c).
Either single contrasts can be examined or conjunctions of different contrasts. In the latter case a new SPM{Z} is created, that reflects the sum of all specified effects and voxels are eliminated where there are significant differences among these effects (at p< 0.05 uncorrected). A conjunction is therefore the conjoint expression of two or more effects (each specified in terms of a contrast) to a similar degree.
Masking simply eliminates voxels from the current contrast if they do not survive an uncorrected p value (based on height) in one or more further contrasts. No account is taken of this masking in the statistical inference pertaining to the masked contrast.
The smoothness estimator is now based on the normalisation residuals and is, we hope, a much more robust estimator. In particular it is not affected by deviations from the null hypothesis or the contrasts specified.
SPM is now largely "directory independent". Results (spm.ps files, *.mat files etc.) are written in the current directory, rather than the directory in which SPM was started. A "CD" button has been added to the interface. The only exception here is the spatial routines, which write realigned and normalised images (and the respective *.mat files) in the same directory as the source images (clearly the realignment *.mat files have to go alongside the original images). However, the spm.ps file will still be written in the current directory :-)
Filtered SPM{Z} can be written out to Analyze files (spm_projections_ui). SPM*.img are no longer automatically written out during the statistical analysis.
This section describes the bugs that have been reported, along with the appropriate fixes.
Updated versions of appropriate SPM functions are available from our anonymous FTP server in the spm96_updates
spm_coregister.m
avg305T1.hdr
spm.m
)spm_spm_ui.m
)spm_input.m
spm_get.m
spm_coregister
: Rigid body registration deviates very slightly from rigid body.Synopsis:There was an almost imperceptible deviation from a rigid body transformation in the coregistration, resulting in a tiny amount of shearing being introduced into the transformation matrix.
Fix: The orders of matrix multiplications have been rearranged to eliminate the problem.
sccs diffs -r1.12 spm_coregister.m------- spm_coregister.m -------42c42< % %W% John Ashburner FIL %E%---> % @(#)spm_coregister.m1.13 John Ashburner FIL 97/06/13290c290,291< params = [sptl_Ornt(1:6) sptl_Ornt(1:6) sptl_Ornt(7:12) 1 1]';---> tmp = spm_imatrix(inv(spm_matrix(sptl_Ornt(1:12))));> params = [tmp(1:6) tmp(1:6) tmp(7:12) 1 1]';295,297c296,298< params = spm_affsub3('register1', PPG, PPF, 1, 12, params);< params = spm_affsub3('register1', PPG, PPF, 1, 8 , params);< params = spm_affsub3('register1', PPG, PPF, 1, 4 , params);---> params = spm_affsub3('register1', PPF, PPG, 1, 12, params);> params = spm_affsub3('register1', PPF, PPG, 1, 8 , params);> params = spm_affsub3('register1', PPF, PPG, 1, 4 , params);302c303< MM = spm_matrix(params([1:6 13:18]))\spm_matrix(params([7:12 13:18]));---> MM = spm_matrix(params([1:6 13:18]))/spm_matrix(params([7:12 13:18]));311c312< spm_segment(PGF,spm_matrix(params([1:6 13:18])),'t');---> spm_segment(PGF,inv(spm_matrix(params([1:6 13:18]))),'t');331c332< spm_segment(PFF,spm_matrix(params([7:12 13:18])),'t');---> spm_segment(PFF,inv(spm_matrix(params([7:12 13:18]))),'t');
Download:spm_coregister.m
v1.13, to replace v1.12 as shipped with SPM96
-john (Friday) 13/06/97
avg305T1.hdr
ORIGIN is in the wrong place in the image.Synopsis:The Z coordinate of the ORIGIN was out by two voxels in avg305T1.hdr. This will have affected spatial normalizations only if avg305T1.img was specified as the template image, but it does result in a 4mm discrepency in Z if you used this image for superimposing your results on to.
Fix: The correct ORIGIN of [46 65 35] has been put into the header.
Thanks: to Dr Paulesu for pointing this out.
Download:avg305T1.hdr
to replace version shipped with SPM96, or alternatively modify the existing header from the `Display' module of SPM.
-john (page modified) 19/08/97
spm.m
: SPM96 not quite directory independentSynopsis:Changing directory doesn't quite work:
Some files are still written to the original working directory.
Description: Historically SPM used a global variableCWD
to trach the current working directory, and this hasn't been eliminated from all components of SPM96.
Fix: Set the global variable CWD to the current working directory after changing directory:cddir, global CWD, CWD=pwd;
The SPM Menu window has a "CD" button, handled byspm.m
, which can be fixed by changingspm.m
at line 442 as follows:
fil % sccs diffs -r1.26 spm.m442c442,444< 'cd(spm_get(-1,[],''Select new working directory'')),',...---> 'global CWD, ',...> 'CWD = spm_get(-1,[],''Select new working directory''); ',...> 'cd(CWD), clear CWD, ',...
Thanks: to all those who pointed this out!
Download:spm.m
to replace version as shipped with SPM96
-andrew 26/01/1998
spm_spm_ui.m
PET stats uses 6 confounds when I ask for moreSynopsis:Choosing "greater than 5" for the number of confounding covariates in a PET/SPECT statistics run actually gives you six!
Description: Typo...
Fix: Change line 353 ofspm_spm_ui.m
as follows:
fil % sccs diffs -r1.15.1.2 spm_spm_ui.m353c353< if (c == 6), g = spm_input('# of confounding covariates',J); end---> if (g == 6), g = spm_input('# of confounding covariates',J); end
Thanks: to Christophe Phillips for pointing this out.
Download:spm_spm_ui.m
to replace version as shipped with SPM96
-andrew 19/01/1998
spm_input.m
GUI input goes off bottom of interactive window!Synopsis:GUI input can go off the bottom of the SPM "Interactive" window, which isn't resizable.
Description: SPM appears to hang whilst doing nothing, but in fact it's actually waiting for an answer to a question you can't see! This doesn't usually happen in vanilla SPM96, but with an event-related fMRI analysis using theevent-related kit for SPM96 (SPM97) there can be lots of questions for different event types and the problem is quite common.
Fix: Either use the command line (use the defaults button to set global CMDLINE to 1, or download and install a fixedspm_input.m
(there are too many changes to list here)
Thanks: to Tom Ellmore & Vinod Goel for pointing this out.
Download:spm_input.m
to replace version as shipped with SPM96
-andrew 20/11/1998
spm_get.m
Synopsis:Ordering of files within groups in file selection window when using summary views may not be as expected.
Description: The SPM file selection window (titled SPMget) uses summary views for directories with large numbers of files. In a summary view, files with similar names are grouped, labelled by a wildcarded filename (such as image*.img), and can be selected as a group be selecting the label.
There are certain circumstances when the ordering of the files within a group is not the same as the order displayed outwith summary views (a group summary can be expanded by clicking the white figure to the left of the group label). Outwith summary view, files are listed in a smart alphabetical order. In this smart ordering, fileimage2.img
would appear before fileimage10.img
, even though alphabetically they should be the other way round. With a file filter of*.img
, a sumary view with labelimage*.img
would enforce alphabetical order, puttingimage10.img
beforeimage2.img
. In certain circumstances when using no file filter string, i.e. a file filter of*
, the members of a group in a summary view can be in a completely bizzare order (sorted on the last letters)!
Further, in certain circumstances, when using a filter of*
in a summary view with lots of very similar named files,spm_get.m
can crash with an "Index exceeds matrix dimensions" error.
Fix: Either:
*.img
) when using summary view file selection.spm_get.m
to respect the original order of the file listing when summarising:fil % sccs diffs -r1.13 spm_get.m167c167< % Specifys which end to take as common for file summary---> % Specifies which end to take as common for file summary171a172,175> % FSpecs - String matrix of file patterns, with n rows> % FnamePos - Matrix of n rows.> % Each row contains the indicies of all Fnames matching the pattern> % given in the corresponding row of FSpecs. Padded with zeros.859c863< fS = ones(nS,Sl);---> fS = setstr(zeros(nS,Sl));880,883c884,887< if size(Fnames,1) == 1< %-Only one filename!< R1 = deblank(Fnames);< R2 = 1;---> if size(Fnames,1)==1 | size(Fnames,2)%-Only one filename | text shorter than required common length> R1 = Fnames;> R2 = [1:size(Fnames,1)]';908c912,913< tI = I(cI);---> %-Note indices of Fnames in this group, retain original ordering> tI = sort(I(cI));914a920,924> %-Order groups by original ordering of first member occurence> [null,tmp] = sort(FnamePos(:,1));> FSpecs = FSpecs(tmp,:);> FnamePos = FnamePos(tmp,:);954,955c964< %-Sort in next line keeps ordering by headers< cI = chI(sort(tI(j,tI(j,:)>0)));---> cI = chI(tI(j,tI(j,:)>0));
Thanks: to Andreas Bork, for noting the "Index exceeds matrix dimensions" problem.
Download:spm_get.m
to replace version as shipped with SPM96
-andrew 18/01/1999
SPM96b is a public beta release. This section describes the bugs that have been reported, along with the appropriate fixes.
Updated versions of appropriate SPM functions are available from our anonymous FTP server in the spm96b_updates
spm_get_space.m
spm_figure.m
spm_write_sn.m
spm_spm_ui.m
spm_sptop.m
spm_get.m
spm_projections.m
spm_realign.m
spm_coregister.m
spm_spm_ui.m
spm.m
spm_projections_ui.m
spm_get_space
: Occasionally crashes out.Synopsis:Occasionally crashes out.
Fix: The fixed version (v1.7) differs from v1.6 at line 52 as follows:
fil % sccs diffs -r1.6 spm_get_space.m52c52< vx = abs([M(1,1) M(2,2) M(3,3)]); --- > vx = sqrt(sum(M(1:3,1:3).^2));
Download:spm_get_space.m
v1.7, to replace v1.6 as shipped with SPM96b
-john 30/09/96
spm_figure.m
: SPM crashes at startupSynopsis:SPM96b crashes at startup, reporting "MATLAB bus errors" or "MATLAB segmentation violations" at line 256 ofspm_figure.m
Description: SPM96 usues the 'Tag' attribute of the figures to locate them, rather than hardcoding the figure number into the programs. Line 256 ofspm_figure.m
checks that figure F exists:
if ~any(F==findobj(get(0,'Children'))), F=[]; end
Fix: Upgrade to MatLab v4.2c, the current version of MatLab, on which SPM is developed.
Alternatively...
Fix: The findobj here is redundent, and so the line should be changed to:
if ~any(F==get(0,'Children')), F=[]; end
Thanks: to Dan Pavel and Rene deBruin for their comments.
Download:spm_figure.m
v1.14, to replace v1.13 as shipped with SPM96b.
-andrew 07/10/96
spm_write_sn
: Unmap files.Synopsis:Memory mapped images to normalise aren't unmapped. Not unmapping causes problems on HPUX 9.x.
Fix: Unmap the files!The fixed version (v1.5) differs from v1.4 at line 278 as follows:
fil % sccs diffs -r1.4 spm_write_sn.m190a191> for i=1:size(V,2), spm_unmap(V(:,i)); end;
Thanks: to Darren Gitelman for reporting this problem.
Download:spm_write_sn.m
v1.5, to replace v1.4 as shipped with SPM96b
-john 28/10/96
spm_spm_ui
: Confounding covariate by factor interactions don't work?Synopsis:Subject by covariate of no interest interaction doesn't work, study by covariate of no interest interaction actually gives subject by covariate interactions, and condition by covariate of no interest interaction actually gives study by condition interactions!
Description: In SPM95, Interactions of covariates with study and subject were permitted in various designs. In SPM96b, interaction with condition was added as an additional option, supposedly only for covariates of interest. Unfortunately, changes in the code for confounding covariates for the presence of this additional covariate weren't made.
Fix: The problem is in lines 378 & 381 ofspm_spm_ui.m
v1.15, where the indices should be incremented by one. Further, the option of interaction with condition should not be offered. The fixed version (v1.15.1.1) differs from v1.15 as follows:
fil % sccs diffs -r1.15 spm_spm_ui.m ------- spm_spm_ui.m ------- 374a375 > iCovEffInt(iCovEffInt==2)=[]; 378c379< if (i==2) %-Interaction with study --- > if (i==3) %-Interaction with study 381c382< elseif (i==3) %-Interaction with subject --- > elseif (i==4) %-Interaction with subject
Thanks: to Geriant Rees, Gereon Fink and Sergey Pakhomov for reporting this bug.
Download:spm_spm_ui.m
v1.15.1.2, to replace v1.15 as shipped with SPM96b.
-andrew 15/11/96
spm_sptop
:This section is still under construction...
Synopsis:
Description:
Fix: Set row-wise sums to unity
Thanks:
Download:spm_sptop.m
v1.2, to replace v1.1 as shipped with SPM96b.
-karl 09/11/96
spm_get
: CmdLine mode says files don't exist?Synopsis:When using SPM in command-line mode the file selection program incorrectly reports files not to exist when the filenames have trailing spaces.
Description:spm_get.m
, the file selection dialog for SPM, has a command line mode, entered using the "KEYBD" button on the file selection window, or directly if SPM is in command-line mode (global CMDLINE=1). This command line variant checks the existance of entered filenames, prepending the current working directory to relative paths. However, filenames with trailing spaces are erroneously reported not to exist.
Fix: The fix is to insertdeblank
statements at various places in the command line code. An updated version (v1.13) may be downloaded.
Thanks: to Manabu Honda for noting this bug, and to Corbett Nelson for noting this and proposing an amendment.
Download:spm_get.m
v1.13, to replace v1.12 as shipped with SPM96b.
-andrew 21/11/96
spm_projections
: Incorrect FWHM {voxels} printed.Synopsis:Summary print-outs of SPM{t} print an erroneous value for the smoothness (FWHM) in voxels.
Description: The smoothness estimate is saved internally as the sigma (in voxels) of the equivalent Gaussian point response function. (Note that this is a convenience, only the bivairate cluster size-&-height test assummes a Gaussian auto-correlation function.) In the footer of parameters,spm_projections
prints sigma in millimeters where it should print the FWHM in voxels. The two are related byFWHMvoxels = SIGMAmm * VoxDim/sqrt(8ln(2))
.
Fix: The problem is on line 351 ofspm_projections.m
v1.11. The fixed version (v1.12) differs from v1.11 as follows:
fil % sccs diffs -r1.11 spm_projections.m ------- spm_spm_ui.m ------- 351c351< str = sprintf(' {voxels} = %0.1f %0.1f %0.1f',sqrt(8*log(2))*W); --- > str = sprintf(' {voxels} = %0.1f %0.1f %0.1f',W.*V([1:D] + 3)');
Thanks: to Alistair Howesman for reporting this bug.
Download:spm_projections.m
v1.12, to replace v1.11 as shipped with SPM96b.
-andrew 30/01/97
spm_realign
: Suboptimal adjustment offMRI data.Synopsis:The adjustment for movement when writing realignedfMRI data was only subtracting anything correlated with movements in the Z direction.
Description: After some empirical research, we found that signal changes correlated with motion within plane can also confound the results. This adjustment is still an optional part of the realignment procedure, but the user also gets the choice of a first or second order adjustment, either with or without spin history correction.
Fix: The adjustment works by subtracting from the data anything which is correlated with the movement parameters. A constant term should have been included in the design matrix for determining what is correlated with movement. This was omitted in spm96b, but has been re-introduced with the patch.
Thanks: to Sylke Grootoonk, Chloe Hutton and Bob Turner for looking into the problem.
Download:spm_realign.m
v1.16, to replace v1.15 as shipped with SPM96b, and also a new routinespm_imatrix.m
v1.2
-john 05/02/97
spm_coregister
: Leaving temporary files behind.Synopsis:Within modality coregistration was leaving temporary files behind.
Fix: The temporary smoothed images are now being deleted properly.
Download:spm_coregister.m
v1.12, to replace v1.11 as shipped with SPM96b
-john 05/02/97
spm_spm_ui
: Incorrect F statistics for most PET designs.Synopsis:For all PET designs except the "covariates only" designs, the (numerator) F degrees of freedom are one too many, and hence the F-statistic is incorrect.
Background: In SPM effects are divided into confounding effects and effects of interest. An F-statistic is computed at each voxel for the null hypothesis that the parameters for the effects of interest are zero, that is that there are no effects of interest. This F-statistic image is thresholded at upper tail probability value UFp (a global default), and only suprathreshold voxels are retained for display and interrogation in the results section of SPM.
Description: For PET designs other than the "covariates only" designs, a constant term is not added to the model, and any block effects are constrained to sum to zero, such that the mean is modelled in the condition effects. Thus the confounding partition of the design matrix cannot model the mean. However, the fitting code implicitly fits the mean for all (balanced) designs, by mean correcting the data. The additional degree of freedom implicated here is not accounted for, and the (numerator) F-degrees of freedom printed are therefore one too many, and the F-statistic computed from these degrees of freedom incorrect.
E.g. SPM96b prints the F degrees of freedom as [a,b]. The true degrees of freedom are [a-1,b]. The printed F-statistic differs from the true one by a factor of (a-1)/a, multiply the erroneous SPM96b F-statistic by a/(a-1) to obtain the correct F-statistic. The threshold applied by SPM96b to the erroneous F statistic using erroneous df isUF=spm_invFcdf(1-UFp,[a,b])
, which translates to a threshold ofa*UF/(a-1)
for the correct F-statistics. Compare this with the correct threshold ofspm_invFcdf(1-UFp,[a-1,b])
.
Comment: In general it is impossible to say whether the p-values attributed to the erroneous F-statistics are conservative or liberal. This is because the true F-statistic is greater than the one printed, but the F-distribution for the correct degrees of freedom has a fatter tail than the one used, so high F-values are more likely.
For most PET designs the SPM{F} is not of interest in itself, and it is only the effect of the SPM{F} thresholding we need to consider. Thus the F error will not affect the Type I (false positive) error rate for the contrasts (SPM{t}). The possibility is that thresholding the erroneous SPM{F} at p=UFp (for the erroneous df) is exceptionally severe when compared to that for the true F and df: The probability of Type II error (false negatives) may be increased. Clearly the error is most marked when the degrees of freedom involved are small. For small numbers of effects of interest the omnibus F-statistic will be highly significant if the contrast is, such that voxels with SPM{t} reaching corrected significance at p=0.05 are likely to have very high (true) SPM{F}, and therefore pass the UFp threshold even with the erroneous F and df of SPM96b. Our experience comparing results from SPM96b with a fixed version is that this is the case, and that the regions reaching corrected significance are the same.
Fix: The fix is to always let the block partition model the constant term. For single subject designs this is acheived by including a column of ones as a dummy variable for a constant term, for multi-subject designs this is acheived by not constraining the block effects to sum to zero.
Modify the block effect code in lines 269--270 ofspm_spm_ui.m
v1.15.1.1, and delete lines 548,556. The fixed version (v1.15.1.2) differs from v1.15.1.1 as follows:
fil % sccs diffs -r1.15.1.1 spm_spm_ui.m267,276c267,273< %-Always model block (subject) effects if possible< %-----------------------------------------------------------------------< if (nSUBJ == 1) | (nSUBJ == q)%-Unestimable effects< B = []; Bnames = [];< else< %-Use implicit SumToZero constraints via relative block effects &< % MatLabs pinv. See spm_DesMtx for more information on this.< %---------------------------------------------------------------< [B,Bnames] = spm_DesMtx(iSUBJ,'+0m','SUBJ');< end---> %-Always model block (subject) effects> %-----------------------------------------------------------------------> if (nSUBJ == 1) | (nSUBJ == q)> B = ones(q,1); Bnames = 'Constant';> else> [B,Bnames] = spm_DesMtx(iSUBJ,'-','SUBJ');> end548,556d544<< %-Include a constant term in G if H isempty< %-----------------------------------------------------------------------< if ~size(H,2)< K = ones(q,1); Knames = 'Constant';< G = [G K];< if isempty(Gnames), Gnames = Knames;< else Gnames = str2mat(Gnames,Knames); end< end
Thanks: to Thomas White for reporting this bug.
Download:spm_spm_ui.m
v1.15.1.2, to replace v1.15 as shipped with SPM96b.
-andrew 06/02/97
spm
: Watermark & Progress bar.Synopsis:The "watermark" in the interactive window slows down the redrawing of the progress bar.
Description: The "SPM96" watermark in the interactive (bottom-left) SPM window needs redrawing every time the progress bar is updated. This takes a considerable amount of time, and slows SPM down considerably!
Fix: Lose the watermark, or make it temporary.The fixed version (v1.26) differs from v1.25 at line 278 as follows:
fil % sccs diffs -r1.25 spm.m278c278< spm_figure('WaterMark',Finter,spm('Ver'),'NoDelete',45), fprintf('.') --- > spm_figure('WaterMark',Finter,spm('Ver'),'',45), fprintf('.')
Thanks: to John Ashburner & Thomas White for reporting this bug.
Download:spm.m
v1.26, to replace v1.25 as shipped with SPM96b
-andrew 17/01/97
spm_projections_ui
: Occasional problems witheig
.Synopsis:eig
gives some problems (ML4.2c/Sol2.4).
Fix: Usesvd
instead.The fixed version (v1.11.1.1) differs from v1.11 at line 106 as follows:
fil % sccs diffs -r1.11 spm_projections_ui.m106c106< [e v] = eig(J); --- > [e v d] = svd(J);
Download:spm_projections_ui.m
v1.11.1.1, to replace v1.11 as shipped with SPM96b
-karl ??/03/97
SPM only models residual variance, and therefore only fits and assessesfixed effects models. In studies with repeated measurements of a condition, and where there is subject-by-contrast interaction, a fixed-effects analysis is limited to the inferring about the effects on these subjects during these scanning sessions. Inference does not extend to the populations from which the subjects were drawn. Thus, all fixed-effects analyses are basicallycase studies. This is particularly a problem for group comparisons, and (paradoxically) infMRI, where the inter-scan variability within an imaging session is very small in comparison to the variability of responses from subject to subject.
In general mixed effects models (with both random and fixed effects) are difficult to analyse. However, in functional neuroimaging the models are fairly simple, balanced, and the only random effect of concern is the subject by condition interaction: Further, the models are seperable into individual subject models. This enables a basic mixed effects analysis to be easily be carried out in two stages, corresponding to the two levels of variability in question. The first level is the intra-subject level, the second the inter-subject (intra-population) level.
The key is to avoid repeated measures: If we have only one scan per condition per subject, then the residual variance incorporates the appropriate inter and intra-subject variance components, and effects a mixed effects analysis appropriate for population inference. With repeated measures the trick then is to collapse over replications to give a single summary image representative of each condition for each subject. Such collapsing may be as simple as a straight mean of the replicate observations, or can be a sophisticated weighted mean of adjusted data effected via the General Linear Model, enabling removal of confounds.
To enable random effects analyses suitable for population inference to be carried out within SPM96, we have produced a `kit' of routines to assist in producing appropriate summary ajusted condition images.
spm_adjmean_ui.m
spm_adjmean_fmri_ui.m
spm_RandFX.man
spm_hrf.m
spm_sptop.m
spm.m
spm_adjmean_ui
orspm_adjmean_fmri_ui
according to the current SPM mode, PET offMRIspm_help.m
To install: move to the directory where you want the files to reside, download the GNU-zipped tar filespm96_RFX.tar.gz, and unpack with the UNIX commandgzip -dc ./spm96_RFX.tar.gz | tar -xvf - Then make sure that this directory preceeds the SPM96 installation on your MatLab search path (help path in MatLab for details).
Since spm_sptop.m (v1.7), spm.m (v1.26.1.2) & spm_help.m (v1.15.1.2) are backwards compatible with the versions supplied with SPM96, so the SPM96 random effects kit can be installed over an SPM96 installation.
spm_RandFX.man
file contained in the kit contains a basic overview and recipe for use.-andrew 20/02/1998
The event-relatedfMRI "kit" for SPM96 upgrades SPM96 for event relatedfMRI using basis functions of peri-stimulus time to model responses to single events within the standard SPM framework of the General Linear Model.
This "kit" upgrades SPM'96 to have the functionality of SPM'97, the (unreleased) Matlab4 version of SPM implementing event relatedfMRI, which has been cited in the literature. The combination of this kit and SPM'96 should be referred to asSPM'97.
The kit provides an updated interface for SPM96fMRI stats, incorporating event relatedfMRI, along with appropriate extended plotting routines and various utility functions. There are also improvements for block-modefMRI designs, such as additional options (time and global by condition interactions) and convolution of reference functions with a synthetic haemodynamic response.
SPM'97 offers the possibility to analyse efMRI studies. The basic concept is identical to blocked fMRI analyses, using the GLM. The difference is only the design matrix and the plotting routines. In the current implementation SPM creates a sparse matrix n x t for n events over time t. This matrix is created with a temporal resolution of 100 msec. The events are modelled as delta functions ('ones' in this matrix). This matrix containing ones modelling an event and zeros elsewhere is then convolved with the basis function(s) you specify. This is still done at 100 msec resolution. Since there is only a single observation per scan and this is likely to cover more than 100 msec, the matrix is downsampled to match the TR that has been entered. The user's choice is mainly the set of basis functions to be used:
SPM will create an additional *.mat file (ER.mat) for this analysis. Load this file and plot the variable DER to see the basis function(s) you have used.
The plotting routines have been extended to cope with efMRI analyses. You can plot the estimated HRF time locked to the events. This menu offers several options:
Events can be equally or unequally distributed over time. In the former case you only have to specify the time between two events. In the latter case SPM expects a vector of time points when events occured. SPM expects time in scans [i.e. an event at 10 seconds with a TR of 4s has to be entered as 2.5 (TRs)]. Differences between events can be estimated in two ways: Using t-statistic when comparing two events modelled by a single basis function (eg. HRF alone). Howver,this gets problematic if you model your events as a linear combination of more than one basis function (eg. Fourier set). In this case you can use the F-statistic and the option 'model differences'. If you model your events as 'HRF alone' you choose the option 'all events' and test for differences with contrasts.
The kit is available fromftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_ER.tar.gz , and contains:
spm_efmri.man
spm_AnCova.m
spm_Volt_W.m
spm_fmri_spm_ui.m
spm_graph.m
spm_graph.m
spm_graph_ui.m
spm_hrf.m
spm_results_ui.m
spm_spm.m
spm_sptop.m
NOTE: Since this "kit" includes an updated interface for blockfMRI analyses, which gives slightly different results to SPM96 (although results files are cross-compatible between the two implementations), we recommend you maintain the integrity of your SPM96 installation and install this kit in a seperate directory to SPM96. Place the directory containing this kit before SPM96 on your Matlab path when you wish to use the updated SPM97 event related or the updated blockfMRI interface, and refer to this combination as SPM97 in correspondance.
To install: move to a new directory where you want the files to reside, download the GNU-zipped tar filespm96_ER.tar.gz, and unpack with the UNIX commandgzip -dc ./spm96_ER.tar.gz | tar -xvf - Then make sure that this directory preceeds the SPM96 installation on your MatLab search path (help path in MatLab for details).
Event related fMRI for SPM was developed by Oliver Josephs, Karl Friston and Christian Büchel. The "kit" upgrading SPM96 to SPM97 was compiled and tested by Christian Büchel and Andrew Holmes. Thanks also to our beta testers.
-andrew 31/07/1998
This section describes user contributed functions, extensions and ports for SPM. Each contribution has a subsection written by the author. The SPM authors are not responsible for this code! However, most contributors do read theSPMemail discussion list, so discussion of these contributions is best staged there alongside "official" SPM.
SPM96 contributed files are available from our anonymous FTP server in the spm96_contrib
Contributions should be accompnied by a description along the lines of those below, including installation, configuration, and usage instructions. These can be left in our anonymous FTP upload area:ftp://ftp.fil.ion.ucl.ac.uk/in.eMailspm@fil.ion.ucl.ac.uk detailing your contribution, and we'll put it up here.
Overview & Description:This contribution contains a minor port of SPM96 to DEC Unix. I have not attempted a complete test of SPM, but in my hands (analysing only PET data), it runs without complaining. I have tested it on a DEC AlphaStation 200, running DEC UNix 4.0 (rev 386), and 4.0A (464). There are still some problems; text in the input routines is sometimes displayed truncated, and the menu / text input routines will not accept defaults without some selection / placebo editing. I haven't attempted to look at these; they seemed quite minor.
Installation: If you want to extract the dec archive onto a pre-existing standard spm96 installation, then you will need to allow write permission first. Type 'chmod u+w *.m' to allow the files to be updated. Then extract the spm96_dec archive into the directory with the SPM 96 standard distribution. You may want to restore write protection with 'chmod u-w *.m'. The archive is a gzipped tar file containing byte swapped image headers, modified m-files (see below), compiled mex files,and some small byte swapping routines. The byte swapping script is called byte_conv_imgs. Below are some notes on the changes that I have made, in the archived files, to the standard distribution.
Usage: Hey, it's just SPM!
Details: ...are given in theREADME file.
Download:ftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_contrib/spm96_dec.tar.gz
(116kb>
Overview & Description: Dr. Phoebe Spetsieris, working with Dr Vijay Dhawan at the Functional Brain Imaging laboratory of North Shore University Hospital, Manhasset, NY, has successfully ported SPM'96 to Windows NT 4.0 on an Intel PC platform, in Matlab 5.0.
A significant number of changes had to be implemented for this to work. Although not all features have been tested, the results for typical PET data sets previously analyzed on our SUN Ultra SPARC 1 were identical (within round-off errors). A few lingering problems for which temporary solutions have been provided are being looked into. The software is undergoing final testing/documentation and will be released within a few weeks.
The PC platform was a Pentium Pro 200 with 128 MB RAM and a 2GB SCSI ultra wide disk. The C compiler was Watcom C/C++ (version 10.6) and MATLAB 5.0 was utilized. The initial benchmarks against a similarly configured SUN Ultra SPARC 1 suggest a 20% faster performance on the PC platform. As North Shore does not have an FTP site yet, we can only transfer this package to other FTP sites. We have therefore arranged with Drs. Friston/Holmes for this package to be posted here on the original SPM FTP site so that any user can download the software from there.
Details of the port, oninstallation andusage are given in theREADME.NT file supplied with the distribution.
Download:ftp://ftp.fil.ion.ucl.ac.uk/spm/spm96_contrib/spm96_nt.tar.gz
(5.7Mb)