Differences between revisions 7 and 80 (spanning 73 versions)
Revision 7 as of 2013-11-05 13:04:06
Size: 8037
Comment:
Revision 80 as of 2017-03-23 20:22:33
Size: 9856
Editor: AndrewHoopes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[FsTutorial/MultiModal_freeview|Back to Tutorial Top]]<<BR>>
[[FsTutorial/MultiModal_freeview|Back to Multimodal Top]]
Other Multimodal Tutorials:
[[FsTutorial/MultiModalFmriIndividual_freeview|B. Individual fMRI Integration]],
[[FsTutorial/MultiModalFmriGroup_freeview|C. Surface-based Group fMRI Analysis]],
[[FsTutorial/MultiModalDtiIndividual_freeview|D. Individual DTI Integration]] <<BR>>
The purpose of this tutorial is to get you acquainted with the concepts need to perform multi-modal integration in FreeSurfer using fMRI and DTI analysis. You will not learn how to perform fMRI or DTI analysis here; that knowledge is already assumed. The fMRI makes use of data from the Functional Biomedical Informatics Research Network (fBIRN, www.nbirn.net).
<<TableOfContents>>
= Registration =
## page was renamed from FsTutorial/MultiModalRegistrationV5.1
## page was renamed from FsTutorial/MultiModalRegistration_freeview
#pragma section-numbers 1
[[Tutorials|Back to Tutorial Homepage]]<<BR>>[[FsTutorial|Back to Course Homepage]]<<BR>>[[FsTutorial/MultiModal_freeview|Back to Multimodal Tutorial List]]

##Other Multimodal Tutorials: [[FsTutorial/MultiModalDtiIndividual_freeview|B. Individual DTI Integration]], [[FsTutorial/MultiModalFmriIndividual_freeview|C. Individual fMRI Integration]], [[FsTutorial/MultiModalFmriGroup_freeview|D. Surface-based Group fMRI Analysis]]
----
Other Multimodal Tutorials: [[FsTutorial/MultiModalFmriIndividual_freeview|Individual fMRI Integration]], [[FsTutorial/MultiModalFmriGroup_freeview|Surface-based Group fMRI Analysis]], [[FsTutorial/Diffusion_DtiIntegration|Diffusion and DTI Integration]]

----
{{{#!html
<h1>Registration</h1>
}}}
The purpose of this multimodal tutorial is to get you acquainted with the concepts needed to perform multi-modal integration in !FreeSurfer using fMRI and DTI analysis. You will not learn how to perform fMRI or DTI analysis here; that knowledge is already assumed. The fMRI makes use of data from the Functional Biomedical Informatics Research Network (fBIRN, www.nbirn.net). <<TableOfContents(2)>>
Line 13: Line 19:
Line 14: Line 21:
export SUBJECTS_DIR=$TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/multimodal/fmri/fbirn-101
}}}
''To copy: Highlight the command in the box above, right click and select copy (or use keyboard shortcut Ctrl+c), then use the middle button of your mouse to click inside the terminal window (this will paste the command). Press enter to run the command.''

These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into the directory within the SUBJECTS_DIR that you will use for this part of the tutorial. You can now skip ahead to the tutorial (below the gray line).

=== If You're Not at an Organized Course ===
If you are '''NOT''' taking one of the formally organized courses, then 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. These are the commands that you need to run before getting started:

{{{
## bash
<source_freesurfer>
export TUTORIAL_DATA=<path_to_your_tutorial_data>
export SUBJECTS_DIR=$TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/multimodal/fmri/fbirn-101

## tcsh
source $FREESURFER_HOME/SetUpFreeSurfer.csh
setenv TUTORIAL_DATA <path_to_your_tutorial_data>
Line 17: Line 44:
''To copy: Highlight the command in the box above, right click and select copy (or use keyboard shortcut Ctrl+c), then use the middle button of your mouse to click inside the terminal window (this will paste the command). Press enter to run the command.''
These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into this directory. You can now skip ahead to the tutorial (below the gray line).
=== If You're not at an Organized Course ===
If you are '''NOT''' taking one of the formally organized courses, then 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. These are the commands that you need to run before getting started:
{{{
tcsh
source your_freesurfer_dir/SetUpFreeSurfer.csh
setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/multimodal/fmri/fbirn-101
}}}
Notice the command to open tcsh. If you are already running the tcsh command shell, then the 'tcsh' command is not necessary. If you are not using the tutorial data you should set your {{{SUBJECTS_DIR}}} to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.
''Information on how to source [[https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurfer|FreeSurfer]] is located [[https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall#Setup+&+Configuration|here]]''.

If you are not using the tutorial data you should set your {{{SUBJECTS_DIR}}} to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.
Line 31: Line 51:
  1. Familiarize you with the tkregister2 command interface.
  1. Show you how to make manual adjustments to the registration.
  1. Show you what a bad registration is and how hard it is to fix manually.
First, load a functional volume with the anatomical volume using tkregister2:
----

 1. Familiarize you with the !FreeView and/or tkregister2 command interface.
 1. Show you how to make manual adjustments to the registration.
 1. Show you what a bad registration is and how hard it is to fix manually.

'''Option A''': Using FreeView

In order to use !FreeView, run the command below:

{{{
freeview -v template.nii \
$SUBJECTS_DIR/fbirn-anat-101.v4/mri/orig.mgz:visible=0 -f \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/lh.white:edgecolor=green \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/rh.white:edgecolor=green \
-viewport coronal
}}}
This should bring up an interface that looks like this:

{{attachment:FreeView.Snap1.sm.png||height="448",width="717"}}

 1. The grayscale image is the functional data.
 1. The green line is the white surface.
 1. Gray matter and CSF are bright while white matter is dark.

Notice how the surfaces do not line up with the anatomy in the functional volume. You can turn the orig volume on and off to see how much the registration is off. To do manual registration in !FreeView, select the volume you want to adjust (in this case, choose template) and then go to the 'Tools' menu and select 'Transform Volume'. Select the 'Translate' tab and play around with the sliders until the surfaces follow the anatomy better. You could play with the Rotation, as well.

{{attachment:FreeView.Snap2.png||height="410",width="386"}} {{attachment:FreeView.Snap3.png||height="413",width="389"}}

When you are happy with your results, save the registration file ('Save Reg') and/or the resampled volume ('Save Volume As'). If you would like to start over, you can choose 'Restore to Original'. Note, !FreeView will save .lta type registration files.

'''Option B''': Using tkregister2

In order to use tkregister2 for this task, load a functional volume with the anatomical volume using:
Line 40: Line 89:
----
The FreeSurfer subject name is "fbirn-anat-101.v4". --regheader
indicates that tkregister2 should assume that the volumes are already
in registration. myregister.dat is the output registration (does not
exist yet).
This should bring up an interface that looks like this:<<BR>>
{{attachment:Registration.jpg}}<<BR>>
 1. The gray scale image is the functional.
 1. The green line is the white surface.
 1. Note that they are not at all in alignment.
 1. Gray matter and CSF are bright while white matter is dark.
The !FreeSurfer subject name is "fbirn-anat-101.v4", and myregister.dat is the output registration (which does not exist yet). --regheader indicates to compute the initial registration from the information in the headers of the input volumes and not from the contents of a registration file, which is suitable when the volumes were acquired during the same scan session (ie, the head motion is minimal).

This should bring up an interface that looks like this:<<BR>> {{attachment:Registration.jpeg}} <<BR>>
Line 52: Line 94:
Line 56: Line 99:
 1. You can hit the "SAVE REG" button at any time to save a registration. If you hit it again, it will ask you if it is ok to overwrite it (it is).

=== Optional:Manual Registration in freeview ===

First, load a functional volume with the anatomical volume using freeview:
----
{{{
freeview -v template.nii
$SUBJECTS_DIR/fbirn-anat-101.v4/mri/orig.mgz:visible:0 -f
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/lh.white:edgecolor=green
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/rh.white:edgecolor=green
}}}
----
The FreeSurfer subject name is "fbirn-anat-101.v4". This should bring up an interface that looks like this:<<BR>>
{{attachment:Registration.jpg}}<<BR>>
 1. The gray scale image is the functional.
 1. The green line is the white surface.
 1. Note that they are not at all in alignment.
 1. Gray matter and CSF are bright while white matter is dark.
Things to do:
 1. Highlight the surface in the panel on the left and click alt+v to toggle the surface on and off.
 1. Compare the functional and anatomical volumes by highlight one of the volumes and clicking alt+v to toggle it on and off. Note that the green surface is aligned with the anatomical.
 1. Use the buttons in the top bar of freeview to change orientation of the volumes. Look at coronal, sagittal, and horizontal.
 1. NOTE: DO NOT SPEND MORE THAN 5min DOING THIS STEP! In order to do manual registration in freeview, press "Tools"==>"Transform volume".
 1. You can save the registration at any time.
 1. You can hit the "SAVE REG" button at any time to save a registration. (This will save a .dat type registration file.) If you hit it again, it will ask you if it is ok to overwrite it (it is).
 1. Close tkreg
Line 83: Line 103:
The purpose of this exercise is to show you how to use the automatic
registration program (bbregister). To run, cut and paste this command
into your shell:
----
The purpose of this exercise is to show you how to use the automatic registration program (bbregister). To run, copy and paste this command into your shell:
Line 90: Line 108:
    --init-fsl --reg register.dat     --init-rr --lta register.lta
Line 92: Line 110:
----
Line 94: Line 111:
  1. --bold indicates that the template has bold/T2 contrast (meaning that gray matter is brighter than white matter).
  1. --init-fsl indicates that the program should use [[http://www.fmrib.ox.ac.uk/fsl|FSL FLIRT]]. You must have FSL installed.
  1. register.dat is the output file
  1. This will take about 5 min (the same amount of time you spent manually, right?)

1. --bold indicates that the template has bold/T2 contrast (meaning that gray matter is brighter than white matter).
 1. --init-rr indicates that the [[mri_robust_register]] program will be used for registration.
 1. --lta indicates that the output registration file is register.lta (Note, currently register.dat will also be written into the output directory for backwards compatibility).
 1. This will take about 5 min (the same amount of time you spent manually, right?).
Line 99: Line 118:
Look at the register.dat text file created:
----
Look at the register.lta text file created:
Line 102: Line 121:
cat register.dat cat register.lta
Line 104: Line 123:
----
Click [[FsTutorial/MultiModalRegistration/RegisterFile|here]] to see an example.
Load a functional volume with the anatomical volume specifying
the recently created automatic registration:
----
Click [[FsTutorial/MultiModalRegistration/RegisterFileLta|here]] to see an example.

In order to load a functional volume with the anatomical volume specifying the recently created automatic registration:

'''Option A''': Using !FreeView

{{{
freeview -v $SUBJECTS_DIR/fbirn-anat-101.v4/mri/orig.mgz \
template.nii:reg=register.lta -f \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/lh.white:edgecolor=green \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/rh.white:edgecolor=green \
-viewport coronal
}}}
Select the template volume and hit Alt+v to switch between the template and orig or change the opacity value on the top volume to observe the quality of the alignment. See how much better the registration is now? How does it compare to your manual registration?

{{attachment:Registered.Snap.sm.png||height="428",width="684"}}

'''Option B''': Using tkregister2
Line 112: Line 145:
Click back and forth between "TARGET" (the anatomical volume) and "MOVEABLE" (the automatically registered functional volume) to observe the quality of the alignment.

{{attachment:registerafter.jpeg}}

Notes:

 1. The subject is not specified since it is in the register.dat.
 1. --regheader is not used.

How does this registration look compared to your manual registration above? Can you make it any better?

##Other Multimodal Tutorials: [[FsTutorial/MultiModalDtiIndividual_freeview|B. Individual DTI Integration]] [[FsTutorial/MultiModalFmriIndividual_freeview|C. Individual fMRI Integration]], [[FsTutorial/MultiModalFmriGroup_freeview|D. Surface-based Group fMRI Analysis]]
Line 113: Line 158:
{{attachment:registerafter.jpg}}
Command-line Notes:
  1. The subject is not specified since it is in the register.dat
  1. --regheader is not used
Things to do or try:
  1. How does it look compared to your manual registration above? Can you make it any better?
Other Multimodal Tutorials: [[FsTutorial/MultiModalFmriIndividual_freeview|Individual fMRI Integration]], [[FsTutorial/MultiModalFmriGroup_freeview|Surface-based Group fMRI Analysis]], [[FsTutorial/Diffusion_DtiIntegration|Diffusion and DTI Integration]]
Line 120: Line 160:
=== Optional: Automatic Registration and freeview ===

Load a functional volume with the anatomical volume specifying
the recently created automatic registration:
----
{{{
freeview -v $SUBJECTS_DIR/fbirn-anat-101.v4/mri/orig.mgz
template.nii:reg=bb.register.dat -f
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/lh.white:edgecolor=green
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/rh.white:edgecolor=green
}}}
----
{{attachment:registerafter.jpg}}
Command-line Notes:
  1. The subject is not specified since it is in the register.dat
Things to do or try:
  1. How does it look compared to your manual registration above? Can you make it any better?

Other Multimodal Tutorials:
[[FsTutorial/MultiModalFmriIndividual_freeview|B. Individual fMRI Integration]],
[[FsTutorial/MultiModalFmriGroup_freeview|C. Surface-based Group fMRI Analysis]],
[[FsTutorial/MultiModalDtiIndividual_freeview|D. Individual DTI Integration]] <<BR>>
<<BR>>[[Tutorials|Back to Tutorial Homepage]]<<BR>>[[https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial|Back to Course Homepage]]

Back to Tutorial Homepage
Back to Course Homepage
Back to Multimodal Tutorial List


Other Multimodal Tutorials: Individual fMRI Integration, Surface-based Group fMRI Analysis, Diffusion and DTI Integration


Registration

The purpose of this multimodal tutorial is to get you acquainted with the concepts needed to perform multi-modal integration in FreeSurfer using fMRI and DTI analysis. You will not learn how to perform fMRI or DTI analysis here; that knowledge is already assumed. The fMRI makes use of data from the Functional Biomedical Informatics Research Network (fBIRN, www.nbirn.net).

1. Preparations

1.1. If You're at an Organized Course

If you are taking one of the formally organized courses, everything has been set up for you on the provided laptop. The only thing you will need to do is run the following commands in every new terminal window (aka shell) you open throughout this tutorial. Copy and paste the commands below to get started:

export SUBJECTS_DIR=$TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/multimodal/fmri/fbirn-101

To copy: Highlight the command in the box above, right click and select copy (or use keyboard shortcut Ctrl+c), then use the middle button of your mouse to click inside the terminal window (this will paste the command). Press enter to run the command.

These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into the directory within the SUBJECTS_DIR that you will use for this part of the tutorial. You can now skip ahead to the tutorial (below the gray line).

1.2. If You're Not at an Organized Course

If you are NOT taking one of the formally organized courses, then to follow this exercise exactly be sure you've downloaded the 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. These are the commands that you need to run before getting started:

## bash
<source_freesurfer>
export TUTORIAL_DATA=<path_to_your_tutorial_data>
export SUBJECTS_DIR=$TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/multimodal/fmri/fbirn-101

## tcsh
source $FREESURFER_HOME/SetUpFreeSurfer.csh
setenv TUTORIAL_DATA <path_to_your_tutorial_data>
setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/multimodal/fmri/fbirn-101

Information on how to source FreeSurfer is located here.

If you are not using the tutorial data you should set your SUBJECTS_DIR to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.


2. Basic Manual Registration

The purpose of this exercise is to:

  1. Familiarize you with the FreeView and/or tkregister2 command interface.

  2. Show you how to make manual adjustments to the registration.
  3. Show you what a bad registration is and how hard it is to fix manually.

Option A: Using FreeView

In order to use FreeView, run the command below:

freeview -v template.nii \
$SUBJECTS_DIR/fbirn-anat-101.v4/mri/orig.mgz:visible=0 -f \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/lh.white:edgecolor=green \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/rh.white:edgecolor=green \
-viewport coronal

This should bring up an interface that looks like this:

FreeView.Snap1.sm.png

  1. The grayscale image is the functional data.
  2. The green line is the white surface.
  3. Gray matter and CSF are bright while white matter is dark.

Notice how the surfaces do not line up with the anatomy in the functional volume. You can turn the orig volume on and off to see how much the registration is off. To do manual registration in FreeView, select the volume you want to adjust (in this case, choose template) and then go to the 'Tools' menu and select 'Transform Volume'. Select the 'Translate' tab and play around with the sliders until the surfaces follow the anatomy better. You could play with the Rotation, as well.

FreeView.Snap2.png FreeView.Snap3.png

When you are happy with your results, save the registration file ('Save Reg') and/or the resampled volume ('Save Volume As'). If you would like to start over, you can choose 'Restore to Original'. Note, FreeView will save .lta type registration files.

Option B: Using tkregister2

In order to use tkregister2 for this task, load a functional volume with the anatomical volume using:

tkregister2 --mov template.nii --s fbirn-anat-101.v4 \
 --regheader --reg myregister.dat --surf

The FreeSurfer subject name is "fbirn-anat-101.v4", and myregister.dat is the output registration (which does not exist yet). --regheader indicates to compute the initial registration from the information in the headers of the input volumes and not from the contents of a registration file, which is suitable when the volumes were acquired during the same scan session (ie, the head motion is minimal).

This should bring up an interface that looks like this:
Registration.jpeg

Things to do:

  1. Click in the image window and hit the 's' key to toggle the surface on and off.
  2. Click on the "COMPARE" button to toggle between the functional and the anatomical. Note that the green surface is aligned with the anatomical.
  3. Change orientation by clicking on the "CORONAL", "SAGITTAL", and "HORIZONTAL" buttons.
  4. NOTE: DO NOT SPEND MORE THAN 5min DOING THIS STEP! Attempt to register the functional manually by adjusting the "TRANSLATE BRAIN" and "ROTATE BRAIN" sliders. Do NOT use "SCALE BRAIN".
  5. You can hit the "SAVE REG" button at any time to save a registration. (This will save a .dat type registration file.) If you hit it again, it will ask you if it is ok to overwrite it (it is).
  6. Close tkreg

3. Automatic Registration

The purpose of this exercise is to show you how to use the automatic registration program (bbregister). To run, copy and paste this command into your shell:

  bbregister --mov template.nii --bold \
    --s fbirn-anat-101.v4 \
    --init-rr --lta register.lta

Notes:

  1. --bold indicates that the template has bold/T2 contrast (meaning that gray matter is brighter than white matter).
  2. --init-rr indicates that the mri_robust_register program will be used for registration.

  3. --lta indicates that the output registration file is register.lta (Note, currently register.dat will also be written into the output directory for backwards compatibility).
  4. This will take about 5 min (the same amount of time you spent manually, right?).

4. View Automatic Registration

Look at the register.lta text file created:

cat register.lta

Click here to see an example.

In order to load a functional volume with the anatomical volume specifying the recently created automatic registration:

Option A: Using FreeView

freeview -v $SUBJECTS_DIR/fbirn-anat-101.v4/mri/orig.mgz \
template.nii:reg=register.lta -f \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/lh.white:edgecolor=green \
$SUBJECTS_DIR/fbirn-anat-101.v4/surf/rh.white:edgecolor=green \
-viewport coronal

Select the template volume and hit Alt+v to switch between the template and orig or change the opacity value on the top volume to observe the quality of the alignment. See how much better the registration is now? How does it compare to your manual registration?

Registered.Snap.sm.png

Option B: Using tkregister2

tkregister2 --mov template.nii --reg register.dat --surf

Click back and forth between "TARGET" (the anatomical volume) and "MOVEABLE" (the automatically registered functional volume) to observe the quality of the alignment.

registerafter.jpeg

Notes:

  1. The subject is not specified since it is in the register.dat.
  2. --regheader is not used.

How does this registration look compared to your manual registration above? Can you make it any better?


Other Multimodal Tutorials: Individual fMRI Integration, Surface-based Group fMRI Analysis, Diffusion and DTI Integration


Back to Tutorial Homepage
Back to Course Homepage

FsTutorial/MultiModalRegistration_freeview (last edited 2017-03-23 20:22:33 by AndrewHoopes)