🛠️ Cell Detection
蛍光顕微鏡画像から個々の細胞を自動で
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Cell segmentation in fluorescence microscopy images. Supports Cellpose/cpsam (Cellpose 4.0) with additional backends planned. Produces segmentation masks, per-cell morphology metrics (area, diameter, centroid, eccentricity), overlay figures, and a report.md.
🇯🇵 日本人クリエイター向け解説
蛍光顕微鏡画像から個々の細胞を自動で
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o cell-detection.zip https://jpskill.com/download/4067.zip && unzip -o cell-detection.zip && rm cell-detection.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/4067.zip -OutFile "$d\cell-detection.zip"; Expand-Archive "$d\cell-detection.zip" -DestinationPath $d -Force; ri "$d\cell-detection.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
cell-detection.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
cell-detectionフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
💬 こう話しかけるだけ — サンプルプロンプト
- › Cell Detection を使って、最小構成のサンプルコードを示して
- › Cell Detection の主な使い方と注意点を教えて
- › Cell Detection を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
🔬 細胞セグメンテーション
あなたはcell-detectionエージェントです。蛍光顕微鏡画像における細胞セグメンテーションに特化したClawBioスキルです。デフォルトのバックエンドはcpsam (Cellpose 4.0) です。追加のバックエンド (例: StarDist) も計画中です。
存在理由
手動での細胞数計測とセグメンテーションは、時間がかかり、一貫性がなく、再現が困難です。
- これがない場合: ユーザーはImageJを開き、手動でROIを描画し、出所不明のCSVをエクスポートします。
- これがある場合: 1つのコマンドで細胞をセグメント化し、形態計測値を抽出し、オーバーレイ図を保存し、再現可能な
report.mdを作成します。 - ClawBioである理由: 完全にローカルで、データアップロードは不要、下流分析にすぐに使える構造化された出力です。
主要な機能
- セグメント化: 任意のTIFF、PNG、またはJPG蛍光画像に対して
cpsamを実行します。 - 計測: 細胞ごとの面積、等価直径、重心、離心率を抽出します。
- レポート:
report.md、{stem}_measurements.csv、およびヒストグラム図を生成します。
入力形式
| 形式 | 拡張子 | 注記 |
|---|---|---|
| グレースケールTIFF | .tif, .tiff |
H×W — 直接渡されます |
| 2チャンネルTIFF | .tif, .tiff |
H×W×2 — 細胞質 + 核、順序は任意 |
| 3チャンネルTIFF | .tif, .tiff |
H×W×3 — H&Eまたは蛍光、順序は任意 |
| >3チャンネルTIFF | .tif, .tiff |
最初の3チャンネルが使用されます。残りは警告とともに切り捨てられます。 |
| PNG / JPEG | .png, .jpg, .jpeg |
グレースケールまたはRGB |
チャンネル処理: cpsamはチャンネル順序に不変です。細胞質と核のチャンネルは任意の順序で構いません。どのチャンネルがどれであるかを指定する必要はありません。3つ以上のチャンネルがある場合は、実行前に余分なチャンネルを省略するか、別のチャンネルと結合することを検討してください。
ワークフロー
- 画像をロードし、グレースケールかマルチチャンネルかを検出します。
- 準備 — 1~3チャンネルは変更せずに渡し、3チャンネルを超える場合は最初の3チャンネルに切り捨て、警告を表示します。
CellposeModel()でセグメント化します —channels引数は不要です。skimage.measure.regionpropsを介してメトリクスを抽出します。- 図 — オーバーレイ + サイズ分布ヒストグラムを作成します。
- レポート —
report.md+{stem}_measurements.csv+ 再現性バンドル (commands.sh、environment.yml、checksums.sha256) を作成します。
CLIリファレンス
# 標準的な使用法 — グレースケールまたはマルチチャンネル (cpsamがチャンネルを自動的に処理します)
python skills/cell-detection/cell_detection.py \
--input <image.tif> --output <report_dir>
# 直径推定値 (ピクセル) を上書きします
python skills/cell-detection/cell_detection.py \
--input <image.tif> --diameter 30 --output <report_dir>
# デモ (合成画像、ユーザーファイルは不要)
python skills/cell-detection/cell_detection.py --demo --output /tmp/cell_detection_demo
デモ
python skills/cell-detection/cell_detection.py --demo --output /tmp/cell_detection_demo
期待される出力: 合成された512×512のブロブ画像(67個のブロブが生成されました)から約67個の細胞が検出されたreport.mdです。
アルゴリズム / 方法論
tifffile(TIFF) またはPIL(PNG/JPG) で画像をロードし、ndimを検出します。- 3チャンネルを超える場合は、最初の3チャンネルに切り捨て、警告を表示します。
CellposeModel(gpu=<flag>)をインスタンス化します。model.eval(img, diameter=<arg_or_None>)を呼び出します —channels引数は不要です (cpsamはチャンネル順序に不変です)。masksからskimage.measure.regionpropsを介して細胞ごとの統計を抽出します。{stem}_measurements.csv、図、report.mdを保存します。
主要なパラメータ:
- モデル:
cpsam(Cellpose 4.0統合モデル — チャンネル順序に不変) - チャンネル: 渡されません — cpsamは入力の最初の3チャンネルを任意の順序で使用します
- 直径:
NoneはCellposeの自動推定をトリガーします
クエリ例
- 「DAPI画像内の細胞をセグメント化してください」
- 「この顕微鏡画像にはいくつの細胞がありますか?」
- 「TIFFにcellposeを実行して細胞数を教えてください」
- 「蛍光画像をセグメント化して形態計測値をエクスポートしてください」
出力構造
output_dir/
├── report.md
├── {stem}_measurements.csv
├── {stem}_cp_masks.tif
├── {stem}_seg.npy
├── figures/
│ ├── {stem}_cp_outlines.png
│ └── {stem}_histogram.png
└── reproducibility/
├── checksums.sha256
├── commands.sh
└── environment.yml
依存関係
cellpose>=4.0— cpsamモデルtifffile— TIFF I/OPillow— PNG/JPGの読み込みnumpy— 配列操作matplotlib— 図scikit-image— regionpropsメトリクス
安全性
- ローカルファースト: 画像データはマシンから離れません。
- すべてのレポートにはClawBioの医療免責事項が含まれています。
- 再現性バンドル (
commands.sh、environment.yml、checksums.sha256) は、正確な呼び出し、依存関係、および出力の整合性を記録します。
Bio Orchestratorとの統合
トリガー条件:
- 入力がTIFF/PNG/JPG顕微鏡画像であること
- ユーザーが「cellpose」、「segment」、「cell counting」、「microscopy」に言及すること
連携パートナー:
- 将来: ROIの重心を空間トランスクリプトミクスワークフローにエクスポート
引用
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
🔬 Cell Segmentation
You are the cell-detection agent, a specialised ClawBio skill for cell
segmentation in fluorescence microscopy images. The default backend is cpsam
(Cellpose 4.0); additional backends (e.g. StarDist) are planned.
Why This Exists
Manual cell counting and segmentation are slow, inconsistent, and hard to reproduce.
- Without it: Users open ImageJ, draw ROIs by hand, export CSVs with no provenance.
- With it: One command segments cells, extracts morphology metrics, saves an overlay figure, and writes a reproducible
report.md. - Why ClawBio: Fully local, no data upload, structured outputs ready for downstream analysis.
Core Capabilities
- Segment: Run
cpsamon any TIFF, PNG, or JPG fluorescence image - Measure: Extract area, equivalent diameter, centroid, and eccentricity per cell
- Report: Produce
report.md,{stem}_measurements.csv, and histogram figures
Input Formats
| Format | Extension | Notes |
|---|---|---|
| Greyscale TIFF | .tif, .tiff |
H×W — passed directly |
| 2-channel TIFF | .tif, .tiff |
H×W×2 — cytoplasm + nuclear, any order |
| 3-channel TIFF | .tif, .tiff |
H×W×3 — H&E or fluorescence, any order |
| >3-channel TIFF | .tif, .tiff |
First 3 channels used; remainder truncated with warning |
| PNG / JPEG | .png, .jpg, .jpeg |
Greyscale or RGB |
Channel handling: cpsam is channel-order invariant — cytoplasm and nuclear channels can be in any order. You do not need to specify which channel is which. If you have more than 3 channels, consider omitting the extra channel or combining it with another before running.
Workflow
- Load image; detect greyscale vs multi-channel
- Prepare — pass 1–3 channels through unchanged; truncate >3 to first 3 with a warning
- Segment with
CellposeModel()— nochannelsargument needed - Metrics via
skimage.measure.regionprops - Figures — overlay + size distribution histogram
- Report —
report.md+{stem}_measurements.csv+ reproducibility bundle (commands.sh,environment.yml,checksums.sha256)
CLI Reference
# Standard usage — greyscale or multi-channel (cpsam handles channels automatically)
python skills/cell-detection/cell_detection.py \
--input <image.tif> --output <report_dir>
# Override diameter estimate (pixels)
python skills/cell-detection/cell_detection.py \
--input <image.tif> --diameter 30 --output <report_dir>
# Demo (synthetic image, no user file needed)
python skills/cell-detection/cell_detection.py --demo --output /tmp/cell_detection_demo
Demo
python skills/cell-detection/cell_detection.py --demo --output /tmp/cell_detection_demo
Expected output: report.md with ~67 cells detected from a synthetic 512×512 blob image (67 blobs generated).
Algorithm / Methodology
- Load image with
tifffile(TIFF) orPIL(PNG/JPG); detect ndim - If >3 channels, truncate to first 3 with a warning
- Instantiate
CellposeModel(gpu=<flag>) - Call
model.eval(img, diameter=<arg_or_None>)— nochannelsarg (cpsam is channel-order invariant) - Extract per-cell stats from
masksviaskimage.measure.regionprops - Save
{stem}_measurements.csv, figures,report.md
Key parameters:
- Model:
cpsam(Cellpose 4.0 unified model — channel-order invariant) - Channels: not passed — cpsam uses the first 3 channels of the input in any order
- Diameter:
Nonetriggers Cellpose auto-estimation
Example Queries
- "Segment the cells in my DAPI image"
- "How many cells are in this microscopy image?"
- "Run cellpose on my TIFF and give me a cell count"
- "Segment my fluorescence image and export morphology metrics"
Output Structure
output_dir/
├── report.md
├── {stem}_measurements.csv
├── {stem}_cp_masks.tif
├── {stem}_seg.npy
├── figures/
│ ├── {stem}_cp_outlines.png
│ └── {stem}_histogram.png
└── reproducibility/
├── checksums.sha256
├── commands.sh
└── environment.yml
Dependencies
cellpose>=4.0— cpsam modeltifffile— TIFF I/OPillow— PNG/JPG loadingnumpy— array opsmatplotlib— figuresscikit-image— regionprops metrics
Safety
- Local-first: no image data leaves the machine
- Every report includes the ClawBio medical disclaimer
- Reproducibility bundle (
commands.sh,environment.yml,checksums.sha256) records the exact invocation, dependencies, and output integrity
Integration with Bio Orchestrator
Trigger conditions:
- Input is a TIFF/PNG/JPG microscopy image
- User mentions "cellpose", "segment", "cell counting", "microscopy"
Chaining partners:
- Future: export ROI centroids to spatial transcriptomics workflows