Mar 07, 2024

Public workspaceQuantification of fibrosis extend and airspace availability in lung: a semi-automatic ImageJ/Fiji toolbox (step-by-step protocol)

CheckPeer-reviewed method
  • 1Research and Development Department, Metcela Inc., Kawasaki, Kanagawa, Japan.
Open access
Protocol CitationBertrand-David Ségard 2024. Quantification of fibrosis extend and airspace availability in lung: a semi-automatic ImageJ/Fiji toolbox (step-by-step protocol). protocols.io https://dx.doi.org/10.17504/protocols.io.14egn7nqmv5d/v1
Manuscript citation:
Ségard BD, Kimura K, Matsuoka Y, Imamura T, Ikeda A, et al. (2024) Quantification of fibrosis extend and airspace availability in lung: A semi-automatic ImageJ/Fiji toolbox. PLOS ONE 19(2): e0298015. https://doi.org/10.1371/journal.pone.0298015
License: This is an open access protocol distributed under the terms of the Creative Commons Attribution License,  which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Protocol status: Working
We use this protocol and it's working.
Created: May 26, 2022
Last Modified: March 07, 2024
Protocol Integer ID: 63251
Keywords: Lung, Fibrosis, Airspace, SR, MT, ImageJ, Fiji
Funders Acknowledgement:
Kawasaki City New Technology/New Product Development Support Project Subsidy
Grant ID: Grant No. 84
Kawasaki City “New Normal” Research and Development Subsidy
Grant ID: Grant No. 225
Abstract
The evaluation of the structural integrity of mechanically dynamic organs such as lungs is critical for the diagnosis of numerous pathologies and the development of therapies. This task is classically performed by histology experts in a qualitative or semi-quantitative manner. Automatic digital image processing methods appeared in the last decades, and although immensely powerful, tools are highly specialized and lack the versatility required in various experimental designs. Here, a set of scripts for the image processing software ImageJ/Fiji to easily quantify fibrosis extend and alveolar airspace availability in Sirius Red or Masson’s trichrome stained samples is presented. The toolbox consists in thirteen modules: sample detection, particles filtration (automatic and manual), border definition, air ducts identification, air ducts walls definition, parenchyma extraction, MT-staining specific pre-processing, fibrosis detection, fibrosis particles filtration, airspace detection, and visualizations (tissue only or tissue and airspace). While the process is largely automated, critical parameters are accessible to the user for increased adaptability. The modularity of the protocol allows for its adjustment to alternative experimental settings. Fibrosis and airspace can be combined as an evaluation of the structural integrity of the organ. All settings and intermediate states are saved to ensure reproducibility. These new analysis scripts allow for a rapid quantification of fibrosis and airspace in a large variety of experimental settings.
Guidelines
In the following protocol, typographical emphases and brackets have been used for software and in-text references.

They are: (1) software features and tools written in bold, e.g., Wand (tracing) tool; (2) references to steps of the protocol in italics, e.g., step 2; (3) <keyboard buttons> in <angle markers>, e.g., <delete>; and (4) computational workflows linked by angle markers (>), e.g., Plugins > Macros > Edit….

This protocol has been developed for ImageJ/Fiji. Nevertheless, forks can also be used. In this case, some functionalities may be accessed and applied differently.
Materials
List of materials needed:
  • ImageJ session accepting the installation of macros (used here: Fiji 2.3.0 with ImageJ 1.53q, and Fiji 2.14.0 with ImageJ 1.54f)
  • whole slide images of lung stained with SR or MT

Macros available at:

Benchmark dataset available at
Before start
Files with the “ijm” extension must be copied to the plugins folder of ImageJ/Fiji (e.g., …/Fiji/plugins/Fibrosis).

ImageJ/Fiji manages images directly in the RAM of the computer. The maximum RAM ImageJ/Fiji is allowed to use is set in a dedicated menu (Edit > Options > Memory & Threads…).

Alternatively, ImageJ/Fiji can import large images as "Virtual Stack" to avoid loading all data in the RAM. A dedicated menu is available to use this format (File > Import > TIFF Virtual Stack…). Note that displaying the image will be slower.

The plugin Bio-Formats supports BigTiff (File > Import > Bio-Formats) and can manage extremely large images.

Recommendations on lung sample preparation can be found in:
Hsia CC, Hyde DM, Ochs M, Weibel ER; ATS/ERS Joint Task Force on Quantitative Assessment of Lung Structure. An official research policy statement of the American Thoracic Society/European Respiratory Society: standards for quantitative assessment of lung structure. Am J Respir Crit Care Med. 2010 Feb 15;181(4):394-418. doi: 10.1164/rccm.200809-1522ST. PMID: 20130146; PMCID: PMC5455840.
Slides of different anatomical positions within the lungs should be analyzed to minimize sampling or orientation bias.
Sample detection
Sample detection
Sample detection

Note: the scale of images must be defined prior to the analysis.
Open the image to be analyzed (File > Open…).
Representative samples.
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Launch the script (Plugins > Fibrosis > Sample detection).
Define the scale of the image (i.e., px / μm). Click the “OK” button.
Define the lower (close to black: strongly stained tissue) and upper (close to white: lightly stained tissue) thresholds (reset to automatically defined values available). Selected objects are highlighted in yellow on the overlay.
To finish, check the “Confirm settings” box and click the “OK” button.
Sample detection.
A. Interface of the "sample detection" tool.
B. Binary masks of detected samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Background cleaning
Background cleaning
Background cleaning

Automatic filtering
Open the mask of the sample obtained at step 1.5 (File > Open…).
Launch the script (Plugins > Fibrosis > Particle filter auto).
Define the minimal and maximal size cutoffs (reset to default values available). Selected objects are highlighted in orange on the overlay.
To finish, check the “Confirm settings” box and click the “OK” button.
Save output files in the desired folder (check the "Save" box and click "OK").
Manual cleaning
Open the mask of the sample obtained at step 2.5 (File > Open…).
Launch the script (Plugins > Fibrosis > Particle filter manual).
Using a selection tool (e.g., Rectangle), select undesirable objects in the background and delete them (<delete>). Click the “OK” button on the dialog window.

Note: it is not necessary to clean particles in air ducts as most will be deleted at the air ducts identification step.
Selected objects are highlighted in magenta on the overlay.
To finish, check the “Confirm cleaning” box and click the “OK” button.
Background cleaning.
A. Interface of the "particle filter" automatic and manual tools.
B. Cleaned binary masks of samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Border definition
Border definition
Border definition
Open the mask of the sample obtained at step 2.11 (File > Open…).
Launch the script (Plugins > Fibrosis > Border definition).
Using a drawing tool (e.g., Pencil Tool), repair breaks in the border of the sample. Tissues are highlighted in orange and airspace in black on the overlay.
To finish, check the “Confirm correction” box and click the “OK” button.
Define the size of the border (reset to default value available). Selected objects are highlighted in green on the overlay.
To finish, check the "Confirm settings" box and click the “OK” button.
Border definition.
A. Interface of the "border definition" tool.
B. Binary masks of the borders of the samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Air ducts and air ducts walls definition
Air ducts and air ducts walls definition
Air ducts and air ducts walls definition
Air ducts identification

Note: as it is not easy to identify air ducts on a binary mask, it is advised to refer to the original image.
Open the mask of the sample obtained at step 2.11 (File > Open…).
Launch the script (Plugins > Fibrosis > Air duct identification).
Check the “Add new air duct” box and click the “OK” button to enter the selection mode.
Using a selection tool (e.g., Wand (tracing) tool), select an air duct. It is advised to add air ducts one by one. To validate a selection, click the “OK” button on the dialog window. Selected objects are highlighted in cyan on the overlay.

Note: check the “Delete last air duct” box and click the “OK” button to remove the last air duct from the selection.

To finish, check the "Confirm selection" box and click the “OK” button.
Air ducts identification.
A. Interface of the "air duct identification" tool.
B. Overlays of samples and identified air ducts:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Air ducts walls definition
Launch the script (Plugins > Fibrosis > Air ducts walls definition).
Open the required files (automatic prompt):
  • clean mask (from step 2.11)
  • air ducts ROI set (from step 4.6)
Define the size of air ducts walls (reset to default value available). Selected objects are highlighted in green on the overlay.
To finish, check the "Confirm settings" box and click the “OK” button.
Air ducts walls definition.
A. Interface of the "air ducts walls definition" tool.
B. Overlays of samples, identified air ducts, and defined air ducts walls:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Parenchyma extraction
Parenchyma extraction
Parenchyma extraction
Launch the script (Plugins > Fibrosis > Parenchyma extraction).
Open the required files (automatic prompt):
  • sample image (original)
  • clean mask (from step 2.11)
  • sample border ROI set (from step 3.5)
  • air ducts walls ROI set (from step 4.11)
Define the scale of the image (i.e., px / μm). Click the “OK” button.
Parenchyma extraction.
A. Interface of the "parenchyma extraction" tool.
B. Images of parenchyma of samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
[Only for MT-stained samples] Connective tissue extraction
[Only for MT-stained samples] Connective tissue extraction
Connective tissue extraction

Note: it is recommended to use Fiji as this module has a dependency to the plugin Colour Deconvolution.
Open the image of the parenchyma obtained at step 5.4 (File > Open…).
Launch the script (Plugins > Fibrosis > MT pre-processing).
Save output files in the desired folder (check the "Save" box and click "OK").
Fibrosis detection
Fibrosis detection
Fibrosis detection

Note: the separation of color channels is different between SR and MT, which leads to different threshold settings.
Open the image of the parenchyma (SR; step 5.4) or of the connective tissue in the parenchyma (MT; step 6.3) (File > Open…).
Launch the script (Plugins > Fibrosis > Fibrosis detection).
Define the scale of the image (i.e., px / μm). Click the “OK” button.
Define the lower (close to black: strongly stained tissue) and upper (close to white: lightly stained tissue) thresholds (reset to automatically defined values available). Selected objects are highlighted in red on the overlay.
To finish, check the “Confirm settings” box and click the “OK” button.
Fibrosis detection.
A. Interface of the "fibrosis detection" tool.
B. Binary masks of fibrosis in samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Fibrosis cleaning
Fibrosis cleaning
Fibrosis cleaning

Note: SR and MT stain different structures, which leads to different filter settings.
Automatic filtering
Open the mask of the fibrotic tissue obtained at step 7.5 (File > Open…).
Launch the script (Plugins > Fibrosis > Fibrosis filter auto).
Define the minimal and maximal size cutoffs (reset to default values available). Selected objects are highlighted in magenta on the overlay.
To finish, check the “Confirm settings” box and click the “OK” button.
Fibrosis cleaning.
A. Interface of the "fibrosis filter" automatic tool.
B. Binary masks of filtered fibrosis in samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Tissue visualization
Tissue visualization
Overlay of tissue segmentation
Launch the script (Plugins > Fibrosis > Visualization tissue).
Open the required files (automatic prompt):
  • sample image (original)
  • parenchyma ROI set (from step 5.4)
  • sample border ROI set (from step 3.5)
  • air ducts walls ROI set (from step 4.11)
  • air ducts ROI set (from step 4.6)
  • fibrosis ROI set (from step 8.5)
Tissue visualization.
A. Interface of the "visualization tissue" tool.
B. Visualization of regions of interest in samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Airspace quantification
Airspace quantification
Airspace quantification
Launch the script (Plugins > Fibrosis > Airspace detection).
Open the required files (automatic prompt):
  • parenchyma image (from step 5.4)
  • sample border ROI set (from step 3.5)
  • air ducts walls ROI set (from step 4.11)
Define the minimal and maximal size and circularity cutoffs (reset to default values available). Selected objects are highlighted in blue on the overlay.
To finish, check the “Confirm settings” box and click the “OK” button.
Airspace quantification.
A. Interface of the "airspace detection" tool.
B. Binary masks of airspace in samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Tissue and airspace visualization
Tissue and airspace visualization
Overlay of tissue and airspace segmentation
Launch the script (Plugins > Fibrosis > Visualization tissue airspace).
Open the required files (automatic prompt):
  • tissue visualization image (from step 9.3)
  • airspace ROI set (from step 10.4)
Tissue and airspace visualization.
A. Interface of the "visualization tissue airspace" tool.
B. Visualization of regions of interest in samples:
  1. Mouse lung slice stained with MT (baseline sample);
  2. Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);
  3. Mouse lung slice stained with SR (baseline sample);
  4. Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Save output files in the desired folder (check the "Save" box and click "OK").
Results
Results
Compilation of results
Files and data:
  • Parenchyma area: (from step 5.4) Results.csv -> Area(Parenchyma)
  • Fibrosis area: (from step 8.5) Summary.csv -> Total Area
  • Airspace area: (from step 10.4) Summary.csv -> Total Area
Calculations:
  • Ratio fibrosis/parenchyma = Fibrosis area / Parenchyma area
  • Ratio airspace/sample = Airspace area / (Parenchyma area + Airspace area)
Results (data).
Quantification of fibrosis extend and airspace availability in the benchmark dataset (all samples).
Results (graph).
Quantification of fibrosis extend and airspace availability in the benchmark dataset (all samples).