Reads lung slides with AI-driven and classical methods
Project description
AlveolEye: Automated Lung Morphometry Made Easy
This repository contains the beta version of AlveolEye, created by the Sucre lab.
The code is authored by Samuel Hirsh, Joseph Hirsh, Nick Negretti, and Shawyon Shirazi.
AlveolEye is a Napari plugin that uses computer vision and classical image processing
to calculate mean linear intercept (MLI) and airspace volume density (ASVD) of histologic images.
The goal of this tool is to aid researchers, not provide a complete automated annotation solution.
We welcome GitHub issues and feedback!
Installation
The goal of this process is to create a conda environment containing Napari and all AlveolEye requirements.
If you already have conda set up, you can skip step 1.
-
Install Miniconda by downloading the appropriate version from here:
- Choose the version that matches your processor.
- Download the
.pkg
version for easy installation.
-
Clone the repository (by opening a terminal or Miniconda prompt and running the following)
git clone https://github.com/SucreLab/AlveolEye
-
Navigate to the directory:
cd AlveolEye
-
Create the conda environment:
conda env create -f ./environment.yml
-
Activate the environment:
conda activate AlveolEye
-
Install the plugin:
pip install .
-
Launch Napari and locate the plugin in the plugin menu:
napari
Running Post-Installation
-
Activate the environment in the terminal or Miniconda prompt:
conda activate AlveolEye
-
Run Napari in the terminal:
napari
Usage
Processing: Identify and Segment Vessel Endothelium and Airway Epithelium with Computer Vision
-
Import image
- Click the "Import Image" button.
- Use the file dialog to select an image (
.jpg
,.png
, or.tiff
). - Verify that the image correctly loaded. The file name should appear to the right of the button.
-
Toggle processing with computer vision
- Keep the checkbox selected to process the image with computer vision (continue to step 3).
- Deselect to skip computer vision processing (skip to step 5).
-
Import weights
- To use the default model, proceed to step 4.
- To use a custom model:
- Click the "Import Weights" button.
- Select a model file (
.pth
). - Verify that the weights correctly loaded. The file name should appear to the right of the button.
-
Set minimum confidence
- Adjust the minimum confidence using the input box or the "-/+" buttons.
- Predictions from the computer vision model with lower confidence than this threshold will not appear.
-
Run processing
- Click the "Run Processing" button.
- Once completed, manually edit the prediction as needed using Napari's built-in tools.
Postprocessing: Segment Alveolar Tissue and Find Vessel and Aireway Lumens
-
Configure thresholding
- For manual thresholding: Select the "Manual threshold" checkbox and use the spinbox to set the threshold level.
- For automatic thresholding (Otsu's method): Leave the box unchecked.
-
Remove small particles
- Set the minimum size cutoff.
- Particles with fewer pixels than this value will be removed.
-
Remove small holes
- Set the minimum size cutoff.
- Holes with fewer pixels than this value will be removed.
-
Run postprocessing
- Click the "Run Postprocessing" button.
- Once completed, manually edit the results as needed using Napari's built-in tools.
Assessments: Calculate Morphometry Measurements
-
Airspace Volume Density (ASVD)
- Select the checkbox to run ASVD calculation.
- Deselect the checkbox to exclude data from export and increase processing speed.
-
Mean Linear Intercept (MLI)
- Select the checkbox to run MLI calculation.
- Deselect the checkbox to exclude data from export and increase processing speed.
-
Number of lines
- Set the number of lines used for MLI calculation.
-
Minimum length
- Set the minimum chord length for inclusion in MLI calculations.
- Note: Chords are the line segments that span across an airspace between two alveolar tissue boundaries during MLI calculation.
-
Scale
- Set the pixel-to-physical space multiplier.
-
Run assessments
- Click the "Run Assessments" button.
- View results displayed beside assessment checkboxes and in the export box.
Export Results: Save Assessment Results as a CSV or JSON File
-
Add results
- Click "Add" to include current assessment data in the export file.
-
Remove last result
- Click "Remove" to delete the last added results from the export file.
-
Clear export data
- Click "Clear" to empty the export file.
-
Export results
- Click "Export Results" to save the data (
.csv
or.json
format).
- Click "Export Results" to save the data (
Results Key
-
MLI: Mean Linear Intercept for the tissue image
-
Standard deviation: Standard deviation of chord lengths used in MLI calculation
-
Number of chords: Number of chords used in MLI calculation
-
ASVD: Airspace Volume Density for the image
-
Airspace pixels: Total number of airspace pixels
-
Non-airspace pixels: Total number of non-airspace pixels
Manual Annotation Guide
Label Reference
Structure | Label Number |
---|---|
Blocker | 1 |
Airway Epithelium | 2 |
Vessel Endothelium | 3 |
Airway Lumen | 4 |
Vessel Lumen | 5 |
Parenchyma | 6 |
Alveoli | 7 |
Annotation Tips
- Eyedropper tool: Click the eyedropper tool, then click a pixel in the image to set your active label (for drawing and editing) to that pixel's label.
- Layer selection: Ensure you're working on the correct layer before annotating.
- Visibility control: Hide unnecessary layers using the eye icon on the layer boxes (to the left of the image viewer) for clearer viewing.
- Blocking: Encircle airways and vessels in the blocking label, and everything within that closed shape will be discounted from assessments calculation.
Additional Information
Theme Settings
Toggle between dark and light mode using:
- Windows/Linux:
Ctrl + Shift + T
- macOS:
Cmd + Shift + T
Or through Napari preferences:
-
Select "napari" in the menu bar.
-
Choose "Preferences."
-
Click "Appearance" in the left menu.
-
Select "dark," "light," or "system" in the theme dropdown.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file alveoleye-0.1.6.tar.gz
.
File metadata
- Download URL: alveoleye-0.1.6.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d05ff3cf376715a51cbc521f773e98409b1a69953c674200472cfcb69109346f
|
|
MD5 |
83cba909ec0395ff5c2df8c7e7fd9096
|
|
BLAKE2b-256 |
3828bdc243f244255acfce8c1b522091973508253db62f8519d380401cae956a
|
Provenance
The following attestation bundles were made for alveoleye-0.1.6.tar.gz
:
Publisher:
tests.yml
on SucreLab/AlveolEye
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
alveoleye-0.1.6.tar.gz
-
Subject digest:
d05ff3cf376715a51cbc521f773e98409b1a69953c674200472cfcb69109346f
- Sigstore transparency entry: 253877505
- Sigstore integration time:
-
Permalink:
SucreLab/AlveolEye@8b91ca6c9eedda79c68a1e983e66c4bca5917409
-
Branch / Tag:
refs/tags/v0.1.6
- Owner: https://github.com/SucreLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
tests.yml@8b91ca6c9eedda79c68a1e983e66c4bca5917409
-
Trigger Event:
push
-
Statement type: