Skip to content

Latest commit

 

History

History
57 lines (52 loc) · 3.8 KB

2. FreeSurfer T1 Reconstruction.md

File metadata and controls

57 lines (52 loc) · 3.8 KB

FreeSurfer-T1-Reconstruction-For-Mac-Locally

  1. tcsh
  2. source .cshrc
  3. Download the dicom folder to your drive from the subject folder located on the server. (EX. home/fhlin/lin2/fhlin/eegmri_wm/subjects/s004/mri/orig/dicom). If you have not already, install XQuartz to prevent an error with reading the dicom files (Ex. ERROR: reading ../dicom/EEGFMRI_WM_S004.MR.RESEARCH_FHLIN.0037.0001.2023.02.24.17.53.54.227018.233311136.IMA tag 28 30)
  4. Add the dicom folder to your subjects orig folder, you should have the following folder path for your subject
Example Folder Path Screen Shot 2024-04-18 at 2 24 33 PM
  1. mri_info checks if all freesurfer items are there
  2. setenv SUBJECTS_DIR $PWD
  3. setenv SUBJECTS_DIR /Users/jessica/data_analysis/seeg/subjects set your subject directory
  4. echo $SUBJECTS_DIR sees what path your subjects are in
  5. cd /Users/jessica/data_analysis/seeg/subjects/s004/mri/orig get into right directory in orig folder
  6. mkdir unpack creates empty folder called unpack (in orig folder)
  7. cd unpack/
  8. vi unpack.rule makes a file called unpack.rule, enter "37 3danat COR blah" (number changes based on dicom scan, in this case is it 37)
  9. unpacksdcmdir -src ../dicom -targ . -scanonly ./info output should be "Done scanning"
  10. mri_convert -all-info
  11. unpacksdcmdir -src ../dicom -targ . -cfg ./unpack.rule make sure you are in the unpack folder (this step may take some time)
  12. cd ../ make sure you are in orig file for next step (going back one folder)
  13. mri_convert unpack/3danat/037/COR-.info ./001.mgz this step converts COR files into a 001.mgz file in the orig folder (number changes based on dicom scan, in this case is it 37. Leading zeros should not be added in the unpack.rule, EX. if dicom number is 0037, only put 37)
  14. cd /Users/jessica/data_analysis/seeg/subjects/s004 make sure you are in the subjects folder
  15. recon-all -subjid s004 -all change based on subject ID, this step will take about 10 hours to complete the whole processing
  16. If done successfully, you should have the following folder path for your subject
Example Folder Path Screen Shot 2024-04-17 at 10 59 39 AM

Alternate Steps if Error Present at Step 15

Using Mango

  1. Go to Mango and open the dicom folder of your subject
  2. File save as .nii.gz file into your orig folder
  3. mri_convert EEGFMRI_WM_S004.nii.gz 001.mgz in orig file, converts file to 001.mgz
  4. cd ../ make sure in orig file for next step (going back one folder)
  5. mri_convert unpack/3danat/037/COR-.info ./001.mgz after this step there should be a 001.mgz in the orig folder
  6. recon-all -subjid s004 -all change based on subject ID

Using mri_convert

  1. mri_convert ../dicom/EEGFMRI_WM_S004.MR.RESEARCH_FHLIN.0037.0001.2023.02.24.17.53.54.227018.233311136.IMA -ot COR -o c converts file (which can be copied from error message in setp 17) to ‘c’
  2. cd c
  3. ls to check if all COR files are there
  4. cd .. to go back to unpack folder
  5. mv c 037 to rename folder
  6. ls to check if folder named 037 is in unpack folder
  7. mkdir 3danat makes folder
  8. mv 037 3danat/
  9. ls to see if 3danat folder is there
  10. mri_convert 3danat/037/COR-.info 001.mgz
  11. ls to see if 001.mgz file is there
  12. cd ../ make sure in orig file for next step (going back one folder)
  13. mri_convert unpack/3danat/037/COR-.info ./001.mgz after this step there should be a 001.mgz in the orig folder
  14. recon-all -subjid s004 -all change based on subject ID