- Within that list, you can find the
tkmedit command to call this script. (The aliases need to be saved in a ~/.alias).
Tkmedit tcl Script
As mentioned in the course, you can create a tcl script to use when opening tkmedit or tksurfer so that they open with your preferences already selected (such as surface color, surface thickness, etc.). Below is an example of a tcl script that interacts with tkmedit:
SetZoomLevel 2 RedrawScreen SetSurfaceLineColor 0 0 0 0 1 SetSurfaceLineColor 1 0 0 0 1 SetSurfaceLineWidth 0 0 2 SetSurfaceLineWidth 1 0 2 SetSurfaceLineWidth 0 2 2 SetSurfaceLineWidth 1 2 2 SetDisplayFlag 5 0 SetCursorColor .5 0 .5
The above script does the following things (the order below corresponds to the order of each line in the script):
- Zooms in once
RedrawScreen applies this zoom
- Sets one hemisphere of the white surface to blue
- Sets the other hemisphere of the white surface to blue
- Sets one hemisphere of the white surface to a thickness of 2
- Sets the other hemisphere of the white surface to a thickness of 2
- Sets one hemisphere of the pial surface to a thickness of 2
- Sets the other hemisphere of the pial surface to a thickness of 2
- Turns off the original surface
- Changes the cursor (+) to purple
The script can be created in any text editor (i.e. emacs, vi, gedit) and should be saved with the tcl extension (i.e. surfaces.tcl) in a convenient location.
A list of other options that can be added to the script are here: https://surfer.nmr.mgh.harvard.edu/fswiki/TkMeditGuide/TkMeditReference/TkMeditScripting
In order to use the script, you would call it using the [-tcl] flag with your tkmedit command. For example:
tkmedit subj001 brainmask.mgz -aux T1.mgz -surfs -tcl /path/to/surfaces.tcl
- more reconall_all.csh
#!/bin/tcsh -ef
source subjects.csh
foreach s ($SUBJECTS)
- set cmd = (recon-all -autorecon2-cp -autorecon3 -no-isrunning -s $s)
# set mdir=$SUBJECTS_DIR/$s/mri # if (-e $mdir/aseg.frozen.auto.mgz) then # echo skipping $s # continue ; # else # echo processing $s # endif
if (hostname == seychelles) then
- pbsubmit -q lieutenant -l nodes=1:opteron -c "$cmd" sleep 30;
- eval $cmd
end
#if you want email notification then add -m $LOGNAME to the pbsubmit line (pbsubmit -q lieutenant -m $LOGNAME -l nodes =1 etc...
- more run-recon-all.csh
#!/bin/tcsh -f #run-recon-all.csh
set s = $1 setenv SUBJECTS_DIR /path/to/your/data set log = $SUBJECTS_DIR/recon-all-commands.log set dcmdir = /path/to/your/dicoms set subjid = echo $s |gawk -F- '{print $2}'
if (-e $dcmdir/$s/scan.dat) then
- echo "found scan.dat, finding mprages" set dat = $dcmdir/$s/scan.dat
else
- echo "no scan.dat"
endif
set mpr = (cat $dat | grep "256 256 128" |grep ok | awk '{print $8}') echo "found mprages, $mpr"
echo pbsubmit -f -m astevens -c \"recon-all -i $dcmdir/$s/$mpr -all -s $subjid \" echo pbsubmit -f -m astevens -c \"recon-all -i $dcmdir/$s/$mpr -all -s $subjid \" >> $log
- more aliases
alias tkm "tkmedit \!* brainmask.mgz rh.white -aux T1.mgz -aux-surface lh.white -segmentation aseg.mgz -segmentation-o pacity 0.2 -tcl ~/analysis_scripts/allisons_surfaces.tcl" alias tkmwm "tkmedit \!* brainmask.mgz rh.white -aux wm.mgz -aux-surface lh.white -segmentation aseg.mgz -segmentation -opacity 0.2 -tcl ~/analysis_scripts/allisons_surfaces.tcl" alias sp 'setenv SUBJECTS_DIR pwd' alias unpack 'unpacksdcmdir -src . -targ . -scanonly scan.log'
#MUST STAY AT BOTTOM alias subdir 'echo $SUBJECTS_DIR' alias fshome 'echo $FREESURFER_HOME' alias csubdir 'cd $SUBJECTS_DIR' alias cfshome 'cd $FREESURFER_HOME'