# 1d_tool.py for Euclidean Norm

Hi,

I am checking out the functionality of 1d_tool.py to create an overall framewise displacement score (euclidean_norm) for each subject to run group ICA analyses in GIFT (preprocessing done in AFNI). My understanding is that for each time, you take each of the rotation and displacement values and subtract from the one just before. This value is squared for each of 6 displacement/rotation columns and then this is in turn summed and a square root is taken of the sum. Is this correct? The reason I ask is that I when I went to Excel to manually do this, I could get the same number as what 1d_tool.py gave me but only when I have the -derivative flag. Am I missing something about how the e.norm value gets calculated?

Thank you,

Jatin

Hi Jatin,

That -derivative option is taking the first difference
of each time series, where run breaks get an automatic
0. In any case, it would be helpful to see your actual
1d_tool.py command, to comment on it precisely.

See 1d_tool.py -help, examples 9a and 9b.

• rick

Hi Rick,

Here’s the command I ran for one subject with one resting state scan (again, I’m preprocessing in AFNI but need to run group ICA in GIFT).

1d_tool.py -infile Rest_mt.1D -set_nruns 1 -derivative -collapse_cols euclidean_norm -write motion.txt

I think I may not be understanding what -collage_cols euclidean_norm is doing without the “-derivative” option. Here’s the motion.1D file I am working with.

0.0260 -0.0177 0.1769 -0.1301 0.1481 -0.0707
0.0657 -0.0265 0.1597 -0.1272 0.1836 -0.1027
0.0744 -0.0291 0.2307 -0.1935 0.2170 -0.1394
0.0823 0.0174 0.1887 -0.1716 0.1683 -0.0964
0.0722 -0.0436 0.0924 -0.1104 0.0640 -0.0830
0.0667 -0.0070 0.1164 -0.1501 0.0667 -0.0747
0.1186 -0.0990 0.1510 -0.0265 0.0831 -0.0765
0.1034 -0.1006 0.1648 -0.0218 0.1012 -0.0651
0.0485 -0.0571 0.1586 -0.0260 0.0696 -0.0276
0.0519 -0.1090 0.1827 0.0029 0.0508 -0.0869
0.0493 -0.0308 0.1478 -0.0879 0.0537 -0.0958
0.0685 -0.0120 0.2317 -0.0745 0.1063 -0.0601
0.0564 -0.0211 0.1891 -0.0101 0.0675 -0.0640
0.0278 -0.0508 0.1619 0.0049 0.0376 -0.0264
0.0373 -0.0529 0.1675 -0.0651 0.0508 -0.0682
0.0398 -0.0166 0.2122 -0.1608 0.1127 -0.1001
0.0203 0.0015 0.1775 -0.1594 0.0581 -0.1245
-0.0364 0.0279 0.1186 -0.1644 0.0082 -0.1046
-0.0373 0.0217 0.1572 -0.1851 0.0537 -0.1100
-0.0516 -0.0190 0.1742 -0.1344 0.0270 -0.1224
-0.0360 0.0488 0.2127 -0.2506 0.0733 -0.1192
-0.0195 -0.0181 0.1703 -0.2326 0.0566 -0.0732
-0.0318 0.0148 0.1162 -0.1474 0.0135 -0.0286
-0.0139 -0.0423 0.1572 -0.1530 0.0839 -0.0457
-0.0023 -0.0711 0.1244 -0.1141 0.0589 -0.1018
0.0071 -0.0616 0.0145 -0.1050 -0.0347 -0.0479
-0.0054 -0.0582 0.1021 -0.1810 0.0461 -0.0973
0.0175 -0.0598 0.0671 -0.0856 0.0347 -0.0358
-0.0001 -0.0529 0.0567 -0.0357 0.0435 -0.0436
-0.0040 -0.0202 0.1563 -0.1356 0.1003 -0.0712
-0.0261 -0.0340 0.1555 0.0591 0.0865 0.0550
-0.0307 -0.0492 0.1379 0.0112 0.1011 -0.0527
-0.0279 -0.0516 0.1043 0.0195 0.0724 -0.0223
-0.0119 -0.0505 0.0992 0.0334 0.0620 -0.0302
0.0034 -0.0738 0.0702 0.0253 0.0484 -0.0234
-0.0031 -0.0500 0.1007 -0.0220 0.0609 -0.0426
-0.0031 -0.0252 0.0804 -0.0419 0.0494 -0.0306
-0.0149 -0.0463 0.1013 -0.0101 0.0473 -0.0316
-0.0037 -0.0609 0.1270 0.0228 0.0605 -0.0236
0.0079 -0.0501 0.0943 0.0207 0.0425 0.0015
0.0154 -0.0519 0.0867 -0.0366 0.0542 -0.0293
0.0026 -0.0662 0.1075 -0.0447 0.0571 -0.0606
-0.0099 -0.0631 0.0980 -0.0158 0.0367 -0.0444
0.0101 -0.0475 0.0883 -0.0503 0.0424 -0.0390
0.0174 -0.0113 0.0675 -0.0387 0.0093 -0.0438
0.0130 -0.0509 0.1042 0.0135 0.0482 -0.0322
0.0180 -0.0440 0.0844 -0.0698 0.0779 -0.0373
0.0165 -0.0422 0.0779 -0.0469 0.0529 -0.0437
0.0122 -0.0176 0.0857 -0.0751 0.0697 -0.0516
0.0427 -0.0127 0.0401 -0.0961 0.0358 -0.0774
0.0264 -0.0153 0.0932 -0.0832 0.0708 -0.0857
0.0421 -0.0434 0.0718 -0.0427 0.0386 -0.0533
0.0370 -0.0158 0.0867 -0.0733 0.0789 -0.0806
0.0375 -0.0153 0.1232 -0.1044 0.0816 -0.0553
0.0251 -0.0167 0.1346 -0.0873 0.0786 -0.0588
0.0306 -0.0500 0.1156 -0.0867 0.0746 -0.0866
0.0429 -0.0363 0.0998 -0.0756 0.0695 -0.0561
0.0317 -0.0290 0.1253 -0.0408 0.0726 -0.0500
0.0121 0.0013 0.1092 -0.0646 0.0838 -0.0304
0.0184 -0.0139 0.1028 -0.0447 0.0787 -0.0406
-0.0035 -0.0179 0.1002 -0.0841 0.0754 -0.0529
0.0060 -0.0246 0.0770 -0.0716 0.0615 -0.0578
0.0085 0.0033 0.0636 -0.0709 0.0378 -0.0411
0.0001 0.0221 -0.0204 -0.0140 -0.0202 -0.0279
0.0055 0.0060 0.0522 -0.0360 0.0398 -0.0616
0.0089 0.0196 0.0531 0.0369 0.0344 -0.0376
0.0022 -0.0070 0.0059 0.0147 0.0012 -0.0072
0.0053 0.0100 -0.0019 -0.0291 0.0012 -0.0453
0.0351 0.0202 0.0689 -0.0595 0.0220 -0.0532
0.0523 0.0268 0.1005 -0.1151 0.0414 -0.0576
0.0284 0.0080 0.1043 -0.1029 0.0589 -0.0619
0.0430 -0.0071 0.1058 -0.0523 0.0634 -0.0524
0.0540 -0.0084 0.0811 -0.0457 0.0543 -0.0744
0.0425 0.0128 0.0843 -0.0969 0.0374 -0.0606
0.0321 0.0297 0.0870 -0.1119 0.0574 -0.0636
0.0352 -0.0022 0.1035 -0.1030 0.0592 -0.0864
0.0366 0.0102 0.1180 -0.1104 0.0662 -0.0707
0.0467 0.0166 0.1180 -0.1223 0.0568 -0.0498
0.0363 0.0006 0.1208 -0.1131 0.0462 -0.0813
0.0171 -0.0105 0.1310 -0.1017 0.0409 -0.0732
0.0144 0.0024 0.1498 -0.1309 0.0644 -0.0681
0.0263 0.0085 0.1261 -0.1083 0.0460 -0.0676
0.0287 0.0237 0.1426 -0.1331 0.0393 -0.0955
0.0412 0.0295 0.1525 -0.1539 0.0671 -0.0604
0.0272 0.0146 0.1352 -0.1083 0.0764 -0.0530
0.0514 0.0202 0.0622 -0.0825 0.0064 -0.0663
0.0306 0.0339 0.0798 -0.1288 0.0348 -0.0775
0.0046 0.0337 0.0713 -0.1992 0.0480 -0.0968
0.0243 0.0316 0.0840 -0.2027 0.0476 -0.1013
0.0325 0.0183 0.1210 -0.1031 0.0570 -0.0869
0.0173 -0.0039 0.1000 -0.1130 0.0380 -0.0795
0.0177 0.0090 0.1157 -0.1697 0.0728 -0.1035
0.0274 0.0245 0.1185 -0.1451 0.0693 -0.0828
0.0175 0.0125 0.1096 -0.1547 0.0608 -0.0665
0.0171 0.0349 0.0389 -0.1363 0.0086 -0.0565
0.0220 0.0354 0.0338 -0.1327 0.0179 -0.0593
0.0240 0.0612 0.0195 -0.1033 0.0056 -0.0433
0.0342 0.0229 0.0916 -0.1102 0.0437 -0.0698
0.0251 0.0664 0.0328 -0.1136 0.0129 -0.0447
0.0153 0.0271 0.0553 -0.1031 0.0272 -0.0804
0.0282 0.0159 0.0690 -0.0577 0.0393 -0.0697
0.0303 0.0145 0.0063 -0.0006 0.0059 -0.0436
0.0311 -0.0000 0.0770 -0.0360 0.0472 -0.0410
0.0294 0.0229 0.1141 -0.0491 0.0431 -0.0450
0.0231 0.0451 0.0567 -0.0677 0.0150 -0.0626
0.0137 0.0312 0.0593 -0.1180 0.0355 -0.0916
0.0219 0.0351 0.0770 -0.1431 0.0326 -0.1074
0.0161 0.0335 0.0681 -0.1394 0.0393 -0.1049
0.0223 0.0135 0.0694 -0.0534 0.0071 -0.0661
0.0319 -0.0066 0.0339 -0.0136 -0.0160 -0.0205
0.0577 -0.0177 0.0790 -0.0385 -0.0016 -0.0649
0.0604 -0.0095 0.1121 -0.0657 0.0098 -0.0804
0.0369 0.0313 0.0658 -0.0961 0.0051 -0.0580
0.0310 0.0485 0.0029 -0.0755 -0.0159 -0.0728
0.0349 0.0303 0.0248 -0.0776 -0.0115 -0.0343
0.0261 0.0206 -0.0013 -0.0419 -0.0219 -0.0398
0.0466 0.0076 0.0548 -0.0972 0.0159 -0.1013
0.0437 0.0319 0.0759 -0.1615 0.0302 -0.0970
0.0400 0.0574 0.0881 -0.1979 0.0397 -0.1362
0.0491 0.0482 0.1044 -0.1601 0.0217 -0.1393
0.0431 0.0358 0.0800 -0.1223 0.0190 -0.0998
0.0382 0.0503 -0.0226 -0.0673 -0.0435 -0.0614
0.0350 0.0472 0.0461 -0.1538 0.0109 -0.0736
0.0378 0.0645 0.0625 -0.1936 0.0309 -0.1057
0.0529 0.0663 0.0091 -0.1137 -0.0392 -0.0912
0.0600 0.0236 0.0704 -0.1319 0.0161 -0.1106
0.0502 0.0346 0.0886 -0.1360 0.0147 -0.0834
0.0506 0.0220 0.1283 -0.1391 0.0337 -0.0695
0.0682 0.0067 0.0602 -0.0745 -0.0210 -0.0786
0.0674 0.0338 0.0535 -0.1323 0.0159 -0.1061
0.0677 0.0287 0.0952 -0.1566 0.0274 -0.1088
0.0603 0.0514 0.0985 -0.2042 0.0298 -0.0993
0.0434 0.0815 0.0090 -0.1198 -0.0551 -0.0815
0.0394 0.0353 0.0271 -0.1328 -0.0086 -0.0815
0.0421 0.0249 0.0161 -0.0628 -0.0263 -0.0534
0.0546 0.0318 0.0448 -0.1000 -0.0019 -0.0819
0.0559 0.0366 0.0729 -0.1257 0.0223 -0.0935
0.0516 0.0473 0.0889 -0.1357 -0.0052 -0.0663
0.0735 0.0577 0.1446 -0.1307 0.0140 -0.0895
0.0715 0.0306 0.0780 -0.1173 0.0030 -0.0685
0.0482 0.0093 0.0829 -0.1434 -0.0021 -0.0672
0.0465 0.0374 0.0560 -0.1603 -0.0104 -0.1027
0.0580 0.0478 0.0886 -0.1886 0.0054 -0.1126
0.0456 0.0638 0.0840 -0.2120 -0.0083 -0.1102
0.0455 0.0671 0.0390 -0.2079 -0.0277 -0.1398
0.0416 0.0611 0.0056 -0.1679 -0.0358 -0.1073
0.0472 0.0449 0.0489 -0.1668 -0.0068 -0.0415
0.0465 0.0523 0.0580 -0.1936 -0.0083 -0.0988
0.0358 0.0615 0.0667 -0.1906 -0.0089 -0.0921
0.0284 0.0424 0.0379 -0.1368 -0.0192 -0.1183
0.0369 0.0282 0.0777 -0.1542 0.0124 -0.0856
0.0441 0.0249 0.0635 -0.1160 0.0051 -0.0638
0.0443 0.0303 0.0591 -0.1524 -0.0146 -0.0894
0.0194 0.0642 0.0496 -0.1356 -0.0063 -0.0818
0.0379 0.0419 0.0822 -0.1501 0.0097 -0.1050
0.0463 0.0335 0.0513 -0.1210 -0.0070 -0.0999
0.0557 0.0421 0.0760 -0.1528 -0.0053 -0.0975
0.0439 0.0793 0.0518 -0.1554 -0.0106 -0.0767

Either way you are asking to collapse the 6 columns
into 1 via the Euclidean norm (sqrt(sum squares)).
The question is whether to do it on the original data,
or whether to take the first differences, first.

• rick

Got it! Thanks.