pytweezer.analysis.roi_slice module

Crop sub-images from ROIs drawn in the image viewers and republish them.

Input:

One image stream.

Output:

One image stream per configured ROI, published on channel _<roi> (so a ROI whose property path ends in .../slice is republished on <name>_slice). Downstream viewers/analyses can subscribe to each crop.

Properties:
  • imagestreams: ([str]) input image streams.

  • roipaths: ([str]) absolute Property paths of the ROIs to apply, e.g. /Image Monitor/ROI/slice. These are exactly the entries the image viewers register under /Servers/roilist and persist to properties.json (each with a pos and size sub-key). Pick the ones you want here; --None-- entries are ignored.

ROI geometry lives in the physical plot coordinates the viewer draws in (pos/size in metres, matching pytweezer.GUI.viewers.image_monitor), so they are mapped back to pixel indices using the image header’s _offset (pixel origin) and _imgresolution (metres/pixel). When those are absent the maths collapses to treating the ROI numbers as raw pixels.

The crop is a NumPy view; it is passed through numpy.ascontiguousarray() before sending so ZMQ transmits a packed buffer rather than a stride into the parent frame.

class pytweezer.analysis.roi_slice.RoiSlice(name)[source]

Bases: ImageAnalysis

process(head, data)[source]

Transform one received message.

Parameters:
  • head – the message header dict.

  • data – the payload (numpy array for images/data).

Returns:

(head, data) to republish, or None to drop the message. The default is a pass-through.