pocket_regions_cluster
go-to Safe accessor for typed region label grid used in surface colouring.
workflow.pocket_regions_cluster(typed_result, seg)Return the pocket-type region label grid for surface colouring.
assign_pocket_types stores the typed region array as PocketTypingResult.regions_cluster (a numpy.ndarray). The naive typed.regions_cluster or seg.get("regions_pbc") fails with ValueError because numpy arrays have no single boolean truth value.
This helper does the safe is not None check and falls back to the raw PBC-merged region grid from the segmentation dict when pocket typing did not populate the array (e.g. when result.ok is False).
Usage::
from mofography.workflow import assign_pocket_types, pocket_regions_cluster
result = assign_pocket_types(seg, atoms)
regions = pocket_regions_cluster(result, seg)
surface = plot_surface_dgrid(dgrid, 1.75, select="all",
region_labels=regions, ...)
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| typed_result | PocketTypingResult from assign_pocket_types |
required | |
| seg | segmentation dict from do_periodic_segmentation_rust |
required |
Returns
| Name | Type | Description |
|---|---|---|
| numpy int array with one label per voxel, or None |