Skip to content

Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.

docs: update skills documentation for histolab and astropy

Timothy Kassisb4d0094b4eda
diff --git a/docs/skills.md b/docs/skills.md
index 3d52ef13..a3d7efbd 100644
--- a/docs/skills.md
+++ b/docs/skills.md
@@ -78,7 +78,7 @@
- **pyOpenMS** - Comprehensive mass spectrometry data analysis for proteomics and metabolomics (LC-MS/MS processing, peptide identification, feature detection, quantification, chemical calculations, and integration with search engines like Comet, Mascot, MSGF+)
### Medical Imaging & Digital Pathology
-- **histolab** - Digital pathology toolkit for whole slide image (WSI) processing and analysis. Provides automated tissue detection, tile extraction for deep learning pipelines, and preprocessing for gigapixel histopathology images. Key features include: multi-format WSI support (SVS, TIFF, NDPI), three tile extraction strategies (RandomTiler for sampling, GridTiler for complete coverage, ScoreTiler for quality-driven selection), automated tissue masks with customizable filters, built-in scorers (NucleiScorer, CellularityScorer), pyramidal image handling, visualization tools (thumbnails, mask overlays, tile previews), and H&E stain decomposition. Supports multiple tissue sections, artifact removal, pen annotation exclusion, and reproducible extraction with seeding. Use cases: creating training datasets for computational pathology, extracting informative tiles for tumor classification, whole-slide tissue characterization, quality assessment of histology samples, automated nuclei density analysis, and preprocessing for digital pathology deep learning workflows
+- **histolab** - Digital pathology toolkit for whole slide image (WSI) processing and analysis. Provides automated tissue detection, tile extraction for deep learning pipelines, and preprocessing for gigapixel histopathology images. Key features include: multi-format WSI support (SVS, TIFF, NDPI), three tile extraction strategies (RandomTiler for sampling, GridTiler for complete coverage, ScoreTiler for quality-driven selection), automated tissue masks with customizable filters, built-in scorers (NucleiScorer, CellularityScorer), Macenko and Reinhard stain normalization (0.6.0+), pyramidal image handling, visualization tools (thumbnails, mask overlays, tile previews), and H&E stain decomposition. Supports multiple tissue sections, artifact removal, pen annotation exclusion, and reproducible extraction with seeding. Requires Python 3.8–3.11, OpenSlide, and Linux or macOS. Use cases: creating training datasets for computational pathology, extracting informative tiles for tumor classification, whole-slide tissue characterization, quality assessment of histology samples, automated nuclei density analysis, and preprocessing for digital pathology deep learning workflows
- **PathML** - Comprehensive computational pathology toolkit for whole slide image analysis, tissue segmentation, and machine learning on pathology data. Provides end-to-end workflows for digital pathology research including data loading, preprocessing, feature extraction, and model deployment
- **pydicom** - Pure Python package for working with DICOM (Digital Imaging and Communications in Medicine) files. Provides comprehensive support for reading, writing, and manipulating medical imaging data from CT, MRI, X-ray, ultrasound, PET scans and other modalities. Key features include: pixel data extraction and manipulation with automatic decompression (JPEG/JPEG 2000/RLE), metadata access and modification with 1000+ standardized DICOM tags, image format conversion (PNG/JPEG/TIFF), anonymization tools for removing Protected Health Information (PHI), windowing and display transformations (VOI LUT application), multi-frame and 3D volume processing, DICOM sequence handling, and support for multiple transfer syntaxes. Use cases: medical image analysis, PACS system integration, radiology workflows, research data processing, DICOM anonymization, format conversion, image preprocessing for machine learning, multi-slice volume reconstruction, and clinical imaging pipelines
diff --git a/skills/astropy/SKILL.md b/skills/astropy/SKILL.md
index af152966..a6984a96 100644
--- a/skills/astropy/SKILL.md
+++ b/skills/astropy/SKILL.md
@@ -1,9 +1,9 @@
---
name: astropy
-description: Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.
+description: Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.
license: BSD-3-Clause license
metadata:
- version: "1.0"
+ version: "1.1"
skill-author: K-Dense Inc.
---
@@ -188,13 +188,18 @@ Robust statistical functions including sigma clipping and outlier rejection.
## Installation
```bash
-# Install astropy
-uv pip install astropy
+# Reproducible install against the current stable release
+uv pip install "astropy==7.2.0"
-# With optional dependencies for full functionality
-uv pip install astropy[all]
+# Recommended optional dependencies for plotting and common workflows
+uv pip install "astropy[recommended]==7.2.0"
+
+# Full optional dependency set for broad astronomy workflows
+uv pip install "astropy[all]==7.2.0"
```
+Astropy 7.2.0 requires Python 3.11+ and depends on NumPy, PyERFA, PyYAML, and packaging. Use an isolated virtual environment; do not install Astropy with elevated privileges.
+
## Common Workflows
### Converting Coordinates Between Systems
@@ -310,6 +315,15 @@ print(f"Found {len(cat1_matched)} matches")
8. **Use QTable for unit-aware tables**: When table columns have units
9. **Check WCS validity**: Verify WCS before using transformations
10. **Cache frequently used values**: Expensive calculations (e.g., cosmological distances) can be cached
+11. **Be explicit about network access**: `SkyCoord.from_name()`, `EarthLocation.of_site(refresh_cache=True)`, `EarthLocation.of_address()`, `download_file()`, remote FITS reads, and some IERS time/coordinate transforms can contact external services or update local caches. Avoid sending sensitive target names, addresses, URLs, or proprietary file locations to third-party services.
+12. **Pin for reproducibility**: Use pinned versions such as `astropy==7.2.0` for shared environments; update pins intentionally after reviewing release notes.
+
+## Current-Version Notes
+
+- Current stable release researched: Astropy 7.2.0 (released 2025-11-25)
+- Python requirement: 3.11+
+- Recent 7.x changes to watch for: Astropy 7.0 removed older deprecated FITS APIs such as `(Bin)Table.update`, `_ExtensionHDU`, `_NonstandardExtHDU`, and the `tile_size` argument for `CompImageHDU`; `CompImageHeader` is deprecated. Avoid those legacy patterns in new examples.
+- The recommended optional extras are `recommended` for common plotting/scientific dependencies and `all` only when a broad optional feature set is needed.
## Documentation and Resources
diff --git a/skills/astropy/references/coordinates.md b/skills/astropy/references/coordinates.md
index 308a0c26..ed757903 100644
--- a/skills/astropy/references/coordinates.md
+++ b/skills/astropy/references/coordinates.md
@@ -188,6 +188,8 @@ matches = target.separation(catalog) < 1*u.arcsec
Retrieve coordinates from online catalogs:
+**Network note:** `SkyCoord.from_name()` sends the object name to remote name-resolution services such as Sesame/SIMBAD/NED. Do not use it with confidential target names or proprietary survey identifiers; use explicit coordinates when privacy or reproducibility matters.
+
```python
# Query by name (requires internet)
m31 = SkyCoord.from_name("M31")
@@ -199,6 +201,8 @@ psr = SkyCoord.from_name("PSR J1012+5307")
Define observer locations:
+**Network note:** `EarthLocation.of_site()` normally uses the bundled site registry, but `refresh_cache=True` downloads an updated registry. `EarthLocation.of_address()` sends the address to a geocoding service, so prefer explicit latitude/longitude/height for sensitive sites.
+
```python
# By coordinates
location = EarthLocation(lat=40*u.deg, lon=-120*u.deg, height=1000*u.m)
@@ -207,8 +211,11 @@ location = EarthLocation(lat=40*u.deg, lon=-120*u.deg, height=1000*u.m)
keck = EarthLocation.of_site('Keck Observatory')
vlt = EarthLocation.of_site('Paranal Observatory')
+# Force a fresh observatory registry only when network access is acceptable
+keck = EarthLocation.of_site('Keck Observatory', refresh_cache=True)
+
# By address (requires internet)
-location = EarthLocation.of_address('1002 Holy Grail Court, St. Louis, MO')
+location = EarthLocation.of_address('1 Observatory Road, Example City')
# List available observatories
EarthLocation.get_site_names()
diff --git a/skills/astropy/references/fits.md b/skills/astropy/references/fits.md
index 58a69142..97a21d74 100644
--- a/skills/astropy/references/fits.md
+++ b/skills/astropy/references/fits.md
@@ -42,6 +42,8 @@ hdul = fits.open('large_file.fits', memmap=True)
Access cloud-hosted FITS files:
+**Network note:** Remote FITS reads disclose the target URI to the storage provider and may use credentials from the configured filesystem backend. Use anonymous reads only for public data, and prefer local files for proprietary observations.
+
```python
uri = "s3://bucket-name/image.fits"
with fits.open(uri, use_fsspec=True, fsspec_kwargs={"anon": True}) as hdul:
diff --git a/skills/astropy/references/time.md b/skills/astropy/references/time.md
index d613bba4..c994d5ad 100644
--- a/skills/astropy/references/time.md
+++ b/skills/astropy/references/time.md
@@ -201,6 +201,14 @@ times = start + TimeDelta(np.linspace(0, 365, 100), format='jd')
## Observing-Related Features
+Some high-precision time and coordinate operations use IERS Earth-rotation data. Astropy uses `astropy-iers-data` by default, but may auto-download fresher IERS-A data when required for UT1 or polar-motion values. Disable auto-download for offline or privacy-sensitive runs:
+
+```python
+from astropy.utils import iers
+
+iers.conf.auto_download = False
+```
+
### Sidereal Time
```python
@@ -392,13 +400,13 @@ ltt_bary = times.light_travel_time(target, kind='barycentric')
# Apply correction to get barycentric times
times_bary = times.tdb + ltt_bary
-# For radial velocity correction
-rv_correction = ltt_bary.to(u.km, equivalencies=u.dimensionless_angles())
+# For radial velocity work, use the coordinate helper instead
+rv_correction = target.radial_velocity_correction(obstime=times, location=location)
```
## Performance Considerations
1. **Array operations are fast**: Process multiple times as arrays
2. **Format conversions are cached**: Repeated access is efficient
-3. **Scale conversions may require IERS data**: Downloads automatically
+3. **Scale conversions may require IERS data**: Update `astropy-iers-data` before offline runs, or set `iers.conf.auto_download = False` to prevent network access
4. **High precision maintained**: Sub-nanosecond accuracy across astronomical timescales
diff --git a/skills/astropy/references/wcs_and_other_modules.md b/skills/astropy/references/wcs_and_other_modules.md
index 87f7842f..6623e7a1 100644
--- a/skills/astropy/references/wcs_and_other_modules.md
+++ b/skills/astropy/references/wcs_and_other_modules.md
@@ -327,6 +327,8 @@ robust_scale = biweight_scale(data)
### Data Downloads
+`download_file()` fetches a remote URL and caches it locally. Treat the URL as data you are disclosing to the remote host; do not pass confidential signed URLs or internal file locations unless the workflow explicitly permits it. Use `cache=False` for one-off downloads that should not be retained in Astropy's cache.
+
```python
from astropy.utils.data import download_file
diff --git a/skills/histolab/SKILL.md b/skills/histolab/SKILL.md
index f811f9f7..cba951bd 100644
--- a/skills/histolab/SKILL.md
+++ b/skills/histolab/SKILL.md
@@ -1,9 +1,10 @@
---
name: histolab
-description: Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
+description: Lightweight WSI tile extraction and preprocessing. Use for basic slide processing, tissue detection, tile extraction, and stain normalization for H&E images. Best for simple pipelines, dataset preparation, and quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
license: Apache-2.0 license
+compatibility: Requires Python 3.8–3.11 (histolab 0.7.0), OpenSlide system libraries, and Linux or macOS. Sample data via histolab.data requires pooch.
metadata:
- version: "1.0"
+ version: "1.1"
skill-author: K-Dense Inc.
---
@@ -15,10 +16,20 @@ Histolab is a Python library for processing whole slide images (WSI) in digital
## Installation
+Install OpenSlide system libraries first ([OpenSlide download](https://openslide.org/download/)), then install histolab:
+
```bash
uv pip install histolab
```
+For built-in TCGA sample slides via `histolab.data`, also install pooch:
+
+```bash
+uv pip install pooch
+```
+
+Histolab 0.7.0 (latest stable) supports Python 3.8–3.11 on Linux and macOS. Windows is not supported as of 0.7.0.
+
## Quick Start
Basic workflow for extracting tiles from a whole slide image:
@@ -84,8 +95,10 @@ print(f"Dimensions: {slide.dimensions}")
print(f"Levels: {slide.levels}")
print(f"Magnification: {slide.properties.get('openslide.objective-power')}")
-# Save thumbnail
-slide.save_thumbnail()
+# Save thumbnail to processed_path
+from pathlib import Path
+Path(slide.processed_path).mkdir(parents=True, exist_ok=True)
+slide.thumbnail.save(Path(slide.processed_path) / f"{slide.name}_thumbnail.png")
```
### 2. Tissue Detection and Masks
@@ -262,7 +275,28 @@ from histolab.tile import Tile
filtered_tile = tile.apply_filters(tissue_detection)
```
-### 5. Visualization
+### 5. Stain Normalization
+
+Standardize staining appearance across slides for deep learning (added in histolab 0.6.0).
+
+**Key classes:** `MacenkoStainNormalizer`, `ReinhardStainNormalizer`
+
+```python
+from histolab.stain_normalizer import MacenkoStainNormalizer, ReinhardStainNormalizer
+from PIL import Image
+
+target = Image.open("reference_stain.png") # Style reference slide/tile
+source = Image.open("slide_to_normalize.png")
+
+normalizer = MacenkoStainNormalizer()
+normalizer.fit(target)
+normalized = normalizer.transform(source)
+normalized.save("normalized.png")
+```
+
+Use `ReinhardStainNormalizer()` for Reinhard color transfer. Fit on a representative target image, then transform source tiles or thumbnails. See `references/filters_preprocessing.md` for filter-based alternatives.
+
+### 6. Visualization
Visualize slides, masks, tile locations, and extraction quality.
@@ -332,6 +366,7 @@ Quick sampling of diverse tissue regions for initial analysis.
```python
from histolab.slide import Slide
from histolab.tiler import RandomTiler
+from pathlib import Path
import logging
# Enable logging for progress tracking
@@ -343,7 +378,8 @@ slide = Slide("slide.svs", processed_path="output/random_tiles/")
# Inspect slide
print(f"Dimensions: {slide.dimensions}")
print(f"Levels: {slide.levels}")
-slide.save_thumbnail()
+Path(slide.processed_path).mkdir(parents=True, exist_ok=True)
+slide.thumbnail.save(Path(slide.processed_path) / f"{slide.name}_thumbnail.png")
# Configure random tiler
random_tiler = RandomTiler(
@@ -468,7 +504,8 @@ for slide_path in slide_dir.glob("*.svs"):
slide = Slide(slide_path, processed_path=output_dir)
# Save thumbnail for review
- slide.save_thumbnail()
+ Path(slide.processed_path).mkdir(parents=True, exist_ok=True)
+ slide.thumbnail.save(Path(slide.processed_path) / f"{slide.name}_thumbnail.png")
# Extract tiles
tiler.extract(slide)
@@ -515,7 +552,7 @@ tiler.extract(slide, extraction_mask=custom_mask)
### Slide Loading and Inspection
1. Always inspect slide properties before processing
-2. Save thumbnails for quick visual review
+2. Save thumbnails with `slide.thumbnail.save()` for quick visual review
3. Check pyramid levels and dimensions
4. Verify tissue is present using thumbnails
@@ -611,7 +648,7 @@ tiler.extract(slide, extraction_mask=custom_mask)
### Inconsistent results across slides
- Use same seed for RandomTiler
-- Normalize staining with preprocessing filters
+- Normalize staining with `MacenkoStainNormalizer` or `ReinhardStainNormalizer`
- Adjust `tissue_percent` per staining quality
- Implement slide-specific mask customization
@@ -655,6 +692,7 @@ Complete filter reference and preprocessing guide:
- Image filters (color conversion, thresholding, contrast)
- Morphological filters (dilation, erosion, opening, closing)
- Filter composition and chaining
+- Built-in stain normalization (Macenko, Reinhard) and filter-based alternatives
- Common preprocessing pipelines
- Applying filters to tiles
- Custom mask filters
diff --git a/skills/histolab/references/filters_preprocessing.md b/skills/histolab/references/filters_preprocessing.md
index a57f4b0e..83d5cdca 100644
--- a/skills/histolab/references/filters_preprocessing.md
+++ b/skills/histolab/references/filters_preprocessing.md
@@ -412,22 +412,44 @@ custom_mask = TissueMask(filters=aggressive_filters)
## Stain Normalization
-While histolab doesn't have built-in stain normalization, filters can be used for basic normalization:
+Histolab 0.6.0+ includes built-in stain normalization via `histolab.stain_normalizer`. Both methods follow the standard fit-on-target, transform-source pattern:
+
+```python
+from histolab.stain_normalizer import MacenkoStainNormalizer, ReinhardStainNormalizer
+from PIL import Image
+
+target_image = Image.open("reference_stain.png")
+source_image = Image.open("source_stain.png")
+
+# Macenko (H&E stain matrix decomposition)
+macenko = MacenkoStainNormalizer()
+macenko.fit(target_image)
+normalized = macenko.transform(source_image)
+
+# Reinhard (color transfer in LAB space)
+reinhard = ReinhardStainNormalizer()
+reinhard.fit(target_image)
+normalized = reinhard.transform(source_image)
+```
+
+See the [stain normalizer docs](https://histolab.readthedocs.io/en/latest/api/stain_normalizer.html) for examples and comparison images.
+
+### Filter-based alternatives
+
+For lightweight preprocessing without full stain normalization, combine HED decomposition with custom filters:
```python
from histolab.filters.image_filters import RgbToHed, Lambda
import numpy as np
def normalize_hed(hed_image, target_means=[0.65, 0.70], target_stds=[0.15, 0.13]):
- """Simple H&E normalization."""
+ """Simple H&E channel normalization in HED space."""
h_channel = hed_image[:, :, 0]
e_channel = hed_image[:, :, 1]
- # Normalize hematoxylin
h_normalized = (h_channel - h_channel.mean()) / h_channel.std()
h_normalized = h_normalized * target_stds[0] + target_means[0]
- # Normalize eosin
e_normalized = (e_channel - e_channel.mean()) / e_channel.std()
e_normalized = e_normalized * target_stds[1] + target_means[1]
@@ -439,7 +461,6 @@ def normalize_hed(hed_image, target_means=[0.65, 0.70], target_stds=[0.15, 0.13]
normalization_pipeline = Compose([
RgbToHed(),
Lambda(normalize_hed)
- # Convert back to RGB if needed
])
```
@@ -464,6 +485,7 @@ import numpy as np
def laplacian_blur_score(gray_image):
"""Calculate Laplacian variance (blur metric)."""
+ # cv2.CV_64F is an OpenCV constant, not Python eval()
return cv2.Laplacian(np.array(gray_image), cv2.CV_64F).var()
blur_detector = Lambda(lambda img: laplacian_blur_score(
@@ -509,6 +531,7 @@ coverage_filter = Lambda(tissue_coverage)
### Issue: Variable staining quality
**Solutions:**
+- Apply `MacenkoStainNormalizer` or `ReinhardStainNormalizer` (histolab 0.6.0+)
- Apply histogram equalization
- Use adaptive thresholding
-- Implement stain normalization pipeline
+- Implement filter-based normalization pipeline
diff --git a/skills/histolab/references/slide_management.md b/skills/histolab/references/slide_management.md
index ee25a8d3..79ad8e36 100644
--- a/skills/histolab/references/slide_management.md
+++ b/skills/histolab/references/slide_management.md
@@ -10,17 +10,21 @@ The `Slide` class is the primary interface for working with whole slide images (
from histolab.slide import Slide
# Initialize a slide with a WSI file and output directory
-slide = Slide(processed_path="path/to/processed/output",
- slide_path="path/to/slide.svs")
+slide = Slide("path/to/slide.svs", processed_path="path/to/processed/output")
```
**Parameters:**
-- `slide_path`: Path to the whole slide image file (supports multiple formats: SVS, TIFF, NDPI, etc.)
+- `path`: Path to the whole slide image file (supports multiple formats: SVS, TIFF, NDPI, etc.)
- `processed_path`: Directory where processed outputs (tiles, thumbnails, etc.) will be saved
+- `use_largeimage` (optional): Use `large_image` for multi-format backends and mpp-based extraction
## Loading Sample Data
-Histolab provides built-in sample datasets from TCGA for testing and demonstration:
+Histolab provides built-in sample datasets from TCGA for testing and demonstration. Install `pooch` to download them:
+
+```bash
+uv pip install pooch
+```
```python
from histolab.data import prostate_tissue, ovarian_tissue, breast_tissue, heart_tissue, kidney_tissue
@@ -73,11 +77,14 @@ properties = slide.properties
## Thumbnail Generation
```python
-# Get thumbnail at specific size
+from pathlib import Path
+
+# Get thumbnail at default size
thumbnail = slide.thumbnail
-# Save thumbnail to disk
-slide.save_thumbnail() # Saves to processed_path
+# Save thumbnail to processed_path
+Path(slide.processed_path).mkdir(parents=True, exist_ok=True)
+slide.thumbnail.save(Path(slide.processed_path) / f"{slide.name}_thumbnail.png")
# Get scaled thumbnail
scaled_thumbnail = slide.scaled_image(scale_factor=32)
@@ -99,12 +106,15 @@ plt.show()
## Extracting Regions
```python
-# Extract region at specific coordinates and level
-region = slide.extract_region(
- location=(x, y), # Top-left coordinates at level 0
- size=(width, height), # Region size
- level=0 # Pyramid level
+from histolab.types import CoordinatePair
+
+# Extract a tile at specific coordinates and level
+tile = slide.extract_tile(
+ coords=CoordinatePair(x_ul=x, y_ul=y, x_br=x + width, y_br=y + height),
+ tile_size=(width, height),
+ level=0,
)
+region = tile.image
```
## Working with Pyramid Levels
@@ -127,8 +137,8 @@ for level in range(slide.levels):
# Get slide filename without extension
slide_name = slide.name
-# Get full path to slide file
-slide_path = slide.scaled_image
+# Get output directory for processed artifacts
+output_dir = slide.processed_path
```
## Best Practices
@@ -154,7 +164,9 @@ print(f"Levels: {slide.levels}")
print(f"Magnification: {slide.properties.get('openslide.objective-power', 'N/A')}")
# Save thumbnail for review
-slide.save_thumbnail()
+from pathlib import Path
+Path(slide.processed_path).mkdir(parents=True, exist_ok=True)
+slide.thumbnail.save(Path(slide.processed_path) / f"{slide.name}_thumbnail.png")
```
### Multi-Slide Processing
diff --git a/skills/histolab/references/visualization.md b/skills/histolab/references/visualization.md
index 0ff443ad..65bbf877 100644
--- a/skills/histolab/references/visualization.md
+++ b/skills/histolab/references/visualization.md
@@ -25,9 +25,10 @@ plt.show()
### Save Thumbnail to Disk
```python
-# Save thumbnail as image file
-slide.save_thumbnail()
-# Saves to processed_path/thumbnails/slide_name_thumb.png
+from pathlib import Path
+
+Path(slide.processed_path).mkdir(parents=True, exist_ok=True)
+slide.thumbnail.save(Path(slide.processed_path) / f"{slide.name}_thumbnail.png")
```
### Scaled Images