Regions of Interest
- class pumpia.image_handling.roi_structures.BaseROI(image: ArrayImage, *, slice_num: int = 0, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = 'yellow', active_colour: str = 'red')
Base class for Region of Interest (ROI) in an image.
- Parameters:
image (ArrayImage) – The image associated with the ROI.
slice_num (int, optional) – The slice number of the ROI (default is 0).
name (str, optional) – The name of the ROI (default is None).
replace (bool, optional) – Whether to replace an existing ROI with the same name (default is True).
cache_values (bool, optional) – Whether to cache pixel values and calculated values (default is True).
colour (str, optional) – The colour of the ROI.
active_colour (str, optional) – The colour of the ROI when it is selected.
- image
The image associated with the ROI.
- Type:
- slice_num
The slice number of the ROI.
- Type:
int
- cache_values
Whether to cache pixel values and calculated values.
- Type:
bool
- colour
The colour of the ROI.
- Type:
str
- active_colour
The colour of the ROI when it is selected.
- Type:
str
- active
Whether the ROI is active.
- Type:
bool
Whether the ROI is hidden.
- Type:
bool
- id_string
- Type:
str
- storage_string
- Type:
str
- tag
- Type:
str
- pixel_values
- Type:
list[int | float | list[float]]
- pixel_array
- Type:
np.ndarray
- mask
- Type:
np.ndarray
- area
- Type:
float
- perimeter
- Type:
float
- mean
- Type:
PixelStatsType
- std
- Type:
PixelStatsType
- xmin
- Type:
int
- xmax
- Type:
int
- ymin
- Type:
int
- ymax
- Type:
int
- xcent
- Type:
float
- ycent
- Type:
float
- values_str
- Type:
str
- Type:
list[tuple[str, Callable[[], None]]]
- delete_cache()
Deletes the cached values of the ROI.
- point_is_in(x: float, y: float) bool
Checks if a pixel is inside the ROI.
- point_is_on(x: float, y: float, dist: float = 0) bool
Checks if a pixel is on the boundary of the ROI.
- move(x: int = 0, y: int = 0)
Moves the ROI by the specified amount.
- enlarge(x: float = 1, y: float = 1)
Enlarges the ROI by the specified amount.
- resize_bbox(x: int = 0, y: int = 0)
Resizes the bounding box of the ROI.
- rotate(angle: float = 0)
Rotates the ROI by the specified angle.
- copy_to_image(image: ArrayImage, slice_num: int, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = ROI_COLOUR, active_colour: str = ACTIVE_ROI_COLOUR) 'BaseROI'
Copies the ROI to another image.
- move_to_image(image: ArrayImage, slice_num: int, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = ROI_COLOUR, active_colour: str = ACTIVE_ROI_COLOUR) 'BaseROI'
Moves the ROI to another image.
- class pumpia.image_handling.roi_structures.Angle(image: ArrayImage, x: int, y: int, x1: int, y1: int, x2: int, y2: int, *, slice_num: int = 0, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = 'yellow', active_colour: str = 'red')
Represents an angle ROI. Has the same attributes and methods as BaseROI unless stated below.
- Parameters:
x (int) – The x-coordinate of the vertex.
y (int) – The y-coordinate of the vertex.
x1 (int) – The x-coordinate of the first point.
y1 (int) – The y-coordinate of the first point.
x2 (int) – The x-coordinate of the second point.
y2 (int) – The y-coordinate of the second point.
- x
The x-coordinate of the vertex.
- Type:
int
- y
The y-coordinate of the vertex.
- Type:
int
- x1
The x-coordinate of the first point.
- Type:
int
- y1
The y-coordinate of the first point.
- Type:
int
- x2
The x-coordinate of the second point.
- Type:
int
- y2
The y-coordinate of the second point.
- Type:
int
- angle
- Type:
float
- angle_degrees
- Type:
float
- class pumpia.image_handling.roi_structures.PointROI(image: ArrayImage, x: int, y: int, *, slice_num: int = 0, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = 'yellow', active_colour: str = 'red')
Represents a point ROI. Has the same attributes and methods as BaseROI unless stated below.
- Parameters:
x (int) – The x-coordinate of the point.
y (int) – The y-coordinate of the point.
- x
The x-coordinate of the point.
- Type:
int
- y
The y-coordinate of the point.
- Type:
int
- class pumpia.image_handling.roi_structures.EllipseROI(image: ArrayImage, x: int, y: int, a: int, b: int, *, slice_num: int = 0, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = 'yellow', active_colour: str = 'red')
Represents an ellipse ROI. Has the same attributes and methods as BaseROI unless stated below.
- Parameters:
x (int) – The x-coordinate of the center of the ellipse.
y (int) – The y-coordinate of the center of the ellipse.
a (int) – The length of the horizontal axis of the ellipse.
b (int) – The length of the vertical axis of the ellipse.
- x
The x-coordinate of the center of the ellipse.
- Type:
int
- y
The y-coordinate of the center of the ellipse.
- Type:
int
- a
The length of the horizontal axis of the ellipse.
- Type:
int
- b
The length of the vertical axis of the ellipse.
- Type:
int
- class pumpia.image_handling.roi_structures.RectangleROI(image: ArrayImage, xmin: int, ymin: int, width: int, height: int, *, slice_num: int = 0, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = 'yellow', active_colour: str = 'red')
Represents a rectangle ROI. Has the same attributes and methods as BaseROI unless stated below.
- Parameters:
xmin (int) – The minimum x-coordinate of the rectangle.
ymin (int) – The minimum y-coordinate of the rectangle.
width (int) – The width of the rectangle.
height (int) – The height of the rectangle.
- x
The minimum x-coordinate of the rectangle.
- Type:
int
- y
The minimum y-coordinate of the rectangle.
- Type:
int
- width
The width of the rectangle.
- Type:
int
- height
The height of the rectangle.
- Type:
int
- h_profile
- Type:
np.ndarray
- v_profile
- Type:
np.ndarray
- plot_h_profile()
Plots the horizontal profile of the ROI in a new window.
- plot_v_profile()
Plots the vertical profile of the ROI in a new window.
- class pumpia.image_handling.roi_structures.LineROI(image: ArrayImage, x1: int, y1: int, x2: int, y2: int, *, slice_num: int = 0, name: str | None = None, replace: bool = True, cache_values: bool = True, colour: str = 'yellow', active_colour: str = 'red')
Represents a line ROI. Has the same attributes and methods as BaseROI unless stated below.
- Parameters:
x1 (int) – The x-coordinate of the first point.
y1 (int) – The y-coordinate of the first point.
x2 (int) – The x-coordinate of the second point.
y2 (int) – The y-coordinate of the second point.
- x1
The x-coordinate of the first point.
- Type:
int
- y1
The y-coordinate of the first point.
- Type:
int
- x2
The x-coordinate of the second point.
- Type:
int
- y2
The y-coordinate of the second point.
- Type:
int
- length
- Type:
float
- profile
- Type:
np.ndarray
- x_len
- Type:
int
- y_len
- Type:
int
- plot_profile()
Plots the profile of the ROI in a new window.