Statistical Image Processing and Multidimensional Modeling Matlab scripts

Nearly all figures in the book showing any kind of numerical result are computer generated, rather than artificially drawn, meaning that I (the author) had to develop Matlab scripts to produce all of the figures. Therefore, to make the methods and algorithms described in this book as useful and accessible as possible, a variety of the Matlab scripts are being made available.

The intent of the scripts is certainly not to be directly applicable to large multidimensional problems. Instead, the code is provided to give the reader some simple examples which actually work, which illustrate the concepts documented in the text, and which hopefully more rapidly lead the reader to be able to do implementations of his or her own.

Therefore I wish to make available much of the code which I developed. The code is provided "as is", with no guarantees of correctness:

  • Hopefully the code is complementary to the textbook, allowing the reader to learn and understand certain concepts more clearly.
  • The code is not interactive, and in many cases does not produce nicely-formatted multi-panel figures. It is code which produces the figures which you see in the textbook.
  • You are free to take the code and edit/modify it. However if you use the code in a publication you should acknowledge it, and if you post the code you need to provide a link back to this page.
  • There are subtle variations between different versions of Matlab, Octave etc., particularly with regards to plotting commands. All of the scripts on this page were tested to run under Matlab 7.9 on a dual-core Linux machine, but should require only minor tweaks to run acceptably under other versions.
  • All of the scripts take a first argument 'printon', which determines whether to plot to file or to format for viewing on a computer screen. By default, the function plots to figures on the screen.

Because some of the scripts use other routines which I have written, it is simplest to download the complete set of scripts with support zip files, however all of the files can be downloaded individually below.

Click on any of the bold headings below to expand / collapse the individual descriptions and script links:

Matrix Condition Number (cond_num.m)

Evaluate the condition number for exponential and Gaussian point-spread functions for two different point-spread widths. Separately evaluate the likelihood of a matrix being positive-definite as a function of its condition number and the degree of random perturbation.

Parameters: none
Produces: the 17 figure panels of Examples 2.4 and 2.5
Link: cond_num.m
Requires: nice_plot.m, plotprint.m

Interpolation and Regularization (interp_reg.m)

Perform simple one-dimensional regularized interpolation given a few data points, using both first-order and second-order priors.

Parameters: none
Produces: the figure panels of Example 2.7 plus panels for an earlier version of Example 3.4
Link: interp_reg.m
Requires: nice_plot.m, plotprint.m

Cross Validation (cross_val.m)

Perform a cross-validation as illustrated in example 2.8. Cross validation is performed for flat, linear, and parabolic measurements, and for first, second, third order models. It is important to observe the interplay between the form of the measurements and the assumed order of the prior.

Parameters: none
Produces: three figures: measurements, cross-validation, and resulting estimates
Link: cross_val.m
Requires: nice_plot.m, plotprint.m, exprange.m

Matrix Banding (bands.m)

A simple script showing very basic multiplicative and inverse behaviour of banded matrices.

Parameters: none
Produces: First and second order banded system matrices, matrix inverse of banded matrix
Link: bands.m
Requires: nice_plot.m, plotprint.m

Matrix Kernels (kernels.m)

Computes 1D, 2D, 3D kernels for the first-order (membrane) and second-order (thin-plate) prior models. Also defines the 2D "wood grain" texture which is used frequently in the book.

Parameters: none
Produces: no plots, just 1D, 2D, 3D kernel definitions
Link: kernels.m
Requires: none

Kernel Correlation Length (corr_len.m)

Calculate the correlation length of 1D, 2D, and 3D kernels. Uses the fast fourier transform (FFT) method to invert the kernels, and so is a good illustration of FFT approaches.

Parameters: none
Produces: Two figures, the correlation length for first-order and second-order priors
Link: corr_len.m
Requires: kernels.m, progress.m, nice_plot.m, plotprint.m

Two-Dimensional Interpolation (twod_interp.m)

A very large 2D interpolation example with cuts, folds, and boundary conditions. The code is very complex and may require a lot of memory, especially for some of the preconditioned problems. Includes code for both preconditioning via wavelets and hierarchical triangles.

Parameters: none (6 parameters may be specified, but leave empty to generate default plots)
Produces: 16 plots of reconstructed surfaces and of iterative convergence
Link: twod_interp.m
Requires: nice_plot.m, plotprint.m

Matrix Positivity (posdef.m)

A look at issues of matrix positivity. The script computes the range of correlation coefficients over which a matrix is positive-definite, and also plots the six analytical positive-definite forms.

Parameters: none
Produces: two figures
Link: posdef.m
Requires: nice_plot.m, plotprint.m