3dNormalize

From MEG Core
Jump to navigation Jump to search

3dNormalize converts values in SAM output BRIK files into normalized versions, by dividing by the standard deviation. It can also work on .nii files.

Normalization of some kind is often useful when comparing across subjects, and when the magnitude of the power change is not as important as where the power change is. If you are interested in the magnitude of the change (as a function of subject, probably), then you don't want to normalize across subjects.

3dNormalize is a shell script that also uses a small utility called 1dstats (which is also included). 1dstats just computes statistics from values in a text file; you might find it useful for other purposes.

Usage

3dNormalize [-z] [-i] [-m subbrik] [-v] in out

Here, in is the input SAM volume or BRIK file you'd like to normalize. It may be a 3d+time BRIK, in which case the statistics are calculated across all subbriks. If a BRIK, it can be either +orig or +tlrc, and optionally compressed. The output is written as a BRIK to out.

The -z option produces z-scores, and causes the output to have a mean of 0 and a standard deviation of 1. The default is to leave the mean the same, but to scale the SD. The -v option reports both values.

The -i option scales the positive and negative tails independently.

3dNormalize only operates on non-zero voxels. Voxels that are exactly zero are considered to be outside the head. To do this, a mask is generated from the non-zero voxels, by default from the first (or only) subbrik. The subbrik to use to generate the mask can be set with -m.

Q & A

Q Should I use the -z option?

A If you are comparing active and control conditions, you generally use a log-ratio, like so:

3dcalc -a ${a},3D_PWR,Mean.nii -b ${b},3D_PWR,Mean.nii -expr 'log(a/b)' -prefix ${p}.nii
3dNormalize -z ${p}.nii ${p}_z.nii

where ${a} is the name of the active condition and ${b} is the name of the control.

In this case, a value of zero has a very precise meaning: equal power levels. If you use -z to subtract the mean from the volume, zero will mean something else, and worse, a positive value, meaning active > control, might become a negative value, meaning control > active. Now, with that said, in general your SAM volumes should have a very normal looking distribution to start with (you can easily check this with 3dhistog), so removing the mean shouldn't hurt, but then, it's not necessary in that case.

Additionally, if you have a state imbalance, removing the mean might be appropriate. Consider what happens if you have many more samples in the active condition than in the control condition. During the calculation of the covariance matrices, more samples means that covariance will converge more. Covariance converges up, so this means that there will be a bias towards more power in the active condition (the one with more samples). You may find that the resulting volume has all positive values, and no negative values at all. If the distribution is still normal (use 3dhistog), -z will fix the state imbalance.