Beauchamp:CorticalSurfaceOverview: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
(New page: {{Beauchamp Navigation Bar}} {| cellspacing="2px" cellpadding="0" border="0" style="padding: 0px; width: 750px; color: #000000; background-color: #ffffff;" |-valign="top" |width=400px sty...)
 
No edit summary
Line 8: Line 8:
[[Beauchamp:CreateAFNIBRIKfromMR|Getting raw data from the scanner]]
[[Beauchamp:CreateAFNIBRIKfromMR|Getting raw data from the scanner]]


=== Using to3d from the command line ===
==MRI: Cortical Surface Models==
There is a simple three step process for creating surface models. The steps assume that you are in the afni subdirectory of the subject for which a surface is to be created.
  cd /Volumes/data/UT/IZ/afni
Step 1: Prepare the FreeSurfer directory tree
  /Volumes/data/scripts/@prep_dir IZanatavg+orig.BRIK 
Step 2: Reconstruct the surface. Note that the name of the anatomy is not needed, but if you are using the up arrow in the UNIX shell to recall the last command and edit it, there is no need to delete the filename. This step takes many hours!
  /Volumes/data/scripts/@recon IZanatavg+orig.BRIK
Step 3: Finish the surface
  /Volumes/data/scripts/@finish IZanatavg+orig.BRIK
step 4: Check the created surface
  cd ..
  ./@ec
Or in a more economical way:
  set ec = IZ
  cd /Volumes/data/UT/{$ec}/afni
  /Volumes/data/scripts/@prep_dir {$ec}anatavg+orig.BRIK 
  /Volumes/data/scripts/@recon {$ec}anatavg+orig.BRIK
  /Volumes/data/scripts/@finish {$ec}anatavg+orig.BRIK
  cd ..
  ./@ec


If scanner data is obtained in NiFTI format from the UT Philips scanner, then no conversion is necessary (see above). For all other types of scanner data, the program to3d is used to convert the raw data to AFNI BRIK/HEAD files.
For more details, see the following web pages:
The preferred way to run to3d is from the command line, so that all parameters are recorded and the process can be automated.
#[[Beauchamp:PrepCortSurfModels|Preparation for Creating Cortical Surface Models]]
To see the to3d options  check the help file:
#[[Beauchamp:CreateCortSurfMod|Creating Cortical Surface Models]]
  to3d –help | more
#[[Beauchamp:UseCortSurfMod|Final touches and using Cortical Surface Models]]
 
#[[Beauchamp:IfCortModExists|What If a Cortical Surface Model Exists Already]]
=== For the BCM Siemens Scanners ===
#[[Beauchamp:EditingCortSurf|What If Cortical Surface Model Looks Bad]]
On the experiment sheet, you should have written down how many different scan series were collected and what each scan series consisted of. Alternately, you can use the ls command.
#[[Beauchamp:CreateStndSurfModNew|Creating Standardized Surface Models]]
  ls *ima
#[[Beauchamp:FSStndSurf|FreeSurfer Standard Surface Models]]
The first three digits show the scan series number. The highest number is the last scan series. e.g.
#[[Beauchamp:SurfDist|Finding Distances on the Surface]]
  002-000114-152629.ima 003-000048-152134.ima 003-000165-154108.ima 004-000099-153921.ima 005-000040-154821.ima 005-000157-154821.ima 006-000082-160430.ima
#[[Beauchamp:SurfaceMetrics|Finding Closest node on the Surface]]
Means there were six scan series. To see how many images are in each scan series use the following commands (replacing the number "6" with how many scan series you collected):
#[[Beauchamp:SUMA|SUMA]]
  foreach s (`count -digits 3 1 6`)
#[[Beauchamp:FreeSurfer|Free Surfer]]
  echo -n $s "  "
#[[Beauchamp:Caret|Caret]]
  ls {$s}*ima | wc
  end
This will output something like
  001          3      3      66
  002        183    183    4026
  003        183    183    4026
  004        176    176    3872
  005        192    192    4224
  006        192    192    4224
 
Scan series 001 is a localizer (only 3 images). From the image number it is ambiguous what the other scan series are (anatomical functional).
You can use to3d to examine a single file to see if it is an EPI:
  to3d 003-000165-154108.ima
e.g. EPI image with multiple slices, or an anatomy
  to3d 005-000040-154821.ima
One high-resolution anatomical image. Then, to3d can be run accordingly:
  foreach s (004 005 006)
  to3d -prefix series{$s} -session $sess -skip_outliers -anat {$s}*ima
  end
for anatomies and
  foreach s (002 003)
  to3d -prefix series{$s} -session $sess -skip_outliers -epan -time:zt 33 183 2000 alt+z {$s}*ima
  end
for EPIs.
 
=== This is the older method for using to3d with Philips data ===
To process an anatomical dataset, to3d is quite simple because there is only one timepoint.
  set session = /Volumes/data1/UT/CD/afni
  to3d -session $session -prefix CDanat  IM_*
 
This creates an AFNI BRIK/HEAD named CD anat from the anatomical DICOM images in the current directory and places them in the "session" directory.
AFNI reads information about the images from the DICOM header so that the voxel size and image origin is automatically correct in the BRIK/HEAD file.
 
To process a functional dataset, to3d if more complicated because we must tell it how many timepoints there were (this information is NOT in the DICOM header). Here is the to3d command to create a BRIK/HEAD from a functional run of DICOM images.
  to3d -session {$session} -skip_outliers -epan -prefix CDr1 -time:tz 110 33 2750 alt+z  IM_*  00000001/IM_*  00000002/IM_* 
 
Alternately, we can run to3d on the PAR/REC file.
 
to3d -skip_outliers -epan -time:tz 60 33 2750 alt+z  3D:0:0:80:80:1980:tms_10_10_1.REC
 
Where "1980" is the product of the number of time points and the number of slices (60*33). This requires you to manually enter all of the information about the dataset (voxel dimensions, etc.) in the GUI, as described in the next section. Alternately, a parent dataset can be specified that was collected with the same parameters.
 
  to3d -overwrite -prefix test -skip_outliers -epan -geomparent ~/fMRI_1.nii -time:tz 120 33 2000 alt+z  3D:0:0:80:80:3960:C.B.study_2404_2404_F.REC
 
===Using to3d from the GUI interface ===
 
If all of the necessary arguments to create a BRIK/HEAD file are given from the command line, then to3d will create the BRIK/HEAD file and finish.
If some arguments are missing, then to3d will display a GUI.
For instance, simply go to the directory containing the raw DICOM files and type
to3d *
from the correct folder. Below is a picture of the GUI interface with the most commonly edited options highlighted. Note that the bottom right of the window includes buttons to view the images, save the dataset, and quit. Normally to3d reads the variable information from the DICOM headers and nothing needs to be changed. Only the filename prefix needs to be set.
 
[[Image:To3d.jpg| 600px]]
 
 
=== Averaging Anatomical Scans Using AFNI ===
 
To register all the anatomicals to the space of the anatomical closest in time to the functional data (generally anatr1), this is with just two anatomical's:
 
  3dAllineate -base ${subj}anatr1+orig -source ${subj}anatr2+orig -prefix ${subj}anatr2_2RegTo1 -verb -warp shift_rotate -cost mi -automask -1Dfile ${subj}anatr2toanatr1
 
Average anatomicals into one dataset:
 
  3dmerge -gnzmean -nscale -prefix ${subj}anatavg ${subj}anatr1+orig ${subj}anatr2_2RegTo1+orig

Revision as of 13:44, 1 May 2014

Brain picture
Beauchamp Lab



Previous step is Getting raw data from the scanner

MRI: Cortical Surface Models

There is a simple three step process for creating surface models. The steps assume that you are in the afni subdirectory of the subject for which a surface is to be created.

 cd /Volumes/data/UT/IZ/afni

Step 1: Prepare the FreeSurfer directory tree

 /Volumes/data/scripts/@prep_dir IZanatavg+orig.BRIK  

Step 2: Reconstruct the surface. Note that the name of the anatomy is not needed, but if you are using the up arrow in the UNIX shell to recall the last command and edit it, there is no need to delete the filename. This step takes many hours!

 /Volumes/data/scripts/@recon IZanatavg+orig.BRIK

Step 3: Finish the surface

 /Volumes/data/scripts/@finish IZanatavg+orig.BRIK

step 4: Check the created surface

 cd ..
 ./@ec

Or in a more economical way:

 set ec = IZ
 cd /Volumes/data/UT/{$ec}/afni
 /Volumes/data/scripts/@prep_dir {$ec}anatavg+orig.BRIK  
 /Volumes/data/scripts/@recon {$ec}anatavg+orig.BRIK
 /Volumes/data/scripts/@finish {$ec}anatavg+orig.BRIK
 cd ..
 ./@ec

For more details, see the following web pages:

  1. Preparation for Creating Cortical Surface Models
  2. Creating Cortical Surface Models
  3. Final touches and using Cortical Surface Models
  4. What If a Cortical Surface Model Exists Already
  5. What If Cortical Surface Model Looks Bad
  6. Creating Standardized Surface Models
  7. FreeSurfer Standard Surface Models
  8. Finding Distances on the Surface
  9. Finding Closest node on the Surface
  10. SUMA
  11. Free Surfer
  12. Caret