Micscape Article for Amateurs:
Deep-field Amateur Microscopy

by Maurice Smith. April 1996
Updated March 2001 with software links that do the job!


Image Enhancement

A lot of software abounds these days to help the amateur and professional scoper get the best out of computer images 'sourced' from their microscopes. There is a particular aspect though that - to my knowledge - has not been considered by software writers, which could prove a massive advantage to the amateur microscopist and educationalists. This aspect is concerned with deep-field microscopy.

Deep-field?

Yup! When I first heard this term, I found it confusing too. Deep-field... sounds more like a rural or farming expression rather than anything to do with 'scoping'. What does it mean? Well, here's the important bit: it relates to the property of lenses. If you have done a lot with your camera in ordinary photography, you will probably understand that all lenses have a 'built-in' distance at which things seen through them will be in focus. In the optical microscope, these distances are very fine indeed. Often you will only to be able to focus on a specific detail of a specimen on a slide, it's top surface for example, and everything below this depth will be out of focus and will appear blurred. To examine most specimens, you need to view the object or subject at varying depths (different focus levels) to interpret true structure and form.

This limitation of any lens/focusing system is known as its 'depth of field'. It is possible to extend the working focus minimum and maximum distance of a lens, but you eventually reach a point where you need extremely bright illumination to maintain an image. Again, photographers will know that you can achieve a crisper image over a better 'field of distance' by stopping the aperture of the camera down to a smaller and smaller setting, where only a tiny hole is left to let the light - carrying the image information - through and onto the film. You need nice bright lighting or very sunny days for this.

Photomicrography

With a stereo microscope, it is possible to obtain slightly better visual interpretation of a specimen. One set of lenses can be focused on a specific plane in the subject while the other lens can be set to view a slightly deeper level. Two such images taken this way are below: F1 is focused on the nearer surface of the diatom frustule and F2 on the furthest surface.
Diatom F1  Diatom F2
The problem comes when you wish to record the specimen to camera, either by normal photographic methods ('still' shots) or by using video recording. The second method can be used to record different focus levels of the subject: you simply keep altering the focus of the microscope when 'filming'. This at least enables the viewer to get a clearer understanding of the structure and processes of the specimen.

No such solution exists for 'still' photography. The only answer is to take several photos at varying levels of focus (slices) and then present the complete set of pictures to anyone who may wish to see them. It would be great if the amateur had a way of recording a single image where all crisp detail from both slices (images) were combined to form a focused composite image!

Intrigue

A year or so ago I became quite intrigued by this limitation of an optical scopes. As an amateur microscopist I was aware that these problems have been beaten for the professionals since they can use Scanning Electron Microscopes or Confocal Microscopes to obtain images where all the structures in the specimen are clearly focused. But what about us amateurs? We can not afford the extraordinary costs of this technology. I thought a solution might be found by using software and the old home PC, and being a programmer - decided to 'play' with the problem and see if I could build something which might help.

Fuzzy Logic

Where to begin? I'm not that good at maths (surprise, surprise) so I had to find a method which allowed me to understand things a different way than by mathematical concepts. The simplest way would be to sit at the microscope with a suitable subject on the stage, and then keep refocusing the scope and try to observe what happens to the image itself as the focus control is altered. I could also 'sample' some slices by rigging my video camera up to the PC and 'grabbing' some images. After several long hours I decided that a set of fuzzy rules could be considered as workable. These could then be used as a basis for a set of software algorithms which could work at a pixel level on the sampled images.

The Quest

The trick is get the computer to work out which pixel in any slice is 'most' focused relative to its neighbours (pixels) in any given slice. These pixels (or at least, their colour values) could then be used to rebuild a final composite image where only the sharpest elements from the source images would be present. Here are some of the thoughts and observations which became rules for selecting the correct pixels:- I built the software to work with 256 colour images to a maximum size of 640x480 pixels. I included several switches to allow selectable tolerance levels to be applied during the image analysis: it became apparent in a couple of quick experiments that this would be necessary to help the software work on different subjects. For example, transparent or semi-opaque subjects present a different set of problems from solid subjects.

Did it work?

It worked far better than I thought it would. To simplify the task, I set a limitation that it will only work with 2 slices (images) for now. I'll show you an example in a moment but don't get too excited because the software is not for sale. It was just an experimental piece of work which, without more development, is not very user-friendly; the main difficulty being what switch parameters (numbers) should be included in the command line to get the best result on a particular image. With all my other commitments right now, I doubt if I will get much time this year to develop the program but you never know.

Another solution

By sheer luck, another possibility for solving the depth-of-field problems has come to light. I purchased a very low priced bundle of software called Double Vision (around 18.00 pounds). The software turns computer images into 3-D images, you know the sort you look at with those cardboard (red/blue) glasses. Normally you would use the software to combine a left image and a right image from a stereo pair and turn it into a composite 3-D anaglyph. In microscopy use, you can take a photo of a specimen (or video still), move the specimen slide slightly to the left or right a bit, and then take another shot. Once the two images are in the computer, the Double Vision software will soon change it into a true 3D image which can be viewed on the monitor or after printing out in colour, using the red/blue glasses supplied with the product.

I was fooling around with the software - taking images through the scope and then turning them into 3D, when I had a mini-brainwave: instead of moving the slide to take the second shot, why not just refocus the scope and capture a deeper slice of the specimen. The software can then use the two separately 'focused' images to construct a deep-field image. I tried it out and hey presto it works! More than this, you can move the slide, refocus, and then take the second shot to get a deep-field 'true' 3D image!

I'm not here to promote the software but if, like me, you are an amateur scoper and a computer user, you should really rush out and buy this cheap bundle. I reckon its great! See our 3-D section to find out more.

And remember, if you go out and get the software, when you get a result, send one or two of your 3D Microscopy or Nature Images into here and we will publish them on our site for you. This way other amateurs and students can enjoy them too.

Examples

I promised you an example, so here it is. The row of images below are of two Diatom frustules (cases) which I shot under the old scope at about 400x mag. (ish). Working from left to right: the first image is taken at one level of focus and the next image along at a another level - deeper into the slide. Note how details in one image are missing from the other! The third image is the result of my software attempting to combine them into a true all-detail-focused image. The forth and final image to the right (slightly shorter) is what Double Vision software made of them when combining them into a type of 3-D image. You will need red/blue 3-D glasses to see this properly! I have reduced the images by about 50% from their original size and converted them into 256 colour from 24 bit (64000 colours), resulting in a loss of detail. Watch out in our 3D section and our Image library for them, because I might load the larger versions of these images into these two sections.

   Focus level 1      Focus level 2      Result with      Result with 

                                         MY software     Double Vision

                                                        (3D glasses reqd.)

... and I think Double Vision produces a better result although you do need to wear those funny glasses!

Footnote: If any budding programmer out there wants to consider working on this problem with a view to building some user-friendly software for the amateur scoper, I will be happy to part with any experience or know-how gained 'playing' with the ideas to-date. Please contact me - The Editor
update!
March 2001: And a very good programmer did do a wonderful job!

Having interests at both extremes of the visual spectrum, micro and telescopic, my interest became intense when I realized that there is a program which will do the things required as outlined by your article, and more; plus the best part - it is absolutely, positively - free! The name of the program is AstroStack. It can be found at several FTP - Astronomy Sites. I have forgotten exactly which site I downloaded it from; however I suspect a web-search using the title "AstroStack" would turn up several in short order.

This marvelous piece of software is used to compile an image from several images to increase depth of field, correct contrasts and stabilize the poorer images. I've played with it a little using photos from telescopes. The results are indeed remarkable! I'll try it with some micro-photos soon. Thanks to you - my memory clicked so as to cause me to remember the program. The program is fairly small and not to difficult to use. If I can find out which site I downloaded it from, I'll send you a link.

That way you can see for yourself how cool the program is not too mention the other manipulations possible. Just think - one could take a subject - shoot 5 or 10 shots depth-wise, move the slide ever-so-slightly to the left or right- shoot 5 or 10 more depth-wise pics then combine them all for a very detailed true 3D composite image; much like you intimated in your article. A image on "steroid", so to speak.
Thanks again for all the wonderful articles.
Regards,

Rick Comer

And Rick kindly took the time to locate the link to the software...
I believe in the motto I've seen posted all over the internet. "Share what you know... Learn what you don't," so by all means feel free to share the information. I did do a search and found the site for AstroStack it is: 


http://utopia.ision.nl/users/rjstek/

Microscopy UK Front Page
Micscape Magazine
Article Library


WIDTH=1


© Onview.net Ltd, Microscopy-UK, and all contributors 1995 onwards. All rights reserved. Main site is at www.microscopy-uk.org.uk with full mirror at www.microscopy-uk.net.