{"name":"napari-maskel-ibex-preprocessing","display_name":"MASKEL IBEX preprocessing","visibility":"public","icon":null,"categories":[],"schema_version":"0.3.0","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"napari-maskel-ibex-preprocessing.get_reader","title":"Open converted light-sheet .h5 (Channel_0, Channel_1, ...)","python_name":"napari_maskel_ibex_preprocessing._reader:get_reader","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"napari-maskel-ibex-preprocessing.widget","title":"Muscle surface and CD34 filtering","python_name":"napari_maskel_ibex_preprocessing._widget:PreprocessingWidget","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"napari-maskel-ibex-preprocessing.cx43_widget","title":"Cx43 puncta near the fibroblast mask","python_name":"napari_maskel_ibex_preprocessing._cx43_widget:Cx43Widget","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":[{"command":"napari-maskel-ibex-preprocessing.get_reader","filename_patterns":["*.h5"],"accepts_directories":false}],"writers":null,"widgets":[{"command":"napari-maskel-ibex-preprocessing.widget","display_name":"Muscle surface and CD34 filtering","autogenerate":false,"default_dock_area":"right","tabify":false},{"command":"napari-maskel-ibex-preprocessing.cx43_widget","display_name":"Cx43 puncta","autogenerate":false,"default_dock_area":"right","tabify":false}],"sample_data":null,"themes":null,"menus":{},"submenus":null,"keybindings":null,"configurations":{}},"package_metadata":{"metadata_version":"2.4","name":"napari-maskel-ibex-preprocessing","version":"0.2.1","dynamic":["license-file"],"platform":null,"supported_platform":null,"summary":"napari plugin: muscle surface from TOM20, CD34 fibroblast mask, distance filtering and TIFF export for light-sheet peritoneum (IBEX) data","description":"# napari-maskel-ibex-preprocessing\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/uderhardtlab/napari-maskel-ibex-preprocessing/main/src/napari_maskel_ibex_preprocessing/resources/logo_preprocessing.png\" alt=\"MaSkel IBEX preprocessing logo\" width=\"400\">\n</p>\n\n[![PyPI](https://img.shields.io/pypi/v/napari-maskel-ibex-preprocessing.svg)](https://pypi.org/project/napari-maskel-ibex-preprocessing)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-maskel-ibex-preprocessing)](https://napari-hub.org/plugins/napari-maskel-ibex-preprocessing)\n[![tests](https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing/actions/workflows/tests.yml/badge.svg)](https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing/actions/workflows/tests.yml)\n[![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing/blob/main/LICENSE)\n\nnapari plugin and batch runner for light-sheet data of mouse peritoneum. It does four things:\n\n- finds the **outer surface of the muscle layer** from the TOM20 channel;\n- builds a **CD34 fibroblast mask**;\n- keeps only the CD34 above the muscle (the **submesothelial fibroblasts**) and exports binary TIFFs, e.g. for Imaris or as input for MASKEL;\n- detects the **Cx43-positive volume** (gap junctions) near the fibroblast mask, as an object table.\n\nThe algorithms are in `napari_maskel_ibex_preprocessing.core` and use only numpy/scipy (no napari). Both the napari widget and the command-line runner use them.\n\n## Installation\n\nInto an existing napari environment (Python ≥ 3.9), either in napari via *Plugins > Install/Uninstall Plugins*, or:\n\n```\npip install napari-maskel-ibex-preprocessing\n```\n\nUse `pip install \"napari-maskel-ibex-preprocessing[napari]\"` to install napari as well.\n\nFor development, from a clone of this repository:\n\n```\npip install -e \".[testing]\"\npytest tests\n```\n\n## Input\n\nA converted `.h5` file with one dataset per channel, `Channel_0`, `Channel_1`, …, each `(Z, Y, X)`. `Channel_0` carries the attribute `element_size_um` (voxel size `(dz, dy, dx)` in µm).\n\nAn Imaris `.ims` file can be converted with `maskel-ibex-ims2h5 sample.ims`, or by the batch runner automatically.\n\nAssumed geometry:\n- the tissue is imaged en face, with the **mesothelium at high z** and the muscle at low z;\n- muscle is present under the whole field of view;\n- the fibres are roughly parallel.\n\n## napari\n\n1. Open the `.h5` (*File > Open*; choose this plugin's reader if asked). Every channel becomes an image layer with the correct voxel size.\n2. Open *Plugins > MASKEL IBEX preprocessing > Muscle surface and CD34 filtering*.\n3. Choose the **muscle channel** (TOM20) and the **CD34 channel**. For files from the reader, Channel_0 and Channel_3 are pre-selected.\n4. For fast tuning, draw a **rectangle** in a Shapes layer (2D view) and choose that layer as the *region*. Every step has *Run on region* (seconds to a minute) and *Run on full volume* (minutes). Both run in the background.\n   - **1 Muscle surface:** muscle mask, surface, height map `h` and the **signed distance map** `d = (z − h)·dz` (µm; > 0 = mesothelium side).\n     Two options guard the surface: *remove muscle components smaller than 1 % of the largest* (removes e.g. a hair lying on the tissue, but keeps large separate pieces of real muscle) and *macrophage columns (CD11b)*. A macrophage cluster on the muscle is bright in TOM20 too and would lift `h`; in columns whose top muscle voxels are CD11b⁺, `h` is taken from the neighbouring columns instead.\n   - **2 CD34 mask:** CD34 mask, thresholded by hysteresis with a local, noise-based low threshold.\n   - **3 Distance filter:** keeps CD34 components ≥ the minimum volume, then the part with `d >` cutoff → **fibroblast mask**.\n5. **Export** (needs the full-volume results; TIFFs in the original image shape, uint8 0/255, voxel size in the metadata, optional ZIP compression):\n   - *distance mask*: 1 where `d >` threshold (given in µm or in z slices), else 0;\n   - *fibroblast mask*;\n   - optionally all results as a steps `.h5`.\n\n### Cx43 window\n\n*Plugins > MASKEL IBEX preprocessing > Cx43 puncta*:\n\n1. Choose the **Cx43 channel** (Channel_2 is pre-selected) and the **fibroblast mask**. \"fibroblast mask FINAL [full]\" from the first window is pre-selected if present; it can also be a mask loaded from a TIFF on the same voxel grid.\n2. Run *4: Cx43 – run on region* or *run on full volume*:\n   - **smoothed** = Gaussian σ (Y, X) = (1.0, 0.7) px;\n   - **contrast** = smoothed − local background (median over ~14.8 µm);\n   - **positive** = contrast > T (12 grey values), only within 2 µm of the fibroblast mask (anisotropic 3D distance);\n   - **objects** = 26-connected; merged puncta are fine, since the positive volume is the quantity of interest.\n3. *Export object table CSV*. One row per object:\n   - centroid in µm;\n   - voxels, volume;\n   - mean / max contrast, mean raw value;\n   - fraction inside the fibroblast mask;\n   - centroid distance to the mask.\n\nResults computed on a region use Otsu thresholds and noise statistics of that region only. They can therefore differ slightly from the same area of a full-volume run.\n\n## Batch\n\n```\nmaskel-ibex-batch D:\\data\\sample.ims\nmaskel-ibex-batch D:\\data\\round1 --dry-run\nmaskel-ibex-batch D:\\data\\round1 --dist-threshold -4 --dist-unit um\n```\n\n- **Input:** a file or a folder. A folder means every `.h5` / `.ims` in it.\n- **Parameters:** the defaults below.\n- **Output per sample:**\n  - `<stem>_layers.h5`, `<stem>_cd34.h5`, `<stem>_submeso_cd34.h5`: intermediate steps;\n  - `<stem>_tif\\…_fibroblast_mask.tif` and `…_distance_gt<T>.tif`;\n  - `<stem>_cx43pos.h5` (contrast, positive objects) and `<stem>_cx43_objects.csv`;\n  - a log file.\n- `--force` recomputes, `--uncompressed` writes plain TIFFs.\n\n## Steps and default parameters (`core/params.py`)\n\n| Step | Operation | Default |\n|---|---|---|\n| 1 | TOM20 block means (valid pixels only) | 4 × 4 px |\n| 1 | normalized Gaussian | σ (2, 5, 5) µm |\n| 1 | muscle = above the lowest 3-class multi-Otsu threshold; small objects removed | < 5000 µm³ |\n| 1 | fibre filter: binary opening with a line along the measured fibre direction (structure tensor) | 30 µm |\n| 1 | 26-connected muscle components smaller than a fraction of the largest are removed (objects lying on the tissue, e.g. a hair) | 1 % |\n| 1 | macrophage columns (CD11b, Channel_4): CD11b⁺ (Otsu of the smoothed CD11b, σ (1, 2, 2) µm) muscle within the top 2 slices of a column → column dilated by 10 µm, its `h` taken from the neighbouring columns; skipped if > 20 % of the columns | on |\n| 1 | `h` = highest muscle z; empty and macrophage columns from the nearest column; grey closing | disk 9.2 µm |\n| 2 | tissue = Otsu on log of the summed channels (2 × 2 blocks) | smoothing 5 µm |\n| 2 | CD34 normalized Gaussian minus background | σ (1, 0.5, 0.5) µm; background 15 µm |\n| 2 | seeds = above Otsu within tissue | |\n| 2 | noise = tissue outside the Otsu mask, in the band −10 ≤ d ≤ 30 µm; per block median + k · robust SD | blocks 272 µm, k = 4 |\n| 2 | hysteresis: components of the low-threshold mask that contain a seed; small objects removed | < 20 µm³ |\n| 3 | 26-connected components of the whole CD34 mask; keep those ≥ the minimum volume, then `d >` cutoff | 500 µm³; −4 µm |\n| 4 | Cx43: Gaussian (pixels; tied to the line step in Y) | σ (0, 1.0, 0.7) px |\n| 4 | Cx43: background = median of 4 × 4 px block means | ~14.8 µm |\n| 4 | Cx43: positive = contrast > T, within the max. distance of the fibroblast mask | T = 12; 2 µm |\n\nThe defaults were validated on `LSM 2026-07-20_B6-12w-naive_co1-s1-r1` (naive, round 1).\n\n## Development and releases\n\n- **Every push and pull request:** `.github/workflows/tests.yml` runs the tests on Windows, Linux and macOS with Python 3.9–3.12. It also builds the package and checks it with `twine check`.\n- **Release:** set the new `version` in `pyproject.toml` and in `src/napari_maskel_ibex_preprocessing/__init__.py`, commit, then push a tag with the same version:\n  ```\n  git tag v0.2.1\n  git push origin v0.2.1\n  ```\n  `.github/workflows/release.yml` builds the package, checks that the tag matches the version, and publishes to PyPI through trusted publishing.\n","description_content_type":"text/markdown","keywords":null,"home_page":null,"download_url":null,"author":"Anna Moeller","author_email":null,"maintainer":null,"maintainer_email":null,"license":null,"classifier":["Development Status :: 3 - Alpha","Framework :: napari","Intended Audience :: Science/Research","Programming Language :: Python :: 3","Programming Language :: Python :: 3 :: Only","Programming Language :: Python :: 3.9","Programming Language :: Python :: 3.10","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12","Operating System :: OS Independent","Topic :: Scientific/Engineering :: Image Processing"],"requires_dist":["numpy>=1.22","scipy>=1.8","scikit-image>=0.20","h5py>=3.6","tifffile>=2022.8","dask[array]>=2022.1","matplotlib>=3.5","magicgui>=0.7","qtpy","napari[all]>=0.4.19; extra == \"napari\"","pytest; extra == \"testing\""],"requires_python":">=3.9","requires_external":null,"project_url":["Source Code, https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing","Bug Tracker, https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing/issues","Documentation, https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing#readme","User Support, https://github.com/uderhardtlab/napari-maskel-ibex-preprocessing/issues"],"provides_extra":["napari","testing"],"provides_dist":null,"obsoletes_dist":null},"npe1_shim":false}