Ichneumon Wasp and the Extended Depth of Field
This wasp was on the window in the entryway last fall, and sadly, it died when I put it in the refrigerator to cool it down for photography.
It appears to be some type of Ichneumon wasp, based on the fact that (a) it looks wasp-like, and (b) its hind trochanter[1] is divided into 2 segments (the next picture is a close-up of the point where the hind leg meets the body).
But, that doesn’t narrow it down much, since there are an estimated 3100 species of ichneumon wasps in North America.
[EDIT April 26, 2012: Down in the comments, Bernardo Santos just kindly identified this one as Messatoporus discoidalis. And since he says he worked with defining this genus of ichneumon wasps as part of his M.Sc. thesis, well, he would know!]
There’s a lot to be said about Ichneumon wasps, they’ve got a fascinatingly repulsive lifestyle. But, I’ve got another species of Ichneumon in the pipeline for next week, and so I will talk about them more later. This week, I’d like to talk about the “Extended Depth of Field” processing technique for macrophotography. I hadn’t managed to make it work previously on other specimens, both because they do insist on moving, and because I didn’t have all the necessary software before. But, since this one died on the operating table (so to speak), it was very good at something the live ones are typically very bad at – keeping perfectly still.
The idea of Extended Depth of Field is that you take a series of pictures focusing on different levels of your specimen, and then use “wavelet processing” to sort out the bits of each picture that are in focus and use them to assemble a finished picture where everything is in focus simultaneously.
So, I started with a picture focused on the surface the wasp was lying on:
then pictures focused on progressively higher levels:
finishing with a picture of the highest parts (the wing and one antenna):
I then used the ImageJ software to assemble these pictures into a “stack”, so they could be handled as a unit.
In order to go further, I needed three plugins for ImageJ: the stackreg and turboreg plugins to “register” the individual pictures in the stack to make sure they were all lined up properly, and the extended depth of field plugin to do the actual generation of the new image.
The stack registration plugins were the things that I needed to have in order to get this to work with my equipment: when I first tried this some months ago with just the Extended Depth of Field plugin, I got crummy results because there are tiny shifts in position between pictures,and I basically ended up with what I can best describe as a “sharply-focused blur”:
Using the stack-registering plugins was pretty simple [2]- I just ran “stackreg”, which went through the whole stack comparing pairs of images with “turboreg” and shifting them back and forth/up and down until everything lined up. Once the stack was registered, it was just a case of starting up the extended depth of field plugin again and letting it run. One point to keep in mind is that, the bigger the images are, the longer it takes and the more memory it sucks down. When I tried it on full-resolution pictures, it never actually finished in periods of up to an hour. So to keep the times reasonable I ended up doing this on images that were 800×600 pixels, which meant that it finished in about a minute.
And here is the result: it isn’t perfect (the upper edge of the wing is a little bit peculiar, and one antenna turned into a blur[3]), and it isn’t an immediately obvious improvement over the first image that I had up at the top of this page. But, it does bring most of the wasp into sharp focus all at once, something that I wasn’t able to do with the original photographs.
So, there we go! I obviously need more practice to make this work more cleanly, and a better understanding of what the software is actually doing would probably be nice, but it does, in fact, work[4].
———–
[1] “Ok”, I hear you say, “That’s great. Um, what’s a trochanter?” It’s the second segment of the leg out from the body. There is a nice diagram showing various types of insect legs, and giving the names of the individual segments, here. It looks like the coxa and the trochanter sometimes more or less fuse so that they can look like just one segment.
[2] Well, simple once I figured out what had to be done to install the plugins. It turns out to be easy enough, but the web pages for the plugins don’t explicity come out and say how to do it. The ImageJ installation itself is pretty painless, but then you have to (a) download the plugins, (b) unzip the packages, and then (c) copy all of the components directly into ImageJ’s “plugins” directory – not as a subdirectory, but as individual files directly in the top level of the plugins directory. If you leave them in a subdirectory, ImageJ won’t be able to find them. A silly little thing, but if you don’t know about it, it’s very aggravating.
[3] I think the problem is that the stack registering software is assuming that the object is just shifting position, and not changing shape. Probably the upper antenna and the wingtips moved slightly between photographs, so it wasn’t possible to perfectly align the appendages, while simultaneously aligning the body. Another probably much bigger problem that just occurred to me is that the wings are transparent, and the software looks like it is taking the background as being the part that needs to be kept in focus, not the wing. Argh! Also, I’ve read that there could be some issues with changes in magnification between slices. There might be some way of getting the registering software to slightly distort the images to line things up, rather than treating it as a perfectly rigid body, and if so, that would most likely take care of the movement and magnification problems. I don’t know what to do about the transparency issue, though. Probably a subject that is more compact, inflexible, and opaque (like, say, a beetle) would work better here. I bet it would work great on mineral specimens, too.
[4] Of course, I have no idea whether the software I am using is the best choice or not. There are other software packages out there to do this sort of thing, and it is quite possible that they will work better. However, ImageJ + the plugins is free, which is a big plus for my purposes. ImageJ is also used a lot by scientific researchers, which means that they are constantly making and releasing additions and improvements (although, admittedly, these are mostly experts writing software primarily for their own purposes, and so they tend to be not so good on the “user friendliness” end of things). After all, while the packages that cost hundreds of dollars probably give more beautiful results and might be easier to use, I could take much better pictures by dropping a few thousand dollars on a better camera, lenses, and lights too. Once one starts down the road of “I want the best photography equipment/software available, never mind the cost”, it could be just a short hop to personal bankruptcy if one doesn’t watch it. So, I’ll stick with the philosophy of doing the best I can with what is cheap or free, and see how far it gets me before thinking about spending any significant money on upgrades.
Comments are closed.
I’ve had good luck with CombineZM which is also free. It’s mentioned and linked on the page you linked to in your note. I’ve mostly used it for small lichens, fungi, and bryophytes so far, but I did do a couple of things with a small spider and its web. Take a look at the spiderweb photos on this page to see how CombineZM did with what seems to be a reasonably difficult scene and a completely novice user (I think it was the first or second day I had ever used it).
Thanks for the pointer. I’ve installed CombineZM, and at the moment I’m having a bit of trouble running it because there is evidently a problem with WMASF.DLL, but I’ll keep trying. The quality of your picture of the dewdrop-coated spiderweb is good enough to suggest that this is worth at least trying. Thanks!
Well, an update: I evidently can’t install CombineZM on my home machine without updating Windows Media Player, because it appears to use at least one DLL that is part of Windows Media Player. I can’t upgrade *that* until I upgrade my operating system to at least Windows XP SP2, and this amounts to several multimegabyte downloads that I have to do over a not-particularly-fast internet connection that occasionally drops out on long downloads. So, getting CombineZM running will be at least a several-hour project before I can even get it to *start*, let alone learn how to use it. Maybe I’ll get around to it someday, but for now, I’ll just muck along with ImageJ and its plugins, which only require a more or less current version of Java in order to run.
This is Messatoporus discoidalis (Cryptinae). It’s a parasitoid of pompilid mud nesting wasps. I revised the genus in my M.Sc., so this is the best id you can get =]
Bernardo: Thank you very much! I can’t ask for much better of an identification than that!