## June 02, 2010

### SPM99 Gem 23: Tabulating T Statistics

```Subject: Fwd: Re: tabulating all statistics
From: John Ashburner <john@FIL.ION.UCL.AC.UK>
Date: Tue, 1 Jul 2003 11:47:07 +0000 (07:47 EDT)
To: SPM@JISCMAIL.AC.UK

> I was wondering if it would be possible to write t values for an
> entire volume into a file?

Try this:

fid=fopen('t-values.txt','w');
P=spm_get(1,'*.img','Select statistic image');
V=spm_vol(P);

[x,y,z] = ndgrid(1:V.dim(1),1:V.dim(2),0);
for i=1:V.dim(3),
z   = z + 1;
tmp = spm_sample_vol(V,x,y,z,0);
msk = find(tmp~=0 & finite(tmp));
if ~isempty(msk),
tmp = tmp(msk);
xyz1=[x(msk)'; y(msk)'; z(msk)'; ones(1,length(msk))];
xyzt=V.mat(1:3,:)*xyz1;
for j=1:length(tmp),
fprintf(fid,'%.4g %.4g %.4g\t%g\n',...
xyzt(1,j),xyzt(2,j),xyzt(3,j),tmp(j));
end;
end;
end;
fclose(fid);

best regards,
-John
```
As noted in a 2 Feb 2004 email, to eliminate all voxels below a certain threshold, change
```     msk = find(tmp~=0 & finite(tmp));
```
to
```     msk = find(tmp>0 & finite(tmp));
```

Name
Email
Anti-Spam Question
My t-shirt is red. What colour is my t-shirt?
Comment

You can not use HTML, but you can use our special markup

## Tags

• Hi, Folks, conversion to HTML still works for PPT 2011 under OS 10.10 (as on my computer), with coup… by Andrew Fisher on this entry
• HTML pages are different from PPT. It is possible to convert PPT in HTML page but it will create a p… by Ramjas on this entry
• Hi This doesn't really address the issue at hand (powerpoint to html), but an alternative and very e… by Rose on this entry
• @Michael. You are a SAINT. BLESS. by emma riley on this entry
• I look this up every couple of years, and always struggle with it, so here are some notes for improv… by johann beda on this entry