Skip to content

Width Profile Tools

Volker edited this page Oct 22, 2024 · 19 revisions

Tools to estimate the width-profile of an object given as a binary mask image.

Calculate the width profile of the object

  • as local thickness
  • as voronoi distance between two parts of the contour-line
  • perpendicular to the axis of inertia
  • at regular distances using rays perpendicular to a centerline segment

The source code in github can be found here. Example images can be downloaded from the toolset.

Getting started

You must have the MorphoLibJ-plugin [1] installed.

To install the tool save the file width_profile_tools.ijm into the folder macros/toolsets of your FIJI installation. Start FIJI and select the width_profile_tools-toolset from the >>-button.

toolset.png

Press the install/update-button (cloud with an arrow) to install the tools and restart FIJI after the installation finished.

  • the first button opens this help-page.
  • the t-button calculates the width profile using the local thickness plugins
  • the v-button calculates the width profile using the voronoi-distance between two parts of the outline of the object
  • the i-button calculates the width profile from line-segments perpendicular to the axis of inertia of the object
  • the c-button calculates the width profile from line-segments perpendicular to the centerline of the object
  • the utilities-menu contains utilities to
    • select the centerline
    • smooth a mask image
    • create a line-roi from a mask image containing a one pixel wide line
    • re-measure the local-thickness after having suppressed widths from the thickness-image
  • the install/update-button installs the tools or updates them to a different version.
  • the images-menu allows to download an example dataset and to open the images from the dataset.

Width profile using local thickness

The local thickness at a point p in a structure is defined in [2] as the diameter of the largest sphere, that contains the point p and that fits entirely into the structure. In the 2D-case we use a circle instead of the sphere.

thickness_in_a_point.png

To calculate the local thickness, create a binary mask and press the t-button.

thickness_result.png

If the border is not smooth we get some small thickness values for the bumpy regions. In case they are not wanted, we can suppress them as suggested in [2], if their thickness is smaller than the smallest thickness of the main structure. To do this in practice, set a lower threshold on the 32-bit result image, so that the unwanted values become excluded. Apply the threshold and make sure to answer Set to NaN in the dialog. This way the unwanted values will be eliminated without changing the remaining values. To measure the corrected thickness values (mean, min, max, ...) use the Re-Measure Thickness-tool from the utilities menu of the toolbar. You can also create a new calibration bar for the 32-result image, using ImageJ's Analyze › Tools › Calibration Bar... command. Before running the command make sure that the contrast limits a reset with the Brightness & Contrast-adjuster.

thickness_result_corrected.png

We can also create a centerline-roi from the input mask image, transfer it to the thickness image and create a profile plot. You can use the Select Centerline-command from the utilities menu to create a centerline-roi. Select the thickness-image and click on the centerline-roi in the roi-manager to activate it on the image. Create the profile plot with the command ̀Analyze › Plot Profile.

thickness_result_plot.png

Width Profile using the Voronoi-Distance

The Voronoi-diagram partitions the plane in a way that all points in the same cell have the same nearest object. See [3] for a list of literature about Voronoi-diagrams.


By taking two parts of the outline of a structure as objects, we can find the Voronoi-separation-line on which all points have equal distance to both objects and the distance to the two objects on each point of the separation-line. To get the width of the structure we multiply the distance by 2.

You can calculate the width profile with the Voronoi-method by pressing the v-button on the toolset.

Voronoi-result.png

If the structure touches the edges of the images on both ends, its outline is naturally separated into to parts. If that is not the case, two rois marking the opposite ends of the structure need to be provided. Draw each roi using ImageJ's Rectangle- or Polygon-Selection tool and add it to the overlay of the image (ctrl+b), before running the Voronoi-width-profile tool.

voronoi_with_caps.png

Width profile using line segments perpendicular to the inertia axis

If the inertia axis of the structure is approximately straight, we can measure the width profile by using line segments from one border to the other, perpendicular to the inertia axis. Note that these widths do not generally correspond to shortest distances from one point on one border to a point on the other border.

perpendicular_inertia_axis_result.png

You can run the width-profile perpendicular to the inertia axis by pressing the i-button on the toolset. A right click on the button opens the option dialog. The options are:

  • Sample Width
    • The distance between two line segments.
  • Left offset / Right offset
    • The distance from the ends of the structure for the first and last line-segment. Use this to avoid line-segments that are not entirely in the image

Width profile using line segments perpendicular to the centerline

Create a centerline roi using one of the methods from the Select Centerline-tool in the Utilities-menu of the toolset, then press the c-button.

perpendicular-centerline-result.png

Again we are not measuring shortest distances from one border to the other. The method will not work well if the object has knee or elbow-like forms, leading to sharp-curves in the centerline.

A right-click on the c-button allows to modify the options of the tool:

  • Sample Width
    • The distance between two line segments.
  • Left offset / Right offset
    • The distance from the ends of the structure for the first and last line-segment. Use this to avoid line-segments that are not entirely in the image
  • Radius
    • Each line segment will be calculated perpendicular to a line segment with the start point radius points before the position and the end point radius points ahead of the position. Larger radii will give smoother changes of directions, however with too large radii, the whole rotated line segment might be outside of the structure.

Macro-recordable commands

All tools and utilities available from the toolset are provided as separate commands and are macro-recordable. Run the commands from Plugins › Width-Profile-Tools to record the parameters.

History

01.09.2023 Wrote a new installer/updater
The old version stopped working due to changes of github. The new one is implemented in jython. If you do not have jython installed, the first time you run the installer/updater, jython will be installed. You then have to restart Fiji and run the updater again.

Slides of the I2K 2024 workshop

Other (third party) width-profile software

Literature

[1] Legland, D., Arganda-Carreras, I., & Andrey, P. (2016). MorphoLibJ: integrated library and plugins for mathematical morphology with ImageJ. Bioinformatics, btw413. doi:10.1093/bioinformatics/btw413

[2] Hildebrand, T., and Rüegsegger, P. (1997). A new method for the model‐independent assessment of thickness in three‐dimensional images. Journal of Microscopy 185, 67–75. 10.1046/j.1365-2818.1997.1340694.x.

[3] Bernal, Javier. (1993). Bibliographic Notes on Voronoi Diagrams.

Clone this wiki locally