Tksurfer display problems and solutions

The surface display app 'tksurfer' is an X11-app making use of OpenGL for graphics rendering. The complexity of this sort of app is described in detail here.

The most common problem encountered in using tksurfer for the first time on a system, or over a VNC connection, is the 'sliver' problem, where just a 'sliver' of the surface is displayed, as shown in the bottom-left of this picture:

There are a few potential solutions you can try to overcome this problem:

NVidia driver update

If your system has an Nvidia graphics driver, then updating this to the latest version often times fixes the problem. To do this:

su root
/sbin/init 3
/usr/bin/nvidia-installer --update

Follow the instructions of the installer

ATI driver update

If your system has an ATI graphics driver, updating to the latest version (Catalyst 10.2 or newer) has fixed the problem. Disabling SELinux is necessary prior to attempting this update:


tksurfer can read a flag which controls rendering. Setting that flag has been known to fix the sliver problem. To do this, in csh:

setenv doublebufferflag 1

In bash:

export doublebufferflag=1

Then start tksurfer.


The VirtualGL project is software that would be appropriate if your sliver problem appears when using a VNC connection, where often its the case that the local OpenGL renderer (for instance, on your laptop) doesnt fully support GLX. So you would download and install VirtualGL on your server (your sysadmin would do this), then you would run ssh or vnc from your client computer to the application server, then run:

/opt/VirtualGL/bin/vglrun tksurfer bert lh inflated

Override native graphics libraries

It might be the case that the graphics libraries installed when the Nvidia or ATI card is installed overwrites the natively installed drivers, that is, overwrites from Mesa that comes with RedHat. A solution at the NMR Center is to keep a copy of those libs elsewhere prior to conducting any driver update, so that those drivers can be used via LD_LIBRARY_PATH later if the newly installed drivers fail in some circumstance (typically when used in a VNC situation). In the NMR Center, this is done by including this in your .cshrc file or setting prior to running tksurfer:

setenv LD_LIBRARY_PATH /usr/lib64/GLoverride:/usr/lib/GLoverride


You can run a virtual machine that runs freesurfer. There is a VirtualBox version of freesurfer available for Windows from the freesurfer download site. See the README associated with it for installation instructions.

Note: VirtualBox does seem to support GLX as section 4.9 of the manual here explains:

It says it is experimental and has some very specific requirements. One of which is Xorg 1.5 or higher and CentOS 5 has only Xorg 1.1. So you would have to try Ubuntu 8.10 or Fedora 10 or higher. The VirtualBox download linked above is to an Ubuntu vm so GLX apps like tksurfer should work.

Vmware does not support GLX. We found this out on a Mac, trying to use VMware Fusion to run CentOS.


If all else fails, and tksurfer still doesnt work, you can try using a new app call freeview slated to replace tkmedit and tksurfer, once enough functionality is incorporated. To run it, see the help:

freeview --help


cd <subjid>
freeview --volume mri/T1.mgz \
  --surface surf/lh.white \
  --surface surf/rh.white \
  --surface surf/lh.pial:annot=aparc.annot \
  --surface surf/rh.pial:annot=aparc.annot

Mac Tksurfer

See MacTksurfer

TksurferDisplayProblems (last edited 2012-05-28 15:22:03 by NickSchmansky)