[[FsTutorial|top]] | [[FsTutorial/FuncRegistration|previous]] == Automatic registration using spmregister and verifying results with tkregister2 == *To follow this exercise exactly be sure you've downloaded the [[FsTutorial/Data|tutorial data set]] before you begin. If you choose not to download the data set you can follow these instructions on your own data, but you will have to substitute your own specific paths and subject names. Two volumes may be automatically registered using the spmregister command. Spmregister uses functionality from Matlab, so make sure Matlab is installed and in a location reflected in your $PATH. === 1.0 Using spmregister === Again, it is important to first be certain that the functional volume and the FreeSurfer structural volume represent the same subject, and that the functional volume exists in the correct orientation before attempting automatic registration. After confirming these, run the following command from the directory containing the functional volume, or explicitly include the functional volume's pathname: {{{ cd $TUTORIAL_DATA/buckner_data/tutorial_subjs setenv SUBJECTS_DIR ${PWD} spmregister --s bert-brf --mov f001.img --reg register.dat }}} Instead of specifying a dummy file in which to save the final registration matrix, in this example we specify the filename ''register.dat'' by convention. Spmregister will produce verbose output in your xterm, and a review of this should indicate whether the registration completed successfully. Upon successful completion, spmregister will write the file ''register.dat'' in the directory from which it was run. This ascii file may be viewed by typing in the xterm window: {{{ cat register.dat }}} === 2.0 Visualizing the result using tkregister2 === To visually check the results of this registration, use the tkregister2 command: {{{ tkregister2 --s bert-brf --mov f001.img --surf orig --reg register.dat }}} making sure to use the same register.dat file that spmregister2 produced. === 3.0 Verifying subject and orientation === After registering two volumes, an important step is to verify that these datasets do in fact belong to the same subject (such mistakes are common enough to warrant mention!). Second, it is also important to verify that the functional volume is not Right/Left flipped relative to the anatomical scan, since automatic registration routines will likely not correct for this orientation error. The different datasets can be visually compared using the {{{compare}}} button in the bottom center of tkregister2's GUI; this button toggles between a view of the white matter surface overlayed onto the structural volume, and a view of the surface overlayed onto the functional volume. In either view, the surface overlay may be toggled on and off by selecting the image window to render it active and then using the {{{s key}}}. A good way to determine whether the functional brain image is correctly oriented is to use the assymmetry of a subject's data; step through the volumes' slices in the view (coronal, axial, or sagittal) that corresponds to the data's capture and find cortical folds that can be used as visually distinct features. Check that these features appear to correspond on both the structural and functional scans as in the example below. {{attachment:verify-without-w.jpg}} {{attachment:verify-with-w.jpg}}