Acknowledgements:
The extinction technique is described in the publication
Polarization-resolved extinction and
scattering cross-sections of individual gold nanoparticles
measured by wide-field microscopy on a large ensemble
Lukas M. Payne, Wolfgang Langbein, and Paola Borri
Appl. Phys. Lett. 102, 131107 (2013) DOI 10.1063/1.4800564
Please cite this work when using the suite.
Plugin File: Extinction_Suite_v3p2p4p7.jar
The Extinction Suite Macro was developed with the specific
intention of analyzing images of nanoparticles fixed in a field of
view. It currently supports recognition of gold and silver
metallic nanoparticles via their color, as well as non-metallic
nanoparticles. It can also recognize two different particle
size ranges via the related extinction crossection range.
The Macro requires an installation of ImageJ or Fiji. To use this
program with Canon RAW files the DCRaw Reader plugin has to be
installed. The program has both unpolarized and polarized
processing modes. There are four processing modules of the
macro and a mapping module which creates the required folder
mapping.
Please install ImageJ or Fiji
following the instructions for your system found here (ImageJ)
or here (Fiji).
DCRAW plugin can be found here
along with instructions, information etc.
The simplest way to install the
plugin is to open ImageJ or Fiji, click the "Plugins" drop-down
menu and select "Install Plugin." You will be prompted to
find/select the plugin on your computer to install. Once
installed it will be available directly from the Plugins drop-down
menu. However, I have encountered problems with this, where
it does not remain permanently installed. If you find that
happens then proceed with the following:
ImageJ: find the "plugins" folder
inside the ImageJ application folder (mac: in "Applications"
folder, PC: in "Program Files"). Simply place the plugin in
this folder. Or if you prefer it be within the "Macros"
portion of the Plugins drop-down menu, then within the plugins
folder is a "Macros" folder. Simply copy the Extinction
macro to this folder. It will then appear in the drop-down
menu via Plugins->Macros->Extinction Suite vx.x.x.
Fiji: the operation is
similar, however you will need to add an underscore "_" to the
end of the "Macros" folder if you wish to use it instead of the
Plugins folder. The "Macros" folder contents will then be
available through the plugins drop-down menu. A note on
Mac with Fiji: if you browse to the Application folder in
search of the Fiji application folder and you only find an icon,
simply control-click or two-finger click Fiji and select "Show
Package Contents." You will then find the Fiji application
contents.
After
starting the Macro in ImageJ it prompts the user to close any
images in ImageJ previously opened. Close any open images and
click "ok". It then prompts the user to select the processing
mode, as unpolarized or polarized (see panel shown to the right),
and to select the desired operation to execute. There are
two operations available: run the Extinction Suite, or run the
folder mapping module.
Unpolarized Analysis
|
Polarized Analysis
|
|
|
By choosing "Run Extinction Suite" from the operating mode
drop-down menu (see Extinction Suite
Panel), you will move onto the main modules of Extinction
suite. These modules are to be run once you have captured
all data required for analysis (see Summary
of Images to be taken).
Upon choosing "Run Extinction Suite," the user will be prompted to
select which modules may be run, see the panel at the right.
The modules can all be run individually, or in various
combinations, however, some require a folder structure developed
by the previous module. For instance, the Particle Analysis
can be run alone, but at some point previously, the Extinction
Analysis module must also have been run. Details about how
each module runs can be found in the next sections, so the user
can decide his/her preferred usage of the suite.
Following the user's choice of modules, he/she will be presented
with a panel prompting input of the main characteristics of the
data to be analysed. The panel will change depending on what
modules the user has chosen to run. The example panel, seen
at right, assumes all modules have been chosen. The first
option asks the user to specify the format of the captured
images. This input allows that the folders may contain files
other than those to be analyzed, for instance ".rec" or ".txt"
files containing camera and image information recorded along with
the image. It will recognize any of the native formats of
ImageJ, and any of the consumer RAW formats listed on the Wikipedia
Raw Image Formats page. The second input is simply a
choice of whether or not the data is color or BW.
Instructions for the next two options are given, in detail,
directly in the panel. Briefly, you can choose between two
types of image, namely, standard single image files, or
multi-image stack files. The final option is to specify
whether or not darkfield images were captured, and if so, how the
darkfield background will be dealt with. The options are (A)
no darkfield images were taken (B) no darkfield background
reduction (C) subtraction of DFBG images (D) subtraction of a
numerical offset. By choosing any of the methods of
darkfield background management, you are, by default, indicating
that you have acquired darkfield images.
This
module is intended to convert RAW files, such as Canon .CR2, to
files usable by ImageJ, such as TIFF or JPEG. It can more
generally be used also as a batch converter between image
formats. The RAW files are opened with the DCRAW reader
plugin into 16-bit linear format for quantitative analysis.
For a detailed list of the image formats, which can be opened
using DCRAW reader, please see the DCRAW homepage
(toward the bottom).
The user selects which of the F, D, BG, etc. folders will be
considered for conversion (see panel to the right). ImageJ will
determine the number of files in the folder, and collect filenames
from the folder in alphabetic order. By default the
background set is not selected, because the background during one
imaging session is typically stable and needs to be converted only
once. In this case move the BG folder (converted/averaged during a
previous macro run) into the new base folder. Immediately after this panel, a
similar one will be seen for the averaging (next) module, if
selected.
Next, if you are running only the
converter module and using colour images, you will be
asked if you want to split the colour channels. If yes, the split
images will be created in subfolders called "R","G", and "B" in
each of the parent folders. The Averager module requires this
splitting into single channel images, thus you will not be
prompted for this choice, if you run both the converter and
averager.
Next you will be asked if you used the
mapping module to create your folder tree. If yes, the
program will use the related folder names. If not, you will
be asked to provide the title of the base folder and the
sub-folders manually (panel to the right).
Next you will be asked for the
destination format and the number range of images to convert,
defined by the starting image number, and number of images
to convert. By default the range is set to use all images in the
folders. The starting image and number of images to convert
can be different between the different kinds of images, i.e.
Focus, Defocus, etc. However, in polarized mode, the
starting image and number of images must be the same through ALL
polarizations of the same image type, i.e. focus, defocus etc. may
still be different, but focus(0) and focus(10) ...focus(180) must
have the same number of images. The panel to the right will be seen once for each of
the image types. A similar panel will be seen for the
averaging (next module), also once for each image type.
After this selection, the conversion process will start. The original images will be moved into a RAW subfolder. If RGB splitting is chosen, the split images are stored in the R, G, and B subfolders. If splitting is not chosen, or not possible, the converted images will be created in a new folder name, "converted."
This module produces averaged images of all image files in each
subfolder. You are also given the option to create an RGB
merged average image, from the images in the R,G,B sub-folders.
The averaged images are stored in a subfolder "Averages", with a
identical R G B folder structure, assuming a color image as
input. If BW images are averaged, then the averaged F, D,
BG, etc. images are created in an "Averages" folder in the main
directory.
Note: In the option panels
for the averaging modules (similar to the one seen above for the
conversion options), you will find a checkbox option for
deletion of individual converted channel files. Check this
if you want to delete the converted files, hence saving space by
keeping only the averaged, and original, images.
You may use this module individually, in which case you will be prompted to provide the folder names and the image format, as in the converter module.
This module assumes a folder structure as created by averaging
module. It creates a folder in the base folder called "Extinction"
into which the resulting images are saved.
The extinction images are calculated as
(1-(Focus-BG)/(Defocus-BG)), and are saved as 32bit float TIFF
files.
The dark-field images, if selected, will be background-subtracted
only, DF-BG, and saved as 16bit TIFF files.
You can run this module separately.
In B/W mode you will be prompted to choose the files directly
rather than the containing folder, i.e. one for each of the
image sets, unless running the polarized procedure. In RGB
mode you will be prompted for the containing folder.
While the plugin was written to analyze nanoparticles within an
image, the development of the extinction image applies to many
cases where you may wish to inspect the absorption/scattering of a
sample. As such, depending on what you are using the program
to observe, you may not wish to average any images. The
converter module can be used seamlessly with the extinction
module, bypassing the averager module, in order to develop an
extinction image from only one captured image. If you choose
to do this, in the RGB case, the converter will create the "R",
"G", and "B" folders, convert and split the single file, and place
each of the appropriate channels into the folders (one file per
folder). Hence, the extinction module will no longer look in
the averages folder, but will take files from each of the R, G,
and B folders in each of the F, D, BG, etc., sets. In the
B/W case, you will be asked to simply select the individual F, D,
BG, etc., images.
This is a section with more significant input from the
user. The macro uses ImageJ's built-in "Find Maxima"
function to locate the positions of the nanoparticles in the
images. In order to do this it must be thresholded above the
image noise. You
will be prompted to choose the analysis options. If
you run only the analysis module (having perhaps previously
prepared the extinction images), you will have to specify the
image type as RGB or B/W. The other options include three
methods of cross-section calculation, i.e. single radius, double
radius, or regional methods, one or two nanoparticle sizes, and
the material to be analyzed, i.e. gold, silver, or
non-metallic. The choice of material is relevant only to
color images. The material choice allows us to place a
filter on the data to collect information only for particles
having a cross-section which is largest in the color channel
corresponding to the plasmon resonance of the material, i.e. for
single spherical particles, the blue channel for silver, or the
green channel for gold. Choosing non-metallic particles no
such filter is used. In
the case of the polarized analysis, selecting the material
allows us to again choose those particles which we believe to be
single/mostly spherical, based upon the color of those particles
whose mean cross-sections (across all polarizer angles, i.e. as
if unpolarized) are largest in the channel corresponding to the
plasmon resonance. If you wish to measure the
ellipticities of all particles even those of extreme ellipticity
or aggregation, i.e. those whose mean cross-section is no longer
largest in the channel corresponding to the plasmon, then select
"Non-Metallic." Finally, there are two options
available for one-time processes to calibrate the optimum
measurement radius (Ri) for your setup, as well as the η factor
(see paper for explanation). The η
factor is used for the absolute scaling of the scattering
cross-section from dark-field images, which depends only upon the
condenser / objective / camera combination. These two
calibrations should be done in unpolarized mode.
In the Nikon Ti-U microscope stand with the Canon D-40 camera on
the left port with the sensor in the intermediate image plane, the
optimum measurement radius is given by Ri=0.135
pixels*magnification*tube multiplier/numerical aperture. For
0.95NA 40x magnification with a 1.5x tube multiplier we find
Ri=8.5 pixels. If you do not know your optimum Ri, run the
one-time calibration. The extinction image most relevant to
your chosen material will be displayed. You will be prompted to
locate a well isolated particle, and zoom in using the ImageJ
toolbar. Place the cursor as best you can over the center of
the particle and then note the X & Y coordinates shown in the
ImageJ toolbar. Click "Ok" to close the prompt. You
will be instructed to enter the X&Y values in another
prompt. Do so, and the program will construct a plot of
extinction cross-section versus measurement radius, Ri. It
uses the double radius method, with the second radius give by
2Ri. Inspect the plot. Record the radius at which the
extinction cross-section saturates. This is your optimum
Ri. Close the plot.
The η factor calibration does not need a manual selection of a
particle. However, it requires a "purely" scattering sample
of nanoparticles smaller than the optical resolution, creating an
approximately isotropic scattering. If you run this
calibration you will not be prompted for the η factor later in the
same run of the module. Instead the η factor will be
calculated (see paper), written to the log, and automatically used
to scale your scattering values. Keep the value of η for
your records, so that you will be able to use it afterwards in
this module for the same
condenser/objectives/camera.configuration. A suited scatterer
material are nanodiamonds of 100nm size, which should show a white
powder color in dry form..
For a correct scaling of darkfield and brightfield, the lamp
intensity has to be constant. The different signal strength can be
compensated using the camera exposure time.To allow for alignment
under dark-field, one can remove a neutral density filter and
replace it for the measurements. For the Canon D-40, short camera
exposure times (<10ms) lead to shutter induced artifacts in the
measured intensity.
If you analyze dark-field images as well as extinction images, or
if you analyze polarized images, it is common to see small
transverse shifts in the field of view due to drift or movement
during switching from brightfield to darkfield, or during the
polarization experiment. An image registration (2D shift)
can be applied match the positions of the maxima of the darkfield
to the extinction, or the extinction/darkfield images of different
angles. If you are running in unpolarized mode and want
darkfield analysis you will only perform one image
registration. However, if you are running in polarized mode
you will perform one registration for brightfield only, or three
registrations for brightfield and darkfield. Three sets of
registrations are needed for the polarized extinction/darkfield
analysis, because we must register the extinction images of
different polarizations, the darkfield images of different
polarizations, and the first extinction image to the first
darkfield image.
You will be given explicit instructions in
a prompt and asked to use "Find Maxima" on the extinction image to
preview the noise tolerance (do NOT run the protocol, simply
"preview point selection" followed after inspection by "Cancel").
The image registration looks for patterns of points within a
certain ROI. The procedure works well if you choose a noise
tolerance that results in about 10 points, especially if the ROI
is small. You will be prompted to provide the noise tolerance and
the "Pattern Recogniton Tolerance" (PRT). The PRT allows for
slight changes in particle maxima within a pattern. The pattern
should be fixed, as the nanoparticles are fixed relative to each
other, however very small (1-2 pixels) shifts in the particle
positions in the pattern (i.e. relative to each other) may occur
due to noise and pixelation. The default PRT is 3 pixels, which
should be sufficient.
If you have many points, appearing to
threshold above the same value, simply resize the selection oval
(seen in the image below) around fewer points, then press "Ok."
You will then need to preview the Find Maxima for the darkfield image, which will open after reformatting of the selection oval. Since this image is not normalized, expect mean values over the particles, e.g. we see about 2000 counts (see right panel). Again, click cancel and input this number in the following prompt.
You can see in this darkfield image (right,
below) the reformatted size of the selection oval chosen for the
extinction image above, when prompted. Input the noise
tolerance (2000) and press "ok."
The next screen will prompt you to check the log for abnormalities. The bottom two numbers of the log window, show the mean shift of the particles' x (upper row) and y (lower row) positions, from the extinction image to the darkfield image.
In the above example, mean shifts in the x and y positions of
the maxima of 0.5 pixels are seen. The value is expected to
be below a few pixels for a stable microscope. So we can press
"Ok" here and say "No" to the next prompt, which asks whether to
re-register. Sometimes re-registration is necessary. If, for
instance, the numbers are extremely large (positive or negative)
or NaN (not a number), you will need to re-register. Perhaps
there was not enough pattern overlap, or the maxima density was
too high, etc. If this occurs, simply confirm you would like
to repeat the registration and reformat the selection oval, or
choose more appropriate thresholds for the Find Maxima
protocols.
The above case is applicable for brightfield
to darkfield in either polarized or unpolarized mode.
However, in polarized mode, you will register extinction images
across different angles, and this is a one-step procedure, i.e.
you will be prompted to input a noise tolerance as you did above
for the extinction, but not for dark field. It is the same
for darkfield across the polarizations. Of course, you will
likely use the same values you noted for brightfield to darkfield,
however, the three registrations are distinct to allow you to
check the Log each time and potentially rerun each if there are
problems in any of the three. Across the polarizations the
shifts will appear as a row of comma-separated values (1st row is
x, 2nd is y), as opposed to the one value in the bright/dark-field
registration. Check the entire row for abnormalities.
When this is finished you can proceed to the calibration.
A screenshot after running
module 3, confirming the analysis options, and performing image
registration (if necessary) is shown on the right. The
prompt provides explicit instructions. You start the "Find
Maxima" protocol found in the ImageJ Menu Bar->Process->Find
Maxima. Since the extinction images are normalized images,
the threshold should correspond to the relative intensity noise in
the image, so in this example 0.0165. You can preview the
number of maxima without running the protocol (seen below). Do NOT
actually run the protocol, and do NOT press 'ok' on the above
prompt until you have completed its instructions.
Brightness/contrast adjustment might be necessary to evaluate the
maxima which were found.
A small fraction of maxima which do not
correspond to nanoparticles is acceptable. It is important
to choose the threshold close to the noise since the background in
the single radius method is taken from points outside the disks of
a given radius around the maxima. These regions should not be
influenced significantly by any relevant particles. After
making notation of the required noise tolerance, close the prompt,
leaving the extinction images as they are.
You may manually determine reasonable numbers for the lowest or
highest allowable mean values of the particles using a point & click scheme whose
instructions are given explicitly in a prompt (1st image
down). Prior to this you will be prompted for the
measurement radii for the single or double radius methods.
If you choose to attempt to recognize two different particle size
ranges, you will be prompted to give an upper mean value bound for
the smaller particle size and a lower mean value bound for the
larger particle size (four values in total for two particle
sizes). One should choose particles which are representative of
the largest and smallest particles (either for one or for both
sizes) by measuring the
means of the brightest and dimmest
particles, respectively. A screenshot of this procedure is shown
to the right, where the results appear in a new panel.
Instructions are explicit, however you must close the prompt this
time, before you will be able to use the Point & Click
procedure.
One should be able to see the yellow outline of the hand-drawn region of interest around the bottom right particle (see third image down). Importantly, this example represents the situation where I wish to analyze gold, hence the green channel extinction image has been selected for the user, as gold has it's plasmon resonance in the green. If I were interested in silver, the blue channel would have been selected.
After taking note of the required upper and lower mean limits
(and intermediates if necessary), simply close the results , choose "don't save," and leave
the extinction images as they are. Follow the instructions
and close the "Test" image to end the Point & Click process.
You are then asked to
enter values into several fields. The desired number of BG
datapoints represents how many background datapoints will be
sampled to produce a BG mean and standard deviation. If you chose
to run the regional reduction method, the BG datapoints represents
how many datapoints will be sampled per particle, and hence, per
region. You will also be asked to submit a radius for the region
around each particle which will be sampled for background
data. The smaller the region, the closer the mean and
standard deviation to the double radius method. Be careful,
though, in a very dense sample, you have to make the region large
enough
so that the BG datapoints will have a probability of finding
space free from particles. The scale value in pixels per
micron is dependent on your objective and camera. The
desired radius of the region of interest (ROI) is for us 8.5
pixels. We use twice this radius for the second radius, giving us
a shot noise of the background value a factor of 2 lower than the
average value over the inner disk. Furthermore, one sets the range
values and pixel size values from manual calibration. You
will be asked to specify the noise tolerance (threshold) you
determined via the mock-Find Maxima performed, previously.
At this point, you will also enter the dark-field and bright-field
exposure times (in decimal format), as well as the η factor.
If you chose the shifted reference method in the first analysis
option panel, then you will be required to enter the shift, in
pixels, in the x and y direction. Relating the reference
image to the focused image, a shift to the left is negative in the
x direction, and upwards is negative in the y direction. The
next option is not a numeric input, but an optional field.
The user can choose whether or not to use a Gaussian fit to the
particle's intensity profile for improved centering of the
ROI. A Gaussian fit to the particle's intensity is made
along the x-axis, y-axis, and both of the main diagonals, all
having their origin at the peak pixel of the particle's ROI.
The mean peak position (in x and y pixel coordinates) of the
fitted Gaussian is then taken as the new center of the particle's
ROI. It is useful in lower resolution images, or images with
a high level of noise, such that the peak pixel does not define
well the "center" of the airy function of the particle. The
next, and final, input requested has some information given
directly in the panel. More explicitly, though, using the
double radius method, a particle must be spaced at least 3 Ri from
any other particle or debris, in order to avoid contamination of
the particle's local BG measurement in the outer radius. We
can get around this limitation, however. Let's call the mean
pixel value of the outer radius,
the standard deviation of the
pixel values in the outer radius,
(called "sigma" in the user prompt). We first measure the
mean of the pixels in the outer radius. Next, we exclude any
pixel, P, for,
and then remeasure the mean, performing this recursively, until
the value converges. N is a simple factor indicating the
number of standard deviations to be accepted, and is the value
requested in the user prompt. By default, N is 2. In
this way, we can exclude points in the outer radius, attributable
to nearby particles/debris. The spacing limit is now reduced
to 2 Ri, allowing for increased particle density in the
image. Any particle who loses more than 50% of the
datapoints in its outer radius via the
-recursion
loop is not accepted however.
Analysis Metadata is printed in the ImageJ Output Log and contains all user inputs to the particle analysis.
The
final data will be saved in the form of excel files and
histograms, produced by custom scripting of ImageJ's plotting
capabilities. These histograms are saved as .png
images. I include a screenshot of a portion of the BG
dataset that would be output using the double radius method
(specified at the top of each column as DR-...). The actual
particle data is similarly presented. The x&y
coordinates of the BG points where the measurements were taken are
given in the 2nd and 3rd columns, and the data-type is given in
the 1st column. The data-type specifies whether or not the
row is for a particle, mean, or standard deviation. Notice
that the BG measurements are given in the form of a cross section
and were measured with the same radius, Ri, as the particles
were. To the right of the viewable region of that dataset is
the scattering and absorption data (extinction minus scattering),
similarly arranged. The regional BG dataset is similarly
constructed however columns will have row-breaks due to each
region having a specified number of datapoints, its own mean, and
standard deviation. The mean and standard deviation shown at
the bottom represent that of all BG datapoints collected across
all individual regions. Intra-regional means and standard
deviations converge to those of the double radius technique.
Inter-regional means and standard deviations converge to those of
the single radius technique. Note: a user may run all three
background methods. The amount of resulting data will be
accordingly large, particularly in the polarized case.
Histograms are provided for each color channel (one channel if
B/W). They show the distribution of cross-sections of the BG
and of the nanoparticles. Lastly, an extinction image is
saved, where each particle is labeled with its corresponding
number on the excel spreadsheet, making it easy to cross-reference
the data with the actual image.
The output data discussed in the general case above is created
for every polarization's "Extinction" folder. Furthermore, a
folder called "Polarization Data" in the base folder will contain:
histograms of the mean particle cross sections (cross-sections as
if unpolarized), histograms of the experimental ellipticity
parameter, plots of cross-section versus polarization for each
particle, distribution (histogram) of individual particles'
ellipticity parameter given simulated noise, and finally a
histogram using all of the particles' ellipticity distributions.
More precisely, each particle's extinction cross-section and
scattering cross-section is recorded versus polarization: see
excel file in "Polarization Data". Each particle will have
it's data plotted for each color channel (custom scripting with
ImageJ's native plotting scheme) and stored in the, "B", "G", or
"R" folders within a new folder called Polarization
Data->"Polarization Curves". Each particle's
cross-sectional data across the polarizations will also be fitted
in order to deduce the relative amplitude parameter, mean
cross-section (as if the particle were unpolarized), and
orientation with respect to the polarizer (see paper for fitting
function): see excel file in "Polarization Data". The fitted
function will be added to each particle's plot (in all three
channels). The user will also be provided with histograms of
the mean cross-sections and relative amplitude parameters across
the color channels: see "Polarization
Data"->"Histograms". Finally, the noise associated with
each particle's relative amplitude parameter will be measured via
a simulated noise procedure (see paper), and presented in the form
of histograms of the possible relative amplitude parameters for
that particle, given the noise: see "Polarization Data"->"Sim
Noise Hist". These fit-distributions are collectively
represented in another histogram found in the same location.
The following images need to be
taken to determine extinction and scattering of a nanoparticle
sample