Worker Context
Helper for Docker worker scripts.
nimbusimage.worker.WorkerContext
Context for a NimbusImage worker execution.
Parses worker parameters, provides typed access to interface values, messaging helpers, and batch processing utilities.
batch_locations()
Yield Location objects for each position in the assignment ranges.
Parses range strings like "0-2" or "1-3, 5-8" from the assignment dict.
get_filtered_annotations(shape=None)
Get annotations filtered by this worker's tag configuration.
submit_property_values(property_id, values)
Submit property values via the dataset's property accessor.
set_interface(image, interface)
Register worker interface metadata for a Docker image.
batch_process(process_fn, output_shape='polygon', channels=None, stack_z=False, progress_text='Processing')
High-level batch processing.
Iterates batch_locations, loads images (stacking channels/z as requested), calls process_fn, creates annotations from results, and optionally connects them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process_fn
|
Callable that takes ndarray and returns annotation coordinate data. |
required | |
output_shape
|
str
|
'polygon' or 'point'. |
'polygon'
|
channels
|
list[int] | None
|
Channel indices to stack. None = use self.channel. |
None
|
stack_z
|
bool
|
Whether to stack all z-planes. |
False
|
progress_text
|
str
|
Text shown in progress bar. |
'Processing'
|