Combine sulcal lines to single ucf file

Written by Owen Phillips. Email Dr. Katherine Narr if you have any questions. For more information, see the protocols page.

Dicom to analyze.img
Freesurface Surface with Medial Sulcal Lines


After Sulcal Line drawing, you will need to combine the indicidual sulcal lines into a single file. Note, all subjects have to have the same number of lines drawn. It is best to check that all lines are correctly named and in the right hemisphere (it's a common mistake to get the left and right mixed up when saving out lines). If lines are not correct, it will cause problems down the line.

  1. Download the two scripts needed to combine lines into a single .ucf file.
  2. Below is a summary of the first script. This script creates simple text files for the left and right hemisphere of each subject that is listed in the foreach loop.
    • foreach x (add the subject IDs of your subjects here)
    • set dir="/ifs/where/your/data/is"
    • foreach y ( 30 31 34 35 32 36 37a 37b 38 33 16 1 3 19 2a 2b 4 5 21 15 6 7 8 )
    • ls ${dir}/${x}/${y}L.obj >> ${dir}/${x}/${x}_Llist_pial.txt
    • ls ${dir}/${x}/${y}R.obj >> ${dir}/${x}/${x}_Rlist_pial.txt
    • end
    • end
  3. Below is a summary of the second script. This will take the text files you created in the first script and combine all the lines listed in those text files into a single .ucf file.
    • foreach x (`add the subject IDs of your subjects here`)
    • set dir="/ifs/where/your/data/is"
      echo "${x}"
    • qsub -b y -q short.q
      /ifs/ccb/rcabeen/bin/cranium/esw-1.0/lib/python/ -m concat ${dir}/${x}/${x}_Llist_pial.txt ${dir}/${x}/${x}_Llines_pial.ucf -o
    • qsub -b y -q short.q
      /ifs/ccb/rcabeen/bin/cranium/esw-1.0/lib/python/ -m concat ${dir}/${x}/${x}_Rlist_pial.txt ${dir}/${x}/${x}_Rlines_pial.ucf -o
    • end
  4. Below is an example of a single subject's left hemisphere sulcal lines.