/cell-segmentation

Primary LanguageJupyter Notebook

Cell Segmentation

Overview

Apply cell segmentation to images using the CLI tool or AWS Batch.

Local Setup

Install uv

curl -LsSf https://astral.sh/uv/install.sh | sh

Python 3.12 Setup

uv python install python==3.12

Setup environment/depdencies

uv sync

CLI Tool

CLI Installation

uv tool install git+https://github.com/neibla/cell-segmentation

CLI Usage

cell-segmentor -d tests/data --output  test_output
cell-segmentor --input-images ./tests/data/L11_s1_w2_slice_0.png --output test_output

Setting up AWS batch

Install terraform (MacOS)

brew tap hashicorp/tap
brew install hashicorp/tap/terraform

Setup AWS infrastructure

./update_infrastructure.sh

Building docker image and pushing to ECR

./build_docker.sh
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
aws batch submit-job \
    --job-name "cell-segmentation-job" \
    --job-queue "arn:aws:batch:us-west-2:${AWS_ACCOUNT_ID}:job-queue/cell-segmentation-job-queue" \
    --job-definition "cell-segmentation-job-def" \
    --container-overrides '{
        "command": [
            "uv",
            "run",
            "src/cell_segmentor_cli/main.py",
            "-d",
            "s3://cell-segmentation-data-a05c1c99b4410510/data/test_data",
            "-o",
            "s3://cell-segmentation-data-a05c1c99b4410510/test_outputs"
        ]
    }'