Thursday, 17 April 2014

Tree of Plants

Everyone knows what plants are like; they have leaves and roots, flowers and seeds. Or do they? All of these classic features of plants are actually relatively recent developments in plant evolution. Conifers don't have flowers, ferns don't have seeds or flowers and moss doesn't have leaves, roots, seeds or flowers! Leaves, roots, flowers and seeds are all features that evolved as plants adapted, starting at something like seaweed, to life on the land.

This term's issue of Phenotype has a bit of a focus on plants, and my research comic for this issue focuses on how plants evolved and adapted to land. You can download a pdf of this feature here, the full issue for the summer (Trinity) term will be available soon here.


While I was making this I started reconsidering just what the plant life cycle looks like, as a classic school education about how plants reproduce isn't very accurate! The classic teaching is that the pollen produced by a flower is like sperm in mammals (and humans), and the ovum in the flower is like the egg in mammals. In fact pollen and the developing seed are more like small haploid multicellular organisms, gametophytes, that used to be free living. If you go back through evolutionary time towards ferns then the gametophyte is a truly independent multicellular organism. Go back further still and the bryophytes spend most of their time as the gametophyte.

If you imagine the same evolutionary history for humans then it is easy to see how different this life cycle is to animals; if the ancestors of humans had a life cycle similar to ferns then, roughly speaking, ovaries and testicles would be free-living organisms that sprout a full grown human once fertilisation successfully occurs. I can't help but think that would have been a little strange!

Software used:
Autodesk Sketchbook Pro: Drawing the cells.
Inkscape: Page layout.


Thursday, 10 April 2014

Cells and Worms - 2. The Shirt

Last post I talked about how seeing how many worms overlap if you drop them on a patch of ground, how (somehow) this was vaguely related to my scientific research, and that the simulation of this process even generates quite nice pictures. If you thought that was geeky, then this takes geekyness to a whole new level!

Part of my research has been into the shapes of trypanosome parasites. Trypanosomes that cause disease in people are fairly widely known (you might have heard of sleeping sickness, Chagas disease, or leishmaniasis) but trypanosomes don't just infect people. Trypanosome species have also been found infecting animals from sharks to penguins, crocodiles to elephants. There is even one species named after Steve Irwin (the crocodile hunter) that infects koalas!

A scanning electron microscope image of Trypanosoma brucei, the trypanosome which causes sleeping sickness.

In short, I did some research to test whether there were particular characteristic shapes of trypanosomes (length, width, etc.) that look like they might help the parasite survive in the bloodstream of different host animals. I made a big database of properties of trypanosome shape and, using the scripts I made to draw nicely tesselated trypanosome shapes I talked about in the last post, I put together a compelling summary of just how varied trypanosome shapes from different host species are are:


The science behind this picture suggests some interesting adaptation to help the parasites swim within their host bloodstream, but that's enough about the science. To me this pattern was just begging to be on a shirt, an abstract design with a biological twist!

Spoonflower is a fantastic online service where you can order customised fabric, wallpaper and other prints. So that is exactly what I did, and after some sewing (that I didn't do myself) I am now the proud owner of the world's only 100% scientifically accurate trypanosome shirt, featuring 27 different trypanosome species.


Scientists always say that research can take you down unexpected paths. This path from wriggly worms, through an image generating script, through research into trypanosome shape, to the world's only trypanosome shirt was quite an unexpected one!

Software used:
ImageJ: Automated trypanosome drawing.
Inkscape: Conversion to vector graphics for printing.

Wednesday, 9 April 2014

Cells and Worms - 1. The Theory

If you scatter 100 worms on a patch of soil 1 meter by 1 meter how many worms will fall on top of another worm? This might seem like a really pointless question, but it is surprisingly relevant to biological research using microscopes. It's also a surprisingly hard question to answer because worms are very wriggly! However, even this dry, theoretical, research problem provides the tools for making fun illustrations...


My work involves a lot of automated image analysis; taking a picture from a microscope and automatically analysing it to extract scientific data. To make sure an automated analysis is reliable you have to think about all the likely problems that might turn up, and with cells and microscopes a common problem is when two cells are lying on top of each other. The problems this causes are easy to imagine; if there are two cells with one nucleus lying on top of each other then it might look like one cell with two nuclei.

For some types of cells it is quite easy to work out how likely two are to touch or lie partly on top of each other when they are scattered randomly over a microscope slide. An example of an easy case is where all cells are circular and the same size; the approximate calculation is quite simple. Unfortunately the cells I work on are more worm-like in shape, about 17 microns long and 2 wide... if you scatter these cells over a slide how many will end up touching?

To work out the answer simulation is vital; the maths is just too complicated to do it analytically. A simulation of worm-like shapes proved to be quite simple:
  1. Pick a random starting point, direction and curvature.
  2. Start drawing a curved line from that point.
  3. Occasionally re-randomise the curvature.
  4. Stop once you have reached the length of the cell.
  5. Draw the profile of the cell shape along that curve.
Following these simple rules and tweaking the parameters (e.g. the minimum and maximum curvature, frequency of randomising curvature, etc.) gives a simple algorithm for drawing a worm-like shape. With a bit of tweaking it could draw cells that look like trypanosomes. Using this drawing tool it was possible to measure the chance of a cell touching or lying on top of another cell already on the microscope slide. Just repeat the drawing process thousands of times and detect whether the newly drawn cell intersects with any previously drawn ones. Problem solved.

This process gave me the answer I needed, but it also provided a tool for drawing trypanosome-like shapes. Better than that, it was easy to adapt it to make sure no two cells overlapped and they fitted neatly together over the image... And just like that a dry, theoretical, research problem turned into a beautiful image:


This was also easy to adapt to other worm-like shapes, like earthworms:


Software used:

Thursday, 3 April 2014

Cheeky


Human cheek cells are a classic subject of school microscopy. It is easy to collect some by gently scraping the inside of your cheek. This is a high resolution phase contrast image of one of my cheek cells, put together using focus stacking of a 4 by 4 montage of 57 focus slices using one of my ImageJ macros. The detail of the nuclear structure, the granular contents of the cytoplasm and the structured surface of the cell really jump out.

This cell is quite large for mammalian cells, about 75 μm across, and around 10 times larger than the single cell Leishmania parasite I currently do much of my research on. If you have sharp eyesight you can even see human cheek cells by eye (although only just) when they are spread on a slide.

Like most mammalian cells, cheek cells are essentially transparent. If you use a microscope in the most basic way, essentially as a giant magnifying glass, shining light straight through the sample towards your eye, you see something like this:

Bright field micrograph of a human cheek cell.

This picture has even had the contrast artificially enhanced. Practically it is tough to even find the cells on the slide and get them in focus!

For many years the best alternative was oblique or dark field microscopy. Here you deliberately avoid shining light straight through the sample, and instead make sure that only light scattered by structures in the sample can collected by the objective lens and get up to your eye.

Dark field micrograph of a human cheek cell.

Images by dark field microscopy can be hard to interpret, and are typically limited to fairly low resolution.

More complex methods based on interference of light travelling through the sample were developed in the 20th Century. These methods, phase contrast and differential interference contrast, were a revolution. They allowed completely new approaches for looking at the biology of cells, particularly live cells and dynamic processes like cell division. They were such a revolution that the inventor of phase contrast microscopy, Frits Zernik, was awarded the Nobel prize in Physics in 1953 for this work.

Phase contrast micrograph of a human cheek cell.

DIC micrograph of a human cheek cell.

It was not until the development of the famous green fluorescence protein, for fluorescence microscopy in live cells in the 1990s, that there was another discovery which improved the capacity for live cell microscopy to the same extent as phase contrast and DIC.

Software used:
ImageJ

Friday, 28 March 2014

Monroe, Einstein and Visual Acuity

The recent Mirror newspaper advert in the UK has brought a classic optical illusion back into the public eye; a hybrid image of Marilyn Monroe and Albert Einstein which, up close, looks like Einstein but from further away, or with squinted eyes, looks like Marilyn.


Try it out! From close up Einstein's trademark hair and moustache jump out, but squint or stand back from the screen and you can see a classic shot of Marylin's curls, eyelashes and smile. A version of this illusion was first made by Aude Oliva for a feature in New Scientist, and it is a really striking example of a hybrid image illusion.

So what is your brain doing? And how can you make an image like this? Making an image is actually quite simple. First of all take pictures of these two pop icons with similar(ish) lighting and align them so their main features (eyes, mouth, overall face) are at the same size and position in the images:


The trick is then to to use a Fourier bandpass filter to filter out low frequency structure in the Einstein image, and filter out high frequency structure in the Marylin image. You can find Fourier bandpass filters (sometimes called FFT filters) for many image editing programs.

So what is a Fourier bandpass filter? Without diving into too much maths it is a way of separating out information based on its wavelength. Filtering out low frequency structure in an image leaves only the short wavelength features, i.e. fine lines and sharp edges, while filtering out high frequency structure leaves only the long wavelengths, i.e. the general brightness of different parts of the image.

 Einstein with a <5px bandpass="" filter="" fourier="" p="" wavelength="">

 Marylin with a >10px wavelength Fourier bandpass filter

Fourier bandpass filters are easier to intuitively understand with sound rather than an image. It might help to imaging using a Fourier bandpass filter on some music; a low frequency (long wavelength) bandpass filter would leave only the bassline and bass drum, while a high frequency (short wavelength) bandpass filter would leave vocal lines and high pitched instruments and drums.

If you are more mathematically minded it might be useful to imagine this through some graphs. These are plots how bright the image is as you go along a line across the middle of the two images. It is easy to see that the filtering of the Einstein image only leaves the short wavelength data, and the filtering of the Marylin image only leaves the long wavelength data:


You can also imagine a long wavelength Fourier bandpass filter as a blurring, and a short wavelength Fourier bandpass filter as the inverse of blurring; grabbing the details that are lost when the image is blurred.

Having made the two Fourier bandpass images it is simply a matter of averaging the two together to get the final product:


So how does it work? The trick is simply based on a limitation of how well you can see. From a greater distance your eyes are less able to see the fine detail of the image, so your brain interprets only the big structures. In this case this leaves your brain to latch onto the Marylin part of the image, helped by the fact that many of her photos are extremely recognisable.

From closer in your eyes can now resolve the fine detail in the image, and your brain does its best effort at interpreting a slightly messy image. Because both the photo of Einstein and Marylin are kind of similar (light skin on a dark background, with big hair) your brain can do a decent job of merging the fine detail of Einstein's face onto the general light and shadow of Marylin's face.

By switching the filtering of the two images you can get the reverse effect...


... although I do find Marylin's teeth in this photo quite terrifying!

Software used:

Monday, 24 March 2014

Finding Circles

Today's random image processing tip: finding circles in images. Circular structures pop up all over the place, from craters on Mars to cross-sections through microtubules inside cells, and automatically detecting them in an image is often really useful! Take this starting image:

An electron microscope image, with the circular crossection of a microtubule.

Using the right filter, circular structures like the microtubule pop out as bright spots. Bright spots are then easy to pull out for later automatic image analysis steps.

 The electron microscope image after filtering.

The trick is use to use a kernel filter designed to find circles. Kernel filters are most commonly used for quickly filtering or sharpening a picture: this simple kernel finds edges in an image:

0  1  0
1 -4  1
0  1  0

Applying a kernel to an image is done by looking at each pixel in turn, and setting its new value according to the values in the kernel. In this example the new pixel value is equal to -4× the current pixel, plus 1× the pixel above, left, below and right of the current pixel.

To find circles the kernel should look like a circle. To find the microtubule in the electron microscope image this kernel, a circle the same size as the microtubule, was used:


This image can be represented as a matrix of numbers, which can be applied as a kernel:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 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something like this yourself? This ImageJ macro will get you started.

Software used:
ImageJ

Thursday, 30 January 2014

Figuring Out Good Figures

The main point of doing scientific research is to share the things you discover. After all, what is the point if discovering something if no one knows about it, to work or learn from it? Science is typically shared in research papers, but the actual date is normally just in the figures (the graphs and images) while the the text describes what it means (as I have talked about before). Sharing scientific data is important, therefore good design of figures is also important. So how do you make a good figure?

Each term I make a research comic for the Oxford University Biochemical Society magazine called Phenotype. This one is all about figuring out figures. How do you make a good one, and how can you avoid getting tricked by bad ones?



Check out the comic here, the whole issue is available to download for free from here.

Software used:
Inkscape: Page layout and drawing.