Cypose
A finetune of cellpose and accompanying scripts designed for segmenting single and dual channel cyanobacteria movies.
Install / Use
/learn @cameronlab/CyposeREADME
Cyanosegment - Cyanobacteria Optimized Deep Cell Segmentation
<p align="center"> ⚠️ The main documentation for this project can be found at <a href="https://cameronlab.github.io/cypose/">GitHub Pages</a> ⚠️ </p>Description
This toolkit is designed to run segmentation and training on a cyanobacteria movie using the Cellpose model. It reads an ND2 and TIFF file, applies the specified model for segmentation, and saves the results as a TIFF stack. Included in this repository is our recommended model for segmentation of Synechococcus sp. PCC 7002, finetuned from the base cellpose model. This model is saved in the models folder.
Installation Instructions
To use this script, you need to have Python installed along with the following packages: nd2reader, torch, scikit-image, tifffile, argparse, cellpose, tqdm, numpy and PyQT6. You can install these using pip:
pip install nd2reader torch scikit-image tifffile argparse cellpose tqdm numpy PyQT6
Alternatively (and likely easier on Windows), you can install these using conda:
conda install -c conda-forge nd2reader torch scikit-image tifffile argparse cellpose tqdm numpy PyQT6
In some circumstances, you may need to install pytorch manually. You can do this using pip or conda to get proper GPU acceleration. See the Pytorch website for more information.
Execution Instructions
- If you would like to use GUI for segmenting and training use the command below. GUI script doesn't require passing extra parameters. After GUI interface has loaded select the correct tab for your task and fill required fields.
python run_gui.py
If GUI is used the folder for segmenting and training logs will be created and will contain all output from each run.
- To use terminal commands To run the script, use the following command in your terminal:
python run_segmentation.py --input_file input.nd2 --output_file output.tiff --model model_name [--gpu] [--start_frame frame_number] [--end_frame frame_number] [--debug]
Replace input.nd2 with the path to your input ND2 file, output.tiff with the desired output TIFF file name, and model_name with the path of the model you want to use. The script will run segmentation on all frames (or a specified subset) of the input file and save the results as a TIFF stack.
Optional arguments:
- --gpu: Use GPU for segmentation if available. This gives a ~2-10x speedup depending on your hardware.
- --start_frame frame_number: The first frame to start segmentation on. Default is 0.
- --end_frame frame_number: The last frame to end segmentation on. If not provided, the script will segment all frames.
- --debug: Run in debug mode, which saves additional output files (flows and probabilities).
Example usage:
python run_segmentation.py --input_file data/movie.nd2 --output_file results/segmented.tiff --model models/7002_CAH_default --gpu --start_frame 10 --end_frame 50 --debug
This command will run segmentation on the frames 10 to 50 of data/movie.nd2 using the 'cyto' model, and save the results as a TIFF stack in results/segmented.tiff. It will also save additional files with flows and probabilities for debugging purposes.
The model output consists of a generated TIF file saved at the user specified location. The output file contains masks for each identified cell separated by integer level. For example, background is indicated by a 0 value, the first cell identified is identified with a 1 value in all pixels containing that cell, and so on for each identified cell. The base Cellpose framework structures output in this way to handle the condition where two segmented cells share a pixel on an edge, as if a single value was used for segmented cells, downstream analysis would treat those cells as merged into a single cell.
Building a distributable binary
To build a distributable package for your operating system, you'll need to install the dependencies listed above, as well as pyinstaller. Note that you'll need to be on a windows system for this to work. Then, run the following command in the root directory of this repository:
pyinstaller --onefile run_segmentation.py
This will create a single executable file in the dist folder. You can then run this executable from the command line with the same arguments as above. If you are on Windows, this will be an exe file, and if you are on Linux, this will be an ELF file. On Mac, this will be a DMG file that should work.
Related Skills
diffs
341.6kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
openpencil
1.9kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
HappyColorBlend
HappyColorBlendVibe Project Guidelines Project Overview HappyColorBlendVibe is a Figma plugin for color palette generation with advanced tint/shade blending capabilities. It allows designers to
