Skip to content

Drop-in Python & Rust ops

Drop any .py or .rs file with a # lucem: header into ~/.config/lucem/plugins/ops/ (or $LUCEM_PLUGINS/ops/) and Lucem discovers it automatically — no build step or plugin boilerplate required.

~/.config/lucem/plugins/ops/local_contrast_boost.py
# /// script
# dependencies = ["numpy", "scipy"]
# ///
import numpy as np
from scipy.ndimage import gaussian_filter
import lucem
@lucem.op(family="Filter", halo=12)
def local_contrast_boost(
image: np.ndarray,
sigma: float = 3.0,
strength: float = 1.8,
) -> np.ndarray:
"""Enhances fine cellular structures by subtracting a blurred local background."""
img = image.astype(np.float32, copy=False)
background = gaussian_filter(img, sigma=max(float(sigma), 0.2))
enhanced = img + float(strength) * (img - background)
return np.clip(enhanced, float(img.min()), float(img.max())).astype(np.float32)
Directive Purpose Example
name = "..." Display title in menus and on the Pipeline node name = "Local Contrast Boost"
family = "..." Category in the Process / Script menu family = "Filter"
description = "..." Tooltip and Inspector summary description = "Boost local detail"
halo = N Border overlap in pixels for seamless tiled execution halo = 12
input <name>: <type> Typed input port (image, mask, or labels) input image: image
param <name> = <num> Editable numeric parameter in the Inspector param sigma = 3.0
output <type> Output port type (image, mask, or labels) output image

See also the starter repository template in templates/lucem-plugin-template/ for publishing community plugins with CI validation and .lucem-recipe.json presets.