Minimum Phase Image InterpolationThe function below implements smooth phase interpolation between two images. It solves some problems with previous phase interpolation methods by interpolating in the direction of minimum phase, either clockwise or counter-clockwise. In our study of face detection (Ales, Farzin, et al. 2012) we wanted to smoothly vary the visibility of a face while measuring visual evoked potentials. There were several previous methods that held the power spectrum constant and interpolated between a random phase image and a final intact image. But because phase is a circularly distributed value and previous methods either ignored this fact, or worked around it, they suffered from artifacts due to non-uniform phase steps. For more details see the methods section of Ales, Farzin, et al. 2012.
Image Scrambling Using the Fourier TransformControlling for low-level features is a commonly needed for visual stimuli. One way to control low-level features is to enforce identical power spectrums. The following functions provide some useful scrambling code. To randomize the phases and keep the power the spectrum the same use phaseScrambleImage(). Less useful, is powerScrambleImage() which replaces the power spectrum with gaussian white noise.
Fast calculation of the area under the ROC curveThe area under the ROC curve is a useful measure for asssesing discriminability. The simple way to calculate the area numerically integrates the curve. Numerical integration can be slow. However, it turns out you can calculate the quantity with a simple sort and sum. This works because the area under the ROC curve is equivalent to the Wilcoxon signed-rank test.
Suggested Reading: Hand & Till (2001) A Simple Generalisation of the Area Under the ROC Curve for Multiple Class Classification Problems. Machine Learning paper link