AutoMorphoTrack 1.0.0__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.
- AutoMorphoTrack-1.0.0/AutoMorphoTrack.egg-info/PKG-INFO +115 -0
- AutoMorphoTrack-1.0.0/AutoMorphoTrack.egg-info/SOURCES.txt +20 -0
- AutoMorphoTrack-1.0.0/AutoMorphoTrack.egg-info/dependency_links.txt +1 -0
- AutoMorphoTrack-1.0.0/AutoMorphoTrack.egg-info/requires.txt +8 -0
- AutoMorphoTrack-1.0.0/AutoMorphoTrack.egg-info/top_level.txt +1 -0
- AutoMorphoTrack-1.0.0/MANIFEST.in +19 -0
- AutoMorphoTrack-1.0.0/PKG-INFO +115 -0
- AutoMorphoTrack-1.0.0/README.md +95 -0
- AutoMorphoTrack-1.0.0/automorphotrack/__init__.py +75 -0
- AutoMorphoTrack-1.0.0/automorphotrack/colocalization.py +128 -0
- AutoMorphoTrack-1.0.0/automorphotrack/detection.py +65 -0
- AutoMorphoTrack-1.0.0/automorphotrack/lyso_count.py +84 -0
- AutoMorphoTrack-1.0.0/automorphotrack/morphology.py +140 -0
- AutoMorphoTrack-1.0.0/automorphotrack/motility.py +102 -0
- AutoMorphoTrack-1.0.0/automorphotrack/shape_features.py +100 -0
- AutoMorphoTrack-1.0.0/automorphotrack/shape_profiling.py +51 -0
- AutoMorphoTrack-1.0.0/automorphotrack/summary.py +72 -0
- AutoMorphoTrack-1.0.0/automorphotrack/tracking.py +121 -0
- AutoMorphoTrack-1.0.0/automorphotrack/tracking_overlay.py +123 -0
- AutoMorphoTrack-1.0.0/automorphotrack/utils.py +37 -0
- AutoMorphoTrack-1.0.0/setup.cfg +4 -0
- AutoMorphoTrack-1.0.0/setup.py +46 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: AutoMorphoTrack
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AutoMorphoTrack is an open-source Python package for automated detection, morphology classification, motility tracking, and colocalization analysis of organelles in multichannel fluorescence microscopy data.
|
|
5
|
+
Home-page: https://github.com/abayatibrain/AMTpackage
|
|
6
|
+
Author: Armin Bayati
|
|
7
|
+
Author-email: a.bayati.brain@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://github.com/abayatibrain/AMTpackage
|
|
10
|
+
Project-URL: Source, https://github.com/abayatibrain/AMTpackage
|
|
11
|
+
Project-URL: Tracker, https://github.com/abayatibrain/AMTpackage/issues
|
|
12
|
+
Description: # AutoMorphoTrack
|
|
13
|
+
|
|
14
|
+
**AutoMorphoTrack** is an open-source Python package for automated detection, morphology classification, shape profiling, motility tracking, and colocalization analysis of subcellular organelles in multichannel fluorescence microscopy data.
|
|
15
|
+
|
|
16
|
+
This package represents the fully modular version of the **AutoMorphoTrack pipeline**, originally developed as a Jupyter Notebook by **Armin Bayati, Ph.D.**, and now distributed as an installable Python framework.
|
|
17
|
+
Repository: [https://github.com/abayatibrain/automorphotrack](https://github.com/abayatibrain/automorphotrack)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🧬 Overview
|
|
22
|
+
|
|
23
|
+
AutoMorphoTrack automates quantitative analysis of time-lapse `.tif` image stacks—typically dual-channel recordings of mitochondria and lysosomes—and generates publication-ready visual and numerical outputs at every step of the analysis pipeline.
|
|
24
|
+
|
|
25
|
+
**Pipeline stages:**
|
|
26
|
+
|
|
27
|
+
1. **Detection** – Organelle segmentation and outline visualization
|
|
28
|
+
2. **Lysosomal Counting** – Per-frame lysosome enumeration and temporal profiling
|
|
29
|
+
3. **Morphology Classification** – Elongated vs. punctate mitochondria
|
|
30
|
+
4. **Shape Feature Extraction** – Area, circularity, solidity, aspect ratio, orientation
|
|
31
|
+
5. **Tracking** – Cumulative organelle trajectories (mitochondria, lysosomes, composite)
|
|
32
|
+
6. **Motility Analysis** – Velocity, displacement, and trajectory-based statistics
|
|
33
|
+
7. **Colocalization** – Bright-blue overlap overlays and correlation metrics
|
|
34
|
+
8. **Integrated Summary** – Correlation matrices linking morphology, motility, and overlap
|
|
35
|
+
|
|
36
|
+
Each stage outputs high-resolution figures, videos, and CSV data tables stored in standardized subdirectories, ensuring reproducibility and compatibility with any image dataset.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📦 Installation
|
|
41
|
+
|
|
42
|
+
Install directly from PyPI:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install AutoMorphoTrack
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or from source:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/abayatibrain/automorphotrack.git
|
|
52
|
+
cd automorphotrack
|
|
53
|
+
pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🚀 Basic Usage
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from automorphotrack import *
|
|
62
|
+
|
|
63
|
+
tif_path = "Composite.tif"
|
|
64
|
+
|
|
65
|
+
detect_organelles(tif_path)
|
|
66
|
+
count_lysosomes_per_frame(tif_path)
|
|
67
|
+
classify_morphology(tif_path)
|
|
68
|
+
analyze_shape_features(tif_path)
|
|
69
|
+
track_organelles(tif_path)
|
|
70
|
+
analyze_motility()
|
|
71
|
+
analyze_colocalization(tif_path)
|
|
72
|
+
summarize_integrated_data()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each function automatically generates visual and quantitative outputs at every step.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 📁 Outputs
|
|
80
|
+
|
|
81
|
+
| Step | Output Type | Example Files |
|
|
82
|
+
|------|--------------|---------------|
|
|
83
|
+
| Detection | PNG + MP4 | `Mito_Frame0.png`, `Mitochondria_Detection.mp4` |
|
|
84
|
+
| Lysosome Count | PNG + CSV + MP4 | `Lyso_Count_Plot.png`, `Lysosome_Counts.csv` |
|
|
85
|
+
| Morphology | PNG + MP4 + CSV | `Morphology_Frame0_Labeled.png`, `Morphology_Labeled.mp4` |
|
|
86
|
+
| Shape Features | PNG + CSV | `Shape_Distributions.png`, `Mito_ShapeMetrics.csv` |
|
|
87
|
+
| Tracking | PNG + MP4 + CSV | `Cumulative_Mito.png`, `Mito_Tracks.csv` |
|
|
88
|
+
| Motility | PNG + CSV | `Motility_Distributions.png`, `Motility_Scatter.png` |
|
|
89
|
+
| Colocalization | PNG + MP4 + CSV | `Colocalization_Frame0.png`, `Colocalization.csv` |
|
|
90
|
+
| Summary | PNG + CSV | `Integrated_CorrelationMatrix.png`, `Integrated_Merged_Data.csv` |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🔧 Dependencies
|
|
95
|
+
|
|
96
|
+
- Python ≥ 3.9
|
|
97
|
+
- numpy, pandas, matplotlib, seaborn, opencv-python, scikit-image, scipy, tifffile
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🧩 Citation
|
|
102
|
+
|
|
103
|
+
If you use **AutoMorphoTrack** in your research, please cite:
|
|
104
|
+
|
|
105
|
+
> **Bayati, A. (2025)**. AutoMorphoTrack: An accessible Python framework for automated analysis of organelle morphology and motility.
|
|
106
|
+
> *GitHub Repository:* [https://github.com/abayatibrain/automorphotrack](https://github.com/abayatibrain/automorphotrack)
|
|
107
|
+
|
|
108
|
+
Platform: UNKNOWN
|
|
109
|
+
Classifier: Programming Language :: Python :: 3
|
|
110
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
111
|
+
Classifier: Operating System :: OS Independent
|
|
112
|
+
Classifier: Intended Audience :: Science/Research
|
|
113
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
114
|
+
Requires-Python: >=3.9
|
|
115
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
AutoMorphoTrack.egg-info/PKG-INFO
|
|
5
|
+
AutoMorphoTrack.egg-info/SOURCES.txt
|
|
6
|
+
AutoMorphoTrack.egg-info/dependency_links.txt
|
|
7
|
+
AutoMorphoTrack.egg-info/requires.txt
|
|
8
|
+
AutoMorphoTrack.egg-info/top_level.txt
|
|
9
|
+
automorphotrack/__init__.py
|
|
10
|
+
automorphotrack/colocalization.py
|
|
11
|
+
automorphotrack/detection.py
|
|
12
|
+
automorphotrack/lyso_count.py
|
|
13
|
+
automorphotrack/morphology.py
|
|
14
|
+
automorphotrack/motility.py
|
|
15
|
+
automorphotrack/shape_features.py
|
|
16
|
+
automorphotrack/shape_profiling.py
|
|
17
|
+
automorphotrack/summary.py
|
|
18
|
+
automorphotrack/tracking.py
|
|
19
|
+
automorphotrack/tracking_overlay.py
|
|
20
|
+
automorphotrack/utils.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
automorphotrack
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Include documentation and license files
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include requirements.txt
|
|
5
|
+
|
|
6
|
+
# Include all Python source files
|
|
7
|
+
recursive-include automorphotrack *.py
|
|
8
|
+
|
|
9
|
+
# Include any additional data files (if present)
|
|
10
|
+
recursive-include automorphotrack *.csv
|
|
11
|
+
recursive-include automorphotrack *.txt
|
|
12
|
+
recursive-include automorphotrack *.ipynb
|
|
13
|
+
recursive-include automorphotrack *.png
|
|
14
|
+
recursive-include automorphotrack *.jpg
|
|
15
|
+
recursive-include automorphotrack *.tif
|
|
16
|
+
recursive-include automorphotrack *.json
|
|
17
|
+
|
|
18
|
+
# Exclude unnecessary system or cache files
|
|
19
|
+
global-exclude __pycache__ *.py[cod] .DS_Store
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: AutoMorphoTrack
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AutoMorphoTrack is an open-source Python package for automated detection, morphology classification, motility tracking, and colocalization analysis of organelles in multichannel fluorescence microscopy data.
|
|
5
|
+
Home-page: https://github.com/abayatibrain/AMTpackage
|
|
6
|
+
Author: Armin Bayati
|
|
7
|
+
Author-email: a.bayati.brain@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://github.com/abayatibrain/AMTpackage
|
|
10
|
+
Project-URL: Source, https://github.com/abayatibrain/AMTpackage
|
|
11
|
+
Project-URL: Tracker, https://github.com/abayatibrain/AMTpackage/issues
|
|
12
|
+
Description: # AutoMorphoTrack
|
|
13
|
+
|
|
14
|
+
**AutoMorphoTrack** is an open-source Python package for automated detection, morphology classification, shape profiling, motility tracking, and colocalization analysis of subcellular organelles in multichannel fluorescence microscopy data.
|
|
15
|
+
|
|
16
|
+
This package represents the fully modular version of the **AutoMorphoTrack pipeline**, originally developed as a Jupyter Notebook by **Armin Bayati, Ph.D.**, and now distributed as an installable Python framework.
|
|
17
|
+
Repository: [https://github.com/abayatibrain/automorphotrack](https://github.com/abayatibrain/automorphotrack)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🧬 Overview
|
|
22
|
+
|
|
23
|
+
AutoMorphoTrack automates quantitative analysis of time-lapse `.tif` image stacks—typically dual-channel recordings of mitochondria and lysosomes—and generates publication-ready visual and numerical outputs at every step of the analysis pipeline.
|
|
24
|
+
|
|
25
|
+
**Pipeline stages:**
|
|
26
|
+
|
|
27
|
+
1. **Detection** – Organelle segmentation and outline visualization
|
|
28
|
+
2. **Lysosomal Counting** – Per-frame lysosome enumeration and temporal profiling
|
|
29
|
+
3. **Morphology Classification** – Elongated vs. punctate mitochondria
|
|
30
|
+
4. **Shape Feature Extraction** – Area, circularity, solidity, aspect ratio, orientation
|
|
31
|
+
5. **Tracking** – Cumulative organelle trajectories (mitochondria, lysosomes, composite)
|
|
32
|
+
6. **Motility Analysis** – Velocity, displacement, and trajectory-based statistics
|
|
33
|
+
7. **Colocalization** – Bright-blue overlap overlays and correlation metrics
|
|
34
|
+
8. **Integrated Summary** – Correlation matrices linking morphology, motility, and overlap
|
|
35
|
+
|
|
36
|
+
Each stage outputs high-resolution figures, videos, and CSV data tables stored in standardized subdirectories, ensuring reproducibility and compatibility with any image dataset.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📦 Installation
|
|
41
|
+
|
|
42
|
+
Install directly from PyPI:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install AutoMorphoTrack
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or from source:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/abayatibrain/automorphotrack.git
|
|
52
|
+
cd automorphotrack
|
|
53
|
+
pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🚀 Basic Usage
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from automorphotrack import *
|
|
62
|
+
|
|
63
|
+
tif_path = "Composite.tif"
|
|
64
|
+
|
|
65
|
+
detect_organelles(tif_path)
|
|
66
|
+
count_lysosomes_per_frame(tif_path)
|
|
67
|
+
classify_morphology(tif_path)
|
|
68
|
+
analyze_shape_features(tif_path)
|
|
69
|
+
track_organelles(tif_path)
|
|
70
|
+
analyze_motility()
|
|
71
|
+
analyze_colocalization(tif_path)
|
|
72
|
+
summarize_integrated_data()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each function automatically generates visual and quantitative outputs at every step.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 📁 Outputs
|
|
80
|
+
|
|
81
|
+
| Step | Output Type | Example Files |
|
|
82
|
+
|------|--------------|---------------|
|
|
83
|
+
| Detection | PNG + MP4 | `Mito_Frame0.png`, `Mitochondria_Detection.mp4` |
|
|
84
|
+
| Lysosome Count | PNG + CSV + MP4 | `Lyso_Count_Plot.png`, `Lysosome_Counts.csv` |
|
|
85
|
+
| Morphology | PNG + MP4 + CSV | `Morphology_Frame0_Labeled.png`, `Morphology_Labeled.mp4` |
|
|
86
|
+
| Shape Features | PNG + CSV | `Shape_Distributions.png`, `Mito_ShapeMetrics.csv` |
|
|
87
|
+
| Tracking | PNG + MP4 + CSV | `Cumulative_Mito.png`, `Mito_Tracks.csv` |
|
|
88
|
+
| Motility | PNG + CSV | `Motility_Distributions.png`, `Motility_Scatter.png` |
|
|
89
|
+
| Colocalization | PNG + MP4 + CSV | `Colocalization_Frame0.png`, `Colocalization.csv` |
|
|
90
|
+
| Summary | PNG + CSV | `Integrated_CorrelationMatrix.png`, `Integrated_Merged_Data.csv` |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🔧 Dependencies
|
|
95
|
+
|
|
96
|
+
- Python ≥ 3.9
|
|
97
|
+
- numpy, pandas, matplotlib, seaborn, opencv-python, scikit-image, scipy, tifffile
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🧩 Citation
|
|
102
|
+
|
|
103
|
+
If you use **AutoMorphoTrack** in your research, please cite:
|
|
104
|
+
|
|
105
|
+
> **Bayati, A. (2025)**. AutoMorphoTrack: An accessible Python framework for automated analysis of organelle morphology and motility.
|
|
106
|
+
> *GitHub Repository:* [https://github.com/abayatibrain/automorphotrack](https://github.com/abayatibrain/automorphotrack)
|
|
107
|
+
|
|
108
|
+
Platform: UNKNOWN
|
|
109
|
+
Classifier: Programming Language :: Python :: 3
|
|
110
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
111
|
+
Classifier: Operating System :: OS Independent
|
|
112
|
+
Classifier: Intended Audience :: Science/Research
|
|
113
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
114
|
+
Requires-Python: >=3.9
|
|
115
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# AutoMorphoTrack
|
|
2
|
+
|
|
3
|
+
**AutoMorphoTrack** is an open-source Python package for automated detection, morphology classification, shape profiling, motility tracking, and colocalization analysis of subcellular organelles in multichannel fluorescence microscopy data.
|
|
4
|
+
|
|
5
|
+
This package represents the fully modular version of the **AutoMorphoTrack pipeline**, originally developed as a Jupyter Notebook by **Armin Bayati, Ph.D.**, and now distributed as an installable Python framework.
|
|
6
|
+
Repository: [https://github.com/abayatibrain/automorphotrack](https://github.com/abayatibrain/automorphotrack)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🧬 Overview
|
|
11
|
+
|
|
12
|
+
AutoMorphoTrack automates quantitative analysis of time-lapse `.tif` image stacks—typically dual-channel recordings of mitochondria and lysosomes—and generates publication-ready visual and numerical outputs at every step of the analysis pipeline.
|
|
13
|
+
|
|
14
|
+
**Pipeline stages:**
|
|
15
|
+
|
|
16
|
+
1. **Detection** – Organelle segmentation and outline visualization
|
|
17
|
+
2. **Lysosomal Counting** – Per-frame lysosome enumeration and temporal profiling
|
|
18
|
+
3. **Morphology Classification** – Elongated vs. punctate mitochondria
|
|
19
|
+
4. **Shape Feature Extraction** – Area, circularity, solidity, aspect ratio, orientation
|
|
20
|
+
5. **Tracking** – Cumulative organelle trajectories (mitochondria, lysosomes, composite)
|
|
21
|
+
6. **Motility Analysis** – Velocity, displacement, and trajectory-based statistics
|
|
22
|
+
7. **Colocalization** – Bright-blue overlap overlays and correlation metrics
|
|
23
|
+
8. **Integrated Summary** – Correlation matrices linking morphology, motility, and overlap
|
|
24
|
+
|
|
25
|
+
Each stage outputs high-resolution figures, videos, and CSV data tables stored in standardized subdirectories, ensuring reproducibility and compatibility with any image dataset.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📦 Installation
|
|
30
|
+
|
|
31
|
+
Install directly from PyPI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install AutoMorphoTrack
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or from source:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/abayatibrain/automorphotrack.git
|
|
41
|
+
cd automorphotrack
|
|
42
|
+
pip install -e .
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🚀 Basic Usage
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from automorphotrack import *
|
|
51
|
+
|
|
52
|
+
tif_path = "Composite.tif"
|
|
53
|
+
|
|
54
|
+
detect_organelles(tif_path)
|
|
55
|
+
count_lysosomes_per_frame(tif_path)
|
|
56
|
+
classify_morphology(tif_path)
|
|
57
|
+
analyze_shape_features(tif_path)
|
|
58
|
+
track_organelles(tif_path)
|
|
59
|
+
analyze_motility()
|
|
60
|
+
analyze_colocalization(tif_path)
|
|
61
|
+
summarize_integrated_data()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Each function automatically generates visual and quantitative outputs at every step.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 📁 Outputs
|
|
69
|
+
|
|
70
|
+
| Step | Output Type | Example Files |
|
|
71
|
+
|------|--------------|---------------|
|
|
72
|
+
| Detection | PNG + MP4 | `Mito_Frame0.png`, `Mitochondria_Detection.mp4` |
|
|
73
|
+
| Lysosome Count | PNG + CSV + MP4 | `Lyso_Count_Plot.png`, `Lysosome_Counts.csv` |
|
|
74
|
+
| Morphology | PNG + MP4 + CSV | `Morphology_Frame0_Labeled.png`, `Morphology_Labeled.mp4` |
|
|
75
|
+
| Shape Features | PNG + CSV | `Shape_Distributions.png`, `Mito_ShapeMetrics.csv` |
|
|
76
|
+
| Tracking | PNG + MP4 + CSV | `Cumulative_Mito.png`, `Mito_Tracks.csv` |
|
|
77
|
+
| Motility | PNG + CSV | `Motility_Distributions.png`, `Motility_Scatter.png` |
|
|
78
|
+
| Colocalization | PNG + MP4 + CSV | `Colocalization_Frame0.png`, `Colocalization.csv` |
|
|
79
|
+
| Summary | PNG + CSV | `Integrated_CorrelationMatrix.png`, `Integrated_Merged_Data.csv` |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 🔧 Dependencies
|
|
84
|
+
|
|
85
|
+
- Python ≥ 3.9
|
|
86
|
+
- numpy, pandas, matplotlib, seaborn, opencv-python, scikit-image, scipy, tifffile
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 🧩 Citation
|
|
91
|
+
|
|
92
|
+
If you use **AutoMorphoTrack** in your research, please cite:
|
|
93
|
+
|
|
94
|
+
> **Bayati, A. (2025)**. AutoMorphoTrack: An accessible Python framework for automated analysis of organelle morphology and motility.
|
|
95
|
+
> *GitHub Repository:* [https://github.com/abayatibrain/automorphotrack](https://github.com/abayatibrain/automorphotrack)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# AutoMorphoTrack – Automated Organelle Detection and Tracking
|
|
3
|
+
# ============================================================
|
|
4
|
+
# Author: Armin Bayati, Ph.D.
|
|
5
|
+
# Description:
|
|
6
|
+
# AutoMorphoTrack is a modular image-analysis package for
|
|
7
|
+
# mitochondria and lysosome tracking, morphology, shape,
|
|
8
|
+
# motility, and colocalization analysis in fluorescence microscopy.
|
|
9
|
+
#
|
|
10
|
+
# Core Pipeline:
|
|
11
|
+
# 1. Detection (detection.py)
|
|
12
|
+
# 2. Lysosome counting (lyso_count.py)
|
|
13
|
+
# 3. Morphology classification (morphology.py)
|
|
14
|
+
# 4. Shape feature extraction (shape_features.py)
|
|
15
|
+
# 5. Shape profiling (shape_profiling.py)
|
|
16
|
+
# 6. Organelle tracking (tracking.py / tracking_overlay.py)
|
|
17
|
+
# 7. Motility analysis (motility.py)
|
|
18
|
+
# 8. Colocalization analysis (colocalization.py)
|
|
19
|
+
# 9. Integrated summary (summary.py)
|
|
20
|
+
#
|
|
21
|
+
# Package structure follows:
|
|
22
|
+
# from automorphotrack import (
|
|
23
|
+
# detect_organelles,
|
|
24
|
+
# count_lysosomes_per_frame,
|
|
25
|
+
# classify_morphology,
|
|
26
|
+
# analyze_shape_features,
|
|
27
|
+
# profile_shape_data,
|
|
28
|
+
# track_organelles,
|
|
29
|
+
# track_overlay,
|
|
30
|
+
# analyze_motility,
|
|
31
|
+
# analyze_colocalization,
|
|
32
|
+
# summarize_integrated_data
|
|
33
|
+
# )
|
|
34
|
+
# ============================================================
|
|
35
|
+
|
|
36
|
+
__version__ = "1.0.0"
|
|
37
|
+
__author__ = "Armin Bayati"
|
|
38
|
+
|
|
39
|
+
# --- Utility Imports ---
|
|
40
|
+
from automorphotrack.utils import (
|
|
41
|
+
ensure_dir,
|
|
42
|
+
save_high_dpi,
|
|
43
|
+
upscale_frame,
|
|
44
|
+
write_video
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# --- Core Functional Imports ---
|
|
48
|
+
from automorphotrack.detection import detect_organelles
|
|
49
|
+
from automorphotrack.lyso_count import count_lysosomes_per_frame
|
|
50
|
+
from automorphotrack.morphology import classify_morphology
|
|
51
|
+
from automorphotrack.shape_features import analyze_shape_features
|
|
52
|
+
from automorphotrack.shape_profiling import profile_shape_data
|
|
53
|
+
from automorphotrack.tracking import track_organelles
|
|
54
|
+
from automorphotrack.tracking_overlay import track_overlay
|
|
55
|
+
from automorphotrack.motility import analyze_motility
|
|
56
|
+
from automorphotrack.colocalization import analyze_colocalization
|
|
57
|
+
from automorphotrack.summary import summarize_integrated_data
|
|
58
|
+
|
|
59
|
+
# --- Convenience Alias (optional shortcut API) ---
|
|
60
|
+
__all__ = [
|
|
61
|
+
"ensure_dir",
|
|
62
|
+
"save_high_dpi",
|
|
63
|
+
"upscale_frame",
|
|
64
|
+
"write_video",
|
|
65
|
+
"detect_organelles",
|
|
66
|
+
"count_lysosomes_per_frame",
|
|
67
|
+
"classify_morphology",
|
|
68
|
+
"analyze_shape_features",
|
|
69
|
+
"profile_shape_data",
|
|
70
|
+
"track_organelles",
|
|
71
|
+
"track_overlay",
|
|
72
|
+
"analyze_motility",
|
|
73
|
+
"analyze_colocalization",
|
|
74
|
+
"summarize_integrated_data"
|
|
75
|
+
]
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# AutoMorphoTrack – Colocalization Analysis (Manders + Pearson)
|
|
3
|
+
# ============================================================
|
|
4
|
+
|
|
5
|
+
import tifffile, cv2, numpy as np, pandas as pd, matplotlib.pyplot as plt
|
|
6
|
+
from skimage.filters import threshold_otsu
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from automorphotrack.utils import ensure_dir, save_high_dpi
|
|
9
|
+
|
|
10
|
+
def analyze_colocalization(
|
|
11
|
+
tif_path="Composite.tif",
|
|
12
|
+
mito_channel=0,
|
|
13
|
+
lyso_channel=1,
|
|
14
|
+
out_dir="Colocalization_Outputs",
|
|
15
|
+
fps=5,
|
|
16
|
+
upscale=2.0,
|
|
17
|
+
overlay_alpha=0.6):
|
|
18
|
+
|
|
19
|
+
ensure_dir(out_dir)
|
|
20
|
+
stack = tifffile.imread(tif_path)
|
|
21
|
+
if stack.shape[1] == 3 and stack.shape[-1] != 3:
|
|
22
|
+
stack = np.moveaxis(stack, 1, -1)
|
|
23
|
+
n_frames = stack.shape[0]
|
|
24
|
+
print(f"Loaded {n_frames} frames for colocalization analysis")
|
|
25
|
+
|
|
26
|
+
# ---------- Helpers ----------
|
|
27
|
+
def upscale_frame(img):
|
|
28
|
+
h, w = img.shape[:2]
|
|
29
|
+
return cv2.resize(img, (int(w * upscale), int(h * upscale)), interpolation=cv2.INTER_CUBIC)
|
|
30
|
+
|
|
31
|
+
def write_video(frames, out_path, fps):
|
|
32
|
+
h, w = frames[0].shape[:2]
|
|
33
|
+
out = cv2.VideoWriter(str(out_path), cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
|
|
34
|
+
for fr in frames:
|
|
35
|
+
out.write(cv2.cvtColor(fr, cv2.COLOR_RGB2BGR))
|
|
36
|
+
out.release()
|
|
37
|
+
|
|
38
|
+
frames_out = []
|
|
39
|
+
overlap_percent, m1_list, m2_list = [], [], []
|
|
40
|
+
pearson_r, overlap_R = [], []
|
|
41
|
+
mito_sum, lyso_sum = [], []
|
|
42
|
+
|
|
43
|
+
for f in range(n_frames):
|
|
44
|
+
mito = stack[f][..., mito_channel].astype(float)
|
|
45
|
+
lyso = stack[f][..., lyso_channel].astype(float)
|
|
46
|
+
|
|
47
|
+
# Background correction
|
|
48
|
+
mito -= np.percentile(mito, 5)
|
|
49
|
+
lyso -= np.percentile(lyso, 5)
|
|
50
|
+
mito, lyso = np.clip(mito, 0, None), np.clip(lyso, 0, None)
|
|
51
|
+
|
|
52
|
+
# Binary masks
|
|
53
|
+
thr_m, thr_l = threshold_otsu(mito), threshold_otsu(lyso)
|
|
54
|
+
mito_mask, lyso_mask = mito > thr_m, lyso > thr_l
|
|
55
|
+
overlap_mask, union_mask = mito_mask & lyso_mask, mito_mask | lyso_mask
|
|
56
|
+
|
|
57
|
+
# Metrics
|
|
58
|
+
overlap_ratio = (overlap_mask.sum() / union_mask.sum() * 100) if union_mask.sum() else 0
|
|
59
|
+
overlap_percent.append(overlap_ratio)
|
|
60
|
+
M1 = mito[lyso_mask].sum() / mito.sum() if mito.sum() > 0 else 0
|
|
61
|
+
M2 = lyso[mito_mask].sum() / lyso.sum() if lyso.sum() > 0 else 0
|
|
62
|
+
m1_list.append(M1)
|
|
63
|
+
m2_list.append(M2)
|
|
64
|
+
|
|
65
|
+
flat_m, flat_l = mito.flatten(), lyso.flatten()
|
|
66
|
+
if np.std(flat_m) > 0 and np.std(flat_l) > 0:
|
|
67
|
+
pearson_r.append(np.corrcoef(flat_m, flat_l)[0, 1])
|
|
68
|
+
else:
|
|
69
|
+
pearson_r.append(0)
|
|
70
|
+
denom = np.sqrt((mito**2).sum() * (lyso**2).sum())
|
|
71
|
+
overlap_R.append((mito * lyso).sum() / denom if denom > 0 else 0)
|
|
72
|
+
|
|
73
|
+
mito_sum.append(mito.sum())
|
|
74
|
+
lyso_sum.append(lyso.sum())
|
|
75
|
+
|
|
76
|
+
# Visualization with bright-blue overlay
|
|
77
|
+
mito_norm = (mito / mito.max() * 255).astype(np.uint8)
|
|
78
|
+
lyso_norm = (lyso / lyso.max() * 255).astype(np.uint8)
|
|
79
|
+
rgb = np.zeros((*mito.shape, 3), np.uint8)
|
|
80
|
+
rgb[..., 0], rgb[..., 1] = mito_norm, lyso_norm
|
|
81
|
+
|
|
82
|
+
mask = overlap_mask.astype(bool)
|
|
83
|
+
bright_blue_overlay = np.full_like(rgb[mask], (0, 150, 255), dtype=np.uint8)
|
|
84
|
+
rgb[mask] = cv2.addWeighted(rgb[mask], 1 - overlay_alpha, bright_blue_overlay, overlay_alpha, 0)
|
|
85
|
+
|
|
86
|
+
frames_out.append(upscale_frame(rgb))
|
|
87
|
+
|
|
88
|
+
# ---------- Save metrics ----------
|
|
89
|
+
csv_path = Path(out_dir) / "Colocalization.csv"
|
|
90
|
+
pd.DataFrame({
|
|
91
|
+
"Frame": np.arange(n_frames),
|
|
92
|
+
"Percent_Overlap": overlap_percent,
|
|
93
|
+
"Manders_M1": m1_list,
|
|
94
|
+
"Manders_M2": m2_list,
|
|
95
|
+
"Pearson_r": pearson_r,
|
|
96
|
+
"Overlap_R": overlap_R,
|
|
97
|
+
"Mito_TotalIntensity": mito_sum,
|
|
98
|
+
"Lyso_TotalIntensity": lyso_sum
|
|
99
|
+
}).to_csv(csv_path, index=False)
|
|
100
|
+
print(f"Saved metrics → {csv_path}")
|
|
101
|
+
|
|
102
|
+
# ---------- Save video ----------
|
|
103
|
+
video_path = Path(out_dir) / "Colocalization_BrightBlueOverlay.mp4"
|
|
104
|
+
write_video(frames_out, video_path, fps=fps)
|
|
105
|
+
|
|
106
|
+
# ---------- Save frame 0 still ----------
|
|
107
|
+
frame0_path = Path(out_dir) / "Colocalization_Frame0.png"
|
|
108
|
+
cv2.imwrite(str(frame0_path),
|
|
109
|
+
cv2.cvtColor(frames_out[0], cv2.COLOR_RGB2BGR),
|
|
110
|
+
[cv2.IMWRITE_PNG_COMPRESSION, 0])
|
|
111
|
+
|
|
112
|
+
# ---------- Plot metrics ----------
|
|
113
|
+
plot_path = Path(out_dir) / "Colocalization_MetricsPlot.png"
|
|
114
|
+
fig, ax = plt.subplots(figsize=(10, 9))
|
|
115
|
+
ax.plot(m1_list, 'r-', label='Manders M1 (mito→lyso)')
|
|
116
|
+
ax.plot(m2_list, 'g-', label='Manders M2 (lyso→mito)')
|
|
117
|
+
ax.plot(np.array(overlap_percent) / 100, 'b--', label='Overlap fraction')
|
|
118
|
+
ax.plot(pearson_r, 'k-.', label='Pearson r')
|
|
119
|
+
ax.plot(overlap_R, 'm:', label='Normalized R')
|
|
120
|
+
ax.set_xlabel("Frame")
|
|
121
|
+
ax.set_ylabel("Coefficient / Fraction (0–1)")
|
|
122
|
+
ax.set_ylim(0, 1)
|
|
123
|
+
ax.legend()
|
|
124
|
+
ax.set_title("Colocalization Metrics Over Time")
|
|
125
|
+
plt.tight_layout()
|
|
126
|
+
save_high_dpi(fig, plot_path)
|
|
127
|
+
|
|
128
|
+
print(f"Colocalization analysis complete — results saved in {Path(out_dir).resolve()}")
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# AutoMorphoTrack – Organelle Detection
|
|
3
|
+
# ============================================================
|
|
4
|
+
|
|
5
|
+
import tifffile, numpy as np, cv2
|
|
6
|
+
from skimage.filters import threshold_otsu
|
|
7
|
+
from skimage.morphology import remove_small_objects, binary_opening, disk
|
|
8
|
+
from skimage.segmentation import clear_border
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from automorphotrack.utils import ensure_dir, write_video, upscale_frame
|
|
11
|
+
|
|
12
|
+
def detect_mask(frame, ch, thr_factor=0.8, min_size=3):
|
|
13
|
+
"""Threshold and clean a single channel."""
|
|
14
|
+
img = frame[..., ch].astype(float)
|
|
15
|
+
img = (img - img.min()) / (img.ptp() + 1e-12)
|
|
16
|
+
thr = threshold_otsu(img) * thr_factor
|
|
17
|
+
mask = clear_border(binary_opening(img > thr, footprint=disk(1)))
|
|
18
|
+
mask = remove_small_objects(mask, min_size)
|
|
19
|
+
return (mask * 255).astype(np.uint8), img
|
|
20
|
+
|
|
21
|
+
def detect_organelles(
|
|
22
|
+
tif_path="Composite.tif",
|
|
23
|
+
out_dir="Detection_Outputs",
|
|
24
|
+
mito_channel=0,
|
|
25
|
+
lyso_channel=1,
|
|
26
|
+
upscale_factor=2,
|
|
27
|
+
fps=5):
|
|
28
|
+
|
|
29
|
+
ensure_dir(out_dir)
|
|
30
|
+
stack = tifffile.imread(str(tif_path))
|
|
31
|
+
if stack.shape[1] == 3 and stack.shape[-1] != 3:
|
|
32
|
+
stack = np.moveaxis(stack, 1, -1)
|
|
33
|
+
n_frames = stack.shape[0]
|
|
34
|
+
print(f"Loaded {n_frames} frames for detection")
|
|
35
|
+
|
|
36
|
+
mito_frames, lyso_frames = [], []
|
|
37
|
+
|
|
38
|
+
for f in range(n_frames):
|
|
39
|
+
# ----- Mitochondria (relaxed detection) -----
|
|
40
|
+
mito_mask, mito_img = detect_mask(stack[f], mito_channel, thr_factor=0.6, min_size=0.5)
|
|
41
|
+
mito_gray = (mito_img * 255).astype(np.uint8)
|
|
42
|
+
mito_rgb = cv2.cvtColor(mito_gray, cv2.COLOR_GRAY2RGB)
|
|
43
|
+
cnts, _ = cv2.findContours(mito_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
|
44
|
+
cv2.drawContours(mito_rgb, cnts, -1, (255, 0, 0), 1, cv2.LINE_AA)
|
|
45
|
+
mito_frames.append(upscale_frame(mito_rgb, upscale_factor))
|
|
46
|
+
|
|
47
|
+
# ----- Lysosomes (standard detection) -----
|
|
48
|
+
lyso_mask, lyso_img = detect_mask(stack[f], lyso_channel, thr_factor=0.8, min_size=2)
|
|
49
|
+
lyso_gray = (lyso_img * 255).astype(np.uint8)
|
|
50
|
+
lyso_rgb = cv2.cvtColor(lyso_gray, cv2.COLOR_GRAY2RGB)
|
|
51
|
+
cnts, _ = cv2.findContours(lyso_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
|
52
|
+
cv2.drawContours(lyso_rgb, cnts, -1, (0, 255, 0), 1, cv2.LINE_AA)
|
|
53
|
+
lyso_frames.append(upscale_frame(lyso_rgb, upscale_factor))
|
|
54
|
+
|
|
55
|
+
# Save representative frames
|
|
56
|
+
cv2.imwrite(str(Path(out_dir) / "Mito_Frame0.png"),
|
|
57
|
+
cv2.cvtColor(mito_frames[0], cv2.COLOR_RGB2BGR))
|
|
58
|
+
cv2.imwrite(str(Path(out_dir) / "Lyso_Frame0.png"),
|
|
59
|
+
cv2.cvtColor(lyso_frames[0], cv2.COLOR_RGB2BGR))
|
|
60
|
+
|
|
61
|
+
# Save videos
|
|
62
|
+
write_video(mito_frames, Path(out_dir) / "Mitochondria_Detection.mp4", fps=fps)
|
|
63
|
+
write_video(lyso_frames, Path(out_dir) / "Lysosomes_Detection.mp4", fps=fps)
|
|
64
|
+
|
|
65
|
+
print(f"Detection complete — outputs saved in {Path(out_dir).resolve()}")
|