{"id":23853,"library":"histomicstk","title":"HistomicsTK","description":"HistomicsTK is a Python toolkit for histopathology image analysis, providing algorithms for segmentation, feature extraction, and classification of whole-slide images. Current version is 1.4.0, with a release cadence of approximately 2-3 months.","status":"active","version":"1.4.0","language":"python","source_language":"en","source_url":"https://github.com/DigitalSlideArchive/HistomicsTK","tags":["histopathology","whole-slide-images","image-segmentation","feature-extraction","medical-imaging"],"install":[{"cmd":"pip install histomicstk","lang":"bash","label":"Install from PyPI"},{"cmd":"pip install histomicstk[all]","lang":"bash","label":"Install with all optional dependencies (e.g., LargeImage, WSIDeepLearning)"}],"dependencies":[{"reason":"For reading whole-slide images (openslide, DICOM, etc.)","package":"large_image","optional":true},{"reason":"Core numerical computation","package":"numpy","optional":false},{"reason":"Image processing algorithms","package":"scikit-image","optional":false},{"reason":"DataFrame operations for features","package":"pandas","optional":false},{"reason":"Geometric operations for annotations","package":"shapely","optional":false}],"imports":[{"note":"Case-sensitive; package is lowercase","wrong":"import HistomicsTK","symbol":"histomicstk","correct":"import histomicstk as htk"},{"note":"Old path deprecated; use nuclear_segmentation submodule","wrong":"from histomicstk.segmentation.nuclei import nuclear_segmentation","symbol":"segmentation.nuclear_segmentation","correct":"from histomicstk.segmentation import nuclear_segmentation"},{"note":"Haralick features moved to top-level features module in v1.4.0","wrong":"from histomicstk.features.haralick import compute_haralick_features","symbol":"features.compute_haralick_features","correct":"from histomicstk.features import compute_haralick_features"}],"quickstart":{"code":"import histomicstk as htk\nimport numpy as np\n\n# Load a sample image (replace with your own)\n# For whole-slide images, use large_image\n# Here we simulate a 2D grayscale image\nimage = np.random.rand(100, 100).astype(np.float32)\n\n# Compute Haralick texture features\nfrom histomicstk.features import compute_haralick_features\nharalick = compute_haralick_features(image, return_labels=True)\nprint(haralick['Harmonic mean'])\n\n# Nuclear segmentation (requires stain normalization first)\nfrom histomicstk.segmentation import nuclear_segmentation\n# nuclei_df, nuclei_im = nuclear_segmentation.nuclei_segmentation(image)  # requires proper staining","lang":"python","description":"Basic example of computing Haralick features from a 2D image. For whole-slide images, you need to install 'large_image' and use it to read tiles."},"warnings":[{"fix":"Upgrade Python to 3.9+ or pin histomicstk to <1.4.0.","message":"In v1.4.0, Python 3.8 support was dropped. You must use Python >=3.9.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Update imports to use top-level module: from histomicstk.features import compute_haralick_features","message":"Direct import of submodules like histomicstk.features.haralick is deprecated. Use histomicstk.features instead.","severity":"deprecated","affected_versions":">=1.4.0"},{"fix":"Normalize image: image = image.astype(np.float32) / 255.0","message":"compute_haralick_features expects float32 image in [0,1] range. Passing integer or unnormalized images yields incorrect results.","severity":"gotcha","affected_versions":"all"},{"fix":"Use histomicstk.preprocessing.color_normalization.reinhard first.","message":"Nuclear segmentation functions require stain normalization (e.g., Reinhard) before use. Skipping this step leads to poor segmentation.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install histomicstk","cause":"Package not installed or incorrect environment.","error":"ModuleNotFoundError: No module named 'histomicstk'"},{"fix":"Run: pip install large-image or pip install histomicstk[all]","cause":"Optional dependency not installed for whole-slide image support.","error":"ModuleNotFoundError: No module named 'large_image'"},{"fix":"Convert to grayscale: from skimage.color import rgb2gray; gray = rgb2gray(image)","cause":"Input image has more than 2 dimensions (e.g., RGB).","error":"ValueError: Haralick features require a 2-D image"},{"fix":"Ensure you have v1.4.0+ and use correct import: from histomicstk.features import compute_haralick_features","cause":"Old import path used or wrong version.","error":"AttributeError: module 'histomicstk.features' has no attribute 'compute_haralick_features'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}