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

Bertrand-David Ségard

Published: 2024-03-07 DOI: 10.17504/protocols.io.14egn7nqmv5d/v1

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.

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.

Steps

Sample detection

1.

Sample detection

Note: the scale of images must be defined prior to the analysis.

1.1.

Open the image to be analyzed ( File > Open… ).

Representative samples.Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
Representative samples.Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample).
1.2.

Launch the script ( Plugins > Fibrosis > Sample detection ).

1.3.

Define the scale of the image (i.e., px / μm). Click the “OK” button.

1.4.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig2.jpg" alt="Sample detection.A. Interface of the "sample detection" tool.B. Binary masks of detected samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Sample detection.A. Interface of the "sample detection" tool.B. Binary masks of detected samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

1.5.

Save output files in the desired folder (check the "Save" box and click "OK").

Background cleaning

2.

Background cleaning

2.1.

Automatic filtering

2.10.

Selected objects are highlighted in magenta on the overlay.

To finish, check the “Confirm cleaning” box and click the “OK” button.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig3.jpg" alt="Background cleaning.A. Interface of the "particle filter" automatic and manual tools.B. Cleaned binary masks of samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Background cleaning.A. Interface of the "particle filter" automatic and manual tools.B. Cleaned binary masks of samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

2.11.

Save output files in the desired folder (check the "Save" box and click "OK").

2.2.

Open the mask of the sample obtained at step 1.5 ( File > Open… ).

2.3.

Launch the script ( Plugins > Fibrosis > Particle filter auto ).

2.4.

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.

2.5.

Save output files in the desired folder (check the "Save" box and click "OK").

2.6.

Manual cleaning

2.7.

Open the mask of the sample obtained at step 2.5 ( File > Open… ).

2.8.

Launch the script ( Plugins > Fibrosis > Particle filter manual ).

2.9.

Using a selection tool (e.g., Rectangle ), select undesirable objects in the background and delete them (). 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.

Border definition

3.

Border definition

3.1.

Open the mask of the sample obtained at step 2.11 ( File > Open… ).

3.2.

Launch the script ( Plugins > Fibrosis > Border definition ).

3.3.

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.

3.4.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig4.jpg" alt="Border definition.A. Interface of the "border definition" tool.B. Binary masks of the borders of the samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Border definition.A. Interface of the "border definition" tool.B. Binary masks of the borders of the samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

3.5.

Save output files in the desired folder (check the "Save" box and click "OK").

Air ducts and air ducts walls definition

4.

Air ducts and air ducts walls definition

4.1.

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.

4.10.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig6.jpg" alt="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:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="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:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

4.11.

Save output files in the desired folder (check the "Save" box and click "OK").

4.2.

Open the mask of the sample obtained at step 2.11 ( File > Open… ).

4.3.

Launch the script ( Plugins > Fibrosis > Air duct identification ).

4.4.

Check the “Add new air duct” box and click the “OK” button to enter the selection mode.

4.5.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig5.jpg" alt="Air ducts identification.A. Interface of the "air duct identification" tool.B. Overlays of samples and identified air ducts:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Air ducts identification.A. Interface of the "air duct identification" tool.B. Overlays of samples and identified air ducts:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

4.6.

Save output files in the desired folder (check the "Save" box and click "OK").

4.7.

Air ducts walls definition

4.8.

Launch the script ( Plugins > Fibrosis > Air ducts walls definition ).

4.9.

Open the required files (automatic prompt):

  • clean mask (from step 2.11 )
  • air ducts ROI set (from step 4.6 )

Parenchyma extraction

5.

Parenchyma extraction

5.1.

Launch the script ( Plugins > Fibrosis > Parenchyma extraction ).

5.2.

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 )
5.3.

Define the scale of the image (i.e., px / μm). Click the “OK” button.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig7.jpg" alt="Parenchyma extraction.A. Interface of the "parenchyma extraction" tool.B. Images of parenchyma of samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Parenchyma extraction.A. Interface of the "parenchyma extraction" tool.B. Images of parenchyma of samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

5.4.

Save output files in the desired folder (check the "Save" box and click "OK").

[Only for MT-stained samples] Connective tissue extraction

6.

Connective tissue extraction

Note: it is recommended to use Fiji as this module has a dependency to the plugin Colour Deconvolution.

6.1.

Open the image of the parenchyma obtained at step 5.4 ( File > Open… ).

6.2.

Launch the script ( Plugins > Fibrosis > MT pre-processing ).

6.3.

Save output files in the desired folder (check the "Save" box and click "OK").

Fibrosis detection

7.

Fibrosis detection

Note: the separation of color channels is different between SR and MT, which leads to different threshold settings.

7.1.

Open the image of the parenchyma (SR; step 5.4 ) or of the connective tissue in the parenchyma (MT; step 6.3 ) ( File > Open… ).

7.2.

Launch the script ( Plugins > Fibrosis > Fibrosis detection ).

7.3.

Define the scale of the image (i.e., px / μm). Click the “OK” button.

7.4.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig8.jpg" alt="Fibrosis detection.A. Interface of the "fibrosis detection" tool.B. Binary masks of fibrosis in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Fibrosis detection.A. Interface of the "fibrosis detection" tool.B. Binary masks of fibrosis in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

7.5.

Save output files in the desired folder (check the "Save" box and click "OK").

Fibrosis cleaning

8.

Fibrosis cleaning

Note: SR and MT stain different structures, which leads to different filter settings.

8.1.

Automatic filtering

8.2.

Open the mask of the fibrotic tissue obtained at step 7.5 ( File > Open… ).

8.3.

Launch the script ( Plugins > Fibrosis > Fibrosis filter auto ).

8.4.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig9.jpg" alt="Fibrosis cleaning.A. Interface of the "fibrosis filter" automatic tool.B. Binary masks of filtered fibrosis in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Fibrosis cleaning.A. Interface of the "fibrosis filter" automatic tool.B. Binary masks of filtered fibrosis in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

8.5.

Save output files in the desired folder (check the "Save" box and click "OK").

Tissue visualization

9.

Overlay of tissue segmentation

9.1.

Launch the script ( Plugins > Fibrosis > Visualization tissue ).

9.2.

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 ) <img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig10.jpg" alt="Tissue visualization.A. Interface of the "visualization tissue" tool.B. Visualization of regions of interest in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Tissue visualization.A. Interface of the "visualization tissue" tool.B. Visualization of regions of interest in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>
9.3.

Save output files in the desired folder (check the "Save" box and click "OK").

Airspace quantification

10.

Airspace quantification

10.1.

Launch the script ( Plugins > Fibrosis > Airspace detection ).

10.2.

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 )
10.3.

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.

<img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig11.jpg" alt="Airspace quantification.A. Interface of the "airspace detection" tool.B. Binary masks of airspace in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Airspace quantification.A. Interface of the "airspace detection" tool.B. Binary masks of airspace in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>

10.4.

Save output files in the desired folder (check the "Save" box and click "OK").

Tissue and airspace visualization

11.

Overlay of tissue and airspace segmentation

11.1.

Launch the script ( Plugins > Fibrosis > Visualization tissue airspace ).

11.2.

Open the required files (automatic prompt):

  • tissue visualization image (from step 9.3 )
  • airspace ROI set (from step 10.4 ) <img src="https://static.yanyin.tech/literature_test/protocol_io_true/protocols.io.14egn7nqmv5d/S1_Fig12.jpg" alt="Tissue and airspace visualization.A. Interface of the "visualization tissue airspace" tool.B. Visualization of regions of interest in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)." loading="lazy" title="Tissue and airspace visualization.A. Interface of the "visualization tissue airspace" tool.B. Visualization of regions of interest in samples:Mouse lung slice stained with MT (baseline sample);Mouse lung slice stained with MT (bleomycin-induced fibrosis sample);Mouse lung slice stained with SR (baseline sample);Mouse lung slice stained with SR (bleomycin-induced fibrosis sample)."/>
11.3.

Save output files in the desired folder (check the "Save" box and click "OK").

Results

12.

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 (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).
Results (graph).Quantification of fibrosis extend and airspace availability in the benchmark dataset (all samples).

推荐阅读

Nature Protocols
Protocols IO
Current Protocols
扫码咨询