og package

Submodules

og.app module

class og.app.HistoryApp(file)[source]

Bases: object

Applications with history stored in JSON format in isimple/.history

reset_history()[source]
load_history()[source]
save_history()[source]
get_own_history()[source]
unpack_history()[source]
pack_history()[source]

og.gui module

class og.gui.OG_ScriptWindow[source]

Bases: tkinter.Tk

focus()[source]

Direct input focus to this widget.

If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.

close(do_exit=True)[source]

Called when user tries to close the window.

class og.gui.OG_FileSelectWindow(WRAPPER, file='/home/docs/checkouts/readthedocs.org/user_builds/isimple/checkouts/master/og/gui.py')[source]

Bases: og.app.HistoryApp

  • Select video & overlay files
  • Edit script parameters (dt, …)
config = {}
reset_history()[source]
unpack_history()[source]
browse_video()[source]
browse_design()[source]
commit(_=None)[source]
class og.gui.OG_ReshapeSelection(window, transform, initial_coordinates=None)[source]

Bases: object

Reshape-able rectangle ROI selection for tkinter canvases

initialize()[source]
undo(_)[source]

Callback to clear selection rectangle

press(event)[source]

Mouse press callback. Initializes rectangle dragging.

release(event)[source]

Mouse release callback. Commits rectangle dragging result.

get_corners()[source]
update()[source]

Update selection rectangle and transform matrix.

redraw()[source]

Redraw selection rectangle on the canvas.

quit(_)[source]

Close the window.

class og.gui.OG_Corner(selection, co, name='')[source]

Bases: object

Draggable corner for ROI selection rectangle

alpha = 0.05
handle = None
press(event)[source]

Callback for mouse click

drag(event)[source]

Callback for mouse movement after click

release(event)[source]

Callback for mouse release

delete()[source]
class og.gui.OG_ImageDisplay(window: og.gui.OG_ScriptWindow, order=(0, 1, 2, 3), initial_coordinates=None)[source]

Bases: object

OpenCV image display in tkinter canvas with link to ROI selection and coordinate transform.

permute(permutation_id)[source]
class og.gui.OG_TransformImage(canvas, image, overlay_img, co, callback, ratio, initial_order=(0, 1, 2, 3), frame_number=0)[source]

Bases: object

OpenCV perspective transform overlay alpha blending and display with tkinter

alpha = 0.1
get_new_transform(from_coordinates)[source]

Recalculate transform and show overlay.

update()[source]

Update image based

show_overlay()[source]

Show overlay; i.e. without the acual video frame

og.gui.hsvimg2tk(image, ratio=1.0)[source]

Convert OpenCV HSV image to PhotoImage object

og.gui.bgrimg2tk(image, ratio=1.0)[source]

Convert OpenCV HSV image to PhotoImage object

og.gui.binimg2tk(image, ratio=1.0)[source]

Convert OpenCV binary image to PhotoImage object

class og.gui.OG_ColorPicker(window, WRAPPER)[source]

Bases: object

Select colours by clicking image pixels.

update()[source]

Update UI

pick(event)[source]

Pick a colour

track(value)[source]

Scrollbar callback - track through the video.

quit(_)[source]

Close the window.

class og.gui.OG_OverlayAlignWindow(WRAPPER)[source]

Bases: og.gui.OG_ScriptWindow

class og.gui.OG_MaskFilterWindow(WRAPPER)[source]

Bases: og.gui.OG_ScriptWindow

selection_callback()[source]
class og.gui.OG_ProgressWindow(WRAPPER)[source]

Bases: og.gui.OG_ScriptWindow

update_image(state, frame)[source]

Show the current video frame in the UI

update_window(time, values, state, frame)[source]
plot(t, areas)[source]

Update the plot.

keepopen()[source]

Called to keep the window open after the script has run.

og.gui.has_zenity()[source]
og.gui.load_file_dialog(title: str = None, patterns: List[str] = None, patterns_str: str = None)[source]
og.gui.save_file_dialog(title: str = None, patterns: List[str] = None, patterns_str: str = None)[source]
class og.gui.EntryPopup(parent, iid, index, item, callback, **kw)[source]

Bases: tkinter.ttk.Entry

Pop-up widget to allow value editing in TreeDict

on_return(event)[source]
select_all(*ignore)[source]

Set selection on the whole text

class og.gui.TreeDict(tk: Union[tkinter.Tk, tkinter.Misc], data: dict, callback: Callable[[dict], dict])[source]

Bases: object

An editable representation of a dictionary in a ttk.Treeview

set(data: dict)[source]
set_value(iid, value)[source]
callback()[source]
build()[source]
edit(event)[source]

Executed, when a row is double-clicked. Opens read-only EntryPopup above the item’s column, so it is possible to select text

update(data: dict)[source]
class og.gui.guiElement[source]

Bases: abc.ABC

Abstract class for GUI elements

build()[source]
class og.gui.guiPane[source]

Bases: og.gui.guiElement

Abstract class for a GUI pane

build()[source]
class og.gui.guiWindow[source]

Bases: og.gui.guiElement

Abstract class for a GUI window

open()[source]
close()[source]
class og.gui.SetupWindow[source]

Bases: og.gui.guiWindow

open()[source]
class og.gui.TransformWindow[source]

Bases: og.gui.guiWindow

Allows the user to set up a transform interactively * Callbacks:

  • Get the raw and transformed frame at a certain frame number (scrollable)
  • Estimate the transform for a set of coordinates
open()[source]
class og.gui.FilterWindow[source]

Bases: og.gui.guiWindow

Allows the user to set up a filter interactively * Interaction:

  • Scroll through the video to find the liquid of interest, click on it and set the filter according to the selected pixel
  • todo: extra GUI elements for more control over filter parameters
  • todo: would be great to change the filter type dynamically; in that
    case the gui Manager would have to be involved in order to update the FilterWindow’s callbacks… Otherwise: filter implementations wrapped by Filter, not inheriting from Filter
  • Callbacks:
    • Get the masked / masked & filtered frame at a certain frame number (scrollable)
    • Set the filter
open()[source]
class og.gui.ProgressWindow[source]

Bases: og.gui.guiWindow

Shows the progress of an analysis. * No callbacks; not interactive, so the backend pushes to the GUI instead

open()[source]
update(time: float, values: list, state: numpy.ndarray, frame: numpy.ndarray) → None[source]
class og.gui.VideoAnalyzerGui(backend: isimple.core.common.Manager)[source]

Bases: isimple.core.common.Manager, og.gui.guiElement

open_setupwindow() → None[source]
open_transformwindow() → None[source]
open_filterwindow(index: int) → None[source]
open_progresswindow() → None[source]
add_window(window_type: Type[og.gui.guiWindow])[source]
open_window(window_type: Type[og.gui.guiWindow], index: int = None)[source]
close_window(index: int)[source]
wait_on_close(window)[source]
close_all_windows()[source]

Module contents