Modules

class pumpia.module_handling.modules.BaseModule(parent: Misc | None = None, manager: Manager | None = None, context_manager: BaseContextManager | None = None, *, verbose_name: str | None = None, direction: DirectionType = 'Horizontal', border: ScreenUnits = ..., borderwidth: ScreenUnits = ..., class_: str = '', cursor: Cursor = '', height: ScreenUnits = 0, padding: Padding = ..., relief: Relief = ..., style: str = '', takefocus: TakeFocusValue = '', width: ScreenUnits = 0)
class pumpia.module_handling.modules.BaseModule(parent: Misc | None = None, manager: Manager | None = None, context_manager: BaseContextManager | None = None, *, verbose_name: str | None = None, direction: DirectionType = 'Horizontal', **kw)

Base class for modules.

Parameters:
  • parent (tk.Misc or None, optional) – The parent widget (default is None).

  • manager (Manager or None, optional) – The manager object (default is None).

  • context_manager (BaseContextManager or None, optional) – The context manager instance to be used (default is None).

  • verbose_name (str or None, optional) – The verbose name of the module (default is None).

  • direction (DirectionType, optional) – The direction of the child widgets in the frame (default is “Horizontal”).

  • **kw (dict) – Additional keyword arguments as defined by ttk Labelframe.

context_manager

Set at class level. Determines which context manager to use if none is passed in at object initialisation. (default is SimpleContextManager)

Type:

BaseContextManager

show_draw_rois_button

Set at class level. Determines if a button to draw ROIs is shown.

Type:

bool

show_analyse_button

Set at class level. Determines if a button to analyse the module is shown.

Type:

bool

show_copy_buttons

Set at class level. Determines if buttons to copy all field values is shown.

Type:

bool

title

Set at class level. Title of the module tkinter window.

Type:

str

fields
field_windows
viewers
rois

ROI Fields for the module

manager
Type:

Manager | None

parent
Type:

tk.Misc | None

verbose_name
Type:

str | None

direction
Type:

Literal[“horizontal”, “vertical”]

main_viewer

The main viewer for the module, used to get context etc. Defaults to first viewer defined if not provided in ViewerIOs. If multiple are set then defaults to the last defined ViewerIO.

Type:

BaseViewer | None

rois_loaded
Type:

bool

analysed
Type:

bool

input_count
Type:

int

output_count
Type:

int

viewer_count
Type:

int

roi_count
Type:

int

is_setup
Type:

bool

setup(parent: tk.Misc | None = None, manager: Manager | None = None, context_manager: BaseContextManager | None = None)

Sets up the module.

get_context() BaseContext

Returns the context for the module.

load_commands()

User can override this method to register command buttons for the collection.

register_command(text: str, command: Callable[[], Any])

Register a command so that it shows as a button in the main tab.

Link ROIs and viewers for manual drawing.

post_roi_register(roi_input: BaseInputROI)

Command ran after an roi is registered with an input.

manual_roi_draw(self)

Does a full manual draw of all ROIs

draw_rois(context: BaseContext) None

User should override this method to handle drawing the required ROIs.

analyse()

User should override this method to handle analysing the ROIs.

on_image_load(viewer: BaseViewer) None

User can add to this method to handle image load events by calling it using super.

on_tab_select()

Handles the event when a tab containing the module is selected.

create_rois(context: BaseContext | None = None) None

Creates the ROIs for the module.

run_analysis() None

Runs the analysis for the module.

create_and_run(context: BaseContext | None = None) None

Creates the ROIs and runs the analysis.

setup_window(app: tk.Tk, direction: DirectionType = 'Horizontal')

Sets up the application window when running the module independently.

run(direction: DirectionType = 'Horizontal')

Class method which runs the module independently.

class pumpia.module_handling.modules.PhantomModule(parent: Misc | None = None, manager: Manager | None = None, context_manager: BaseContextManager | None = None, *, verbose_name: str | None = None, direction: DirectionType = 'Horizontal', border: ScreenUnits = ..., borderwidth: ScreenUnits = ..., class_: str = '', cursor: Cursor = '', height: ScreenUnits = 0, padding: Padding = ..., relief: Relief = ..., style: str = '', takefocus: TakeFocusValue = '', width: ScreenUnits = 0)
class pumpia.module_handling.modules.PhantomModule(parent: Misc | None = None, manager: Manager | None = None, context_manager: BaseContextManager | None = None, *, verbose_name: str | None = None, direction: DirectionType = 'Horizontal', **kw)

Module for handling phantom images. Has the same attributes and methods as BaseModule unless stated below.

Uses ManualPhantomManager as the default context_manager.