Category: MATLAB

dssi: diced same size interpolation of volumes

dssi: diced same size interpolation of volumes

Linear interpolation is probably one of the most proliferated data processing algorithms in the world. From simple drawing of a straight line, through rescaling of images and last but not least performing affine transformations of volumetric data – all of these can be accomplished by some implementation of linear interpolation. […]

File Origin Tracker (for SPM)

If you’re annoyed by having to memorize the meaning and origin of all those thousands of files that you generate every day with SPM, I’ve got something for you. A file origin tracker that will record the checksums of all the Nifti files created by SPM, along with their origins […]

xdir.m – more powerful rdir.m

It offers the same syntax as rdir.m but differs in two major ways: 1) performs processing on pathnames from a list 2) supports relative paths in the wildcard expression To demonstrate what the above means in practical terms, assume that you have the following hierarchy: For some reason you already […]


This script loads selected SPM batch, tries to intelligently guess which fields are potential candidates for “parallel splits” and after interactively asking for confirmation: splits your batch into multiple .mat, .m and .sh files (placing them in the same directory as the original batch) – the latter being ready for […]

Efficient CSV Reader for MATLAB

This CSV reader will provide you with uncompromised performance. Thanks to the power of MEX compiler, for the first time in history you can load _HUGE_ CSV files into MATLAB in seconds. Enjoy! Usage: The attached archive contains compiled MEXW64 version. For other OS/architecture you need to: DOWNLOAD:

Handling Java objects in MEX files

In case you are right now having the same doubts as author of this post, I might have some good news for you. The following snippet of code was supposed to be part of my upcoming Weka toolbox for SPM8. It copies content of a 2-D full real MATLAB array […]

mat_joy – MATLAB Interface for Joysticks

Admittedly, it already exists – but its awkward way of doing things (exposing functions using ActiveX server) was a bit of overkill for our needs. Hence, this stripped down, pure MEX version. Enjoy. Usage: [position, buttons] = mat_joy(joystick_id), where: joystick_id – joystick identifier (0-15), position – list of joystick […]

Save SPM8 results with anatomical labels

Hi there! This little script saves cluster-level SPM results along with anatomical labels to spm_results_with_anat.txt file in the current directory. Results are appended to the file, so that you can run it repeatedly for different contrasts. It requires SPM8. Included are AAL atlas files: aal_MNI_V4.nii, aal_MNI_V4.txt and atlas to anatomical […]

Faster dot product for SVM

If you’ve ever used SVM for classification of 3D images, you’re probably a big fan of the kernel trick as it improves SVM performance significantly when working with such huge sets of features. I’m working in neuroscience at the moment and I think it’s fair to say that using SVM […]


Just in case you’re missing the Stats toolbox, a KMeans implementation for MATLAB. DOWNLOAD: