cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Batch Image Analyzer
JohnPonte
Staff (Retired)

Recently I was contacted by a customer asking if there was an easy way to do image analysis in a batch mode. They were familiar with the Image Analyzer but that is an interactive GUI based way of analyzing images. This customer had hundreds of images to process and really just wanted to use JMP to calculate some statistic about each image. To do this in an interactive mode would take a lot of time. So I wrote the Batch Image Analyzer, which turns an image into a JMP data table, just like the Image Analyzer. But it will process a whole directory of images, using JMP to calculate a statistic for the image - in this case calculate the mean of each column.

 

This script does the following:

  • Access a directory - either specified in the script or it will prompt you to navigate to the directory
  • Filter the file list in the directory to be just the image files (based on the specified extenstion). That way it won't attempt to process non-image files in the directory
  • Open each image file and convert the image into a JMP data table, where each pixel is represented as a row of data, just like the Image Analyzer
  • Calculate a statistic, using JMP. In this case the script is calculating the mean of each column (red, green, blue, intensity, hue, lightness, saturation)
  • Produce a data table with the results of the statistical calculation, each row is one image
  • Optionally, it will add a thumbnail of each image into the data table

Processing a batch of images like this can take some time so I added the option of showing a progress bar. The Progress Bar script was added to the File Exchange by @Craige_Hales. To utilize the progress bar with the Batch Image Analyzer, just download the Progress Bar script and comment out the test code at the bottom of that script. Make sure the Progress Bar script is in the same directory as the Batch Image Analyzer script (or modify the path in this script). Then search for "progress" in the Batch Image Analyzer script and uncomment each line. Now you will see a progress bar and know if you have time to get a cup of coffee or go home for the evening.

 

Chances are you will want to modify this script to calculate some other statistic. But this script should give you a nice starting point for batch processing of images. 

 

Enjoy,

John Ponte

 

Comments

This is lovely! Many thanks for your work and ideas! I am using your Analyzer for single images and have just tested the Batch Analyzer. This is really needed and demanded software!

 

With kind regards,

Michael

Chris_Liu

Hi John,

     As picture show, I want save red value in JMP, could you help me to change JSL?Thanks!

 

 

图片 1.jpg图片 2.jpg图片 3.jpg

图片 4.jpg

Recommended Articles