G. Landini - Software

This page has moved! Pease update your bookmarks: http://www.mecourse.com/landinig/software/software.html

Here are some ImageJ macros and plugins that I have written.
Please make sure that you have the latest version of the ImageJ ij.jar file

Disclaimer: The software in these pages is experimental. Use these plugins at your own risk. Although I have made every effort to make sure that they run as intended, there may be bugs and unexpected behaviour in instances that I have not envisaged.
Please send any comments, problems or improvements to .

Copyright notice: Please check the copyright notices in the source code of each plugin. Some of the plugins are modifications of earlier versions written by other authors and therefore their original copyright notices apply. Please respect the original authors authorship notices.
If no specific copyright notice is included, then consider the plugin as free software: you can redistribute it and/or modify it under the terms of the GNU General Public license as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version.
These programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the programs; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

IsoPhotContour (java & class files) and IsoPhotContour2 (java & class files) These plugins take a greyscale image and creates a new image [called IsoPhot] with up to 8 contour lines in the grey scale range. Isophotcontour2 can be drawn in different selected colours and depth levels. There is an option to draw the contour lines on a white or on a black background. There is also an option to convert the image to 8 bit colour image, otherwise the result is an RGB image

New in 1.2 Can deal with stacks.

Blend (java & class files) Blends (linearly) two greyscale or RGB images with a chosen mix ratio.

List_LUTs and LUTs plugins. Files and examples can be found here.

Align_4 (java & class files) This plugin allows manual alignment (movements in the x and y directions) up to 4 images. Supports transparency of the active image and selection of fiducial points (an origin and a target) for easy alignment. The plugin may be useful to build mosaics of smaller images.

Align_RGB_planes (java & class files) This plugin allows to shift (move in the x and y directions) stretch and rotate the red green and blue planes in an RGB image. Includes a macro to resize images so they are not affected by the cropping due to the rotation. Thanks to Leon Espinosa for suggesting the modification to log the net movement of the planes.

New in 1.7 Supports stacks of RGB images. A set of buttons to move across the stack will appear when dealing with stacks. To align 48bit RGB stacks use the Align_Slice plugin.
New in 1.9 Does All Slices.

Align_Slice (java & class files) This plugin allows to manually shift (move in the x and y directions) stretch and rotate a particular slice in an image stack.

Auto_Threshold and Auto_Local_Threshold (link to jar file, source included) These plugins binarise 8-bit images using various global (histogram-derived) and local (adaptive) thresholding methods.

Requires v1.42m or newer. Copy the jar file into the ImageJ/Plugins folder and either restart ImageJ or run the Help>Update Menus command. After this 2 new commands should appear: Image>Adjust>Auto Threshold andImage>Adjust>Auto Local Threshold. Details and examples can be found here (local link) or at the Auto_Threshold and Aulto_Local_Threshold at the Fiji website wiki (external links).

Threshold_Colour ( jar file includes source ) (requires ImageJ 1.43h This plugin (a modification of Bob Dougherty's BandPass2 filter) allows to threshold a colour RGB images in the HSB, RGB, CIE Lab and YUV spaces. It suports extracting the range of HSB, RGB, CIE Lab or YUV values from a sample ROI (any type). Use: Extract the files from the zip archive and put them somewhere in the plugins directory (or subdirectory). The Threshold_Colour entry will appear in the Plugins hierarchy, depending  on where theof the subdirectory which the plugin is copied to (I suggest the name "Segmentation" to keep all thresholding plugins).

Version 1.7 has a [Macro] button that generates a macro and sends it to the Recorder window (if active) based on the current plugin settings. The zip file also includes RGB2YUV and RGB2Lab plugins which are necessary for that macro (note that these plugins convert an RGB image to YUV and CIE Lab colour spaces but with values mapped into an 8-bit space).

Version 1.8 added a warning and commented lines for back/foreground colours.
Version 1.9 solved the problem of not applying the threshold if the original was being displayed.
Version 1.10 added Select button. Fixed bug related to the name of files created with the image calculator command, solved bug in macro generated code for IJ v1.43h onwards.
Version 1.11 background according to Binary>Options, thanks to Michael Schmid for several tips.
Version 1.12 fixed the Selection button to return the proper ROI rather than the inverse of it, launch recorder if not active when pressing [Macro], added batch mode to the macro code. Version 1.15 the sRGB to Lab conversion now matches the colour space converter plugin in ImageJ.
New! Version 1.16 fixed Lab space rescaling into 8 bits container.

Anaglyph (java & class files) Creates colour or greyscale, red-cyan or red-green anaglyphs, stereo pairs (crossed view stereo pairs) and depth-map images from the depth data and focused image generated with the extended depth of focus plugin. The Anaglyph plugin expects both the "Height-Map" and "Output" images to be open (they hold the "topographical map" data and the "on focus" data). For Height-Map images created using other programmes, they can be 8 or 32 bits, but they should not be re-scaled (i.e. depth plane pixel values should be contiguous in the grey scale and start a 0). Because it cannot be known in advance the acquisition direction of the Z sequence, it may be necessary to invert the view sides when checking the red-cyan anaglyph. The plugin has been tested with only a small number of slices (6~20), so please report any problems.
New in 1.6:
A recent update of the Extended Depth of Focus plugin changed the name of the "Topology" image to "Height Map". Version 1.6 of the Anaglyph plugin also expects the new file name.

Colour_Deconvolution (java & class files) This plugin implements stain separation using Ruifrok & Johnston's colour deconvolution method described in [1]. Details and examples can be found here.

Dichromacy (java & class files) This plugin simulates the three main types dichromatic vision due to lack of function or absence of retinal photosensitive pigments: protanopia (red), deuteranopia (green) and tritanopia (blue cones deficiency). More details and examples can be found here.

ThreePointCircularROI (java & class files) This plugin creates a circular ROI based on 3 user selected points on an image. The log window reports the coordinates of the centre of the circle and its radius. Co-linear points (that define an impossible circle) return a radius of -1.

Colour_Correct (java & class files) This plugin corrects the colours of an image by first subtracting the mean RGB values of a number of selected points considered to be 'black' and then subtracts the background by performing the ratio of the image and the mean RGB values of a number of points considered to be 'white' minus the 'black'. It does not correct for uneven illumination. The procedure is:

image = [(original-black)/(white-black)]*255.

This is a simple and quick (although not the best) method to compensate the filament temperature colour of light transmitted images such as bright field microscopy when there is no original illumination source available to perform the correction.

New in 1.3 Bug fix, popup menu disabled during right click.

Convex_Hull_Plus (java & class files) This plugin calculates the convex hull and the minimum bounding circle of a binary set (formed by white or black particles).
The Convex Hull is the smallest convex polygon that contains the set. The plugin uses the 'wrapping around' (Graham scan) algorithm.
The Minimum Bounding Circle is the smallest circle that contains the set. An algorithm was modified from Xavier Draye's posting to the ImageJ mailing list. I implemented so it does the calculations based on the convex hull points rather than the whole set (as the points that define the Minimum Bounding Circle must be in the Convex Hull). This should be speed up the computation. Please see the source code for details.
The plugin can display any of the above as a selection or draw them on the image. The plugin also displays in the Log window: the number of points in the Convex Hull, the length of the Convex Hull, the centre coordinates and radius of the Minimal Bounding Circle (in pixel units).
Version 1.1 returns these values in floating point format.
Version 1.2 fixes a bug in the Minimal Bounding Circle routine.

RCC8D and RCC8D_Multi.  These are plugins implementing Discrete Mereotopology concepts and the Region Connection Calculus to perform spatial reasoning on image contents. More details and examples can be found here and in our page on Intelligent Microscopy.

Results_Histogram (java & class files) This plugin creates a histogram from a selected column of the Results Table data. Note that not everything that is shown in the Results window is necessarily in the Results Table. Incorporated into ImageJ 1.35g as the Analyze>Distribution... command.

Retinex (java & class files) This plugin is an implementation of the Retinex filter from the GIMP package. Retinex filtering is based on Land's theory of image perception.  Several algorithms exist and among these the multiscale retinex with colour restoration algorithm (MSRCR) combines colour constancy with local contrast enhancement so images are rendered in a similar way to the colour perception of the human vision. There appears to be a bug in the GMP filter, which was avoided here by using the built-in Gaussian filter of ImageJ.  The Retinex plugin and examples are here.

The ImageJ plugin was written by Francisco Jiménez Hernández (UAEMex) jimenezf at  fi.uaemex.mx  during a research visit to Birmingham University School of Dentistry. 

IJ_Robot (java & class files) This plugin calls the Robot Java class. The purpose of the plugin is to allow the macro language to control other programs via programmed clicking and key presses.
When running the plugin one must specify an 'order' to the robot and some parameters (not all orders require all the parameters).

A handy way to find the target coordinates is to first grab the screen (which opens as an image in ImageJ) and check the coordinates with the mouse (reported in the status bar).


  1. One should be careful with this plugin because it is really easy to end up clicking in unintended places with undesired results. You have been warned!
  2. It may be necessary to increase the delay time for clicking orders depending on what is needed to be done and the response time of the target program.
  3. It may be also necessary to slow down the macro calls to this plugin between orders by using the macro command: wait(time_in_milliseconds). For instance when grabbing an image with an external programme, this might take some time to complete, and so calling further commands, these might not be executed while the image is being grabbed.

The included demo, seems to work fine in various platforms. Make sure that there are no open images in IJ and that please do not move the mouse while running the macro.

Morphological Operators for ImageJ

Below is my collection of ImageJ plugins to perform various morphological operations.
All plugins are recordable. Some macros that make use of those plugins are also included.
Download the full set as a single zip file from here.
The zip file contains a Morphology folder with all the plugins and macros. Unzip the files in the plugins folder and finally restart ImageJ.
In Fiji, you can activate the "Morphology update site to install the collection.
Be aware that while most macros were written to deal with white regions, the plugins, deal with both, black or white regions (this means that the macros can be easily modified to deal with black regions too).

Please reference in your publications as:

This plugin set the pixels at the border of the image to black (0) or white (255) in the case of 8, 16 and 32 bits and to values (0,0,0) or (255,255,255) in 24bit images. This is used to set the image boundary values for special cases of binary and greyscale reconstruction, watershed transform and so on. Some of the macros in this collection use this plugin.

This plugin dilates (3x3 neighbourhood, 8-connected) particlesin an image (called seed) inside another image (called mask). The procedure can be applied n of times, or until idempotence if n = -1. In that case the procedure becomes is the same as BinaryReconstruction.

This plugin erodes (3x3 neighbourhood, 8-connected) particles in an image (called seed) except what is masked in another image (called mask) (i.e. the mask "protects" what should not be eroded). it can be applied n times, or, until idempotence if n = -1.

Returns the number of connected pixels (+1) to each foreground pixel (8 neighbours): background = 0, single pixel = 1, end of a line = 2, bifurcations = 3, triple points = 4, etc. To see the resut, you will need to adjust the Brightness/Contrast, or use an appropriate LUT such as glasbey.lut (included in this collection).

This plugin performs a 3x3 8-neighbour Binary Dilation of a binary image. The differences with the built in Dilation in ImageJ are:

Notice: This plugin will be discontinued since ImageJ 1.33q fixed a bug that prevented border processing and also implements the use "coefficients". Note, however that in ImageJ, the coefficients range from 1 to 8 instead of 0 to 7.


These plugins perform a conditional binary dilation of a binary image (without merging particles together). The results are similar to a binary watershed transform of the background, partitioning it into areas of influence of the particles. Dilations are done with 4 or 8 pixel structuring elements respectively. The number of iterations can be set. Use -1 for dilation until idempotence.
Very slow, maybe there are better algorithms, but slow seems better than nothing...
To dilate without merging until idempotence, the macro Influence_Zones.txt described below is faster, although the principle undelying the algorithm is a different one.

This plugin performs a conditional binary dilation of a binary image (seed) inside another binary image (mask), without merging the seeds when they meet. The results are similar to a the BinaryDilateNoMerge8, but the operation is done inside a mask and so it restricts the dilation to the mask. The number of iterations can be set. Use -1 for dilation until idempotence.
Very slow, maybe there are better algorithms, but slow seems better than nothing...

This plugin performs a 3x3 8-neighbour Binary Erosion of a binary image.
The differences with the built in erosion in ImageJ are:

Notice: This plugin will be discontinued since ImageJ 1.33q fixed a bug that prevented border processing and also implements the use "coefficients". Note, however that in ImageJ, the coefficients range from 1 to 8 instead of 0 to 7.

These plugins fill holes in 8-connected particles (and also in child-particles) of a binary image. This function was incorporated in ImageJ v.1.31o (Process->Binary->Fill holes).
BinaryFill_2 is a much faster version, that uses ImageJ's flood fill.

This plugin filters 8-connected particles in a binary image that otherwise would disappear after n erosions. This technique is also called "opening by reconstruction", The difference with morphological Opening is that BinaryFilterReconstruct preserves the original shape or the particles (while opening tends to smooth the boundaries of particles). The algorithm is n erosions, followed by a Binary Reconstruction of the original image based on the eroded image as the seed.
The macro BinaryFilterReconstruct.txt shows how to implement this as a macro using the BinaryReconstruct plugin.

New in 1.3 Changed 'dilations in a mask' for 'floodfill8 in the mask from the seed' to speed up.
New in 1.4 Fixed bug with black particles and inverted LUTs.
New in 1.5 Slight speed improvement.
New in 1.6 Speed up by using 1D arrays.

This plugin returns the locations of the image that match the kernel pattern.
The pattern is defined by a 3x3 square neighbourhood where 0=empty, 1=set, 2=don't care.

BinaryLabel8_.class and BinaryLabel_.class
ImageJ plugin for labelling particles (8 neighbours) in a binary image.
BinaryLabel8_ can label up to 65530 particles in a unique greyscale value (from 1 to 65531), after that, the colours are recycled.
The output is a new 16 bit greyscale image with re-scaled brightness.
BinaryLabel_ can label more particles thant the above, as it stores the result in a 32bit image.
The BinaryLabelMacro.txt macro does a similar job.

The ideal look up table (LUT) to maximise the contrast between labelled particles is glasbey.lut (included in the zip file). Please read about it in Chris Glasbey's website (the link to the paper is http://www.bioss.ac.uk/staff/chris/colorpaper.pdf ).

This is a very powerful morphological operation that reconstructs (retains) 8-connected particles in an image (called mask) based on markers present in another image (called seed).
Morphological Reconstruction consists of dilating the seeds inside the mask (so particles that do not have seeds are not reconstructed).
New in 1.5 Changed 'dilations in a mask' for 'floodfill8 in the mask from the seed' to speed up.
New in 2.0 Rewrite following the guidelines at http://pacific.mpi-cbg.de/wiki/index.php/PlugIn_Design_Guidelines. Apart from being about 4 times faster, it can be called from another plugin without having to show the images. The plugin does not process stacks anymore, but that was not commonly used anyway.
To call the binary reconstruction plugin from another without displaying the images use, for example:

   BinaryReconstruct_ br = new BinaryReconstruct_();
Object[] result = br.exec(img1, img2, null, false, true);
//parameters above are: mask ImagePlus, seed ImagePlus, name, create new image, white particle
if (null != result) {
String name = (String) result[0];
ImagePlus recons = (ImagePlus) result[1];

This procedure is called "Feature-AND" in reference [2].
New in 2.1 Supports 4-neighbour connectivity.
New in 2.2 Speed up by using 1D arrays.

BinaryKillBorders_.class This plugin deletes binary objects that intersect the image border.


These two plugins dilate the locations of the image that match one (BinaryThick_.class) or two (BinaryThick2_.class) kernel patterns.
First dilates then rotates the kernel, if set to do so. The pattern is a 3x3 neighbourhood where 0=empty, 1=set, 2=don't care.

These two plugins erode the locations of the image that match one (BinaryThick_.class) or two (BinaryThick2_.class) kernel patterns.
First erodes then rotates the kernel, if set to do so. The pattern is a 3x3 neighbourhood where 0=empty, 1=set, 2=don't care.

This macro creates a catalogue of particles (all in one image) and a stack (1 particle per slice) sorted by the values of any of the morphological parameters in the Results Table.

This plugin allows to classify the particles based on the data produced by other plugins. Here are all the details.

This plugin computes the correlation between any 2 parameters from the Results Table.

This plugin extracts "domes" in a greyscale image. Domes are also called h-convex transform in [6] and they are obtained by subtraction of the h-maxima from the original image
They are bright 8-connected regions of up to given height h (measured from their top downwards) in the greyscale function such that all the pixels around the dome have strictly lower greyscale values.
This plugin can also return "basins" (regionally dark regions) or h-concave transform in [6] instead of domes. They are obtained by subtraction of the original from h-minima transform

Domes and basins are good candidates to extract reconstruction markers in images with uneven backgrounds. See reference [3].

New in 2.0 Rewritten following the guidelines at http://pacific.mpi-cbg.de/wiki/index.php/PlugIn_Design_Guidelines. This version uses the new GreyscaleReconstruct plugin.
New in 2.1 The basins are returned with the correct polarity.

This macro produces an Euclidean Distance Map on a binary image [the object over which the EDM is calculated is assumed to be 255 and the background 0]. The macro extends the built in ImageJ command to distances of up to 65535 pixels. The result is a 16 bit image. Note that the distance transform implemented in ImageJ (and used in this plugin) is approximate. If you need an exact distance transform, see Bob Dougherty's Local Thickness. plugin.


These plugins perform a 3x3 Binary Dilation/Erosion of a greyscale image. Same as the Min and Max filters of radius=1 (8 neighbours) in ImageJ, but:

Greyscale "Proper" Morphological Filters (macros)

This plugin reconstructs a greyscale image (the "mask" image) based on geodesic dilations of a "seed" image. This is an implementation of the parallel algorithm from [3] (there are faster algorithms, though).
It is very important to read Vincent's paper [3] and Soille's book [6] to understand greyscale reconstruction and its applications.
The reconstruction algorithm is: iterated 8-neighbour geodesic dilations of the seed UNDER the mask image until stability is reached (the idempotent limit).
The 'reconstruction by erosion' corresponds to the complement of the reconstruction by dilation of the complement of the mask with the complement of the seed (i.e. invert both images, reconstruct by dilation and invert the result).

New in 2.0 Rewrite following the guidelines at http://pacific.mpi-cbg.de/wiki/index.php/PlugIn_Design_Guidelines. Apart from being immensely faster, it can be called from another plugin without having to show the images. See the example for BinaryReconstruct. This version computes the result image differently, which seems much faster for large images. It visits all grey levels where it binary-reconstructs the thresholded mask with the thresholded seed and retains the maximum greylevel at which the reconstruction was done. The plugin does not process stacks anymore, but that was not commonly used anyway.
New in 2.1 Supports 4-neighbour connectivity.

Morphological Gradients and 2nd Derivative macros

Morphological_Clustering.txt labels particles in k different classes based on the raw data in the Results Table, their computed Z-scores (data transformed to have mean=0 and standard deviation=1, so all descriptors have comparable weightings) or the principal components extracted. It requires Jarek Sacha's k-means clustering plugin (http://ij-plugins.sourceforge.net/plugins/clustering/index.html)

Morphological_PCA.txt uses Michael Abràmoff's PCA plugin (http://bij.isi.uu.nl/pca.htm) to reduce large data sets by combining existing variables into a smaller set of 'components' based on their contribution to the observed data variance. The new components are appended to the Results Table. You can then use the principal components to -for example- do k-means clustering with the Morphological_Clustering macro.

Parameter_Matrix.txt creates a graphic representation of the object parameters in the Results Table (normalised to the table values) as coloured spots in a matrix. The data values per particle (in a row) use a diverging look up table which facilitates identifying extreme values as well as objects with similar morphological properties.

Particle_Data_Map.txt labels particles with up to 3 raw or rescaled shape parameters as RGB, HSB or HS values. Mapping values to object positions may help revealing spatial associations. This is a form of spatial encoding that can be used to disclose where in a sample the different morphological features appear. Alternatively it can be used for performing interactive parameter thresholding (e.g. mapping the values as RGB and using the Threshold_Colour plugin in RGB mode so the 3 available sliders filter a different parameter each).

These are plugins for estimating various statistics of binary 4- and 8-connected particles or lines (Lines8_).

1) These plugins assume square pixels to extract the various geometrical measures. If your image capture device has an aspect ration different to 1:1, you should not use these plugins.
2) These plugins do not return exactly the same values as the built-in ImageJ Analyze Particles command because they use an alternative concept to extract area and perimeter. Here, Perimeter and Area are measured from the centres of the boundary pixels of a particle, i.e. the length of the 8-neighbours chain code (Freeman algorithm).
Area disregards "holes" in the particles (i.e. it returns the area bounded by the perimeter), but Pixels returns the number of pixels forming the particle (a particle with holes will therefore have more Area than Pixels.
Also note that as Area is calculated from the polygon formed by the boundary pixels (the chain code), if the particle has no holes, then Area is likely to be smaller than Pixels (since the polygon is positioned in the centres of boundary pixels). Using this logic, the Area of 1 pixel particles is 0, for a 2x2 square it is 1, etc. while the value of Pixels in each particle is what you see.
Likewise, a single pixel particle has a Perimeter of 0, for a 2x2 square it is 4, and so on.

Why to write such a plugin?
This was created to return exactly the number of pixels in particles when dealing with synthetic images (such as percolation clusters).
The Analyze Particles command in ImageJ performs a different measurement of the perimeter of particles.

These plugins can label the particles in different colours. Some colours are reserved for the particle detection and some temporary calculations, so there are only 250 labelling colours available (1 to 251). It is therefore possible when using Particles4_ that two 4-connected particles which are corner-neighbours may end up labelled with the same colour and consequently look like a single 8-connected particle (this may happen when a very large particle is surrounded by many small ones). Although the labelling may appear confusing, the results generated are correct. (If one only needs to label the particles unequivocally, then it is better to use the BinaryLabel8_.class plugin because it can label up to 65530 particles in unique greyscale values --after that, it also recycles the labelling colour.). BinaryLabel_.classcan label more particles as it uses a 32bit image to store the labels, but remember that .

The plugins can draw the centre of mass (rounded to the nearest pixel, labelled or not) of each particle or the start coordinates of each particle (the only pixel with 100% certainty that it belongs to the particle). These may be useful for reconstruction purposes (see the KeepParticlesInRange.txt macro below and BinaryReconstruct_ plugin above).
Filtered particles (smaller than the minimum and larger than the maximum sizes) are deleted from the image.

Lines8_ is an experimental modification of the Particles8 plugin to analyse lines and skeletons. The main differences from the other 2 plugins are as follows. (i) The option to skeletonise the image guarantees that the analysis is performed on lines/skeletons. (ii) Provides two estimates of skeleton lengths: PLength is measured from the boundary pixels (each counted once regardless the number times they are visited) while SkelLen is the length based on connectivity. SkelLen also measures the length of branches that are not part of the boundary (such as branches inside loops, which PLength will otherwise miss). (iii) Skeletons can be characterised by their pixel connectivity using the Redirect to>Connectivity option. This creates a new image where each particle pixel in the original is labelled with the number of particle pixels (including itself) that exist in its 3x3 neighbourhood. The frequency of 1- to 8-point neighbour pixels is also reported to the Results table and can be utilised to infer the number of free ends (given by 1Point counts), inside-line points (2Point), the number of bifurcations (3Point) and so on. Interestingly, the skeleton can reveal additional geometrical properties of the objects. For example, polygons usually have skeletons with the same number of branches as number of sides (unless the borders are very noisy) which can be inferred from the 1Point counts.

New in Version 1.6
The labels of the options have been modified so they are consistent with those of the built in Analyzer in ImageJ.
A new option "Overwrite Results" was added to prevent the macro asking to save or delete the current Results when executing from a macro.
The results of the particle analysis are now sent to the ResultsTable, so the data generated can be retrieved from a macro for further processing. The macros below show how to do it.

Note: Although these plugins can analyse stacks, the results from all the slices are stored in the same ResultsTable. The data has an extra column named 'Stack' that indicates where the measurements belong to. Therefore, the macro examples above need to be modified to work properly with stacks.

New in Version 1.7
The plugin analysis has been extended to include the following new parameters:

Particles8_Plus adds more parameters (complete list below).

New in Version 1.8
Fixed bug that did not delete single border pixels when "exclude edge particles" was selected. Added CountCorrect parameter for unbiased counting of particles. This parameter should be used with "exclude edge particles" checked.
Here is the complete list of parameters:

Example macros that show some of the new parameters: DrawBoundingBox.txt, DrawFeret&Breadth.txt, DrawMinR&MaxR.txt.
The macroUnbiasedCounting.txt counts particles that touch the top and right image frames but not the bottom and left frames.
The macro UnbiasedParticleArea.txt estimates the corrected average particle area and number using the CountCorrect parameter.

New in Version 1.8a of Particles8_Plus
Fixed a bug in the Minimal Bounding Circle routine.
Added an example macro: DrawBoundingCircle.txt.

New in Version 1.9
When the image is a stack, the stack label is written to the Results window ("null" otherwise).
Changed some parameter names that caused problems when importing the data into SPSS.
DrawFeret&Breadth.txt was updated to use the new parameter names.

New in Version 2.0
More parameters are calculated by the plugin (the value -1 indicates that the parameter is no possible to calculate):

The measurements can be redirected to another image. "Redirection" means that the plugin will use the current binary image to extract the particle profiles and morphometrical parameters, and a further 8bit greyscale image (typically the original image from which the binary image was created) to extract the greyscale statistics corresponding to the particles. This second greyscale image must be open and its name specified in the Redirect to box. When redirection is selected, the following greyscale statistics are produced:

New in Version 2.1: Removed the "\n" from the slice label, otherwise the Results table is not formatted correctly.
New in Version 2.2: Better use of the Results table.
New in Version 2.3: Added redirection to RGB images to extract particle colour (R,G & B) stats. When the redirection is to a greyscale image, the greycale stats introduced in version 2.0 are extracted instead.
New in Version 2.4: When the Overwrite results option is false, the data is appended to the Results table. When run from the IJ menu and Overwrite results is true, it will ask to save any existing data in the Results Table before deleting it, but when run from a macro, no questions are asked.
New in Version 2.5: Fixed a bug that overflowed the calculation of the centre of mass when dealing with very large particles.
New in Version 2.6: Speed up using flood fill instead of scanning up and down the blob bounding box
New in Version 2.7: Single plugin to do morphology or fast analysis. Renamed Particles8_
New in Version 2.8: Fast erasing if using filtering, removed feret drawing (use the DrawFeret&Breadth.txt macro if you need it)
New in Version 2.9: Computes the CentreOfMass at the end, otherwise the point might fall in a near particle and that locks the labelling. Coordinates are done at the end too.
New in Version 2.10: Speed up when adding data to the Results Table. Requires v1.42j or newer.
New in Version 2.11: Fixed a bug introduced in v 2.10 which triggered an error when using size filtering.
New in Version 2.12a: Allow redirection to 16bit images.
New in Version 2.13: Allow be called without showing the image.
New in Version 2.14: Allow redirection to 32bit images.
New in Version 2.15: Cleaned code and speed ups.
New in Version 2.16: Fixed PerimEquivD bug (thanks to Peter J. Lee for reporting this).
New in Version 2.17: Updates table only at the end of processing stacks (much faster).
New in Version 2.18: Convert to plugin so it can be called directly to its exec method, several speed ups.
For example, in a Java plugin, Particles8 can be called directly:
    Particles8_  p8 = new Particles8_();
    Object[] result = p8.exec(imp1, imp2, true, false, false, false, "Particles", false, 0,0, false, true);
    // the parameters above correspond to the various dialogue options (set as required): 
    // (ImagePlusToAnalyse, ImagePlusToRedirectTo, whiteRegions, deleteAtBorders, labelRegions, morphologyParameters, outputOption, filterByPixels, minimumPixels, maximumPixels, showTable, overwriteTable);   
Note the the above will not show the Results Table.
Particles8_ can also be called in a plugin as recorded by the Macro Recorder:
 IJ.run(imp, "Particles8 ", "white show=Particles minimum=0 maximum=9999999 overwrite redirect=None");
However this goes through the dialog, which performs various checks (binary image, square pixels, etc.) that require extra computation.
New in Version 2.19: Fixed single pixel greyscale value in 32bit images was being ignored.

Plot_Histograms.txt estimates histograms of all the morphological parameters in the Results Table with a single command, automatically excluding columns with coordinates values. The result is a multiple graph montage.

Summarize_Results.txt produces statistics of the Results table in tab-delimited format so they can be loaded in other programs. The summaries include the average, minimum, maximum, standard deviation, variance, average deviation, skweness and kurtosis.

Thin_Results_Table.txt based on J. Mutterer's Import Results Table macro, shows how to keep certain values in the Results Table. Note: You should always keep the 'label' column.

Viscous_Geodesic_Reconstruction.txt reconstructs areas of objects larger than a disc of radius R. This consists of reconstruction followed by an opening at every step. Mask and Seed must be binary [0..255]. Foreground must be white and Background black. see reference [5].

Threshold_Global_Gradient and Threshold_Regional_Gradient. Two plugins for automatic global and regional segmentation based on a strategy used by human operators when manually adjusting thresholds. See reference [7] and this page for further details.


  • [1] Ruifrok AC, Johnston DA. Quantification of histochemical staining by color deconvolution. Anal Quant Cytol Histol 23: 291-299, 2001.
  • [2] Russ JC.The image processing handbook Ch7. 3rd Edition, (CRC Press), 1999.
  • [3] Vincent L. Morphological greyscale reconstruction in Image Analysis: Applications and efficient algorithms. IEEE Trans Image Proc 2(2) 176-201, 1993.
  • [4] Pratt WK. Digital Image Processing. 4th Ed. John Wiley & Sons. p624, 2007.
  • [5] Kammerer P, Zolda E, Sablatnig R. Computer aided analysis of underdrawings in infrared reflectograms. 4th Intl Symposium on Virtual Reality, Archaeology and Intelligent Cultural Heritage (2003), pp. 19-27. Arnold D, Chalmers A, Niccolucci F (Editors), Brighton, United Kingdom. http://www.caa.tuwien.ac.at/cvl/wp-content/uploads/2014/12/vast03.pdf
  • [6] Soille P. Morphological Image Analysis. 2nd Corrected Edition, Springer, 2004.
  • [7] Landini G, Randell DA, Fouad S, Galton A. Automatic thresholding from the gradients of region boundaries. Journal of Microscopy, 2016. (PDF)


Last updated on 20/Sep/2016.