技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
image-analysis【数据与研究】Use stable Squidpy image APIs for ImageContainer storage, processing, segmentation, and AnnData image-feature extraction.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill for stable squidpy.im workflows: create ImageContainer objects, manage image layers, process images, segment masks, crop around AnnData observations, and calculate image-derived features.
sq.im.ImageContainer from arrays, dask arrays, image files, Zarr/NetCDF stores, or AnnData spatial image metadata.sq.im.process with smoothing, grayscale conversion, custom callbacks, lazy execution, chunks, and explicit output layer names.sq.im.segment with watershed, SegmentationWatershed, SegmentationCustom, or custom callables.sq.im.calculate_image_features, including summary, histogram, texture, segmentation, and custom features.(y, x, z, channels) dimensions, channel selection, crop geometry, image scale, lazy arrays, chunks, and memory behavior.datasets-and-io for squidpy.datasets, squidpy.read.*, Visium/Vizgen/Nanostring loading, and AnnData spatial metadata setup.experimental-imaging for squidpy.experimental.im, SpatialData tiling, tissue detection, stain normalization, image QC, stitching, and tile-level feature extraction.visualization for image overlays, segmentation overlays, sq.pl.spatial_scatter, and sq.pl.spatial_segment.graph-analysis for spatial neighbor graphs and image-independent spatial statistics.references/image-workflows.md for practical image-layer, processing, segmentation, crop, and feature recipes.references/api-reference.md for stable signatures, copy behavior, feature storage, and model contracts.references/troubleshooting.md when dimensions, layers, channel axes, segmentation masks, crops, features, chunks, or memory fail.scripts/image_container_smoke.py --help or the default smoke command to check a local Squidpy install with generated in-memory data only.import numpy as np
import squidpy as sq
arr = np.zeros((32, 32, 3), dtype=np.float32)
arr[8:20, 10:22, 0] = 1.0
img = sq.im.ImageContainer(arr, layer="image", lazy=False, scale=1.0)
sq.im.process(img, layer="image", method="smooth", sigma=[1, 1, 0, 0], layer_added="image_smooth")
sq.im.segment(img, layer="image_smooth", method="watershed", channel=0, thresh=0.2, layer_added="segmentation")
Keep reusable code explicit: name layer and layer_added, validate list(img) after each mutation, select a single watershed channel, and use copy=True when the caller needs a returned container or feature table instead of in-place mutation.