BioImager  4.9.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._Imager Class Reference
Inheritance diagram for microscope.gui._Imager:

Public Member Functions

None __init__ (self, microscope.abc.Camera camera)
 
None snap (self)
 
None fetchLoop (self)
 

Static Public Attributes

 imageAcquired = QtCore.Signal(numpy.ndarray)
 

Protected Attributes

 _camera = camera
 
 _data_queue = _DataQueue()
 

Detailed Description

Helper for CameraWidget handling the internals of the camera trigger.

Definition at line 137 of file gui.py.

Constructor & Destructor Documentation

◆ __init__()

None microscope.gui._Imager.__init__ ( self,
microscope.abc.Camera camera )

Definition at line 142 of file gui.py.

142 def __init__(self, camera: microscope.abc.Camera) -> None:
143 super().__init__()
144 self._camera = camera
145 self._data_queue = _DataQueue()
146 if isinstance(self._camera, Pyro4.Proxy):
147 pyro_daemon = Pyro4.Daemon()
148 queue_uri = pyro_daemon.register(self._data_queue)
149 self._camera.set_client(queue_uri)
150 data_thread = threading.Thread(
151 target=pyro_daemon.requestLoop, daemon=True
152 )
153 data_thread.start()
154 else:
155 self._device.set_client(self._data_queue)
156 fetch_thread = threading.Thread(target=self.fetchLoop, daemon=True)
157 fetch_thread.start()
158
159 # Depending on the Qt backend this might not get called (seems
160 # to work on PySide2 but not with PyQt5). The device itself
161 # should be removing clients that no longer work anyway.
162 self.destroyed.connect(lambda: self._camera.set_client(None))
163

Member Function Documentation

◆ fetchLoop()

None microscope.gui._Imager.fetchLoop ( self)

Definition at line 167 of file gui.py.

167 def fetchLoop(self) -> None:
168 while True:
169 # We may be getting images faster than we can display so
170 # only get the last image in the queue and discard the
171 # rest (we could do with a class that only has one item
172 # and putting a new item will discard the previous instead
173 # of blocking/queue).
174 data = self._data_queue.get()
175 while not self._data_queue.empty():
176 data = self._data_queue.get()
177 self.imageAcquired.emit(data)
178
179

◆ snap()

None microscope.gui._Imager.snap ( self)

Definition at line 164 of file gui.py.

164 def snap(self) -> None:
165 self._camera.trigger()
166

Member Data Documentation

◆ _camera

microscope.gui._Imager._camera = camera
protected

Definition at line 144 of file gui.py.

◆ _data_queue

microscope.gui._Imager._data_queue = _DataQueue()
protected

Definition at line 145 of file gui.py.

◆ imageAcquired

microscope.gui._Imager.imageAcquired = QtCore.Signal(numpy.ndarray)
static

Definition at line 140 of file gui.py.


The documentation for this class was generated from the following file: