Skip to content

R package bayesImageS

My R package, bayesImageS version 0.1-21, is now available online. It uses a hidden Potts model with additive Gaussian noise for image segmentation of 2D and 3D datasets. The latent labels z can be simulated using chequerboard updating or the Swendsen-Wang algorithm. Several methods for full Bayesian inference with intractable likelihoods are supported, including pseudolikelihood, the exchange algorithm, path sampling, and approximate Bayesian computation (ABC-MCMC & ABC-SMC).

The R source package is released under the GNU General Public License, version 2. Its computational engine is implemented in C++ using RcppArmadillo and OpenMP. There is zero documentation available at present, but I’m working on that…

Thesis submitted, articles in press

The process for Australian doctoral candidates is different from Europe and elsewhere. Due mainly to geographic isolation, there is no “viva voce” where external examiners are invited to interrogate the candidate in person. Rather, there is a public seminar followed by a meeting with the university thesis committee. Once recommended changes to the thesis have been made, it it sent to the external examiners for review. So if you’ve recently received my thesis in your inbox, then thanks in advance!

Some of my thesis papers have recently appeared online:

“Pre-processing for approximate Bayesian computation in image analysis”
Moores, Drovandi, Mengersen & Robert (2015)
Statistics & Computing
 25(1): 23-33. DOI: 10.1007/s11222-014-9525-6

“An external field prior for the hidden Potts model, with application to cone-beam computed tomography”
Moores, Hargrave, Deegan, Poulsen, Harden & Mengersen (2015)
Computational Statistics & Data Analysis 86: 27–41. DOI: 10.1016/j.csda.2014.12.001

Software Inventory for Mac OS X

Previously I listed all of the software that I usually install on Windows 7. Now that I’ve got an iMac with OS X Mavericks, it’s time to give an updated list:

From the App Store

Follow these instructions for installing the Command Line Tools (you don’t need a full install of Xcode on Mavericks)

xcode-select --install

From other websites

R 3.1.1
RStudio 0.98.1056
MacTeX 2014 (including TeX Live & TeXShop)
XQuartz 2.7.7 (X11 windowing system for OS X)
Skype 6
MS Office 2011


gcc and gfortran 4.9.0 from “High Performance Computing for Mac OS X

  • requires sudo to untar into /usr/local/bin
  • don’t forget to edit your Makeconf using these instructions

Problems with Gate Keeper

JabRef 2.10
ImageJ 1.48

Big Data, Big Models, it is a Big Deal


I’ve submitted a poster to the Network on Computational Statistics and Machine Learning (NCSML) workshop “Big Data, Big Models, it is a Big Deal” at the University of Warwick on the 1st & 2nd of September. More details are available from the workshop homepage. My abstract is as follows:

Scalable Bayesian computation for intractable likelihoods in image analysis

The availability of inexpensive, high-quality imaging has given scientists the capacity to generate more data than ever before. In medicine, some patients are scanned daily throughout their course of treatment, to monitor their progress as well as for image-guided therapies. Satellites such as Landsat and MODIS orbit the globe, regularly providing remotely-sensed imagery of the Earth’s surface. Automated methods of image analysis are vital in order to keep pace with the volumes of data that are generated in these settings. Increases in image resolution and sample depth have improved the quality of these images, but this has also resulted in a vast increase in the size of the digital representation. Many methods that were originally developed for much smaller images are infeasible for the image dimensions that are required by current applications. Thus, the scalability of automated methods to meet the needs of real world data is a major concern.

The hidden Potts model is widely applied in image analysis to segment the image pixels and label them according to their underlying classification. The inverse temperature parameter of this model governs the strength of spatial cohesion and therefore has a substantial influence over the resulting model fit. The difficulty arises from the dependence of an intractable normalising constant on the value of the inverse temperature, thus there is no closed form solution for sampling from the distribution directly. We review three computational approaches for addressing this issue, namely pseudolikelihood, path sampling, and the approximate exchange algorithm. We compare the accuracy and scalability of these methods using a simulation study.

This is joint work with Clair Alston and Kerrie Mengersen, Queensland University of Technology, Australia.

PhD Final Seminar

Thesis Title: Bayesian Computational Methods for Spatial Analysis of Images.

Candidate: Matthew T. Moores

Discipline: Statistical Science

Review Panel:
Prof. Ian Turner
Prof. Tony Pettitt
Dr. Fiona Harden
Dr. Chris Drovandi

This thesis is motivated by an important applied problem in image-guided radiation therapy. The aim is to assist in interpreting cone-beam computed tomography (CT) of radiotherapy patients by labelling the image pixels according to tissue type. These medical images have poor contrast-to-noise ratio (CNR), thus external sources of information are needed for accurate segmentation. Such sources include the individualised treatment plan, which is based on a diagnostic-quality CT scan that has been manually labelled by a clinician. We also use published studies of physiological variability to derive an estimate of spatial uncertainty.

To address this problem, we adopt a hidden Potts model of the image lattice. We introduce a method for deriving and representing the spatial prior for each patient as an external field in the hidden Potts model. Tissue density estimates are derived from the planning CT and adjusted to account for differences in image modality, forming priors for the noise parameters. These priors can be updated sequentially as more images of the patient are acquired.

Scalable computational algorithms are required for Bayesian inference on 3D volumetric images of this size. We evaluate the existing methods for intractable likelihood problems, including path sampling, pseudolikelihood and the approximate exchange algorithm. We introduce a precomputation step that involves fitting a binding function between the parameters and sufficient statistic of the Potts model. Using this precomputation, we achieve two orders of magnitude improvement in the scalability of approximate Bayesian computation with sequential Monte Carlo (ABC-SMC).

Matthew completed a Bachelor of Information Technology at QUT in 1996 and a Master of Mathematical Science in 2008. Prior to commencing his PhD, he was involved with the Visible Cell project at the Institute for Molecular Bioscience, UQ. He has also worked in R&D for various international companies, including DEC, Compaq and Oracle. He was a member of the development teams for the FaceWorks facial animation software, SpeechBot multimedia search engine, AgileTV speech-enabled programme guide, and the Healthcare Transaction Base. Matthew’s research interests include computational statistics, Bayesian inference, and image analysis

ABC in Sydney


I’ve been invited to give two seminars this week at UNSW. Full details available here:

1:30pm, Thursday July 3: Intro to approximate Bayesian computation (ABC)

4:10pm, Friday July 4: Pre-processing for ABC-SMC with undirected graphical models

ABC is a useful method for Bayesian inference with intractable likelihoods, but existing algorithms require a large number of simulations of pseudo-data from the generative model. The computational cost of these simulations can be prohibitive for high-dimensional data. In this talk I will show that the scalability of ABC-SMC can be improved by performing a pre-computation step before model fitting. The output of this pre-computation can be reused across multiple datasets. I illustrate the approach using undirected graphical models, including the hidden Potts model for image analysis of large datasets.

This research is a collaboration with Christian Robert, Kerrie Mengersen, Chris Drovandi and Antonietta Mira.



This is the first in a series of posts describing the functions and algorithms that I have implemented in the R package bayesImageS.

Gibbs sampling was originally designed by Geman & Geman (1984) for drawing updates from the Gibbs distribution, hence the name. However, single-site Gibbs sampling exhibits poor mixing due to the posterior correlation between the pixel labels. Thus it is very slow to converge when the correlation (controlled by the inverse temperature β) is high.

The algorithm of Swendsen & Wang (1987) addresses this problem by forming clusters of neighbouring pixels, then updating all of the labels within a cluster to the same value. When simulating from the prior, such as a Potts model without an external field, this algorithm is very efficient.

The SW function in the PottsUtils package is implemented in a combination of R and C. The swNoData function in bayesImageS is implemented using RcppArmadillo, which gives it a speed advantage. It is worth noting that the intention of bayesImageS is not to replace PottsUtils. Rather, an efficient Swendsen-Wang algorithm is used as a building block for implementations of ABC (Grelaud et al., 2009), path sampling (Gelman & Meng, 1998), and the exchange algorithm (Murray et al., 2006). These other algorithms will be covered in future posts.

Read more…

Darren Wilkinson's research blog

Statistics, computing, data science, Bayes, stochastic modelling, systems biology and bioinformatics

Not So Standard Deviations

A statistics (etc.) blog by Hilary Parker

LingPipe Blog

Natural Language Processing and Text Analytics

Retraction Watch

Tracking retractions as a window into the scientific process

The official blog for Stat the ISI's journal for Rapid Dissemination of Statistics Research


Computational Bayesian statistics

StatsLife - Significance magazine

Computational Bayesian statistics

(badness 10000)

Computational Bayesian statistics

Igor's Blog

Computational Bayesian statistics

Normal Deviate

Thoughts on Statistics and Machine Learning

Steven Mosher's Blog

Creative License


I can't get no

Xi'an's Og

an attempt at bloggin, nothing more...

The Thesis Whisperer

Just like the horse whisperer - but with more pages

Robin Ryder's blog

Statistics and other stuff

statistical society australia

A virtual meeting place for statisticians

Sam Clifford

Postdoctoral Fellow, Bayesian Statistics, Aerosol Science

Bayesian Research & Applications Group

Frontier Research in Bayesian Methodology & Computation


Get every new post delivered to your Inbox.

Join 226 other followers