Skip to content

Commit 04ee0d5

Browse files
updated readme
1 parent 5e3fe2e commit 04ee0d5

2 files changed

Lines changed: 70 additions & 105 deletions

File tree

README.md

Lines changed: 70 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,110 @@
1-
# AI4Life-OC-3DM3
1+
<p align="center">
2+
<a href="https://ai4life.eurobioimaging.eu/open-calls/">
3+
<img src="https://github.com/ai4life-opencalls/.github/blob/main/AI4Life_banner_giraffe_nodes_OC.png?raw=true" width="70%">
4+
</a>
5+
</p>
26

3-
Python pipeline for stitching, denoising (Noise2Void), and segmenting migrating cells in 5D microscopy data (X, Y, Z, T, C) of tumor spheroids embedded in collagen.
4-
Developed as part of the AI4Life Open Call 3 project, building on [OC-1 Project 11](https://github.com/ai4life-opencalls/oc-1-project-11/tree/main).
7+
# Project 18: 3D Matrix Motility Map (3DM³)
58

6-
---
7-
8-
## 1. Environment Setup (Windows + NVIDIA GPU)
9-
10-
This project uses:
9+
**A collaboration with the Institute of Cell Biology and Immunology, University of Stuttgart, Germany**
1110

12-
- [Noise2Void (n2v)](https://github.com/juglab/n2v) for denoising
13-
- [Cellpose](https://github.com/MouseLand/cellpose) for segmentation
11+
---
1412

15-
To replicate the GPU-enabled setup:
13+
## 🧠 Introduction
1614

17-
```
18-
conda env create -f n2v_env.yaml
19-
conda activate n2v
20-
```
15+
Cancer cell dissemination in 3D matrices is driven by interactions between cells and the extracellular matrix (ECM), especially collagen.
16+
This project focuses on live-cell imaging of breast tumor spheroids embedded in collagen to analyze cancer cell migration, shape, and interaction with ECM architecture.
2117

22-
This uses:
23-
- `tensorflow==2.10.1` (GPU)
24-
- `cudatoolkit=11.2`
25-
- `cudnn=8.1.0`
18+
The dataset includes **5D live imaging (X, Y, Z, T, C)** acquired using widefield and confocal microscopy.
19+
Channels include:
20+
- **Brightfield** (cell shape)
21+
- **mScarlet** (nuclear marker)
22+
- **Second Harmonic Generation (SHG)** (collagen structure)
2623

27-
For alternate setups, refer to the [n2v installation guide](https://github.com/juglab/n2v#installation).
24+
Our aim is to develop a **reproducible pipeline** for:
25+
- Stitching tiled acquisitions
26+
- Denoising (via N2V or Careamics)
27+
- Manual annotation
28+
- Cellpose finetuning
29+
- Segmentation of migrating cells
2830

29-
---
3031

31-
## 2. Stitching Raw Tile Images
32+
## 🔧 Pipeline Overview
3233

33-
We start with tile-based 5D microscopy data (2x2 grid).
34-
Each tile is a TIFF file with shape (X, Y, Z, T, C).
34+
### 1. Environment Setup
3535

36-
We stitch them into a single 5D image using:
36+
To enable GPU acceleration on Windows:
3737

38-
**File to run:**
39-
```
40-
stitch.py
38+
```bash
39+
conda env create -f n2v_env.yaml
40+
conda activate n2v
4141
```
42-
This script loads each tile using known offsets and saves a single `.ome.tif` with full 5D dimensions preserved.
43-
44-
---
42+
For denoising, choose either:
43+
* `Noise2Void` (legacy, self-supervised)
44+
*[Careamics](https://careamics.github.io/0.1) (recommended, modular and modern implementation)
4545

46-
## 3. Preparing 2D+T Data for Denoising
46+
### 2. Stitching Raw Tile Images
47+
We begin with a 2x2 tile grid of 5D TIFF files (shape: X, Y, Z, T, C).
48+
Stitching is done using known positional offsets.
4749

48-
From the stitched 5D data, we extract the nuclei channel and perform a max Z-projection over central slices.
49-
The result is a 3D (T, Y, X) stack, ready for denoising.
50-
51-
**File to run:**
52-
```
53-
prepare_n2v.py
50+
Run:
51+
```bash
52+
python stitch.py
5453
```
55-
Output is saved to:
5654

57-
```
58-
data/n2v_input/{N}_slices/*.tif
59-
```
60-
Where `{N}` is the number of projected slices.
55+
**Output**:
56+
Single `.ome.tif` containing the full volume.
6157

62-
---
58+
### 3. Preparing 2D+T Slices for Denoising
6359

64-
## 4. Denoising with Noise2Void
60+
We extract the nuclei channel (mScarlet), and apply max Z-projection over central slices to obtain a 3D (T, Y, X) stack.
6561

66-
We use a Jupyter notebook to train a self-supervised N2V model and denoise each timepoint.
62+
**Run:**
6763

68-
**Notebook to open:**
69-
```
70-
notebooks/N2V_denoising.ipynb
64+
```bash
65+
python prepare_n2v.py
7166
```
72-
Steps:
73-
- Load projected 3D stack
74-
- Train N2V model using patch-based augmentation
75-
- Predict denoised output
76-
- Save denoised TIFF to disk
7767

78-
Model is saved to:
68+
### 4. Denoising
69+
You can denoise using:
7970

71+
##### Option A: Jupyter Notebook with N2V
72+
Open:
73+
```bash
74+
notebooks/N2V_denoising.ipynb
8075
```
81-
models/denoising_5slices_n2v/
82-
```
83-
We also compute and save image difference plots:
76+
Run the cells, specify where your dataset lies and denoise. Remember to install the environment.
8477

78+
##### Option B: Jupyter Notebook with CAREamics (Recommended)
79+
Open:
80+
```bash
81+
CAREamics_denoising.ipynb
8582
```
86-
models/denoising_5slices_n2v/original-denoised-difference.png
87-
```
88-
---
83+
Again, run each cell and specify the dataset. This will need a different environment.
84+
For any assistance, consult [CAREamics' documentation](https://careamics.github.io/0.1).
8985

90-
## 5. Annotating & Training Segmentation with Cellpose
86+
Here you can see an image representing (from top to bottom) the original image, the image after being properly stitched and preprocessed and after denoising with CAREamics.
9187

92-
### 5.1 Manual Annotation (done using Cellpose GUI)
88+
![Original Image - Preprocessed - Denoised](before-after.png)
9389

94-
We extract individual timepoints from the denoised TIFF stack (done manually or with Fiji).
95-
We then open selected frames in the **Cellpose GUI**, annotate them, and save masks as `_seg.npy`.
90+
### 5. Cell Annotation and Training
9691

97-
To annotate 3D images open cellpose GUI as:
98-
```
92+
#### 5.1 Manual Annotation
93+
Use the Cellpose GUI for annotation:
94+
```bash
9995
python -m cellpose --Zstack
10096
```
101-
For more information on how to annotate images read [this docs](https://cellpose.readthedocs.io/en/latest/gui.html) and [this blog post](https://focalplane.biologists.com/2025/06/05/annotating-images-in-cellpose/).
102-
103-
This produces training pairs like:
10497

105-
```
98+
Save training pairs like:
99+
```text
106100
segmentation_input/training/
107101
├── nuclei_t003.tif
108102
├── nuclei_t003_seg.npy
109103
```
110-
Repeat for 5–10 diverse timepoints.
111104

112-
---
105+
To have a consisten training of cellpose you will need to annotate between 15-20 nuclei per time-point and multiple time-points per scene. If not, there is not enough data to fine-tune cellpose.
106+
107+
For more information on how to annotate images read [this docs](https://cellpose.readthedocs.io/en/latest/gui.html) and [this blog post](https://focalplane.biologists.com/2025/06/05/annotating-images-in-cellpose/).
113108

114109
### 5.2 Training Custom Cellpose Model
115110

@@ -130,37 +125,7 @@ Trained model is saved to:
130125
```
131126
models/cellpose_nuclei_model/nuclei_custom/
132127
```
133-
---
134128

135-
## 6. File Structure Overview
136-
137-
```
138-
AI4Life-OC-3DM3/
139-
140-
├── models/
141-
│ ├── denoising_5slices_n2v/
142-
│ │ ├── weights_best.h5
143-
│ │ └── original-denoised-difference.png
144-
│ └── cellpose_nuclei_model/
145-
│ └── nuclei_custom/
146-
147-
├── data/
148-
│ ├── raw/ # Raw stitched tiles
149-
│ ├── n2v_input/ # Projected TIFFs for N2V
150-
│ └── segmentation_input/
151-
│ └── training/ # .tif + _seg.npy pairs
152-
153-
├── notebooks/
154-
│ └── N2V_denoising.ipynb
155-
156-
├── scripts/
157-
│ └── train_cellpose.bat
158-
159-
├── stitch.py
160-
├── prepare_n2v.py
161-
├── n2v_env.yaml
162-
└── README.md
163-
```
164-
---
129+
**Acknowledgements**
165130

166-
Made by the OC-3DM³ team.
131+
AI4Life has received funding from the European Union’s Horizon Europe research and innovation programme under grant agreement number 101057970. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them.

before-after.png

327 KB
Loading

0 commit comments

Comments
 (0)