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: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Horizontal', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', width: str | float = 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: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Horizontal', **kw)
Base class for modules.
Class attribute context_manager_generator is used when running the module as stand alone, set to SimpleContextManagerGenerator by default.
- 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
- Type:
BaseContextManager | 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
- viewers
- Type:
list[BaseViewer]
- rois
- Type:
list[BaseInputROI]
- 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
- set_parent(parent: tk.Misc)
Sets the parent widget.
- 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_viewers():
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: PhantomContextManager | None = None, *, verbose_name: str | None = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Horizontal', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', width: str | float = 0)
- class pumpia.module_handling.modules.PhantomModule(parent: Misc | None = None, manager: Manager | None = None, context_manager: PhantomContextManager | None = None, *, verbose_name: str | None = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Horizontal', **kw)
Module for handling phantom images. Has the same attributes and methods as BaseModule unless stated below.
Uses ManualPhantomManagerGenerator as the default context_manager_generator.
Adds two buttons for showing the phantom boundary and bounding box compared with BaseModule.