Contents || Index

September 6, 2008  

Fields in Circle Tool

This Tool initially was for generating a table of random field locations within a circular area.  The table guided an automated scanning electron microscope to locations on a circular sample for taking micrographs.  The intent was to take representative fields of view for particle counting and sizing of a filter on which theparticles were deposited.  All that the tool did, was to generate the table of field locations.

I have augmented the tool for examining a run of such images, if the images have been taken on an Aspex* Personal SEM, running the AFA (Autmatic Field Analysis) softeare, which selects the field locations itself (algorithms by Nicholas Ritchie).  The stage locations for each image are in the TIFF Image Description Tag.  You can colorize the fields in the Tool, using a spreadsheet having data (total particle area, for example) for each image, one image per row.  Lispix checks the image names in the tool with those in the spreadsheet, to allow for missing data.

More than one copy of the Fields in Circle (FIC) Tool can be open at one time, to better compare different sets of images.

The tool now opens data from a spreadsheet only.  A use for this is to look at data such as sample charge, taken at an array of points.  Only the data is available - no images being taken.


Tool as it opens.

Examine Aspex Personal SEM AFA Run

All functions are in the Aspex button or the Mag button. 

Load - Scans a folder of images, extracting the stage locations for each.  Optionally uses a text file with the stage fiducial points, which you can extract from the xxx.stg file made by the instrument during the run.  Shows the stage locations as squares.  Also shows the full file name of the image you selected when opening the set of data.

This is the first dialog presented by the Load button.  The FIC Tool uses the coordinates for each field that are stored in the Imagedescription tag of the TIFF file. 

The coordinates for the whole stage, i.e. the locations of the edge of the circle, can be set using the coordinatest saved in the .stg file which is saved in the top level folder for any given run.  Lispix cannot read the stg file, which is a binary file.  You must first open the .stg file with StgXlat, a utility provided with the microscope.  It will display the stage coordinates in a list of text. 

Expanding this utility to see what you need helps.  Cut the first portion of this list - everything down to "Point List" (directions are in the dialog).  Lispix will ignore any extra lines before and after, such as the "Stage File" line, but it does look for the "Circular stub" line, and all lines that follow, down through the Y= line for Point 3.

After selecting the text, which will look something like the above, copy it and paste it into a new text document, name it something like "stage fiducials.txt" and save it - a good place is where the .stg file has been saved.  Select this file after clicking on the left (option 1) button in the above dialog.


Alternatively, Lispix can deduce the stage locations from all of the fields.  The latter assumes that there are fields located fairly near the top, bottom, right and left edges of the circular sample.

Since there might be several runs, or groups of images that have the same .stg file, the third button allows you to use previously loaded or deduced stage fiducials.  This is just a convenience.

The second dialog asks you to select the images to 'load' into the tool.

'Sample' is the easiest way to select all images in a folder.  Just navigate to, and select one (any one) of the images in the folder.  'Select' allows you to choose a subset of the images, which is cumbersome when you have hundreds of them.  Once selected, Lispix shows a progress bar as it looks at each TIFF file to get the stage locations.  This does not take long.


After loading the Aspex image locations, the tool will look like this.

Enlarge the tool by dragging the lower right corner, or the left then the bottom edge.  The width (not height) of the tool window determines the size of the circle, and thus the size of the fields within it.

Since the field edges are drawn separately, and there is a little round-off in the display, sometimes the edges will overlap exactly and sometimes they won't.  This results in darker or double lines here and there, depending on the exact size of the tool.

Field labels

If the tool is displaying Aspex runs, and if it expanded to over 700 pixels wide, then Lispix will label the fields with the numeric suffex of the image names.

Image file Title_703, for example has the number 703.


Set Field Display Mag Factor This is a command in the Mag button.  For the case above, setting the magnification factor to 1/2 results in the following display.  In this case, the fields tile the circular filter -- their edges should touch.  In the display below, the fields are shown half size.  Normally the magnification factor should be set to 1, except for when the fields are taken at high magnification (below).

Click To Show Image - After invoking this command, the cursor will change to cross-hairs.  Clicking on a field will display the corresponding image. The images shown in this way are flipped vertically from the way Lispix normally shows them.  This is to match the coordinate system of the tool.

Field circled in red shown to the right.

Note that the edge of the particle deposition corresponds roughly to the blue circle in the tool on the left.


Colorize - Uses the Spreadsheet Tool.

Uncolor - turns off Colorization.


High Mag Example

This is a set of fields taken at 1500x:

Note that some of the fields appear to overlap.  They do not, but they appear to because Lispix uses squares of this size to show fields this size or smaller.

If the FIC tool is made very large, it becomes more clear that the fields do not overlap:


When these fields are colorized, again by the background mean intensity, the pattern is much the same as with the low mag (75x) set of data:

Setting the field magnification display factor to 16x rather than 1x makes the colorization easier to see:


Generating a Table of Randomly Located Fields

The circular area is defined by three or more points on the perimeter.  The points are loaded via a tab-delimited text file using Load Circle Edge Points.  A sample file is in the Lispix Data folder:  \Data\fields-in-circle\fields-in-circle-edges.txt.

File containing points on the edge of a circle. 

;;; denotes a comment line.

The first non-commented line is assumed to have the column headers and is ignored.


Besides loading the edge points, you need to set the magnification, using the Mag button.  Lispix uses a table, again text tab-delimited, listing magnifications and field widths in mm.  This table should be located in the Lispix Data folder and have this name:  ...\Data\fields-in-circle\fields-in-circle-mags.txt    Lispix comes with a sample file.  To customize for your microscope, edit or add more lines, one line per magnification.

Table of magnifications and field widths.  The magnifications are those presented by the Mag button.


After initialization, clicking on Calculate New Fields shows the field locations as black squares on the circle.

When the squares denoting the fields are this small, they are not to scale.  They might also overlap.  The actual fields do not overlap.



Tool after expanding the window (drag the lower right corner).  Here, the fields are shown to scale.  Note that they do not overlap.




Setup Details:

      Magnification data is in the text tab/delimited file fields-in-circle-mags.txt.   The file was created in Excel as fields-in-circle-mags.exl, and then was saved again, for Lispix, from Excel, as:   Text (Tab delimited).  If the magnification text file is not in the data folder, Lispix will ask for a file.

      Resize the button window as desired.  The size of the circle is controlled by the height of the tool window only.

      Read locations of edges of the circle with Load Circle Edge Points.   See how out of round they are with Plot Errors / Plot.  A sample file - field-in-circle-edges.txt is in the data folder.  Lispix fits a circle to these points, and calculates randomly placed fields withing this circle with Calculate New Fields.  This will calculate the number of fields specified by the #-fields button.  If Lispix has a hard time trying to make all the fields fit in, it quits after 10,000 tries, and the 2nd number to the right of the #-fields button will be the number of fields calculated so far.  For circle fit references: see Data / references /  math.txt and circle-fit.doc

Plot errors/ Plot:      Plots arrows from circle edge point, away from where it should be on the circle (along a radius).  Length of arrow controlled by Plot errors / mag factor'.  In other words, the arrows indicate the magnitude and direction of the error.

Save Fields:      Writes a text / tab delimited file with a header with pertinent data, and the field locations.  Positions for fields are at field center.  All widths and coordinates are in millimeters.