Dear Donald,

Thank you for your reply! I adjusted your code a bit, because I think the input arguments for spm_invTcdf were not correct. The following seems to work for me:

load SPM.mat;
data=load('datafile');
pval=0.001
P=zeros(length(data),1);
t = abs(spm_invTcdf(pval,SPM.xX.erdf));

for i=1:length(data)
     if data(i) > t;
       P(i)=1;
     end
end
voxcount=sum(P)


On Mon, Jun 15, 2009 at 9:33 PM, MCLAREN, Donald <[log in to unmask]> wrote:
P-value is determined purely based on the T-statistic and degrees of freedom. The smoothness of the image only comes in during the FWE correction. So, you just need to find where the p-value exceeds 0.001

If your data are simple a vector of T-values..... and stored in a vector called data

load SPM.mat;
data=load('datafile');
pval=0.001
P=zeros(length(data),1);

for i=1:length(data)
     if ( spm_invTcdf(data(i),SPM.xX.erdf) < pval); then
       P(i)=1;
     end
end
voxcount=sum(P)


On Mon, Jun 15, 2009 at 2:30 PM, MCLAREN, Donald <[log in to unmask]> wrote:
If your data are simple a vector of T-values..... and stored in a vector called data

for i=1:length(data)
     if ( spm_invTcdf(data(i),SPM.xX.erdf) >= pval); then


On Mon, Jun 15, 2009 at 10:32 AM, Anna de Boer <[log in to unmask]> wrote:
Dear SPM users,
 
I am doing a region of interest analysis, and for that want to count the voxels at p < 0.001 in all of my images, in a number of specified ROI's. I use the volume toolbox to extract t-values from my images inside a ROI, but I don't now how I can easily calculate the t threshold which accompanies my desired p level (running the results section of SPM for each different contrast and then looking up the threshold in the results table is going to take a lot of time). I believe the t-threshold is determined based on the p level, the degrees of freedom and smoothness of the images, so maybe I could calculate this myself in matlab, but I am not sure how. Anyone any thought on this?
  
Kind regards,
 
Anna



--
Best Regards, Donald McLaren
=====================
D.G. McLaren
University of Wisconsin - Madison
Neuroscience Training Program
Office: (608) 265-9672
Lab: (608) 256-1901 ext 12914
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is intended only for the use of the individual or entity named above. If the reader of the e-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that you are in possession of confidential and privileged information. Any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this e-mail unintentionally, please immediately notify the sender via telephone at (608) 265-9672 or email.



--
Best Regards, Donald McLaren
=====================
D.G. McLaren
University of Wisconsin - Madison
Neuroscience Training Program
Office: (608) 265-9672
Lab: (608) 256-1901 ext 12914
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is intended only for the use of the individual or entity named above. If the reader of the e-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that you are in possession of confidential and privileged information. Any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this e-mail unintentionally, please immediately notify the sender via telephone at (608) 265-9672 or email.