SurfRelax is a set of programs and Tk/Tcl scripts, with a GUI wrapper, for extracting cortical surface models from anatomical MR images of the brain. SurfRelax is based on the TFI C++ library and is written for a Unix-based environment.
SurfRelax is developed under and performs best under Linux (specifically 64-bit and 32-bit versions of Ubuntu), though as a courtesy to Apple users I will try to maintain a version for Apple/X11. Beware, however, that the OS X version will always lag the Linux version; also, because some of the third-party libraries SurfRelax relies on may not be supported in or compatible with future versions of OS X, I cannot guarantee that the OS X version will be supported indefinitely.
Although in principle SurfRelax could be run under Windows (using Cygwin), because of the difficulties of maintaining multiple platforms and the limited support libraries available under Cygwin, I no longer support SurfRelax on this platform. This should not be much of a problem, however, sincein a world without walls and fences, who needs windows and gates?
For more information, refer to the documentation (somewhat outdated but mostly accurate).
MGL is a library for Matlab and Octave that allows easy programming of visual (and some auditory) stimuli using OpenGL. Current versions run on Mac OS X, Linux, and a Windows port is underway. MGL was developed jointly by myself and Justin Gardner at New York University, but several other people have also contributed; see the documentation for details.
Example code (draw some dots on a second screen):
>> mglOpen(2,800,600,60,32); % Open screen 2 (second monitor) % with 800x600 resolution at 60Hz >> mglVisualAngleCoordinates(57,[16 12]); % Set coordinate frame to visual angle % using a 16x12 cm monitor at a % viewing distance of 57 cm >> mglClearScreen; % Clear back buffer >> mglPoints3(16*rand(500,1)-8,12*rand(500,1)-6,zeros(500,1),2,1); % Draw 3D points on back buffer % (in visual angle coordinates) >> mglFlush; % Swap buffers to show points >> mglWaitSecs(1); % Wait for 1 sec >> mglClose; % Close screen
Matlab and Octave library for reading and writing Nifti-1 files. Unlike the fslio library, cbiNifti makes fairly minimal assumptions about what Nifti files should look like and will not do silly things like setting the x dimension to negative or force the image size to 1x1x1 voxels (unless the image really is that size).
UPDATE: cbiNifti now handles compressed file formats for reading and writing. Compression and decompression is handled by Unix pipes, and probably does not work under Windows (though it might work with Cygwin).
Note though that compression of MRI data is not always optimal, as non-lossy compression - such as gzip - is only efficient for data with highly correlated measurements. MRI data are normally highly uncorrelated, the main exception being anatomical images where the background has been masked to a single value. Typically, fMRI data is only reduced by about 10% in size by compression, but the extra processing time to compress and uncompress files can be substantial. Caveat emptor.
cbiNifti requires the mlpipe library (see below).
Example code (averaging two images):
>> [data1,hdr1]=cbiReadNifti('myNiftiFile1.img.gz'); >> [data2,hdr2]=cbiReadNifti('myNiftiFile2.nii'); >> data=(data1+data2)/2; >> [byteswritten,hdr3]=cbiWriteNifti('myNewFile.nii.gz',data,hdr1,'float32'); Warning: scaling data from double to float32 To avoid this, cast data to desired format before calling cbiWriteNifti, e.g. cbiWriteNifti('myfilename',int16(data),hdr,'int16') >> disp(hdr3) single_file: 0 hdr_name: 'myNewFile.hdr' img_name: 'myNewFile.img' endian: 'b' sizeof_hdr: 348 dim_info: 57 dim: [8x1 double] intent_ps: [3x1 double] intent_code: 0 datatype: 16 bitpix: 32 slice_start: 0 pixdim: [8x1 double] vox_offset: 0 scl_slope: 1 scl_inter: 0 slice_end: 255 slice_code: 0 xyzt_units: 10 cal_max: 3820 cal_min: 0 slice_duration: 0 toffset: 0 descrip: 'FSL3.3 v2.01 NIfTI-1 Dual file format ' aux_file: ' ' qform_code: 1 sform_code: 1 quatern_b: 0 quatern_c: 1 quatern_d: 0 qoffset_x: 87.5000 qoffset_y: -127.5000 qoffset_z: -127.5000 srow_x: [-1 0 0 0] srow_y: [0 1 0 -127.5000] srow_z: [0 0 1 -127.5000] intent_name: ' ' magic: 'ni1 ' matlab_datatype: 'float32' is_analyze: 0 qform44: [4x4 double] sform44: [4x4 double]
Functions for reading and writing to Unix pipes and compressed files. To use, you need to compile the mlpmex.c file (mex mlpmex.c).
Octave toolboxes for Matlab
Octave has lately become a serious open-source rival to Matlab, and current versions can do almost everything Matlab can (except the GUI), making Octave an eminent and free substitute for Matlab. What's more, there are many more toolboxes available for Octave than for Matlab, some of which replicate most of the function of various Matlab toolboxes. Since Octave is mostly source-compatible with Matlab, I decided to translate some of these functions to work under Matlab (as well as under Octave). Unless you are in dire need of every function provided by Mathworks' image processing and statistics toolboxes, you are likely to find these Octave translations fine substitutes, and they have the benefit of being free. Coming soon.
An iDiot's guide to Linux
At one point I intended to summarize the reasons I decided to switch from OS X to Linux, and why I believe Linux remains the superior platform for scientific computing, but fortunately Apple has done the job for me - but if you don't find self-igniting power packs, external hard drives that self-destruct after 12 months, mobile phones that cannot make calls, or the ethics of supporting a company that is supposedly bigger than Exxon to be sufficient evidence why you shouldn't buy a Mac, then ask yourself what OS you would trust to run the world's fastest computers?