libs.annotate_ROI
Utilities behind annotate_rois(): annotation widget, CLI handling,
and small helpers.
- class formhtr.libs.annotate_ROI.annotate_ROIs_widget.AnnotateROIsWidget(image, config, display_residuals)[source]
Bases:
objectWidget to annotate ROIs on the given template.
- formhtr.libs.annotate_ROI.cli_inputs.process_cli(widget)[source]
Dispatch keyboard commands for
AnnotateROIsWidget.- Parameters:
widget – Instance with navigation and
update_content_type/read_varname.- Returns:
Nonewhen the user pressesqor Esc.
- formhtr.libs.annotate_ROI.utils.is_approximately_square(top_left_x, top_left_y, bottom_right_x, bottom_right_y, max_width, max_height, error_percentage=1.0)[source]
Check whether provided rectangle is a square
- Parameters:
top_left_x (float) – top left corner x-coordinate
top_left_y (float) – top left corner y-coordinate
bottom_right_x (float) – bottom right corner x-coordinate
bottom_right_y (float) – bottom right corner y-coordinate
max_width (int) – page width
max_height (int) – page height
error_percentage (float, optional) – allow error. Defaults to 1.0.
- Returns:
True if it is a square
- Return type: