BioImager  5.0.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
microscope.gui Namespace Reference

Classes

class  _DataQueue
 
class  _Imager
 
class  CameraWidget
 
class  ControllerWidget
 
class  DeformableMirrorWidget
 
class  DeviceSettingsWidget
 
class  FilterWheelWidget
 
class  LightSourceWidget
 
class  MainWindow
 
class  StageWidget
 

Functions

QtWidgets.QWidget _guess_device_widget (device)
 
int main (typing.Sequence[str] argv)
 
int _setuptools_entry_point ()
 

Variables

 _logger = logging.getLogger(__name__)
 
 SERIALIZER
 

Function Documentation

◆ _guess_device_widget()

QtWidgets.QWidget microscope.gui._guess_device_widget ( device)
protected

Definition at line 468 of file gui.py.

468def _guess_device_widget(device) -> QtWidgets.QWidget:
469 if hasattr(device, "axes"):
470 return StageWidget
471 elif hasattr(device, "devices"):
472 return ControllerWidget
473 elif hasattr(device, "n_positions"):
474 return FilterWheelWidget
475 elif hasattr(device, "power"):
476 return LightSourceWidget
477 elif hasattr(device, "n_actuators"):
478 return DeformableMirrorWidget
479 elif hasattr(device, "get_sensor_shape"):
480 return CameraWidget
481 elif hasattr(device, "get_all_settings"):
482 return DeviceSettingsWidget
483 else:
484 raise TypeError("device is not a Microscope Device")
485
486

◆ _setuptools_entry_point()

int microscope.gui._setuptools_entry_point ( )
protected

Definition at line 538 of file gui.py.

538def _setuptools_entry_point() -> int:
539 # The setuptools entry point must be a function, we can't simply
540 # name this module even if this module does work as a script. We
541 # also do not want to set the default of main() to sys.argv
542 # because when the documentation is generated (with Sphinx's
543 # autodoc extension), then sys.argv gets replaced with the
544 # sys.argv value at the time docs were generated (see
545 # https://stackoverflow.com/a/12087750 )
546 return main(sys.argv)
547
548

◆ main()

int microscope.gui.main ( typing.Sequence[str] argv)

Definition at line 487 of file gui.py.

487def main(argv: typing.Sequence[str]) -> int:
488 app = QtWidgets.QApplication(argv)
489 app.setApplicationName("Microscope GUI")
490 app.setOrganizationDomain("python-microscope.org")
491
492 type_to_widget = {
493 "Camera": CameraWidget,
494 "Controller": ControllerWidget,
495 "DeformableMirror": DeformableMirrorWidget,
496 "DeviceSettings": DeviceSettingsWidget,
497 "FilterWheel": FilterWheelWidget,
498 "LightSourceWidget": LightSourceWidget,
499 "Stage": StageWidget,
500 }
501
502 parser = argparse.ArgumentParser(prog="microscope-gui")
503
504 # Although we have a function that can guess the device type from
505 # the attributes on the proxy this is still useful. For example,
506 # to display the device settings instead of the device UI. Or
507 # maybe we're dealing with a device that implements more than one
508 # interface (earlier iterations of aurox Clarity were both a
509 # camera and a filterwheel). This option provides a way to force
510 # a specific widget.
511 parser.add_argument(
512 "type",
513 action="store",
514 type=str,
515 metavar="DEVICE-TYPE",
516 choices=type_to_widget.keys(),
517 help="Type of device/widget to show",
518 )
519
520 parser.add_argument(
521 "uri",
522 action="store",
523 type=str,
524 metavar="DEVICE-URI",
525 help="URI for device",
526 )
527 args = parser.parse_args(app.arguments()[1:])
528
529 device = Pyro4.Proxy(args.uri)
530 widget_cls = type_to_widget[args.type]
531 widget = widget_cls(device)
532 window = MainWindow(widget)
533 window.show()
534
535 return app.exec_()
536
537

Variable Documentation

◆ _logger

microscope.gui._logger = logging.getLogger(__name__)
protected

Definition at line 47 of file gui.py.

◆ SERIALIZER

microscope.gui.SERIALIZER

Definition at line 53 of file gui.py.