# catalog/operations/raster/morph_dilate.yaml

id: morph_dilate
name: Morphological Dilate
description: >
  Dilate a raster using a maximum filter with a disk structuring element.
  For binary rasters this grows bright regions. For continuous rasters
  it replaces each pixel with the local maximum within the disk.
version: 1.0.0
category: raster
type: raster-to-raster
default_implementation: native

inputs:
  - name: raster
    type: raster
    format: geotiff
    description: Input raster to dilate
    required: true

requires: {}  # structural — morphological op on any raster

outputs:
  - name: dilated
    type: raster
    format: cog
    description: Dilated raster

params:
  radius:
    type: integer
    default: 1
    min: 1
    max: 50
    description: Radius of the disk structuring element in pixels

cache_policy:
  ttl_days: 30
  invalidate_on: [source_update, param_change]

# backends: audited 2026-08-14 (defect 50). A key means a runtime that DISPATCHES this op —
# folia-engine `dispatch_op` (products/sdk/folia-engine/src/lib.rs), a `registerOp`/OP_TABLE
# entry in packages/compute, `_BUILTIN_OP_MAP` in folia/compute.py, or a backend manifest
# (folia/backends/*/backend.yaml).
backends:
  rust-wasm:
    function: composite_ops::morph_dilate
    handle_function: h_morph_dilate
  js:
    function: morph_dilate
  python:
    function: geo.morphology.dilate
    dispatch: folia/compute.py _BUILTIN_OP_MAP
  gee:
    function: folia.backends.gee.ops.morph_dilate
    dispatch: folia/backends/gee/backend.yaml

display_hints:
  map:
    renderer: maplibre

ui:
  icon: maximize-2
  color: "#4169E1"
