ledtrack 0.1.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.
- ledtrack-0.1.0/PKG-INFO +162 -0
- ledtrack-0.1.0/README.md +139 -0
- ledtrack-0.1.0/pyproject.toml +37 -0
- ledtrack-0.1.0/setup.cfg +4 -0
- ledtrack-0.1.0/src/ledtrack/__init__.py +0 -0
- ledtrack-0.1.0/src/ledtrack/cell_tracking.py +692 -0
- ledtrack-0.1.0/src/ledtrack/convert2CTCFormat.py +178 -0
- ledtrack-0.1.0/src/ledtrack/data_loader.py +180 -0
- ledtrack-0.1.0/src/ledtrack/division_detector.py +366 -0
- ledtrack-0.1.0/src/ledtrack/lineage_tree.py +240 -0
- ledtrack-0.1.0/src/ledtrack/linear_solver.py +135 -0
- ledtrack-0.1.0/src/ledtrack/loss.py +362 -0
- ledtrack-0.1.0/src/ledtrack/main.py +34 -0
- ledtrack-0.1.0/src/ledtrack/model_parts.py +76 -0
- ledtrack-0.1.0/src/ledtrack/models.py +38 -0
- ledtrack-0.1.0/src/ledtrack/predictor.py +156 -0
- ledtrack-0.1.0/src/ledtrack/train.py +138 -0
- ledtrack-0.1.0/src/ledtrack/utils.py +113 -0
- ledtrack-0.1.0/src/ledtrack/warp.py +65 -0
- ledtrack-0.1.0/src/ledtrack.egg-info/PKG-INFO +162 -0
- ledtrack-0.1.0/src/ledtrack.egg-info/SOURCES.txt +23 -0
- ledtrack-0.1.0/src/ledtrack.egg-info/dependency_links.txt +1 -0
- ledtrack-0.1.0/src/ledtrack.egg-info/entry_points.txt +2 -0
- ledtrack-0.1.0/src/ledtrack.egg-info/requires.txt +15 -0
- ledtrack-0.1.0/src/ledtrack.egg-info/top_level.txt +1 -0
ledtrack-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ledtrack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Learning-Estimation-Decision Cell Tracking
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: tqdm==4.67.3
|
|
9
|
+
Requires-Dist: hydra-core==1.3.2
|
|
10
|
+
Requires-Dist: omegaconf==2.3.0
|
|
11
|
+
Requires-Dist: tifffile
|
|
12
|
+
Requires-Dist: scipy==1.15.3
|
|
13
|
+
Requires-Dist: pandas==2.3.3
|
|
14
|
+
Requires-Dist: scikit-image==0.25.2
|
|
15
|
+
Requires-Dist: opencv-python
|
|
16
|
+
Requires-Dist: ortools==9.15.6755
|
|
17
|
+
Requires-Dist: imagecodecs==2025.3.30
|
|
18
|
+
Requires-Dist: ete3==3.1.3
|
|
19
|
+
Requires-Dist: scikit-learn==1.7.2
|
|
20
|
+
Requires-Dist: PyQt5==5.15.11
|
|
21
|
+
Requires-Dist: jupyter
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
|
|
24
|
+
# LearningβEstimationβDecision LED
|
|
25
|
+
*A Self-Supervised LearningβEstimationβDecision Framework for Robust Cell Tracking*
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## π Introduction
|
|
33
|
+
|
|
34
|
+
a novel **Self-Supervised LearningβEstimationβDecision (LED)** framework for robust cell tracking in time-lapse microscopy sequences.
|
|
35
|
+
|
|
36
|
+
<img src="method.png" width="500">
|
|
37
|
+
|
|
38
|
+
The framework integrates:
|
|
39
|
+
|
|
40
|
+
- **Learning**: self-supervised representation learning to represent cell movement and division pattens
|
|
41
|
+
- **Estimation**: posterior linking probability based on Bayesian theorem
|
|
42
|
+
- **Decision**: global optimization to resolve cell associations, divisions, and disappearances
|
|
43
|
+
|
|
44
|
+
These designs enable stable tracking for unseen data under vary imaging conditions, dense cell populations, and vary cell types.
|
|
45
|
+
|
|
46
|
+
<img src="example_lineage_tracks.gif" width="500">
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## π§° Dependencies
|
|
51
|
+
### 1. Conda Environment (Recommended for Windows + NVIDIA GPU)
|
|
52
|
+
Download and install Conda for managing Python environments from [Anaconda](https://www.anaconda.com/products/distribution).
|
|
53
|
+
|
|
54
|
+
Create your environment:
|
|
55
|
+
```bash
|
|
56
|
+
conda create -n your_env_name python=3.11
|
|
57
|
+
```
|
|
58
|
+
and then activate it:
|
|
59
|
+
```bash
|
|
60
|
+
conda activate your_env_name
|
|
61
|
+
```
|
|
62
|
+
### 2. PyTorch Installation (Deep Learning & Large-Scale Image Processing)
|
|
63
|
+
Ensure you have a compatible NVIDIA driver.
|
|
64
|
+
```bash
|
|
65
|
+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126
|
|
66
|
+
```
|
|
67
|
+
### 3. Pip Packages
|
|
68
|
+
**Note:** The code was tested on Windows/Linux with NVIDIA GPUs but not Mac.
|
|
69
|
+
#### Clone the Repository:
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/MingweiMin-Lab/LED.git
|
|
72
|
+
```
|
|
73
|
+
enter the directory
|
|
74
|
+
```bash
|
|
75
|
+
cd LED
|
|
76
|
+
```
|
|
77
|
+
You can install all dependencies using:
|
|
78
|
+
```bash
|
|
79
|
+
pip install -r requirements.txt
|
|
80
|
+
```
|
|
81
|
+
Or, you can install the package directly from PyPI:
|
|
82
|
+
```bash
|
|
83
|
+
pip install ledtrack
|
|
84
|
+
```
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## π Data Preparation
|
|
88
|
+
|
|
89
|
+
Place your data in the following structure:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
data/
|
|
93
|
+
βββ img/ # Time-lapse cell images (*.tif)
|
|
94
|
+
β βββ frame_0001.tif
|
|
95
|
+
β βββ frame_0002.tif
|
|
96
|
+
β βββ ...
|
|
97
|
+
βββ mask/ # Cell segmentation masks (same resolution as images, *.tif)
|
|
98
|
+
β βββ mask_0001.tif
|
|
99
|
+
β βββ mask_0002.tif
|
|
100
|
+
β βββ ...
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
β
Each image must have a corresponding segmentation mask (with sorted name).
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## βοΈ Key Parameters
|
|
108
|
+
|
|
109
|
+
Important tracking-related parameters are defined in the configuration file (`config/tracker.yaml`).
|
|
110
|
+
|
|
111
|
+
### Core parameters
|
|
112
|
+
|
|
113
|
+
| Parameter | Description |
|
|
114
|
+
|----------|-----------------------------------------------------|
|
|
115
|
+
| `max_movemment` | Maximum allowed **pixel** distance for cell linking |
|
|
116
|
+
|
|
117
|
+
### Optional parameters
|
|
118
|
+
|
|
119
|
+
| Parameter | Description |
|
|
120
|
+
|----------|-------------|
|
|
121
|
+
| `division_detect` | whether to pre-detect division for subsequent self-supervised training |
|
|
122
|
+
| `run_num` | number of parallel processes |
|
|
123
|
+
| `division` |whether to use division constraints in LP|
|
|
124
|
+
| `jitter_thr` | threshold for jitter correction |
|
|
125
|
+
| `post_pro` | post process including pruning and merging tracks|
|
|
126
|
+
|...|...|
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## βΆοΈ Usage Example
|
|
131
|
+
**Note:** verify your data and configurations (`config/tracker.yaml`).
|
|
132
|
+
### run main.py `python ledtrack` or the simple code below
|
|
133
|
+
```
|
|
134
|
+
from ledtrack.train import train_model as tm
|
|
135
|
+
from ledtrack.predictor import predictor as pr
|
|
136
|
+
from ledtrack.cell_tracking import tracker as ct
|
|
137
|
+
|
|
138
|
+
tm()
|
|
139
|
+
pr()
|
|
140
|
+
ct()
|
|
141
|
+
```
|
|
142
|
+
### or use jupyter
|
|
143
|
+
Launch jupyter notebook and run demo.ipynb
|
|
144
|
+
```bash
|
|
145
|
+
jupyter notebook
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## π Output
|
|
151
|
+
|
|
152
|
+
After execution, results will be saved as:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
results/
|
|
156
|
+
βββ track.csv # Cell trajectory matrix: frame Γ cell
|
|
157
|
+
βββ CTC format result # Cell Tracking Challenge format
|
|
158
|
+
βββ visualization of lineage tree # Lineage tree
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
ledtrack-0.1.0/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# LearningβEstimationβDecision LED
|
|
2
|
+
*A Self-Supervised LearningβEstimationβDecision Framework for Robust Cell Tracking*
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## π Introduction
|
|
10
|
+
|
|
11
|
+
a novel **Self-Supervised LearningβEstimationβDecision (LED)** framework for robust cell tracking in time-lapse microscopy sequences.
|
|
12
|
+
|
|
13
|
+
<img src="method.png" width="500">
|
|
14
|
+
|
|
15
|
+
The framework integrates:
|
|
16
|
+
|
|
17
|
+
- **Learning**: self-supervised representation learning to represent cell movement and division pattens
|
|
18
|
+
- **Estimation**: posterior linking probability based on Bayesian theorem
|
|
19
|
+
- **Decision**: global optimization to resolve cell associations, divisions, and disappearances
|
|
20
|
+
|
|
21
|
+
These designs enable stable tracking for unseen data under vary imaging conditions, dense cell populations, and vary cell types.
|
|
22
|
+
|
|
23
|
+
<img src="example_lineage_tracks.gif" width="500">
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## π§° Dependencies
|
|
28
|
+
### 1. Conda Environment (Recommended for Windows + NVIDIA GPU)
|
|
29
|
+
Download and install Conda for managing Python environments from [Anaconda](https://www.anaconda.com/products/distribution).
|
|
30
|
+
|
|
31
|
+
Create your environment:
|
|
32
|
+
```bash
|
|
33
|
+
conda create -n your_env_name python=3.11
|
|
34
|
+
```
|
|
35
|
+
and then activate it:
|
|
36
|
+
```bash
|
|
37
|
+
conda activate your_env_name
|
|
38
|
+
```
|
|
39
|
+
### 2. PyTorch Installation (Deep Learning & Large-Scale Image Processing)
|
|
40
|
+
Ensure you have a compatible NVIDIA driver.
|
|
41
|
+
```bash
|
|
42
|
+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126
|
|
43
|
+
```
|
|
44
|
+
### 3. Pip Packages
|
|
45
|
+
**Note:** The code was tested on Windows/Linux with NVIDIA GPUs but not Mac.
|
|
46
|
+
#### Clone the Repository:
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/MingweiMin-Lab/LED.git
|
|
49
|
+
```
|
|
50
|
+
enter the directory
|
|
51
|
+
```bash
|
|
52
|
+
cd LED
|
|
53
|
+
```
|
|
54
|
+
You can install all dependencies using:
|
|
55
|
+
```bash
|
|
56
|
+
pip install -r requirements.txt
|
|
57
|
+
```
|
|
58
|
+
Or, you can install the package directly from PyPI:
|
|
59
|
+
```bash
|
|
60
|
+
pip install ledtrack
|
|
61
|
+
```
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## π Data Preparation
|
|
65
|
+
|
|
66
|
+
Place your data in the following structure:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
data/
|
|
70
|
+
βββ img/ # Time-lapse cell images (*.tif)
|
|
71
|
+
β βββ frame_0001.tif
|
|
72
|
+
β βββ frame_0002.tif
|
|
73
|
+
β βββ ...
|
|
74
|
+
βββ mask/ # Cell segmentation masks (same resolution as images, *.tif)
|
|
75
|
+
β βββ mask_0001.tif
|
|
76
|
+
β βββ mask_0002.tif
|
|
77
|
+
β βββ ...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
β
Each image must have a corresponding segmentation mask (with sorted name).
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## βοΈ Key Parameters
|
|
85
|
+
|
|
86
|
+
Important tracking-related parameters are defined in the configuration file (`config/tracker.yaml`).
|
|
87
|
+
|
|
88
|
+
### Core parameters
|
|
89
|
+
|
|
90
|
+
| Parameter | Description |
|
|
91
|
+
|----------|-----------------------------------------------------|
|
|
92
|
+
| `max_movemment` | Maximum allowed **pixel** distance for cell linking |
|
|
93
|
+
|
|
94
|
+
### Optional parameters
|
|
95
|
+
|
|
96
|
+
| Parameter | Description |
|
|
97
|
+
|----------|-------------|
|
|
98
|
+
| `division_detect` | whether to pre-detect division for subsequent self-supervised training |
|
|
99
|
+
| `run_num` | number of parallel processes |
|
|
100
|
+
| `division` |whether to use division constraints in LP|
|
|
101
|
+
| `jitter_thr` | threshold for jitter correction |
|
|
102
|
+
| `post_pro` | post process including pruning and merging tracks|
|
|
103
|
+
|...|...|
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## βΆοΈ Usage Example
|
|
108
|
+
**Note:** verify your data and configurations (`config/tracker.yaml`).
|
|
109
|
+
### run main.py `python ledtrack` or the simple code below
|
|
110
|
+
```
|
|
111
|
+
from ledtrack.train import train_model as tm
|
|
112
|
+
from ledtrack.predictor import predictor as pr
|
|
113
|
+
from ledtrack.cell_tracking import tracker as ct
|
|
114
|
+
|
|
115
|
+
tm()
|
|
116
|
+
pr()
|
|
117
|
+
ct()
|
|
118
|
+
```
|
|
119
|
+
### or use jupyter
|
|
120
|
+
Launch jupyter notebook and run demo.ipynb
|
|
121
|
+
```bash
|
|
122
|
+
jupyter notebook
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## π Output
|
|
128
|
+
|
|
129
|
+
After execution, results will be saved as:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
results/
|
|
133
|
+
βββ track.csv # Cell trajectory matrix: frame Γ cell
|
|
134
|
+
βββ CTC format result # Cell Tracking Challenge format
|
|
135
|
+
βββ visualization of lineage tree # Lineage tree
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ledtrack"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Learning-Estimation-Decision Cell Tracking"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"tqdm==4.67.3",
|
|
14
|
+
"hydra-core==1.3.2",
|
|
15
|
+
"omegaconf==2.3.0",
|
|
16
|
+
"tifffile",
|
|
17
|
+
"scipy==1.15.3",
|
|
18
|
+
"pandas==2.3.3",
|
|
19
|
+
"scikit-image==0.25.2",
|
|
20
|
+
"opencv-python",
|
|
21
|
+
"ortools==9.15.6755",
|
|
22
|
+
"imagecodecs==2025.3.30",
|
|
23
|
+
"ete3==3.1.3",
|
|
24
|
+
"scikit-learn==1.7.2",
|
|
25
|
+
"PyQt5==5.15.11",
|
|
26
|
+
"jupyter",
|
|
27
|
+
"matplotlib",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
ledtrack = "ledtrack.main:main"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
ledtrack = ["config/*", "data/**/*", "*.png", "*.gif"]
|
ledtrack-0.1.0/setup.cfg
ADDED
|
File without changes
|