本文へスキップ
Skillpedia
分析とスプレッドシート51k · #3476

histolab

できること

Histolab は、顕微鏡のスライド画像を準備するためのツールです。分析に使う画像の一部(タイル)を選び、色の見え方を揃えて一貫性を保ち、今後の研究のためにデータを整理するのに役立ちます。

使う場面

  • ✓スライド画像から特定の部分を切り出して分析したいとき。
  • ✓複数のスライド画像の色味を標準化したいとき。
  • ✓人工知能モデルの学習用に、スライド画像のセットを整理したいとき。

スキルのリンク

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/histolab/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/histolab/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“'example.svs' のスライドから、組織が少なくとも80%含まれる領域を優先して、512x512ピクセルのタイルを100個ランダムに選んで。”

毎週5つの新しいスキル。1分で読めます。

仕組み

Histolab はまずスライド内の組織の領域を特定します。そのうえで、ランダム、グリッド、スコアベースなど、さまざまな方法で切り出す画像の部分を選びます。また、すべての画像が似た見た目になるように色を調整することもできます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Histolab

When to use

Use Histolab to inspect WSI metadata, identify tissue, extract image tiles, and standardize H&E staining. Its masks and scores are image-processing heuristics; they do not diagnose cancer, count individual cells, or establish image quality.

Installation

Histolab 0.7.0 remains the latest published release as of the review date. Its release constraints require Python <3.12, NumPy <=1.24.4, scikit-image <0.19.4, SciPy <1.10.1, Pillow <11, and openslide-python 1.3.1. Keep this stack isolated from modern scientific environments. Windows is not supported by this Histolab release.

Install native OpenSlide for your system, then create a dedicated environment (Python 3.10 was tested):

uv venv --python 3.10 .venv-histolab
uv pip install --python .venv-histolab/bin/python 'histolab==0.7.0' pooch matplotlib
.venv-histolab/bin/python -c 'import openslide; print(openslide.__library_version__)'

On macOS with Homebrew, brew install openslide installs the native library. If the older Python binding cannot find it, launch Python with the library path set immediately before Python starts:

env DYLD_FALLBACK_LIBRARY_PATH="$(brew --prefix openslide)/lib" .venv-histolab/bin/python -c 'import openslide; print(openslide.__library_version__)'

pooch is optional for remote examples. Start with a local slide or the tiny bundled cmu_small_region sample; other sample functions may download hundreds of megabytes. Exact mpp extraction also needs large-image and a matching source plugin; see slide management.

Workflow

  1. Inspect slide.dimensions, slide.levels (a list), and slide.level_dimensions(level) (a method). Check both MPP axes in metadata.
  2. Select physical field of view and pixel resolution; level numbers are not interchangeable across scanners. Preserve level-0 coordinate bounds.
  3. Choose TissueMask for all tissue sections or BiggestTissueBoxMask for the largest section's bounding box. Inspect the mask at its actual resolution.
  4. Configure a tiler and preview with the same mask passed to extraction. Preview methods return a Pillow image; save or display that return value.
  5. Extract into a distinct per-slide/per-strategy directory. Count saved files, inspect representative tiles, and retain parameters, source IDs and QC flags.
  6. Split datasets by patient before training/validation/test tile assignment. Fit stain normalization targets on training data only and validate on held-out scanners. A seed reproduces sampling; it does not prevent patient leakage.

Quick start

Illustrative for a user-provided slide; the same API path is tested with small local fixtures. n_tiles is an upper bound, not a promise of 100 valid tiles.

from pathlib import Path
from histolab.slide import Slide
from histolab.masks import TissueMask
from histolab.tiler import RandomTiler

output = Path("output/random_tiles")
output.mkdir(parents=True, exist_ok=True)
slide = Slide("slide.svs", processed_path=output)
mask = TissueMask()
slide.locate_mask(mask).save(output / "mask_preview.png")

tiler = RandomTiler(
    tile_size=(512, 512), n_tiles=100, level=0, seed=42,
    check_tissue=True, tissue_percent=80.0, prefix="random_",
)
tiler.locate_tiles(slide, extraction_mask=mask).save(output / "tile_preview.png")
tiler.extract(slide, extraction_mask=mask)
print("[OK] Saved tiles:", len(list(output.glob("random_tile_*.png"))))

extraction_mask belongs to extract() and locate_tiles(), not to the tiler constructor. locate_tiles() has no n_tiles argument. Previewing runs tile selection again, so it may be expensive; use a separate small tiler for initial exploration, then preview the final configuration before committing a large run.

Choose a strategy

Tiler Selection Important limitation
RandomTiler Seeded sampling, at most n_tiles, up to max_iter attempts May overlap, repeat, or miss rare structures
GridTiler Grid within the extraction mask Boundary tiles and tissue checks can leave gaps
ScoreTiler Scores all eligible grid candidates; saves top n_tiles Lower output count does not avoid scoring all candidates

For grids, stride in each axis is tile size minus pixel_overlap; positive

…

よくある質問

Histolab で病気を診断できますか?

いいえ、できません。Histolab は画像を準備・分析するためのツールであり、医療診断を行うためのものではありません。

どのコンピューターでも Histolab を使えますか?

最新バージョン(0.7.0)は Windows に対応しておらず、ほかの Python ライブラリの特定のバージョンが必要です。専用の環境を別に作って使うことをおすすめします。

「タイル」とは何ですか?

大きな画像から切り出した小さな断片や正方形のことです。Histolab の文脈では、分析のために顕微鏡スライド画像から取り出した部分を指します。

詳細

作者による元の説明

Extracts and preprocesses whole-slide histology image tiles with Histolab. Use for WSI inspection, tissue masks, random/grid/score-based tile extraction, H&E stain normalization, and tile dataset preparation. For multiplexed imaging or deep learning inference pipelines, use pathml.

repo: K-Dense-AI/scientific-agent-skills

人気

GitHubのスター
51k
ランキング
#3476
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル