Category Archives: Methods to assess TEM and AFM images

Peak height and SHAPE may reflect glycosylation state

Would it be so unusual to have shape follow the number of glycosylated arms in the trimer of SP-D.  Just look at these two peak shapes.  They are certainly not the same.  Artifact from position and random events in processing can affect this i understand, but it seems to me that for sure peak width will increase with number glycosylation sites (1, 2, or 3) if in fact SP-D is glycosylated in that manner???  I have not read anything to suggest it, or to refute it.

Figure below: same image right and left, plots traced in ImageJ, the width of the glycosylation peak on the right hand trimer of the horizontally running hexamer is clearly of greater width.  RElative peak height may be indicitive of level of glycosylation as well, as it has been reported by Arroyo et al,  that the peak that is assumed to represent glycosylation is greatly diminished in de-glycosylated trimers .  Open to suggestion here.

Counting peaks along the arms of SP-D: Image and signal processing

IN this set of data there are (‘ or is’ – to use the noun as a ‘group of data’ (the latter is probably correct – “Merriam-Webster entry for “data,” notes that both singular and plural constructions are “standard” in English. and as someone posts… “anyone who ‘corrects’ you for noncount use of ‘data’ is being pedantic (and probably rude)” LOL, peak numbers along two hexamers of SP-D.

One image of a single SP-D dodecamer (which i call #51) (from a publication by Arroyo et al) was image-processed with 16 filter variations coming from a half a dozen programs,  then analyzed for “peak count” (or “LUT” peak count (aka  “grayscale 0-255 brightness”) by 2 visual and 6 different signal processing algorithms. The purpose is to determine how reliably the number of bright peaks along molecles can be counted in traditional AFM images.

Image processing does change the counts somewhat, but in all plots there are similarities in relative numbers and sizes of peaks regardless of the graphics programs and signal processing algorithms.

The two arms of this dodecamer (51) are clearly different in terms of arm length (artifact likely from stretching and twisting as fell onto the mica). The arms are significantly different in the number of peaks per hexamer.  One could think that stretching one side of the dodecamer could be useful artifact, since squishing of arms would obstruct definition between and among peaks.

Peak values were obtained as follows using the original images processed with 16 different  filters. Filter names are given below: Clearly the filters that increase contrast or mask outliers show different results.

1. Visual count (by eye – after each processing filter
2. Quick count of the peaks in the LUT plots obtained in ImageJ plots (no background subtraction)
3. Batch Process – (an app for excel files that uses dispersion peak detection to detect peaks in the LUT plots obtained in ImageJ) – (lag=1, threshold=0.5, influence=0.025)
4. Batch Process – (lag=1, threshold=0.1, influence=0.01)
5. ImageJ – Find Maxima>0.5>strict>single point
6. ImageJ – Find Maxima>1>strict>single point
7. ImageJ – Find Maxima>2>strict>single point
8. ImageJ – Find Maxima>3>strict>single point

Methods 1, 2, 5, 6, 7, and 8 use the image directly, while Batch Process uses the excel files from LUT plots.

Top figure = image processing filters

The color of the dots indicates which program was used to count peaks, and the number on the x axis corresponds to the way the image was processed before peaks were counted.

SP-D dodecamer (from Arroyo et al) above.  Arm 1 = middle left to middle right, arm 2 = top middle to bottom middle-right.

Interestingly, my eyes see more peaks than are found with image processing.  And second to that is the number of peaks that appear in the LUT plots (ImageJ) in a quick count (without subtracting background).  Summary counts or all processing (hexamer 1 and hexamer 2)  are probably pretty close to reality.

I need to find out what ImageJ uses for finding maxima … and find a good definition for Lag, Threshold and Influence.

Just an aside….. It took me an insane amount of effort to learn the programs, and to obtain and organize these data (and i need to add Octave to the list of programs)… LOL, but i think they are robust enough that using the same (or similar) scripts on numerous arms of SP-D and DMBT1 will be valuable in sorting out the LUT number of peaks per trimer.

Were I going to choose three methods to analyze additional molecules I likely would choose:  5, 6, 8, 11, and/or 16 for image processing,  then Batch Processing LTI 1, 0.5, 0.25 and ImageJ (Find Maxima 1 strict) for peak counting.

CorelDRAW19 various processing algorithms applied to one AFM image of SP-D

Using CorelDRAW19 various processing algorithms have been applied to one AFM image of surfactant protein D. This image was derived from Arroyo et al, and is among dozens of images from various authors that I am using to test the validity and efficacy of such image processing. The list of programs used for this particular image (then vary from processing programs, e.g. photoshop, gimp, gwiddion, imageJ etc. because of the menu options in each program) and from free and proprietary image processing libraries that may or not be available to software developers. While it has taken months, the comparison is something that I needed to do since I have both old and new versions of the industry standards (CorelPhotoPaint, and Draw, and Photoshop) and it was important to see whether there were changes in image processing algorithms that caused significant differences in gray scale (y axis) for surfactant protein D images.

the list for this composite (plot) overlay is: gaussian blur (5px); gaussian blur (5px) and high pass 40%-10 px radius; gaussian blur (5px) unsharpmask (300%-  20 px radius- threshold 50; lowpass 100% 10 px radius; maximum 50% 10 px radius; median 5 px radius; minimum 50% 10 px radius; smartblur 50. Each of the resulting image were measured using ImageJ. Plots were conformed to the mean arm length of all processing and measuring for this single image.  A single background measure (each background was taken at the same time as the measurements, and in the same location) is shown around 50 on the gray scale.

Each plot is a different color and each arm (meaning CRD to CRD in a hexamer) were plotted separately and are shown separately  thus, 16 individual plots and 16 colors. Approximate width at the valley of the plots is given in nm.


Peak counts in the span of both hexamers of a dodecamer comes out to be something between an even and an odd number. This is not really interesting except that it might relate to the issue of whether the N termini (junction of four trimer N termini) that is the center and highest peak found with AFM of surfactant protein d dodecamers….  there is good visual data that says sometimes the N termini are joined in ways other than overlapping (overlapping is the wrong word, more like juxtaposed).  The later, in AFM can be side by side, or end to end. No consensus has been found in the literature so far by me, by me anyway.  I subscribe to the idea that more configurational variations  happen that is usually realized.

Just  over 350 measurements of brightness”peaks” for ONE molecule of SP-D (a dodecamer AFM image from arroyo et al (which i have named 41 aka 45) the data for peaks along the arms is:  (keep in mind that the center peak is likely not mirrored in a consistent way, thus the number of paired peaks on right and left arms of both hexamers will tend to be an odd number)  in that sense, the peaks from looking quickly at each image, and then using ImageJ to plot the peaks of brightness, and adding those, the number of peaks in each hexamer is as follows.  This particular molecule has arms of different lengths with what I have called “arm 2” being longer than arm 1.  The right portion of the dodecamer looking like it was been stretched during preparation. It is still useful to see whether the physical elongation of an SP-D arm allows for greater, or lesser definition of the peaks which occur in the area between the N termini and respective CRD domains.

Below, the image, the summary statistics.  These are all measures on the same image, processed in a dozen different image processing programs.  The image below is a sample, bar marker is green, and 100nm. Image stated above is from arroyo et al.


Comparing gaussian blur – 5 and 10px radius

There are some differences in the “libraries” that are used for image processing.  It is important to determine which is best for your application.  Below is a quick visual summary of 5 and 10 px gaussian blurs from a dozen or so programs.  Inkscape is missing, as I could not find the specific term “gaussian” for any blur filters.  Most of these programs are similar but some are expensive to purchase, or have a monthly contract for, others are free software.  While i really do like photoshop (two versions here) and corelDRAW and corelPhotopaint (two versions here), ImageJ is easy to use and provides pretty comparable results albeit on a very much smaller selection of effects and filters to the former programs.  The bar marker example here was a vector box (no outline) layered onto an image,  exported as a tif and processed in these programs as such.



Measuring SP-D using the “diameter” function in ImageJ

Easy to use, I found this to be the most efficient way to determine the diameter of surfactant protein D dodecamers.  I think it will ultimately be just in between the measurements that correspond to the shorter of the two hexamers, and the longer, which is where it should be.  It is a circle drawn to contact the edge (in this case, the most peripheral part of the carbohydrate domains) of three of the four.  Example below.

One dodecamer (from Arroyo et al), screen print, resampled at 300ppi, image processed in CorelDRAW 19 using the “smart blur”.  This ends up being 136.53nm, very close to what was found for 95 separate measurements of the same image (see mean and sd below)

Deviation, σ: 5.8922403533121
Count, N: 95 (separate processed images, using half a dozen different filters and effects)
Sum, Σx: 12797.82416297
Mean, μ: 134.71393855758
Variance, σ2: 34.7184963812

SP-D “fake” model from real micrographs and LUT tables

So the process of identifying which filters work well for image processing of AFM and TEMs (shadowed and negative stained) of molecules, it became diverted briefly into an effort to understand the algorithms of signal processing.  (the diversion was short lived, as I will never devote the time to understand them, and am not sure that an in-depth knowledge of them is required for those of us who just want to maximize the basic data that is inherent in our micrographs) I am interested in those filters that present in an unbiased and honest and searchable way (and just for fun, the image above).

The previous post (using an RGB control image to watch the erosion and dilation and alterations in pixels) examined some filters in a simplistic way. This spawned an even more interesting idea which was to use an actual “arm” (trimer) of an actual SP-D molecule as a model.  The choice of this arm is definitely biased, as it is what I have come to think is the mostly likely configuration of the SP-D trimer in terms of LUT plots.  SO while the bias in creating the initial vector illustration is mine, it is based on hundreds and hundreds of LUT plots from images processed in dozens of filters and effects in  more than 10 different image processing programs.  So it is “educated” bias.   The “raster” fill for this vector image (which is created with identical trimers — mirrored and rotated) is an actual AFM image of an SP-D trimer.  That “fake” or “control” SP-D model is below.

The N termini junction is central, beside it are four small peaks (which I am predicting) next is the alleged N-glycosylation peak (4 of them) one per trimer (about which I have not been able to find an answer as to whether this is an all (all three molecules) or none event, or 1+ 2+ or 3+ event, thus producing N glycosylation peaks of various sizes).  Lateral to that are the three predicted peaks cascading in size and width along the greater length of the collagen like domain.  Finally,  the neck (sometimes present as a slope, or small peak, leading to the CRD which definitely can be seen to have “areas of brightness and looks actually lumpy, just like the molecular models would predict”, and can be seen in the raster fill of this vector image.  Round and bell shapes are based on my observations.

The first test of a filter was made in CorelDRAWx5: Bitmap>blur>gaussian blur>10px. Image below.

And just for fun

Image processing programs for microscopy

Image processing programs are so numerous that it is a daunting task to find one that is easy to use, and also provides the basic filters and effects that microscopists (thinking here specifically of those that use TEM, and AFM, the only two with which i am familiar). All the commercial tricks for graphic design are not helpful in enhancing images and data (such as smoothing LUT plots of brightness and contrast, to sharpen edges, and increase the chances of quantifying “real” events.

In a search for affordable (and often free and dedicated) user friendly programs for processing images I have used my own “artificial” image of solid squares and circles (RGB) as well as “real” images from several types of published and original micrographs of two well studied multimers (surfactant protein D and DMBT1 –  from various species).  I do NOT in any way profess to understand the math behind various signal processing libraries used in any of these programs. I only express opinions about how they affect my the images, and enhance retrieval of data that can be otherwise be missed.

What follows is just my opinion but it might provide insight for someone who just wants to find an easy program and use the basic filters and effects,  and it might help someone who wants to use such filters and effects to investigate molecular structure of a particular molecule.

The programs whose filters and effects I studied pretty thoroughly, paid, and free  opensource, and an estimate of how easy it was to process the images and “real” images are to the right. First on the list is CorelDRAW which is a program I have used for almost 3 decades, and Photoshop for almost that long. Both are paid programs that have extensive menus of filters and effects, way beyond what is  practical (and pertinent) for image processing for scientific work. It is difficult to assess the ease of use of those two programs because of their long history and general familarity.  Their effects and filter menus are easy to find and extensive. Their affordability has made them less practical now.

Some institutions provide Adobe licenses for their faculty, staff and students, though a two month personal subscription to Photoshop2021 provided me with enough time to process hundreds of images to compare with earlier Photoshop versions. That said, many of the filters for image processing have not changed in decades either.

Features to look for are those which adjust — the  size, color management (HSL, RGB,  and provide the standard filters and effects, e.g. gaussian blur and median, maximum, minimum, highpass, noise and unsharp mask filters.

CorelDRAW (includes CorelPhotoPaint): There are two ways to process images in Corel. 1) is built into the vector part of the program (CorelDRAW) that has all the most commonly used and relevant filters for image processing.  The separate raster processing portion (CorelPhotoPaint) has a different feel than Photoshop but also has the necessary filters to process images. I have found that CorelDRAW (under current owners) has begun very aggressive popup tactics that are not only annoying but sometimes crash the program.  The current commercial version of Photoshop is really only available on a monthly  subscription.

GAUSSIAN BLUR IS A GREAT FILTER – number of pixels to select depends upon the ppi of your image and your desired effect. All programs above have a blur filter.

This I confirmed when I compared images processed in programs separated in time by at least 10 years. Picking up an old CD of CorelDraw (which includes CorelPhotoPaint) or Photoshop is really pretty sufficient for any processing of TEM or AFM images that one needs and has filters that are similar (or nearly identical) across platforms and time. The algorithms used for these standard filters seem to be part of a library and accessible to programmers creating their own image processing platforms, so there is an underlying uniformity among them all (not withstanding some variations, limits, menu name changes, and the addition of sliders for adjusting levels of filter application.

The order in which filters are applied matters as does the pixel radius relationship of each applied filter and percent applied.  Vector image exported to 300ppi tif (8″ width), imported into CorelDrawx5 and processed –bitmap>sharpen>highpass 50% 10px, then – blur>gaussian blur 3pxr, (left image); or bitmap>blur>gaussian blur 10pxr, then highpass 50% 10px (right image). Bottom image, blur>gaussian blur 3pxr, then highpass 50% 10px.
THE ORDER OF APPLICATION of the filters matters in the cosmetics of the outcome, and may affect outcome.

Bitplanes color transform in Corel Photopaint help visualize LUT peaks along the arms of SP-D

Bitplanes-images were obtained as a filter in corel photopaint to visualize LUT peaks along the trimeric arms of SP-D (color>transform>bitplanes with slider) (original image by Arroyo et al).  It has become quite clear that there is a lot of image processing that can be done to AFM images, and with an honest approach, very little of it changes what appears in the original image.

This gif animation was made in GIMP using png files (exported from corel photopaint x5 and sized and edited in corel DRAW x5 to add the arrows that point to three distinct peaks along the collagen like domain of one of the SP-D trimers– in this case to the left of the glycosylation  and N termini peaks ).  While it is garish, the data are real. If you look at the LUT plot (made in ImageJ) from the same SP-D dodecamer in the previous post you will see the three peaks, in their typical increasing height (left to right) as those areas marked by arrows in this animation.

The tiniest (also previously undescribed) peaks that I am pretty sure exists can be seen like  “blips” on either side of the central N termini peak (on the more vertical hexamer).