Rita,
I'm not familiar with NHST.
There isn't a simple calculation of the dof that can be applied to all models as not all models have independent columns. For many models, the DOF is the number of observations (volumes) - #regressors.
For a one-sample t-test, the DF is number of subjects-1.
For a two-sample t-test, the DF is the number of subjects-2. There are two ways to model two groups, both have the same number of DF.
(1) 2 columns with 1 column for each group;
(2) 3 columns with 1 column for each group and a third column for the mean of all subjects.
As you can see the rule of n-#ofregressors works sometimes, but not other times. The reason for this that the rule does not work when the columns are dependent on the other columns in the matrix. Thus, SPM has its own computation to deal with dependency amongst the columns. If all columns are independent and do not influence the other columns, then n-#regressors should work assuming you are not doing repeated measures.
The way SPM computes the DF is as follows (from spm_spm.m):
[trRV, trRVRV] = spm_SpUtil('trRV',xX.xKXs,xX.V)