roi¶
Region of interest creation
-
class
pdsspect.roi.
ROIBase
(image_set, view_canvas, color='red', linewidth=1, linestyle='solid', showcap=False, fill=True, fillcolor=None, alpha=1.0, drawdims=False, font='Sans Serif', fillalpha=1.0, **kwargs)[source]¶ Bases:
ginga.canvas.types.basic.Polygon
Base class for all ROI shapes
-
contains_arr
(x_arr, y_arr)[source]¶ Determine whether the points in the ROI are in arrays
The arrays must be the same shape. The arrays should be result of
np.mgrid[y1:y2:1, x1:x2:1]
Parameters: - x_arr (
numpy.ndarray
) – Array of x coodinates - y_arr (
numpy.ndarray
) – Array of y coordinates
Returns: result – Boolean array where coordinates that are in ROI are True
Return type: - x_arr (
-
create_ROI
(points=None)[source]¶ Create a Region of interest
Parameters: points ( list
oftuple
of twoint
) – Points that make up the vertices of the ROIReturns: coordinates – m x 2
array of coordinates.Return type: numpy.ndarray
-
lock_coords_to_pixel
(data_x, data_y)[source]¶ Lock the coordinates to the bottom-left corner of the pixel
The center of the pixel has integer coordinates and the edges of the pixel are 0.5 units away. We choose to lock to the bottom left corner or each pixel. If the decimal value of the coordinate is less than or equal to 0.5 then the coordinate is to the left/below the center of the pixel. To lock we round the coordinate down and add 0.5. If the decimal value is greater than 0.5 then the coordinate is to the right/above the center. To lock we round the coordinate down and subtract 0.5. For example, if the coordinate is (2.3, 4.7) the pixel coordinate is (2, 4) and the corresponding locked coordinate is (2.5, 4.5).
Parameters: Returns:
-
static
lock_coords_to_pixel_wrapper
(func)[source]¶ Wrapper to lock data coordinates to the corresponding pixels
-
-
class
pdsspect.roi.
Polygon
(image_set, view_canvas, color='red', linewidth=1, linestyle='solid', showcap=False, fill=True, fillcolor=None, alpha=1.0, drawdims=False, font='Sans Serif', fillalpha=1.0, **kwargs)[source]¶ Bases:
pdsspect.roi.ROIBase
Polygon Region of Interest
-
extend_ROI
(data_x, data_y)[source]¶ Extend the current edge of the polygon on mouse motion
Parameters:
-
-
class
pdsspect.roi.
Rectangle
(image_set, view_canvas, color='red', linewidth=1, linestyle='solid', showcap=False, fill=True, fillcolor=None, alpha=1.0, drawdims=False, font='Sans Serif', fillalpha=1.0, **kwargs)[source]¶ Bases:
pdsspect.roi.ROIBase
Rectangle Region of interest
-
extend_ROI
(data_x, data_y)[source]¶ Exend the rectangle on region of interest on mouse motion
Parameters:
-
-
class
pdsspect.roi.
Pencil
(*args, **kwargs)[source]¶ Bases:
pdsspect.roi.ROIBase
Select individual pixels
-
move_delta
(delta_x, delta_y)[source]¶ Override the move_delta function to move all the points
Parameters:
-