Thursday, May 25, 2017

Scale Bars

I have long wanted to put scale bars on pictures. They just make them seem more scientific. When it comes to more difficult species to ID they can even be pretty important in being able to get an ID from a photo. With a scale bar it is even possible to put the picture in photoshop, set the scale, and measure out lengths of various details such as antenna length in the photos.


Getting them on images with a macro lens is a bit of a pain though. The scale changes as the image focus changes. In theory it should be possible to take the information in the photo about the lens focus at the time of the photo and convert it to a scale, in practice it is difficult though. At a minimum it takes a bit of scripting, and from what I have read the accuracy of the lenses is not good enough to get particularly accurate.

With a microscope objective it is comparatively easy. As I have it set up my Mitutoyo 5X Objective is either at 3X or 5X magnification. So, all I need do is figure out the dimensions of one pixel in each scenario and make Photoshop add a scale bar. To that end I bought a microscope calibration slide and imaged it at 3X and 5X.

After doing this, I realized that I take a majority of my photos of insects with 1X magnification by putting the macro lens at minimum focus. By taking a photo of the calibration slide at 1X magnification, it is possible to add a scale bar to any photo which was taken at minimum focus distance. Technically this would be possible at any magnification, but 1X magnification is the only magnification I can quickly and accurately reproduce since it is the minimum focus distance.


That was the easy part. Even once I figured out the overall idea, turning this into a practical method took some time. First, I needed to measure the scale bar in Photoshop by going to Image > Analysis > Ruler Tool . That gave me the width of the scale bar in pixels. With the length of the 1 mm scale in pixels I was able to calculate the width of a single pixel in microns.

I was then able to set the scale such that I could measure any dimension in correct microns by going to Image > Analysis > Set Measurement Scale > Custom and setting it so one pixel was the correct number of microns. Then by going to Image > Analysis > Place Scale Marker I could make a 1mm scale bar. Unfortunately it gave a scale bar with a ridiculous number of significant digits and units in microns. Luckily with the text edit I was able to set it to 1mm.

Now I had my first scale bar!


After making about ten of these, I realized that this was just way too much work to fit into my workflow. It needed to be automated!

First I read up on Photoshop actions. By making a new action and by pressing record when I made the scale bar I was able to turn the process of making a scale bar into pushing one button. Then I made another action which recorded the process of saving as a jpg. Now I just needed to load the photo into photoshop and hit two buttons and the whole process would just work.

Still too much work.  Then I learned that by going to File > Automate >  Batch I could run the action to add a scale bar to every photo which is open. So now all I do is load all the files to get a scale bar, tell it to put a scale bar on every photo then tell it to save every photo. I will have to turn it all into one action one of these days, but it is finally practical to insert into my workflow.

If you are trying this there are a few traps to watch out for. First, the pixel size must be unchanged since the photo was taken. If the photo was compressed when you exported from Lightroom, or saved in some other software then all your scale bars will be wrong. Also, it is easy to put a photo into Photoshop which was not at 1X magnification. Any of those photos will have a wrong scale bar.

Sunday, April 2, 2017

Attempts at aphid identification

Since getting a focus stacking setup and starting to take on identification of some really obscure species I had some luck and some failure. It really did lower my productivity, as in a typical post is more than an hour work for sample preparation, photography, and stacking in Zerene Stacker.
 
If you have interest in trying to build a similar focus stacking system, I described it in detail in the amazon review for the Mitutoyo 5X microscope objective:

I was planning to do one big post of everything I learned since taking this on, but it is pretty clear than aphids deserve their own post.

 Aphids are a tough group to identify. In many cases my 5X magnification is not enough, and in extreme cases I was told a 200X phase contrast microscope is absolutely necessary. Still, there are many species which can be identified from a good photo and focus stacking aphids on a slide increases that number substantially.

The first step is collecting some adult aphids, and putting them on a slide. For this I use some combination of the technique described in the USDA video on slide mounting, and the instructions which came with a slide mounting kit I bought to mount the aphids in Euparal
  1. Put the aphids in a ~10% sodium hydroxide solution for 12-24 hours. I am not real scientific here, and just dump some crystals in until it looks like about 10%. Unfortunately this ruined a couple when I got the concentration a bit high but I am getting a good feel for it. For a supply of sodium hydroxide, I found that some drain cleaner works
  2. Squish the aphids as shown in the USDA video
  3. Put the aphids in specimen clearing solution, and heat them to 120-150 degrees F for a few hours until they look clear.
  4. Run them a few minutes each in 70% alcohol, 95% alcohol, and 99% isopropyl alcohol.
  5. Put a drop of Euparal on a slide and place 3-5 aphids on the slide bottom up. After some usually futile attempts to position such that all limbs are visible, put on a cover slip.
It would be best to heat the slides to dry them, but I just let them sit a day or two. It is clear it takes a couple weeks to completely dry them out. If I get really serious about this, I might switch to Canada Balsam, following this procedure. The advantage there is that the slides should last centuries rather than the years to decades Euparal is likely to survive. At the moment that advantage doesn't mean much to me, but if I end up with a big enough collection it might.

After drying the slides I use my microscope setup to photograph with as much magnification as my setup can do.
Alata:
  1. Full body
  2. Third antenna segment
 Aptera:
  1. Full body
  2. Third antenna segment
  3. Head, dorsal and ventral focus
  4. Apex of rostrum
  5.  Hind Tarsus
  6.  Abdomen, including cornicles and cauda, dorsal focus
  7.  Cornicle, especially apical 1/4 or so.
  8. Cauda, especially setae number and placement
Typically with the magnification my 5X objective can produce, I can get all those items into perhaps four to six photos.

Some examples of aphids rarely reported on iNaturalist I have been able to identify since taking this on:
Metopolophium dirhodum
Myzus persicae
Macrosiphum euphorbiae
Hysteroneura setariae
Neotoxoptera formosana
Aphis craccivora
Wahlgreniella nervata
Sitobion fragariae
Eulachnus rileyi

A couple of those are likely to get pushed back to genus when someone points out a look-alike, but most of them are correct.