# Max Motion Displacement Question

Hello,

I’m interested in knowing what should be the maximum number I should take for my maximum motion displacement? I had two subjects with high max motion displacements - one with 8.68 and another with 11.34. Will these numbers affect my results in any way? How do I decrease these numbers?
Will high max motion displacement numbers affect my group results?

Reason why I’m asking is because my group results clearly still have some motion in them, seen by a motion ring the back of the head.
My motion is set to 0.25, and when I previously did 0.20 there were no differences in how many TRs were removed.

Best,
Rebecca

Hi Rebecca,

The maximum (preferably censored) motion displacement is a consideration for potential distortion differences, assuming a fixed shim at the beginning of a scanning run. The shim corrects distortion, but as the subject moves, the distortion changes.

The maximum displacement is the largest displacement between any pair of volumes (probably not including censored volumes).

For example, in AFNI_demos/AFNI_pamenc/AFNI_02_pamenc/global_process_commands.txt, we used gen_ss_review_table.py to drop subjects having a maximum censored displacement greater than 8 ~mm.

Does that seem reasonable?

• rick

Hello Rick,

Thanks for the response!

So, the difference between the max motion displacement and the max censored displacement is that censored is just looks at the TRs that were removed?

I’m trying to make a gen_ss_review_table.py script, but I’m a little confused. I looked at the link you provided, but not really sure how to make the script so that it goes into each subject’s folder.

I created a script and wrote the following:
[i]set subj = subj
set sdir = /name1/projects/name2/name3/name4/\$subj/Afni/\${subj}_results

gen_ss_review_table.py -write_table review_table.xls
-infiles \$sdir/out.ss_review.\${subj}.txt[/i]

**The output said: Input file not found /name1/projects/name2/name3/name4/\$subj/Afni/\${subj}_results/out.ss_review.subj.txt
Not really sure why the \${subj} didn’t work. I even tried it as {\$subj} and that didn’t work either. Same output.

I also tried:
[i]set subj = subj
set sdir = /name1/projects/name2/name3/name4/\$subj/Afni/\${subj}_results

gen_ss_review_table.py -write_table review_table.xls
-infiles \$sdir/out.ss*.txt[/i]

**The output said: gen_ss_review_table.py: No match.
That means the * definitely does not work.

I’m trying to first get the table so that I can see everyone. Then I was going to add the rest of the script to remove those with numbers that exceed the following:
gen_ss_review_table.py -outlier_sep space
-report_outliers ‘censor fraction’ GE 0.15
-report_outliers ‘average censored motion’ GE 0.1
-report_outliers ‘max censored displacement’ GE 8
-infiles \$sdir/out.ss*.txt

Am I doing this wrong? Any suggestions on how to fix the script with the subj?

Best,
Rebecca

Hi Rebecca,

The censored displacement just considers time points that were not removed, those that are still in the time series after censoring. It is more useful, since those are the time points that will be considered in the regression.

The gen_ss_review_table.py commands should not go into each subject’s directory. The input to that command is generally a list of out.ss_review files across all subjects at once. One command might have out.ss_review files for 200 subjects.

The output from gen_ss_review_table.py might be just a spreadsheet (one row per subject, one column per field entry), or it might be a list of subjects that could be dropped because one or more values are too extreme.

Regarding your errors, the one with …/\$subj/… “file not found” is odd. That suggests there are single quotes in use in the script, which I do not see in the posting. Since \$subj (the actual variable reference) is in the text output, the shell must be being blocked from using its value instead.

The second error could be for the same reason, it is hard to say. But if you replaced the gen_ss command (or preceded it) with something like:

``````ls -ld \$sdir
``````

it would presumably show a “file not found” error. In any case, it is not seeing \$sdir.

Regarding the last command, that -infiles option should read more like:

``````-infiles \$ALL_SUBJECTS/sub*/*.results/out.ss*.txt
``````

That would include all subjects in the input.

Does that seem reasonable?

• rick