Interactive web app for cell segmentation and tracking using Cellpose + LAP tracking.
✨ Now with Apple M4 GPU Support!
# Clone repository
git clone https://github.com/YOUR_USERNAME/flim_tracker.git
cd flim_tracker
# Create conda environment
conda create -n flim python=3.10
conda activate flim
# Install dependencies
pip install -r requirements.txtstreamlit run streamlit_app.pyOpen http://localhost:8501 in your browser.
✅ Automatic M4 Pro GPU acceleration via MPS (Metal Performance Shaders)
- 5-10x faster than CPU
- ~10-30 seconds per frame (vs 2-3 minutes on CPU)
✅ Automatic CUDA GPU acceleration
- ~1-2 seconds per frame
- Real-time Preview: See segmentation results instantly
- Compact UI: No scrolling, all controls visible
- Video Playback: Play/pause frame-by-frame animation
- Arrow Navigation: Previous/Next buttons for frame selection
- Brightness adjustment (0.1-3.0x)
- Contrast normalization (stretch 0-255)
- CLAHE enhancement
- Gamma correction
- Diameter: Expected cell size (10-60px)
- Flow Threshold: Cell boundary detection strictness (0-1)
- Cell Prob Threshold: Detection permissiveness (-6 to 6)
- Min/Max cell area
- Minimum intensity threshold
- LAP (Linear Assignment Problem) algorithm
- Max linking distance
- Gap frame bridging (handle temporary occlusions)
- Download tracking CSV with:
- Track IDs
- Frame numbers
- Cell centroids (x, y)
- Cell areas
- Mean intensities
Upload a ZIP file containing microscopy images:
- Supported formats: TIF, TIFF, PNG, JPG, JPEG
- Images should be grayscale
- Consistent dimensions across frames
- Upload Data: Drag & drop ZIP of images
- Tune Parameters: Adjust preprocessing, Cellpose, and filtering in sidebar
- Preview: Navigate frames with ⬅️/➡️ arrows
- Play Video: Click
▶️ to see animated tracking preview - Run Pipeline: Process all frames with full tracking
- Download CSV: Export results for analysis
| Hardware | Speed per Frame | Full Dataset (15 frames) |
|---|---|---|
| Apple M4 Pro | 10-30 seconds | ~3-7 minutes |
| NVIDIA T4 | 1-2 seconds | ~15-30 seconds |
| CPU (Intel/AMD) | 2-3 minutes | ~30-45 minutes |
- Segmentation: Cellpose v3.0+ (cyto2 model)
- Tracking: LAP algorithm with gap closing
- UI: Streamlit with custom compact CSS
- GPU: PyTorch MPS (Apple Silicon) or CUDA (NVIDIA)
Sample PBS_1 dataset included: pbs1_frames.zip (15 frames, 1.8MB)
- Try enabling Contrast Normalize (dim images)
- Lower Cell Prob Threshold (more permissive)
- Adjust Diameter to match your cell size
- Verify GPU is enabled: Look for "🚀 GPU: Apple M4 Pro (MPS)" message
- If showing "💻 CPU Mode": Reinstall PyTorch with MPS support
pip uninstall torch torchvision pip install torch torchvision torchaudio
- Increase Flow Threshold (stricter boundaries)
- Increase Cell Prob Threshold (stricter detection)
- Adjust Min/Max Area filters
- Increase Min Intensity threshold
- Increase Max Linking Distance (cells move farther between frames)
- Increase Max Gap Frames (handle longer occlusions)
Built with Cellpose, Streamlit, and PyTorch
MIT License