No project description provided
Project description
CellPatchExtraction
Overview
This repository contains code for extracting single-cell patches from microscopic images. The primary objective is to facilitate the analysis of cellular structures and their properties.
Features
- Extracts single-cell patches from microscopic images
- Utilizes advanced image processing techniques
- Offers an example notebook for quick implementation
Requirements
- Python 3.9
- OpenCV
- NumPy
- PyTorch
- Cellpose (https://github.com/MouseLand/cellpose)
- Scipy
- tifffile
- matplotlib
Installation
Clone the repository:
git clone https://github.com/SimonBon/CellPatchExtraction.git
Install the required packages:
Either install the packages in an existing enironment or create a new one using:
cd CellPatchExtraction
conda create -n CellPatches python=3.9
conda activate Cellpatches
pip install -r requirements.txt
Usage
Basic Usage
Run the example notebook Example.ipynb
to get started.
Advanced Usage
For more control, you can directly use the extraction.py
script located in the src
directory.
from CellPatchExtraction import extraction
from plotutils import gridPlot #used for visualization
image_path = "path_to_TIFF_image" # or already loaded image as np.ndarray
model = "path_to_model" # or CellposeModel or one of "CP_TU" or "CP_BM"
diameter = 50 # set mean size of nuclei
min_size = 400 # set minimum size of nuclei, everything below will be discarded
patch_size = 32 # define size of patches
nuclear_channel = 38 # if image has more than 3 channels, define which channel should be used for segmentation
patches = extract_patches(image, model, cellpose_kwargs={"diameter": diameter, "min_size": min_size}, patch_size=32, nuclear_channel=38)
gridPlot(patches)
Contributing
Feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file CellPatchExtraction-1.21.tar.gz
.
File metadata
- Download URL: CellPatchExtraction-1.21.tar.gz
- Upload date:
- Size: 49.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37752fc4729410d3fdb3debaa8220016ab1ff3b5de49cfd6190e80f0d89dc940 |
|
MD5 | 0846f71c0328629892bc1fa83c5dfcdc |
|
BLAKE2b-256 | 005968806727f4dc46f35a963ea008c3412b57259df2bb49a8d682bdb204ea4f |
File details
Details for the file CellPatchExtraction-1.21-py3-none-any.whl
.
File metadata
- Download URL: CellPatchExtraction-1.21-py3-none-any.whl
- Upload date:
- Size: 49.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d7777153e6c42aad96e4f0b2a9bc822af848eaeb2c8f143e28b24e10140258d |
|
MD5 | 847f013c68fb0bf1d779dff3d776fa5b |
|
BLAKE2b-256 | d6bcf776592c39177677369864eaccd10d877ab3e0ebab77cb83968babcdad26 |