Public Lab Research note


Automating Passive Particle Monitor Analysis

by mathew with SimonPyle | | 1,396 views | 3 comments |

Read more: publiclab.org/n/12893


Along with @AmberWise, @Damarquis, @Pagyebo, I've been working to make and document a method of analyzing SEM stub passive particle monitors with visible light microscopy in order to determine PM2.5-10 pollution.

As we've begun working with the samples we've identified a number of issues with imaging, issues we believe will be easier to solve with automated analysis and imaging stages. This note describes some of the issues and challenges we've defined, and solutions we're pursuing.

Imaging time and analysis evaluation

The current process of imaging passive PM samples is rather laborious, involving taking 10-40 images per sample, processing them in ImageJ ), and then analyzing the results in this spreadsheet.

To complicate matters further, the analysis depends on lighting conditions in the thresholding stage. Thresholding divides the image into a high-contrast black and white image. If the particles in the light section are less dark than the background of the dark section, thresholding can't be targeted:

Wi_HA_120715_20x_6.jpg

To solve these two issues, we're seeking to get an automated microscope and script ImageJ to process images automatically. I recently brainstormed a bit about ImageJ scripting goals and workflows with @SimonPyle from Public Lab's Chicago chapter about ImageJ, and the different problems and successes @Pagybo has had with taking evenly lit microscope images. This note will focus on good images for use in ImageJ, and the ImageJ scripting workflow.

For an automated microscope slide stage I'm currently replicating the OpenFlexure microscope @TonyC found at GOSH. I will talk more about that in a future note.

Read our development plan.

See all the research notes tagged passive-pm

Imaging issues

Vignetting & uneven lighting

Vignetting is when an image is darker at the edges. It causes the same problem as uneven lighting, which is also present in this 20X image:

Screen_Shot_2016-03-25_at_8.42.15_PM.png

Here are a variety of different thresholds, they all either miss the translucent particles on the left or the solid particles on the right:

Montage.jpg

Lessons Learned in Imaging

Thresholding can highlight noise, especially "one pixel particles" that are just image artifacts. Some filter for particles below a certain size will have to be implemented.

Getting rid of uneven lighting is ideal. This seems possible through adjustment of the camera and lighting setup. Here is an image with better camera white balance adjustment and a tuned light: 10_26_15_PG1_6_20x.tif

Thresholding is much more successful hear over a range of particle sizes, particle types, and thresholding settings:

Montage.jpg

Still, some effects from the background lighting unevenness remain.

Challenges and Checks

A challenge will be automating image analysis while accounting for image-to-image thresholding discrepancies and discarding poorly thresholded images. We think being able to check automated particle counting by eye can accomplish this. @SimonPyle suggested we use the tiling (or "montage" in ImageJ") functions to put images on to the same page, like in the image above. This would let whoever is analyzing samples to quickly check the computer's work.

A second challenge is verifying the perimeters of particles are determined correctly. Two comparisons seem helpful. Hand-measured particle perimeters can be compared to computer measured particle perimeters. We will also co-locate our monitors with FEM & FRM monitors for verification.

Batch processing in ImageJ and output goals

Scripting ImageJ to walk through the sample processing stages automatically for a samples' entire image set would allow rapid iteration on the thresholding and sizing steps. Luckily, ImageJ has an Macro Recorder that can record the menu steps of analysis for batch processing. While ImageJ can be scripted in a variety of languages, we'd like to stick to its native scripting language for ease.

Our goals are to create a script that outputs a whole image set to a single tiled image for visual verification. As the script steps through the analysis steps of thresholding, filling, perimeter measurement, and circularity calculation, it would save a tiled image of each step with each particle numbered uniquely. These numbers would be in the output CSV file.

next steps

Time to get scripting!


I did this Help out by offering feedback!


People who did this (0)

None yet. Be the first to post one!


3 Comments

@mathew, @SimonPyle, @AmberWise, @Damarquis, @Pagyebo

Wonderful work- I can't imagine counting particles while sizing them, etc. So cheers to the coders. With regards to the difficulty of visualizing light particles on a dark background, I encountered the same problem with trying to make silica dust visible on photographs. In order to see the dust using threshhold filter, using black & white images, applying the inversion filter first worked well. Inversion turns black into white, light gray to dark gray, etc. I thought it was easier to start taking photos in b & w, or converting them to b & w. Inverting color is interesting, but it didn't help me when viewing small bright particles of silica sand for evidence of fugitive dust.

Reply to this comment...


@marlokeno That's a great tip for eyeballing and catching dust.

On that note, as I clean up a prototype of some code to automate this process, I'm looking at Flat Field Correction to correct images. If we can take a control image without a sample, we can divide it out in ImageJ. This will cut down on uneven illumination and lens dust.

It helps with vignetting too, but I think we still need to crop the region of interest inside any vignettes because the surface area measurement will go into our calculations. Even if we can make the vignettes drop out to the background tone, any particles they obscure won't show up in the captured image.

@mathew, @AmberWise, @Damarquis, @Pagyebo

Reply to this comment...


I found this great tutorial on automating ImageJ scripting and batch processing. It got me up and batch processing in short order: Arjun Mehta, UCLA Bioengineering "How to Automate ImageJ Analysis with Macros and Batch processing: https://www.scribd.com/doc/95224926/How-to-Automate-ImageJ-Analysis-With-Macros-and-Batch-Processing

@Damarquis I added one step that cleaned up thresholding a bit, I separated the color channels and only analyze the blue channel. Below is the script:

threshold_macro_1.txt

Reply to this comment...


Login to comment.

Public Lab is open for anyone and will always be free. By signing up you'll join a diverse group of community researchers and tap into a lot of grassroots expertise.

Sign up