Tuesday, 13 December 2011

Image Processing: Paper Camera

The "Paper Camera" style of image, a kinda faux-sketch view of the world, is actually a very simple set of image processing steps:

1. Take an image (this is Franklin bridge in Philadelphia):


2. Find the edges in the image and make them into a dark outline:


3. "Posterize" the brightness to make it look cel-shaded:



 4. Layer the edges onto the posterised image and desaturate slightly:



You can download this filtering effect as a plugin for ImageJ from my website: here.

Software used:
ImageJ - Scripting and image processing

Monday, 12 December 2011

Stop talking about economics; placebo effects and the recession.

It is no surprise that the current economic turmoil has been so bad and lasted so long. This is the first recession of the post internet era, an age where mass media of all forms turns over with incredible speed and can spread word around the globe in seconds. Even when the dot com bubble burst in the early 2000s there was nowhere near the current level of instantly published online news, social network gossip and digital or cable TV with dozens of news channels vying for content.

One part of how economic difficulties arise is the perception of a rise in economic risk. At first this worry hits the investors, people who carefully follow the latest economic news, but in time non-experts, us consumers, become aware of it. And as we see the risk we spend less, saving our cash for harder times which seen to be approaching.

So which came first, the recession or the news story? In the past it was probably the recession which came first, at least to some extent. The modern media system means that now it is often the news story that comes first, a forecast of future economic problems "sells papers", or rather makes people read the website and watch that TV channel...

Economic forecasts are a placebo, and often not a good one. Imagine your weekly shopping, would you really notice if your £50 weekly food shop cost £0.10 more each time? It would take quite a long time... On the other hand you probably would notice if the panicky news headline said "Inflation Hits 10%!". Many people would probably not be affected by these price rises but the psychology of it, being told to worry, is a negative placebo.

Because economies are driven by speculation of risk by telling people there will be economic problems you will get economic problems; you can make an economy ill by telling it that it will get ill. This is just like the negative placebo effect in medicine, if you give someone sugar pills and tell them that they will make them feel ill many of them will somehow get ill. The solution is simple though, just stop talking about the economy, stop taking the sugar pills!

‹/rant›

Read about the "nocebo" (negative placebo) in medicine here: The Nocebo Effect an award-winning article by Penny Sarchet.
Nocebo at Wikipedia.

Thursday, 27 October 2011

Macro Microchip

To see this (much) bigger click here. This is a single integrated circuit die only 3 by 2 mm in size... The thin silver wires radiating from the edges of the die connect the integrated circuit to the legs of its case. The two large greyish patches are the chip's memory, this is an EPROM chip which stores data or programs. The data can be erased by shining a bright UV light onto the microchip. The other fine detail is the control circuitry which lets the chip actually access its memory, write to the memory and function as a microcontroller.

This picture was taken with a Canon 450D using a reversed 18-55mm lens set to 18mm.

Software used:
UFRaw - For RAW to jpeg conversion with colour balancing, etc.


Wednesday, 21 September 2011

Scientific Icons


If you have ever searched for scientific icons (unlikely but possible) you will have found it is nearly impossible to find decent ones...

I thought it was time to change this; download my new set of 22 scientific icons here: SciIcons

Software used:
Inkscape

Tuesday, 16 August 2011

Eggs, eggs, eggs.

(Sigma 18-200mm f/3.5-6.3 DC @ 200mm)
So for anyone up for a challenge... Whose eggs are these?
(Canon 18-55 mm f/3.5-5.6 EF-S on 2cm extension rings @ 35mm)
 They were laid on a cherry tree leaf, neatly covering the lower half of it, and were seen on the 14th Aug.
(Canon 18-55 mm f/3.5-5.6 EF-S on reverser mount @ 18mm)
They are very small, around half a millimetre each, and a blue-grey colour with a slight hint of iridescence... They are definitely a moth or butterfly's eggs, but which species?

Software used:
UFRaw
ImageJ

Thursday, 23 June 2011

Colouring SEMs

Scanning electron microscopes (SEMs) are the source of some of the most iconic science pictures... The problem is that they only work in black and white.

SEMs don't use light to create the image, instead a beam of electrons is fired at the surface and the ones which bounce back or are reemitted are detected. This gives a (very cool) looking picture that would be impossible to get with light but means that colours aren't detected...

The distinctive look of SEM images is because of the way edges of objects in the image appear; unlike most visible light photos the edges of objects are lighter than the middle. By detecting which way the slopes in the image are facing we can fake different coloured light falling onto the sample, I use a red light from the top, a green light from the bottom left and a blue light from the bottom right. This makes the image really come alive and gives it an even stronger sense of 3D.


Technically this colourisation method is mapping hues to the angle of orientation edges in the micrograph. The saturation of the illumination is based on the roughness of the texture at that point in the image and the value (brightness) is simply copied from the original micrograph.

The ImageJ macro I wrote to do this can be downloaded here.

Software used:
ImageJ

Image credit:
http://commons.wikimedia.org/wiki/File:Coleus_leaf_trichomes_SEM.jpg (public domain)

Sunday, 1 May 2011

Trendy and Elemental

You can explore the properties of the periodic table interactively here, and you each one of the periodic table images links to an interactive version showing the same data.

The periodic table is an amazingly elegant arrangement of the elements based on the electron configuration of the atoms... Its power lies in its predictive abilities; clusters of elements in the periodic table have similar properties and there are distinctive trends across the table. This inspired me to make a website where you can explore these trends interactively.

Some of the classic trends are:
Atomic radius (darker colours indicate smaller atoms)
Thermal conductivity (darker colours more conductive, this reflects metallic character)Ionisation energy (darker colours indicate less energy is required to remove an electron)These are just the boring "classic" trends though... You can look at lots of other properties of the elements. The stability of the nucleus (linked with radioactivity) also gives some interesting patterns:
Radioactive decay half life (darker colours indicate more unstable elements, greyed out elements are not radioactive)
There is a clear pattern, only elements with a large number of protons are radioactive, with two exceptions; Tc (Technetium) and Pm (Promethium) which fall out of this sequence... What causes this? We can work it out by looking at the number of stable isotopes for each element, i.e. the number configurations of neutron number for an element which are not radioactive.

Number of stable isotopes (darker colours indicate less stable isotopes, light colours indicate more stable isotopes)The number of stable isotopes shows a distincive striped pattern where alternating columns have either few or many stable isotopes... Notably Tc (Technetium) and Pm (Promethium) fall in columns where the elements have few stable isotopes. These patterns show how an even numbers of protons makes the nucleus more stable, and odd numbers make it less stable. The effect of this can be extreme; Sn (Tin) with 50 protons (an even number) has 10 stable isotopes with 62, 64, 65, 66, 67, 68, 69, 70, 72 or 74 neutrons. Tc (Technetium) with 43 protons (an odd number) has no stable isotopes.

In turn the stability of the nucleus influences how abundant an element is in the universe...
Abundance in the universe (darker colours indicate more rare, light colours indicate more common)Only non-radioactive elements are common in the universe, radioactive heavy elements quickly decay after they are produced (by nucleosynthesis). There is also an obvious general trend that elements with smaller nuclei are more common.

If you look closely at the abundance of columns of elements you can, however, see trends which mirror the number of stable isotopes; elements like Cu (Copper, 29 protons), Ag (Silver, 47 protons) and Au (Gold, 79 protons) are more rare than elements like Ni (Nickel, 28 protons), Pd (Palladium, 26 protons) and Pt (Platinum, 78 protons)... Elements with more stable nuclei are more likely to be formed in supernovae.

There are always exeptions to the rule though, Li (Lithium), Be (Beryllium) and B (Boron) are much less abundant than you might expect from the "smaller nuclei are more common" trend... Turns out these are not produced in large quantities by stars, unlike carbon, oxygen and nitrogen, and were instead produced by cosmic ray spallation, but that's another story...

If you have enjoyed exploring the properties of the periodic table you can carry on, interactively, here. This is an example screenshot showing the heat capacity of the elements (in the colour hue), atomic radius (in colour saturation) and melting point (in colour brightness):
Software used:
HTML5 (canvas) & Javascript

Saturday, 26 March 2011

Tube Map Metabolism

Have a look at this:
Does it look familiar?

Look closer:
It's a metabolism map, tube map-style!

Metabolism is the complex network of enzymatic chemical reactions that go on in all living cells. Many thousands of chemicals and enzymes are involved and metabolism maps are normally extremely complex. This one is a lot simpler, and a lot more light-hearted... You can download a higher resolution version or buy a print here.

Software used:
Inkscape
Creature House Expression 3

Monday, 17 January 2011

Visualising Large Data Sets - Exoplanets - The Video

Exoplanet discovery, from 1988 to 2010...

Watch it on YouTube! Over a decade of data, 300 planetary systems and 50 million cubic light years in just over 2 minutes.

Software used:
ImageJ - scripting and rendering of the video frames
FFMpeg - video transcoding

Sunday, 16 January 2011

Visualising Large Data Sets - Exoplanets

Extremely large data sets pose extremely large challenges... A data set like all confirmed planets around stars other than the Sun (518) and where they sit among the 70000 stars that lie within 200 parsecs (670 light years) of the Sun is a challenge. What better way to show it than with an animation which tracks the discovery of each exoplanet, which star it orbits, where that star is in 3D space relative to the Sun, and the various orbital properties of the planet...

The data
The data I have used is from two totally open, and very useful, data sets: http://exoplanets.org/ for panetary data and http://astronexus.com/node/34 for star data.

Step 1: The timeline.
Exoplanet discovery streaches from 1988 to now. Back in 1988 the first report of evidence for a planet around another star, gamma Cephei, was published and was eventually confirmed as correct in 1996. This sparked huge new interest in exoplanets and since then the number of exoplanets discovered each year has shot up, reaching nearly 100 in 2010. As data from NASA's Kepler mission is confirmed over the course of 2011 this number is likely to shoot up again.
Each planet is added to the final diagram, showing both its 3D location and orbital properties, in the year of its discovery. The entire animation lasts 3200 frames; roughly 2 mins. In 2010 a new planet appears nearly every frame of the animation!

Step 2: The 3D location
The 3D location of many stars near Earth are known, their position is calculated by the position they lie in the sky and the distance to the star as calculated from stellar parallax. This gives fairly accurate 3D locations for many stars within aroun 200 parsecs of Earth. Data about the star's brightness (absolute magnitude) and colour (from the B-V index) can also be used to make a nice looking picture of the Sun's neighbourhood. Unfortunately not many programs can cope with this kind of complex plotting, so I wrote my own:

I use the camera location (rotation around the z axis (theta), angle of elevation (phi) and image scale) and the x, y, z location of a star to project the location of the star onto a 2D image.
a=x*sin(theta)+y*cos(theta)
b=-x*cos(theta)+y*sin(theta)
c=b*sin(phi)+z*cos(phi)
The projected position of the star in the final image is a, c. The star's brightness and colour were then calculated to choose the pixel colour at the star's position.

This picture shows a section of the final 3D starmap. It is animated by rotating it gradually around the z axis to highlight the 3D effect.

Step 3: The planetary system
The most interesting thing about the exoplanet star systems is their arrangement; how big the planets are, how far they are from their parent star and what shape their orbits are. All these properties are summarised in just 3 numbers: estimated minimum mass (measured in Jupiter masses), semi-major axis (a measure of orbit size, normally measured in astronomical units) and orbit ellipticity (which describes how far from circular the orbit is). With a bit more maths a to-scale diagram of the planetary system is drawn in the animation as each new exoplanet is discovered.

The animation
The full animation should be finished soon, I will post it here when it is done...