AlveolEye 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. alveoleye-0.1.2/LICENSE +22 -0
  2. alveoleye-0.1.2/MANIFEST.in +3 -0
  3. alveoleye-0.1.2/PKG-INFO +153 -0
  4. alveoleye-0.1.2/README.md +121 -0
  5. alveoleye-0.1.2/pyproject.toml +6 -0
  6. alveoleye-0.1.2/requirements.txt +6 -0
  7. alveoleye-0.1.2/setup.cfg +61 -0
  8. alveoleye-0.1.2/src/AlveolEye.egg-info/PKG-INFO +153 -0
  9. alveoleye-0.1.2/src/AlveolEye.egg-info/SOURCES.txt +44 -0
  10. alveoleye-0.1.2/src/AlveolEye.egg-info/dependency_links.txt +1 -0
  11. alveoleye-0.1.2/src/AlveolEye.egg-info/entry_points.txt +2 -0
  12. alveoleye-0.1.2/src/AlveolEye.egg-info/requires.txt +10 -0
  13. alveoleye-0.1.2/src/AlveolEye.egg-info/top_level.txt +1 -0
  14. alveoleye-0.1.2/src/alveoleye/__init__.py +14 -0
  15. alveoleye-0.1.2/src/alveoleye/_action_box.py +137 -0
  16. alveoleye-0.1.2/src/alveoleye/_boxes.py +584 -0
  17. alveoleye-0.1.2/src/alveoleye/_export_operations.py +68 -0
  18. alveoleye-0.1.2/src/alveoleye/_gui_creator.py +175 -0
  19. alveoleye-0.1.2/src/alveoleye/_layers_editor.py +37 -0
  20. alveoleye-0.1.2/src/alveoleye/_reader.py +24 -0
  21. alveoleye-0.1.2/src/alveoleye/_rules.py +38 -0
  22. alveoleye-0.1.2/src/alveoleye/_sample_data.py +21 -0
  23. alveoleye-0.1.2/src/alveoleye/_tests/__init__.py +0 -0
  24. alveoleye-0.1.2/src/alveoleye/_tests/test_lungcv.py +19 -0
  25. alveoleye-0.1.2/src/alveoleye/_tests/test_reader.py +9 -0
  26. alveoleye-0.1.2/src/alveoleye/_widget.py +65 -0
  27. alveoleye-0.1.2/src/alveoleye/_workers.py +260 -0
  28. alveoleye-0.1.2/src/alveoleye/_writer.py +33 -0
  29. alveoleye-0.1.2/src/alveoleye/config.json +122 -0
  30. alveoleye-0.1.2/src/alveoleye/dark_theme.css +76 -0
  31. alveoleye-0.1.2/src/alveoleye/data/__init__.py +0 -0
  32. alveoleye-0.1.2/src/alveoleye/light_theme.css +76 -0
  33. alveoleye-0.1.2/src/alveoleye/lungcv/__init__.py +0 -0
  34. alveoleye-0.1.2/src/alveoleye/lungcv/assessments.py +55 -0
  35. alveoleye-0.1.2/src/alveoleye/lungcv/model_operations.py +118 -0
  36. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/__init__.py +0 -0
  37. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/coco_eval.py +192 -0
  38. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/coco_utils.py +234 -0
  39. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/engine.py +115 -0
  40. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/group_by_aspect_ratio.py +196 -0
  41. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/train.py +246 -0
  42. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/transforms.py +602 -0
  43. alveoleye-0.1.2/src/alveoleye/lungcv/mrcnn/utils.py +395 -0
  44. alveoleye-0.1.2/src/alveoleye/lungcv/postprocessor.py +136 -0
  45. alveoleye-0.1.2/src/alveoleye/napari.yaml +38 -0
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2022 <>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ include requirements.txt
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.1
2
+ Name: AlveolEye
3
+ Version: 0.1.2
4
+ Summary: Reads lung slides with AI-driven and classical methods
5
+ Author: Joseph Hirsh
6
+ Author-email: josephhirsh9@gmail.com
7
+ License: MIT
8
+ Classifier: Development Status :: 2 - Pre-Alpha
9
+ Classifier: Framework :: napari
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy
24
+ Requires-Dist: magicgui
25
+ Requires-Dist: qtpy
26
+ Provides-Extra: testing
27
+ Requires-Dist: pytest; extra == "testing"
28
+ Requires-Dist: pytest-cov; extra == "testing"
29
+ Requires-Dist: pytest-qt; extra == "testing"
30
+ Requires-Dist: napari; extra == "testing"
31
+ Requires-Dist: qtpy; extra == "testing"
32
+
33
+ <!--
34
+ [![License MIT](https://img.shields.io/pypi/l/automated-lung-morphometry.svg?color=green)](https://github.com/Quooooooookka/automated-lung-morphometry/raw/main/LICENSE)
35
+ [![PyPI](https://img.shields.io/pypi/v/automated-lung-morphometry.svg?color=green)](https://pypi.org/project/automated-lung-morphometry)
36
+ [![Python Version](https://img.shields.io/pypi/pyversions/automated-lung-morphometry.svg?color=green)](https://python.org)
37
+ [![tests](https://github.com/Quooooooookka/automated-lung-morphometry/workflows/tests/badge.svg)](https://github.com/Quooooooookka/automated-lung-morphometry/actions)
38
+ [![codecov](https://codecov.io/gh/Quooooooookka/automated-lung-morphometry/branch/main/graph/badge.svg)](https://codecov.io/gh/Quooooooookka/automated-lung-morphometry)
39
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/automated-lung-morphometry)](https://napari-hub.org/plugins/automated-lung-morphometry)
40
+ -->
41
+
42
+ # AlveolEye: Automated lung morphometry made easy
43
+
44
+ This repository contains the beta version of AlveolEye, which is created by the Sucre lab.
45
+ This code is authored by Joseph Hirsh, Samuel Hirsh, Nick Negretti, and Shawyon Shirazi.
46
+
47
+ This project is a Napari plugin that uses computer vision tools and classical image processing
48
+ to calculate mean linear intercept (MLI) and airspace volume density (ASVD) from histological images.
49
+
50
+ A primary goal of this tool is to be an aid to the researcher, and not be a complete automated annotation solution.
51
+
52
+ ## Installation
53
+
54
+ The target of this process is to create a conda environment that has both napari, and all of the AlveolEye requirements.
55
+
56
+ If you already have conda setup, you can skip step 1
57
+
58
+ 1. Install miniconda by downlading the appropriate version from [here](https://docs.anaconda.com/free/miniconda/)
59
+
60
+ a. Choose the version that matches your processor
61
+
62
+ b. Download the "pkg" version for easy install
63
+ 2. Open a terminal, or miniconda prompt, and clone this git repository by running:
64
+
65
+ ```git clone https://github.com/SucreLab/AlveolEye```
66
+ 3. Go to the AlveolEye directory
67
+
68
+ ```cd AlveolEye```
69
+ 4. Create the conda environment
70
+
71
+ ```conda env create -f ./environment.yml```
72
+ 5. Activate the new environment
73
+
74
+ ```conda activate AlveolEye```
75
+ 6. Install the plugin
76
+
77
+ ```pip install .```
78
+ 7. Launch napari, followed by locating the plugin in the plugin menu
79
+
80
+ ```napari```
81
+
82
+ ## Running post-installation
83
+
84
+ 1. Open a terminal, or miniconda prompt, activate the environment and run napari
85
+
86
+ ```
87
+ conda activate AlveolEye
88
+ napari
89
+ ```
90
+
91
+
92
+ # AlveolEye Usage Tutorial
93
+
94
+ ## Annotated Diagram
95
+ ![annotated diagram](./docs/Colored_AlveolEye.png)
96
+
97
+ ## Processing: Identify and segment vessel and airway epithelium with an AI computer vision model.
98
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Select an image**: The remaining steps will concern this image.
99
+
100
+ a. Click the “Import Image” button.
101
+
102
+ b. Use operating system default file dialogue to select an image (*.jpg, *.png, or *.tiff).
103
+
104
+ c. Check the image in the “Image” layer (of the Napari Viewer) and the file name (displayed to the right of the “Import Image” button) to confirm that the image loaded correctly.
105
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Select a model**</span>: The selected model will run on the image and predict (segment) vessel and airway epithelium.
106
+
107
+ a. To use the default model, skip to step 3; otherwise, proceed to step 2b. Use the provided default model unless you have a specific reason not to.
108
+
109
+ b. Click the “Import Weights” button.
110
+
111
+ c. Use operating system file dialogue to select a model (*.pth).
112
+
113
+ d. Check the file name (displayed to the right of the “Import Weights” button) to confirm that the model loaded correctly.
114
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Select a confidence level**: Type a percentage and/or click the “-” and “+” buttons in the “Minimum confidence” input box to set the confidence level. Predictions with lower confidence then the set confidence level will not appear.
115
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Run processing**: Click the “Run Processing” button to run the model and segment vessel and airway epithelium filtered by confidence level. Once completed, manually edit the prediction as necessary with the built-in napari tools to the left of the displayed image layer. See Napari documentation for more information about how to use these tools.
116
+
117
+ ---
118
+
119
+ ## Postprocessing: Identify alveolar tissue, and airwary and vessel lumens with “classical” (non-AI) methods; remove small particles and holes to prepare for assessments.
120
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Toggle manual thresholding**: To manually set a threshold value, toggle manual threshold; otherwise, a threshold value will be determined with Otsu's method.
121
+
122
+ a. To use manual thresholding, check the “Manual thresholding” box and proceed; to use automatic thresholding, leave the box unchecked and skip to step 2.
123
+
124
+ b. Type a percentage and/or click the “-” and “+” buttons in the “Manual thresholding” input box to set the threshold level.
125
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Remove small particles**: Type a percentage and/or click the “-” and “+” buttons in the “Remove small particles” input box to set the maximum size cutoff for particles to remove. Particles with fewer pixels than the set number will be removed.
126
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Remove small holes**: Type a percentage and/or click the “-” and “+” buttons in the “Remove small holes” input box to set the maximum size cutoff for holes to remove. Holes with fewer pixels than the set number will be removed.
127
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Run postprocessing**: Click “Run Postprocessing” button to identify alveolar tissue, airwary lumens, and vessel lumens, and to remove small particles and holes. Once completed, manually edit the post-processing layer as necessary with the built-in napari tools to the left of the displayed image layer. See Napari documentation for more information about how to use these tools.
128
+
129
+ ---
130
+
131
+ ## Assessments: Calculate morphometry assessments—mean linear intercept (MLI) and airspace volume density (ASVD) on the fully classified image.
132
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Select ASVD**: To include ASVD calculations in results, check the “ASVD” checkbox; otherwise, leave the box unchecked. Leave the box unchecked to increase the speed of the assessments calculation or to exclude unnecessary data from the final export file.
133
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Select MLI**: To include MLI calculations in results, check the “MLI” checkbox; otherwise, leave the box unchecked. Leave the box unchecked to increase the speed of the assessments calculation or to exclude unnecessary data from the final export file.
134
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Set number of lines**: Type a number and/or click the “-” and “+” buttons in the “number of lines” input box to set the number of MLI lines.
135
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Set minimum length**: Type a number and/or click the “-” and “+” buttons in the “minimum length” input box to set the minimum length required for a chord to be included in the mean calculation.
136
+ 5. ![#f03c15](https://placehold.co/15x15/3359FF/3359FF.png) **Set scale**: Type a number and/or click the “-” and “+” buttons in the “scale” input box to set the scale factor (i.e. a pixel to physical space multiplier).
137
+ 6. ![#f03c15](https://placehold.co/15x15/C433FF/C433FF.png) **Run Assessments**: Click the “Run Assessments” button to calculate the selected assessments. The ASVD and MLI calculation results will display to the right of the assessment checkboxes.
138
+
139
+ ---
140
+
141
+ ## Export Results: Collect assessment results for each image and export all the data into a file when done (*.csv or *.json).
142
+ - **Interpreting Results**
143
+ - **MLI:** Mean Linear Intercept for the given image
144
+ - **Standard deviation:** The standard deviation of the lengths of the chord used to calculate MLI.
145
+ - **Number of chords:** The number of chords used to calculate MLI.
146
+ - **ASVD:** Airspace Volume Density calculation for the given image.
147
+ - **Airspace pixels:** The total number of airspace pixels
148
+ - **Non airspace pixels:** The total number non-airspace pixels.
149
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Add last result**: Click the “Add” button to add the assessment data to the final export file. Once the results are added, you can return to the "Processing" step and do another image.
150
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Remove last result**: Click the “Remove” button to remove the last results added to the export file.
151
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Clear export data**: Click the “Clear” button to clear the export data file.
152
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Export Results**: Click the “Export Results” button to open a file dialogue for saving the assessments results. Note that the plugin supports two export result file types, *.csv and *.json that you can choose between.
153
+
@@ -0,0 +1,121 @@
1
+ <!--
2
+ [![License MIT](https://img.shields.io/pypi/l/automated-lung-morphometry.svg?color=green)](https://github.com/Quooooooookka/automated-lung-morphometry/raw/main/LICENSE)
3
+ [![PyPI](https://img.shields.io/pypi/v/automated-lung-morphometry.svg?color=green)](https://pypi.org/project/automated-lung-morphometry)
4
+ [![Python Version](https://img.shields.io/pypi/pyversions/automated-lung-morphometry.svg?color=green)](https://python.org)
5
+ [![tests](https://github.com/Quooooooookka/automated-lung-morphometry/workflows/tests/badge.svg)](https://github.com/Quooooooookka/automated-lung-morphometry/actions)
6
+ [![codecov](https://codecov.io/gh/Quooooooookka/automated-lung-morphometry/branch/main/graph/badge.svg)](https://codecov.io/gh/Quooooooookka/automated-lung-morphometry)
7
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/automated-lung-morphometry)](https://napari-hub.org/plugins/automated-lung-morphometry)
8
+ -->
9
+
10
+ # AlveolEye: Automated lung morphometry made easy
11
+
12
+ This repository contains the beta version of AlveolEye, which is created by the Sucre lab.
13
+ This code is authored by Joseph Hirsh, Samuel Hirsh, Nick Negretti, and Shawyon Shirazi.
14
+
15
+ This project is a Napari plugin that uses computer vision tools and classical image processing
16
+ to calculate mean linear intercept (MLI) and airspace volume density (ASVD) from histological images.
17
+
18
+ A primary goal of this tool is to be an aid to the researcher, and not be a complete automated annotation solution.
19
+
20
+ ## Installation
21
+
22
+ The target of this process is to create a conda environment that has both napari, and all of the AlveolEye requirements.
23
+
24
+ If you already have conda setup, you can skip step 1
25
+
26
+ 1. Install miniconda by downlading the appropriate version from [here](https://docs.anaconda.com/free/miniconda/)
27
+
28
+ a. Choose the version that matches your processor
29
+
30
+ b. Download the "pkg" version for easy install
31
+ 2. Open a terminal, or miniconda prompt, and clone this git repository by running:
32
+
33
+ ```git clone https://github.com/SucreLab/AlveolEye```
34
+ 3. Go to the AlveolEye directory
35
+
36
+ ```cd AlveolEye```
37
+ 4. Create the conda environment
38
+
39
+ ```conda env create -f ./environment.yml```
40
+ 5. Activate the new environment
41
+
42
+ ```conda activate AlveolEye```
43
+ 6. Install the plugin
44
+
45
+ ```pip install .```
46
+ 7. Launch napari, followed by locating the plugin in the plugin menu
47
+
48
+ ```napari```
49
+
50
+ ## Running post-installation
51
+
52
+ 1. Open a terminal, or miniconda prompt, activate the environment and run napari
53
+
54
+ ```
55
+ conda activate AlveolEye
56
+ napari
57
+ ```
58
+
59
+
60
+ # AlveolEye Usage Tutorial
61
+
62
+ ## Annotated Diagram
63
+ ![annotated diagram](./docs/Colored_AlveolEye.png)
64
+
65
+ ## Processing: Identify and segment vessel and airway epithelium with an AI computer vision model.
66
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Select an image**: The remaining steps will concern this image.
67
+
68
+ a. Click the “Import Image” button.
69
+
70
+ b. Use operating system default file dialogue to select an image (*.jpg, *.png, or *.tiff).
71
+
72
+ c. Check the image in the “Image” layer (of the Napari Viewer) and the file name (displayed to the right of the “Import Image” button) to confirm that the image loaded correctly.
73
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Select a model**</span>: The selected model will run on the image and predict (segment) vessel and airway epithelium.
74
+
75
+ a. To use the default model, skip to step 3; otherwise, proceed to step 2b. Use the provided default model unless you have a specific reason not to.
76
+
77
+ b. Click the “Import Weights” button.
78
+
79
+ c. Use operating system file dialogue to select a model (*.pth).
80
+
81
+ d. Check the file name (displayed to the right of the “Import Weights” button) to confirm that the model loaded correctly.
82
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Select a confidence level**: Type a percentage and/or click the “-” and “+” buttons in the “Minimum confidence” input box to set the confidence level. Predictions with lower confidence then the set confidence level will not appear.
83
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Run processing**: Click the “Run Processing” button to run the model and segment vessel and airway epithelium filtered by confidence level. Once completed, manually edit the prediction as necessary with the built-in napari tools to the left of the displayed image layer. See Napari documentation for more information about how to use these tools.
84
+
85
+ ---
86
+
87
+ ## Postprocessing: Identify alveolar tissue, and airwary and vessel lumens with “classical” (non-AI) methods; remove small particles and holes to prepare for assessments.
88
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Toggle manual thresholding**: To manually set a threshold value, toggle manual threshold; otherwise, a threshold value will be determined with Otsu's method.
89
+
90
+ a. To use manual thresholding, check the “Manual thresholding” box and proceed; to use automatic thresholding, leave the box unchecked and skip to step 2.
91
+
92
+ b. Type a percentage and/or click the “-” and “+” buttons in the “Manual thresholding” input box to set the threshold level.
93
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Remove small particles**: Type a percentage and/or click the “-” and “+” buttons in the “Remove small particles” input box to set the maximum size cutoff for particles to remove. Particles with fewer pixels than the set number will be removed.
94
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Remove small holes**: Type a percentage and/or click the “-” and “+” buttons in the “Remove small holes” input box to set the maximum size cutoff for holes to remove. Holes with fewer pixels than the set number will be removed.
95
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Run postprocessing**: Click “Run Postprocessing” button to identify alveolar tissue, airwary lumens, and vessel lumens, and to remove small particles and holes. Once completed, manually edit the post-processing layer as necessary with the built-in napari tools to the left of the displayed image layer. See Napari documentation for more information about how to use these tools.
96
+
97
+ ---
98
+
99
+ ## Assessments: Calculate morphometry assessments—mean linear intercept (MLI) and airspace volume density (ASVD) on the fully classified image.
100
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Select ASVD**: To include ASVD calculations in results, check the “ASVD” checkbox; otherwise, leave the box unchecked. Leave the box unchecked to increase the speed of the assessments calculation or to exclude unnecessary data from the final export file.
101
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Select MLI**: To include MLI calculations in results, check the “MLI” checkbox; otherwise, leave the box unchecked. Leave the box unchecked to increase the speed of the assessments calculation or to exclude unnecessary data from the final export file.
102
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Set number of lines**: Type a number and/or click the “-” and “+” buttons in the “number of lines” input box to set the number of MLI lines.
103
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Set minimum length**: Type a number and/or click the “-” and “+” buttons in the “minimum length” input box to set the minimum length required for a chord to be included in the mean calculation.
104
+ 5. ![#f03c15](https://placehold.co/15x15/3359FF/3359FF.png) **Set scale**: Type a number and/or click the “-” and “+” buttons in the “scale” input box to set the scale factor (i.e. a pixel to physical space multiplier).
105
+ 6. ![#f03c15](https://placehold.co/15x15/C433FF/C433FF.png) **Run Assessments**: Click the “Run Assessments” button to calculate the selected assessments. The ASVD and MLI calculation results will display to the right of the assessment checkboxes.
106
+
107
+ ---
108
+
109
+ ## Export Results: Collect assessment results for each image and export all the data into a file when done (*.csv or *.json).
110
+ - **Interpreting Results**
111
+ - **MLI:** Mean Linear Intercept for the given image
112
+ - **Standard deviation:** The standard deviation of the lengths of the chord used to calculate MLI.
113
+ - **Number of chords:** The number of chords used to calculate MLI.
114
+ - **ASVD:** Airspace Volume Density calculation for the given image.
115
+ - **Airspace pixels:** The total number of airspace pixels
116
+ - **Non airspace pixels:** The total number non-airspace pixels.
117
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Add last result**: Click the “Add” button to add the assessment data to the final export file. Once the results are added, you can return to the "Processing" step and do another image.
118
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Remove last result**: Click the “Remove” button to remove the last results added to the export file.
119
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Clear export data**: Click the “Clear” button to clear the export data file.
120
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Export Results**: Click the “Export Results” button to open a file dialogue for saving the assessments results. Note that the plugin supports two export result file types, *.csv and *.json that you can choose between.
121
+
@@ -0,0 +1,6 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.flake8]
6
+ max-line-length = 120
@@ -0,0 +1,6 @@
1
+ napari
2
+ qtpy
3
+ pytorch
4
+ torchvision >= 0.16.0
5
+ opencv-python-headless
6
+ pillow
@@ -0,0 +1,61 @@
1
+ [metadata]
2
+ name = AlveolEye
3
+ version = 0.1.2
4
+ description = Reads lung slides with AI-driven and classical methods
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+ author = Joseph Hirsh
8
+ author_email = josephhirsh9@gmail.com
9
+ license = MIT
10
+ license_files = LICENSE
11
+ classifiers =
12
+ Development Status :: 2 - Pre-Alpha
13
+ Framework :: napari
14
+ Intended Audience :: Developers
15
+ License :: OSI Approved :: MIT License
16
+ Operating System :: OS Independent
17
+ Programming Language :: Python
18
+ Programming Language :: Python :: 3
19
+ Programming Language :: Python :: 3 :: Only
20
+ Programming Language :: Python :: 3.8
21
+ Programming Language :: Python :: 3.9
22
+ Programming Language :: Python :: 3.10
23
+ Topic :: Scientific/Engineering :: Image Processing
24
+
25
+ [options]
26
+ packages = find:
27
+ install_requires =
28
+ numpy
29
+ magicgui
30
+ qtpy
31
+ python_requires = >=3.8
32
+ include_package_data = True
33
+ package_dir =
34
+ =src
35
+
36
+ [options.packages.find]
37
+ where = src
38
+
39
+ [options.entry_points]
40
+ napari.manifest =
41
+ AlveolEye = alveoleye:napari.yaml
42
+
43
+ [options.extras_require]
44
+ testing =
45
+ pytest # https://docs.pytest.org/en/latest/contents.html
46
+ pytest-cov # https://pytest-cov.readthedocs.io/en/latest/
47
+ pytest-qt # https://pytest-qt.readthedocs.io/en/latest/
48
+ napari
49
+ qtpy
50
+
51
+ [options.package_data]
52
+ * =
53
+ *.yaml
54
+ *.json
55
+ *.css
56
+ *.pth
57
+
58
+ [egg_info]
59
+ tag_build =
60
+ tag_date = 0
61
+
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.1
2
+ Name: AlveolEye
3
+ Version: 0.1.2
4
+ Summary: Reads lung slides with AI-driven and classical methods
5
+ Author: Joseph Hirsh
6
+ Author-email: josephhirsh9@gmail.com
7
+ License: MIT
8
+ Classifier: Development Status :: 2 - Pre-Alpha
9
+ Classifier: Framework :: napari
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy
24
+ Requires-Dist: magicgui
25
+ Requires-Dist: qtpy
26
+ Provides-Extra: testing
27
+ Requires-Dist: pytest; extra == "testing"
28
+ Requires-Dist: pytest-cov; extra == "testing"
29
+ Requires-Dist: pytest-qt; extra == "testing"
30
+ Requires-Dist: napari; extra == "testing"
31
+ Requires-Dist: qtpy; extra == "testing"
32
+
33
+ <!--
34
+ [![License MIT](https://img.shields.io/pypi/l/automated-lung-morphometry.svg?color=green)](https://github.com/Quooooooookka/automated-lung-morphometry/raw/main/LICENSE)
35
+ [![PyPI](https://img.shields.io/pypi/v/automated-lung-morphometry.svg?color=green)](https://pypi.org/project/automated-lung-morphometry)
36
+ [![Python Version](https://img.shields.io/pypi/pyversions/automated-lung-morphometry.svg?color=green)](https://python.org)
37
+ [![tests](https://github.com/Quooooooookka/automated-lung-morphometry/workflows/tests/badge.svg)](https://github.com/Quooooooookka/automated-lung-morphometry/actions)
38
+ [![codecov](https://codecov.io/gh/Quooooooookka/automated-lung-morphometry/branch/main/graph/badge.svg)](https://codecov.io/gh/Quooooooookka/automated-lung-morphometry)
39
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/automated-lung-morphometry)](https://napari-hub.org/plugins/automated-lung-morphometry)
40
+ -->
41
+
42
+ # AlveolEye: Automated lung morphometry made easy
43
+
44
+ This repository contains the beta version of AlveolEye, which is created by the Sucre lab.
45
+ This code is authored by Joseph Hirsh, Samuel Hirsh, Nick Negretti, and Shawyon Shirazi.
46
+
47
+ This project is a Napari plugin that uses computer vision tools and classical image processing
48
+ to calculate mean linear intercept (MLI) and airspace volume density (ASVD) from histological images.
49
+
50
+ A primary goal of this tool is to be an aid to the researcher, and not be a complete automated annotation solution.
51
+
52
+ ## Installation
53
+
54
+ The target of this process is to create a conda environment that has both napari, and all of the AlveolEye requirements.
55
+
56
+ If you already have conda setup, you can skip step 1
57
+
58
+ 1. Install miniconda by downlading the appropriate version from [here](https://docs.anaconda.com/free/miniconda/)
59
+
60
+ a. Choose the version that matches your processor
61
+
62
+ b. Download the "pkg" version for easy install
63
+ 2. Open a terminal, or miniconda prompt, and clone this git repository by running:
64
+
65
+ ```git clone https://github.com/SucreLab/AlveolEye```
66
+ 3. Go to the AlveolEye directory
67
+
68
+ ```cd AlveolEye```
69
+ 4. Create the conda environment
70
+
71
+ ```conda env create -f ./environment.yml```
72
+ 5. Activate the new environment
73
+
74
+ ```conda activate AlveolEye```
75
+ 6. Install the plugin
76
+
77
+ ```pip install .```
78
+ 7. Launch napari, followed by locating the plugin in the plugin menu
79
+
80
+ ```napari```
81
+
82
+ ## Running post-installation
83
+
84
+ 1. Open a terminal, or miniconda prompt, activate the environment and run napari
85
+
86
+ ```
87
+ conda activate AlveolEye
88
+ napari
89
+ ```
90
+
91
+
92
+ # AlveolEye Usage Tutorial
93
+
94
+ ## Annotated Diagram
95
+ ![annotated diagram](./docs/Colored_AlveolEye.png)
96
+
97
+ ## Processing: Identify and segment vessel and airway epithelium with an AI computer vision model.
98
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Select an image**: The remaining steps will concern this image.
99
+
100
+ a. Click the “Import Image” button.
101
+
102
+ b. Use operating system default file dialogue to select an image (*.jpg, *.png, or *.tiff).
103
+
104
+ c. Check the image in the “Image” layer (of the Napari Viewer) and the file name (displayed to the right of the “Import Image” button) to confirm that the image loaded correctly.
105
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Select a model**</span>: The selected model will run on the image and predict (segment) vessel and airway epithelium.
106
+
107
+ a. To use the default model, skip to step 3; otherwise, proceed to step 2b. Use the provided default model unless you have a specific reason not to.
108
+
109
+ b. Click the “Import Weights” button.
110
+
111
+ c. Use operating system file dialogue to select a model (*.pth).
112
+
113
+ d. Check the file name (displayed to the right of the “Import Weights” button) to confirm that the model loaded correctly.
114
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Select a confidence level**: Type a percentage and/or click the “-” and “+” buttons in the “Minimum confidence” input box to set the confidence level. Predictions with lower confidence then the set confidence level will not appear.
115
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Run processing**: Click the “Run Processing” button to run the model and segment vessel and airway epithelium filtered by confidence level. Once completed, manually edit the prediction as necessary with the built-in napari tools to the left of the displayed image layer. See Napari documentation for more information about how to use these tools.
116
+
117
+ ---
118
+
119
+ ## Postprocessing: Identify alveolar tissue, and airwary and vessel lumens with “classical” (non-AI) methods; remove small particles and holes to prepare for assessments.
120
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Toggle manual thresholding**: To manually set a threshold value, toggle manual threshold; otherwise, a threshold value will be determined with Otsu's method.
121
+
122
+ a. To use manual thresholding, check the “Manual thresholding” box and proceed; to use automatic thresholding, leave the box unchecked and skip to step 2.
123
+
124
+ b. Type a percentage and/or click the “-” and “+” buttons in the “Manual thresholding” input box to set the threshold level.
125
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Remove small particles**: Type a percentage and/or click the “-” and “+” buttons in the “Remove small particles” input box to set the maximum size cutoff for particles to remove. Particles with fewer pixels than the set number will be removed.
126
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Remove small holes**: Type a percentage and/or click the “-” and “+” buttons in the “Remove small holes” input box to set the maximum size cutoff for holes to remove. Holes with fewer pixels than the set number will be removed.
127
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Run postprocessing**: Click “Run Postprocessing” button to identify alveolar tissue, airwary lumens, and vessel lumens, and to remove small particles and holes. Once completed, manually edit the post-processing layer as necessary with the built-in napari tools to the left of the displayed image layer. See Napari documentation for more information about how to use these tools.
128
+
129
+ ---
130
+
131
+ ## Assessments: Calculate morphometry assessments—mean linear intercept (MLI) and airspace volume density (ASVD) on the fully classified image.
132
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Select ASVD**: To include ASVD calculations in results, check the “ASVD” checkbox; otherwise, leave the box unchecked. Leave the box unchecked to increase the speed of the assessments calculation or to exclude unnecessary data from the final export file.
133
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Select MLI**: To include MLI calculations in results, check the “MLI” checkbox; otherwise, leave the box unchecked. Leave the box unchecked to increase the speed of the assessments calculation or to exclude unnecessary data from the final export file.
134
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Set number of lines**: Type a number and/or click the “-” and “+” buttons in the “number of lines” input box to set the number of MLI lines.
135
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Set minimum length**: Type a number and/or click the “-” and “+” buttons in the “minimum length” input box to set the minimum length required for a chord to be included in the mean calculation.
136
+ 5. ![#f03c15](https://placehold.co/15x15/3359FF/3359FF.png) **Set scale**: Type a number and/or click the “-” and “+” buttons in the “scale” input box to set the scale factor (i.e. a pixel to physical space multiplier).
137
+ 6. ![#f03c15](https://placehold.co/15x15/C433FF/C433FF.png) **Run Assessments**: Click the “Run Assessments” button to calculate the selected assessments. The ASVD and MLI calculation results will display to the right of the assessment checkboxes.
138
+
139
+ ---
140
+
141
+ ## Export Results: Collect assessment results for each image and export all the data into a file when done (*.csv or *.json).
142
+ - **Interpreting Results**
143
+ - **MLI:** Mean Linear Intercept for the given image
144
+ - **Standard deviation:** The standard deviation of the lengths of the chord used to calculate MLI.
145
+ - **Number of chords:** The number of chords used to calculate MLI.
146
+ - **ASVD:** Airspace Volume Density calculation for the given image.
147
+ - **Airspace pixels:** The total number of airspace pixels
148
+ - **Non airspace pixels:** The total number non-airspace pixels.
149
+ 1. ![#FF3333](https://placehold.co/15x15/FF3333/FF3333.png) **Add last result**: Click the “Add” button to add the assessment data to the final export file. Once the results are added, you can return to the "Processing" step and do another image.
150
+ 2. ![#FF9933](https://placehold.co/15x15/FF9933/FF9933.png) **Remove last result**: Click the “Remove” button to remove the last results added to the export file.
151
+ 3. ![#FFFF33](https://placehold.co/15x15/FFFF33/FFFF33.png) **Clear export data**: Click the “Clear” button to clear the export data file.
152
+ 4. ![#f03c15](https://placehold.co/15x15/33FF33/33FF33.png) **Export Results**: Click the “Export Results” button to open a file dialogue for saving the assessments results. Note that the plugin supports two export result file types, *.csv and *.json that you can choose between.
153
+
@@ -0,0 +1,44 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ requirements.txt
6
+ setup.cfg
7
+ src/AlveolEye.egg-info/PKG-INFO
8
+ src/AlveolEye.egg-info/SOURCES.txt
9
+ src/AlveolEye.egg-info/dependency_links.txt
10
+ src/AlveolEye.egg-info/entry_points.txt
11
+ src/AlveolEye.egg-info/requires.txt
12
+ src/AlveolEye.egg-info/top_level.txt
13
+ src/alveoleye/__init__.py
14
+ src/alveoleye/_action_box.py
15
+ src/alveoleye/_boxes.py
16
+ src/alveoleye/_export_operations.py
17
+ src/alveoleye/_gui_creator.py
18
+ src/alveoleye/_layers_editor.py
19
+ src/alveoleye/_reader.py
20
+ src/alveoleye/_rules.py
21
+ src/alveoleye/_sample_data.py
22
+ src/alveoleye/_widget.py
23
+ src/alveoleye/_workers.py
24
+ src/alveoleye/_writer.py
25
+ src/alveoleye/config.json
26
+ src/alveoleye/dark_theme.css
27
+ src/alveoleye/light_theme.css
28
+ src/alveoleye/napari.yaml
29
+ src/alveoleye/_tests/__init__.py
30
+ src/alveoleye/_tests/test_lungcv.py
31
+ src/alveoleye/_tests/test_reader.py
32
+ src/alveoleye/data/__init__.py
33
+ src/alveoleye/lungcv/__init__.py
34
+ src/alveoleye/lungcv/assessments.py
35
+ src/alveoleye/lungcv/model_operations.py
36
+ src/alveoleye/lungcv/postprocessor.py
37
+ src/alveoleye/lungcv/mrcnn/__init__.py
38
+ src/alveoleye/lungcv/mrcnn/coco_eval.py
39
+ src/alveoleye/lungcv/mrcnn/coco_utils.py
40
+ src/alveoleye/lungcv/mrcnn/engine.py
41
+ src/alveoleye/lungcv/mrcnn/group_by_aspect_ratio.py
42
+ src/alveoleye/lungcv/mrcnn/train.py
43
+ src/alveoleye/lungcv/mrcnn/transforms.py
44
+ src/alveoleye/lungcv/mrcnn/utils.py
@@ -0,0 +1,2 @@
1
+ [napari.manifest]
2
+ AlveolEye = alveoleye:napari.yaml
@@ -0,0 +1,10 @@
1
+ numpy
2
+ magicgui
3
+ qtpy
4
+
5
+ [testing]
6
+ pytest
7
+ pytest-cov
8
+ pytest-qt
9
+ napari
10
+ qtpy
@@ -0,0 +1 @@
1
+ alveoleye
@@ -0,0 +1,14 @@
1
+ __version__ = "0.1.2"
2
+
3
+ from ._reader import napari_get_reader
4
+ from ._sample_data import make_sample_data
5
+ from ._widget import WidgetMain
6
+ from ._writer import write_multiple, write_single_image
7
+
8
+ __all__ = (
9
+ "napari_get_reader",
10
+ "write_single_image",
11
+ "write_multiple",
12
+ "make_sample_data",
13
+ "WidgetMain",
14
+ )