Skip to content

Conversation

@mdw771
Copy link
Collaborator

@mdw771 mdw771 commented Jan 9, 2026

Features/fixes

Added the following method of Object and BoundingBox:

  • Object.get_roi: Get the object in the ROI defined by the bounding box as a tensor.
  • Object.get_probe_position_frame_roi_bounding_box: Get the ROI bounding box whose bounds are given by the limits of probe positions.
  • Object.get_pixel_frame_roi_bounding_box: Get the ROI bounding box whose bounds are given in pixel indices of the object buffer. (0, 0) is the top left corner.
  • BoundingBox.union: take the union of the current bounding box and another.
  • BoundingBox.get_slicer is changed so that when the origin of the current bounding box is not (0, 0) (i.e. its bounds are not pixel coordinates), it first converts the bounding box to a pixel coordinate one using get_bbox_with_top_left_origin.

Example of combining the bounding boxes of 2 PlanarObject objects and cropping the object using the union of the boxes:

bbox1 = object1.get_pixel_frame_roi_bounding_box()
bbox2 = object2.get_pixel_frame_roi_bounding_box()
bbox = bbox1.union(bbox2)
object_roi_tensor = object1.get_roi(bbox)

Related issues (optional)

#51

Mentions

@yijiang1

Checklist

Have you...

  • Formatted your code properly adhering to PEP-8? Considering using RUFF to format your code automatically.
  • Resolved all merge conflicts with the main branch?
  • Checked the diffs between your branch and the main branch to ensure that your changes are not introducing any regressions or unnecessary/irrelevant changes?

@mdw771 mdw771 merged commit c6ec7ca into main Jan 9, 2026
2 checks passed
@mdw771 mdw771 deleted the roi_bbox branch January 9, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants