jacopoabramo / napari-live-recording Goto Github PK
View Code? Open in Web Editor NEWGeneral-purpouse camera capture plugin for data streaming to napari
License: MIT License
General-purpouse camera capture plugin for data streaming to napari
License: MIT License
At startup of the plugin whenever it tries to discover all possible device adapters available in the Micro-Manager core, it shows the following:
Discovering HID Devices......
HID Device pid: 608d vid: 608d
HID Device pid: 6099 vid: 6099
HID Device pid: 6099 vid: 6099
HID Device pid: 6099 vid: 6099
Discovering USB Devices......
Can this be removed somehow?
Hi. Is it possible to select camera when using opencvgrabber?
Thanks.
Petro.
Hi @jacopoabramo,
Working on conda-forge/napari-live-recording-feedstock#4, It seems some dependencies need to be updated
Could these be updated for the next release?
Cheers!
During live acquisition and recording, each device should be connected to a circular memory buffer on which to store frames acquired at run time. Each device will have it's own independent buffer.
The buffer should be a numpy
array which will reflect the current selected ROI for that device. Whenever a new ROI is requested, the content of the frame buffer should be cleared. The size in frames of the buffer will be kept hard-coded and will later connected to a specific UI element.
Hi.
When I try to start plugin I am getting this error:
ailed to import command at 'napari_live_recording:NapariLiveRecording': cannot import name 'PHOTOMETRIC' from 'tifffile.tifffile' (/home/petro/miniconda3/envs/pyfluoval/lib/python3.9/site-packages/tifffile/tifffile.py)
Any idea what is the problem?
Hi Jacapo @jacopoabramo ,
I just tried the new version 0.1.4 of the plugin and it works a little better. I can select a camera and connect to it. However, when I click on ``, the error below pops up.
Is this a bug or is there anything I can do about it?
Thanks!
Best,
Robert
---------------------------------------------------------------------------
error Traceback (most recent call last)
~\AppData\Local\Programs\napari\\app\napari\_qt\qthreading.py in reraise(e=error("OpenCV(4.5.3) C:\\Users\\runneradmin\\App...e or configure script in function 'cvWaitKey'\n"))
646
647 def reraise(e):
--> 648 raise e
e = error("OpenCV(4.5.3) C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-req-build-z4706ql7\\opencv\\modules\\highgui\\src\\window.cpp:1340: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'\n")
649
650 worker.errored.connect(reraise)
~\AppData\Local\Programs\napari\\app\napari\_qt\qthreading.py in run(self=<napari._qt.qthreading.GeneratorWorker object>)
151 warnings.filterwarnings("always")
152 warnings.showwarning = lambda *w: self.warned.emit(w)
--> 153 result = self.work()
result = undefined
self.work = <bound method GeneratorWorker.work of <napari._qt.qthreading.GeneratorWorker object at 0x00000240537980D0>>
154 if isinstance(result, Exception):
155 if isinstance(result, RuntimeError):
~\AppData\Local\Programs\napari\\app\napari\_qt\qthreading.py in work(self=<napari._qt.qthreading.GeneratorWorker object>)
365 try:
366 input = self._next_value()
--> 367 output = self._gen.send(input)
output = undefined
self._gen.send = <built-in method send of generator object at 0x00000240537D79E0>
input = None
368 self.yielded.emit(output)
369 except StopIteration as exc:
~\AppData\Local\Programs\napari\python\\Lib\\site-packages\napari_live_recording\_dock_widget.py in yield_acquire_images_forever()
235 view_time = time()
236 while True: # infinite loop, quit signal makes it stop
--> 237 img = self.camera.capture_image()
img = undefined
global self.camera.capture_image = undefined
238 (self.live_image_buffer.append(img) if img is not None else None)
239 new_frame_time = time()
~\AppData\Local\Programs\napari\python\\Lib\\site-packages\napari_live_recording\Cameras\CameraOpenCV.py in capture_image(self=<napari_live_recording.Cameras.CameraOpenCV.CameraOpenCV object>)
59 _ , img = self.camera.read()
60 img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
---> 61 cv2.waitKey(1)
global cv2.waitKey = <built-in function waitKey>
62 return img
63
error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-z4706ql7\opencv\modules\highgui\src\window.cpp:1340: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'
And that's my napari info:
napari: 0.4.11
Platform: Windows-10-10.0.19041-SP0
Python: 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)]
Qt: 5.15.2
PyQt5: 5.15.4
NumPy: 1.19.3
SciPy: 1.7.1
Dask: 2021.08.1
VisPy: 0.8.1
OpenGL:
- GL version: 4.6.14761 Compatibility Profile Context 21.30.02.01 30.0.13002.1001
- MAX_TEXTURE_SIZE: 16384
Screens:
- screen 1: resolution 1920x1200, scale 1.0
Plugins:
- Measurements (Plot profile): 0.1.6
- Measurements (skimage regionprops): 0.1.7
- OtherView: 0.1.1
- Search (Plugin): 0.1.1
- Segment (blobs and things with membranes): 0.2.2
- Segmentation (Accelerated Pixel and Object Classification): 0.5.4
- Segmentation (OCLRFC): 0.4.3
- Segmentation (split/merge): 0.1.3
- StarDist: 2021.6.28
- Utilities (skimage regionprops): 0.1.7
- Visualization(B/C): 0.1.3
- aicsimageio-in-memory: 0.4.1
- aicsimageio-out-of-memory: 0.4.1
- animation: 0.0.2
- cellpose-napari: 0.1.3
- clEsperanto: 0.10.3
- console: 0.0.4
- devbio: 0.1.0
- napari-brushsettings: 0.0.2
- napari-crop: 0.1.0
- napari-czifile2: 0.2.5
- napari-folder-browser: 0.1.2
- napari-itk-io: 0.1.0
- napari-live-recording: 0.1.4
- napari-tabu: 0.1.3
- napari-tools-menu: 0.1.1
- napari_webcam: 0.1.18
- ome-types: 0.2.7
- scikit-image
- stl: 0.0.3
- svg: 0.1.5
Currently there's a limitation in the recording functionality, as stacks bigger than 4 GB (which are considered BigTIFF format according to this) are not properly saved. Recording is handled here:
@thread_worker(connect={"yielded": add_recording_layer})
def acquire_stack_images(stack_size: int, file_path: str):
# todo: move this string replacement at beginning of path acquisition
if file_path.endswith(".tiff"):
file_path.replace(".tiff", ".ome.tiff")
# todo: should camera acquisition be moved to another thread
# and yield images to process_stack_images?
stack = process_stack_images(self.special_function_checkbox.isChecked(),
np.stack([self.camera.capture_image() for _ in range(0, stack_size)]),
stack_size)
# todo: stacks bigger than 4 GBs are not saved, how to fix?
with tifffile.TiffWriter(file_path, append=True) as writer:
writer.write(stack,
photometric="minisblack",
metadata={"axes" : "ZYX"})
yield file_path
The TiffWriter class has a flag for BigTIFF files, but I tested it and it seems to not be working properly. I would like to make sure that both TIFF and BigTIFF formats are readable from ImageJ in case an user would like to do more post processing operations.
Hi @jacopoabramo ,
I just tested napari-live-recording again and after clicking on "Connect" to my "Default Camera (OpenCV)", there is an error message popping up:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\miniconda3\envs\nap-dev-bio2\lib\site-packages\napari_live_recording\_dock_widget.py in _on_connect_clicked(self=)
303 self._set_widgets_enabled(True)
304 self.camera_pixel_type_combobox.currentTextChanged.connect(self._on_pixel_format_changed)
--> 305 self._set_default_roi()
self._set_default_roi = >
306 else:
307 raise CameraError(f"Error in opening {self.camera.get_name()}")
~\miniconda3\envs\nap-dev-bio2\lib\site-packages\napari_live_recording\_dock_widget.py in _set_default_roi(self=)
428 def _set_default_roi(self):
429 self.roi = self.camera.get_sensor_range()
--> 430 self.camera_roi_x_offset_spinbox.setValue(self.roi.offset_x)
self.camera_roi_x_offset_spinbox.setValue =
self.roi.offset_x = undefined
431 self.camera_roi_y_offset_spinbox.setValue(self.roi.offset_y)
432 self.camera_roi_x_offset_spinbox.setSingleStep(self.roi.ofs_x_step)
AttributeError: 'NoneType' object has no attribute 'offset_x'
To reproduce: I just started napari, the live recoding plugin, selected the camera and clicked on "Connect".
Afterwards, when I click the start recording button, the plugin works nicely.
Let me know if I can help tracing down that error message.
Happy holidays!
Best,
Robert
Hi Jacopo @jacopoabramo ,
I just installed napari-live-recording in a fresh conda environment and afterwards retrieved the error below from the Plugins > Plugin errors...
menu in napari.
I assume, you need to add ximea
to the dependencies of the plugin.
Let me know if you need further support in tracing down this issue.
Best,
Robert
==================== Errors for plugin 'napari-live-recording' ====================
napari version: 0.4.12
ERROR #1: Error while importing module napari_live_recording --------------------
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in _load_and_register(self=, mod_name='napari_live_recording', plugin_name='napari-live-recording')
317 try:
--> 318 module = load(mod_name)
module = undefined
global load =
mod_name = 'napari_live_recording'
319 if self.is_registered(module):
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in load(value='napari_live_recording')
1041 raise ValueError(f"malformed entry point string: {value}")
-> 1042 module = importlib.import_module(match.group('module'))
module = undefined
global importlib.import_module =
match.group =
1043 attrs = filter(None, (match.group('attr') or '').split('.'))
~\miniconda3\envs\bio_38\lib\importlib\__init__.py in import_module(name='napari_live_recording', package=None)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
global _bootstrap._gcd_import =
name = 'napari_live_recording'
level = 0
package = None
128
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _gcd_import(name='napari_live_recording', package=None, level=0)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _find_and_load(name='napari_live_recording', import_=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name='napari_live_recording', import_=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _load_unlocked(spec=ModuleSpec(name='napari_live_recording', loader=..._38\\lib\\site-packages\\napari_live_recording']))
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap_external.py in exec_module(self=, module=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _call_with_frames_removed(f=, *args=( at 0x0000014A19CAA920, fil...kages\napari_live_recording\__init__.py", line 1>, {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'AttributeError': , 'BaseException': , 'BlockingIOError': , 'BrokenPipeError': , 'BufferError': , 'BytesWarning': , 'ChildProcessError': , 'ConnectionAbortedError': , ...}, '__cached__': r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-p...ive_recording\__pycache__\__init__.cpython-38.pyc', '__doc__': None, '__file__': r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\__init__.py', '__loader__': , '__name__': 'napari_live_recording', '__package__': 'napari_live_recording', '__path__': [r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording'], '__spec__': ModuleSpec(name='napari_live_recording', loader=..._38\\lib\\site-packages\\napari_live_recording']), '__version__': '0.1.0'}), **kwds={})
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\__init__.py in
2
----> 3 from ._dock_widget import napari_experimental_provide_dock_widget
global _dock_widget = undefined
global napari_experimental_provide_dock_widget = undefined
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\_dock_widget.py in
5 from imageio import mimwrite, imwrite
----> 6 from napari_live_recording.Cameras import *
global napari_live_recording.Cameras = undefined
7 from napari_live_recording.Functions import *
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\Cameras\__init__.py in
4 from .CameraOpenCV import *
----> 5 from .CameraXimea import *
global CameraXimea = undefined
6
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\Cameras\CameraXimea.py in
4 # see https://www.ximea.com/support/wiki/apis/APIs for more informations
----> 5 from ximea.xiapi import Camera as XiCamera, Xi_error
global ximea.xiapi = undefined
global Camera = undefined
global XiCamera = undefined
global Xi_error = undefined
6 from ximea.xiapi import Image as XiImage
ModuleNotFoundError: No module named 'ximea'
The above exception was the direct cause of the following exception:
PluginImportError Traceback (most recent call last)
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in discover(self=, path=None, entry_point=None, prefix=None, ignore_errors=True)
262
263 try:
--> 264 if self._load_and_register(mod_name, name):
self._load_and_register = >
mod_name = 'napari_zelda'
name = 'napari-zelda'
265 count += 1
266 self._id_counts[name] = 1
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in _load_and_register(self=, mod_name='napari_live_recording', plugin_name='napari-live-recording')
320 return None
321 except Exception as exc:
--> 322 raise PluginImportError(
global PluginImportError =
plugin_name = 'napari-live-recording'
global cause = undefined
exc = undefined
323 f'Error while importing module {mod_name}',
324 plugin_name=plugin_name,
PluginImportError: Error while importing module napari_live_recording
ERROR #2: Error while importing module napari_live_recording --------------------
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in _load_and_register(self=, mod_name='napari_live_recording', plugin_name='napari-live-recording')
317 try:
--> 318 module = load(mod_name)
module = undefined
global load =
mod_name = 'napari_live_recording'
319 if self.is_registered(module):
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in load(value='napari_live_recording')
1041 raise ValueError(f"malformed entry point string: {value}")
-> 1042 module = importlib.import_module(match.group('module'))
module = undefined
global importlib.import_module =
match.group =
1043 attrs = filter(None, (match.group('attr') or '').split('.'))
~\miniconda3\envs\bio_38\lib\importlib\__init__.py in import_module(name='napari_live_recording', package=None)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
global _bootstrap._gcd_import =
name = 'napari_live_recording'
level = 0
package = None
128
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _gcd_import(name='napari_live_recording', package=None, level=0)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _find_and_load(name='napari_live_recording', import_=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name='napari_live_recording', import_=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _load_unlocked(spec=ModuleSpec(name='napari_live_recording', loader=..._38\\lib\\site-packages\\napari_live_recording']))
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap_external.py in exec_module(self=, module=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _call_with_frames_removed(f=, *args=( at 0x0000014A19D2D3A0, fil...kages\napari_live_recording\__init__.py", line 1>, {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'AttributeError': , 'BaseException': , 'BlockingIOError': , 'BrokenPipeError': , 'BufferError': , 'BytesWarning': , 'ChildProcessError': , 'ConnectionAbortedError': , ...}, '__cached__': r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-p...ive_recording\__pycache__\__init__.cpython-38.pyc', '__doc__': None, '__file__': r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\__init__.py', '__loader__': , '__name__': 'napari_live_recording', '__package__': 'napari_live_recording', '__path__': [r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording'], '__spec__': ModuleSpec(name='napari_live_recording', loader=..._38\\lib\\site-packages\\napari_live_recording']), '__version__': '0.1.0'}), **kwds={})
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\__init__.py in
2
----> 3 from ._dock_widget import napari_experimental_provide_dock_widget
global _dock_widget = undefined
global napari_experimental_provide_dock_widget = undefined
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\_dock_widget.py in
5 from imageio import mimwrite, imwrite
----> 6 from napari_live_recording.Cameras import *
global napari_live_recording.Cameras = undefined
7 from napari_live_recording.Functions import *
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\Cameras\__init__.py in
4 from .CameraOpenCV import *
----> 5 from .CameraXimea import *
global CameraXimea = undefined
6
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\Cameras\CameraXimea.py in
4 # see https://www.ximea.com/support/wiki/apis/APIs for more informations
----> 5 from ximea.xiapi import Camera as XiCamera, Xi_error
global ximea.xiapi = undefined
global Camera = undefined
global XiCamera = undefined
global Xi_error = undefined
6 from ximea.xiapi import Image as XiImage
ModuleNotFoundError: No module named 'ximea'
The above exception was the direct cause of the following exception:
PluginImportError Traceback (most recent call last)
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in discover(self=, path=None, entry_point=None, prefix=None, ignore_errors=True)
262
263 try:
--> 264 if self._load_and_register(mod_name, name):
self._load_and_register = >
mod_name = 'napari_zelda'
name = 'napari-zelda'
265 count += 1
266 self._id_counts[name] = 1
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in _load_and_register(self=, mod_name='napari_live_recording', plugin_name='napari-live-recording')
320 return None
321 except Exception as exc:
--> 322 raise PluginImportError(
global PluginImportError =
plugin_name = 'napari-live-recording'
global cause = undefined
exc = undefined
323 f'Error while importing module {mod_name}',
324 plugin_name=plugin_name,
PluginImportError: Error while importing module napari_live_recording
ERROR #3: Error while importing module napari_live_recording --------------------
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in _load_and_register(self=, mod_name='napari_live_recording', plugin_name='napari-live-recording')
317 try:
--> 318 module = load(mod_name)
module = undefined
global load =
mod_name = 'napari_live_recording'
319 if self.is_registered(module):
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in load(value='napari_live_recording')
1041 raise ValueError(f"malformed entry point string: {value}")
-> 1042 module = importlib.import_module(match.group('module'))
module = undefined
global importlib.import_module =
match.group =
1043 attrs = filter(None, (match.group('attr') or '').split('.'))
~\miniconda3\envs\bio_38\lib\importlib\__init__.py in import_module(name='napari_live_recording', package=None)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
global _bootstrap._gcd_import =
name = 'napari_live_recording'
level = 0
package = None
128
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _gcd_import(name='napari_live_recording', package=None, level=0)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _find_and_load(name='napari_live_recording', import_=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name='napari_live_recording', import_=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _load_unlocked(spec=ModuleSpec(name='napari_live_recording', loader=..._38\\lib\\site-packages\\napari_live_recording']))
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap_external.py in exec_module(self=, module=)
~\miniconda3\envs\bio_38\lib\importlib\_bootstrap.py in _call_with_frames_removed(f=, *args=( at 0x0000014A19D38870, fil...kages\napari_live_recording\__init__.py", line 1>, {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'AttributeError': , 'BaseException': , 'BlockingIOError': , 'BrokenPipeError': , 'BufferError': , 'BytesWarning': , 'ChildProcessError': , 'ConnectionAbortedError': , ...}, '__cached__': r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-p...ive_recording\__pycache__\__init__.cpython-38.pyc', '__doc__': None, '__file__': r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\__init__.py', '__loader__': , '__name__': 'napari_live_recording', '__package__': 'napari_live_recording', '__path__': [r'C:\Users\rober\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording'], '__spec__': ModuleSpec(name='napari_live_recording', loader=..._38\\lib\\site-packages\\napari_live_recording']), '__version__': '0.1.0'}), **kwds={})
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\__init__.py in
2
----> 3 from ._dock_widget import napari_experimental_provide_dock_widget
global _dock_widget = undefined
global napari_experimental_provide_dock_widget = undefined
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\_dock_widget.py in
5 from imageio import mimwrite, imwrite
----> 6 from napari_live_recording.Cameras import *
global napari_live_recording.Cameras = undefined
7 from napari_live_recording.Functions import *
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\Cameras\__init__.py in
4 from .CameraOpenCV import *
----> 5 from .CameraXimea import *
global CameraXimea = undefined
6
~\miniconda3\envs\bio_38\lib\site-packages\napari_live_recording\Cameras\CameraXimea.py in
4 # see https://www.ximea.com/support/wiki/apis/APIs for more informations
----> 5 from ximea.xiapi import Camera as XiCamera, Xi_error
global ximea.xiapi = undefined
global Camera = undefined
global XiCamera = undefined
global Xi_error = undefined
6 from ximea.xiapi import Image as XiImage
ModuleNotFoundError: No module named 'ximea'
The above exception was the direct cause of the following exception:
PluginImportError Traceback (most recent call last)
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in discover(self=, path=None, entry_point=None, prefix=None, ignore_errors=True)
262
263 try:
--> 264 if self._load_and_register(mod_name, name):
self._load_and_register = >
mod_name = 'napari_zelda'
name = 'napari-zelda'
265 count += 1
266 self._id_counts[name] = 1
~\miniconda3\envs\bio_38\lib\site-packages\napari_plugin_engine\manager.py in _load_and_register(self=, mod_name='napari_live_recording', plugin_name='napari-live-recording')
320 return None
321 except Exception as exc:
--> 322 raise PluginImportError(
global PluginImportError =
plugin_name = 'napari-live-recording'
global cause = undefined
exc = undefined
323 f'Error while importing module {mod_name}',
324 plugin_name=plugin_name,
PluginImportError: Error while importing module napari_live_recording
================================================================================
Hi guys!
Great project, I was looking forward for something like this!
I was wondering if you currently have any ongoing/future plan to support writing of mp4 movies.
Thank you in avance for the answer and kudos again!
Hello.
Does it work on windows?
Petro.
Adding the python-microscope camera device layer to be controlled via the plugin. The guidelines to integrate this layer are as follows:
napari_live_recording/control/devices/interface.py
SimulatedCamera
dummy interface provided by the packageAn error occurs here, because the type of the tuple is just tuple and is therefore not iterable.
My Solution would be:
if any(isinstance(parameter, float) for parameter in param)
Wen try to open plugin on fresh environment (Python 3.10.4 Linux, Ubuntu) it crash with:
File ~/Projekty/napari-live-recording/src/napari_live_recording/__init__.py:3
2 from napari.viewer import Viewer
----> 3 from napari_live_recording.ui import ViewerAnchor
4 from napari_live_recording.control import MainController
File ~/Projekty/napari-live-recording/src/napari_live_recording/ui/__init__.py:5
4 from napari_live_recording.common import THIRTY_FPS
----> 5 from napari_live_recording.control.devices import devicesDict, ICamera
6 from napari_live_recording.control.devices.interface import NumberParameter
File ~/Projekty/napari-live-recording/src/napari_live_recording/control/__init__.py:6
5 from napari_live_recording.common import FileFormat, ROI
----> 6 from napari_live_recording.control.devices.interface import ICamera
7 from typing import Dict, NamedTuple
File ~/Projekty/napari-live-recording/src/napari_live_recording/control/devices/__init__.py:13
10 # iterate through the modules of the devices module
11 # in order to find all submodules containing the class definitions
12 # of all cameras
---> 13 for (_, module_name, _) in iter_modules([package_dir]):
package_dir = PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices')
[package_dir] = [PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices')]
14 # import the modulte and iterate through the attributes
15 try:
16 # we skip the interface module
File ~/.pyenv/versions/3.10.4/lib/python3.10/pkgutil.py:129, in iter_modules(path=[PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices')], prefix='')
128 yielded = {}
--> 129 for i in importers:
importers = <map object at 0x7fb2a0d6b790>
130 for name, ispkg in iter_importer_modules(i, prefix):
File ~/.pyenv/versions/3.10.4/lib/python3.10/pkgutil.py:421, in get_importer(path_item=PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices'))
420 try:
--> 421 importer = path_hook(path_item)
path_item = PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices')
path_hook = <function FileFinder.path_hook.<locals>.path_hook_for_FileFinder at 0x7fb326360af0>
422 sys.path_importer_cache.setdefault(path_item, importer)
File <frozen importlib._bootstrap_external>:1632, in path_hook_for_FileFinder(path=PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices'))
File <frozen importlib._bootstrap_external>:1504, in __init__(self=FileFinder(PosixPath('/home/czaki/Projekty/napar...ding/src/napari_live_recording/control/devices')), path=PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices'), *loader_details=((<class '_frozen_importlib_external.ExtensionFileLoader'>, ['.cpython-310-x86_64-linux-gnu.so', '.abi3.so', '.so']), (<class '_frozen_importlib_external.SourceFileLoader'>, ['.py']), (<class '_frozen_importlib_external.SourcelessFileLoader'>, ['.pyc'])))
File <frozen importlib._bootstrap_external>:182, in _path_isabs(path=PosixPath('/home/czaki/Projekty/napari-live-recording/src/napari_live_recording/control/devices'))
AttributeError: 'PosixPath' object has no attribute 'startswith'
To make it work I replaced:
for (_, module_name, _) in iter_modules([package_dir]):
with
for (_, module_name, _) in iter_modules([str(package_dir)]):
in:
File ~/Projekty/napari-live-recording/src/napari_live_recording/control/devices/__init__.py:13
I've been fixing up the CI on GitHub for unit testing. No matter my efforts the CI on ubuntu keeps failing. Some pointers are appreciated.
Adding the pymmcore-plus camera device layer to be controlled via the plugin. The guidelines to integrate this layer are as follows:
napari_live_recording/control/devices/interface.py
DemoCamera
dummy interface provided by the packageI have this error when i try to activate this plugin
AttributeError Traceback (most recent call last)
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\napari\_qt\menus\plugins_menu.py:105, in PluginsMenu._add_plugin_actions.<locals>._add_toggle_widget(key=('napari-live-recording', 'Live recording'), hook_type='dock')
102 return
104 if hook_type == 'dock':
--> 105 self._win.add_plugin_dock_widget(*key)
key = ('napari-live-recording', 'Live recording')
self._win = <napari._qt.qt_main_window.Window object at 0x00000161BE726A50>
self = <napari._qt.menus.plugins_menu.PluginsMenu object at 0x00000161BFD27BE0>
106 else:
107 self._win._add_plugin_function_widget(*key)
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\napari\_qt\qt_main_window.py:811, in Window.add_plugin_dock_widget(self=<napari._qt.qt_main_window.Window object>, plugin_name='napari-live-recording', widget_name='Live recording', tabify=False)
808 wdg = wdg._magic_widget
809 return dock_widget, wdg
--> 811 wdg = _instantiate_dock_widget(
Widget = <class 'napari_live_recording.NapariLiveRecording'>
self = <napari._qt.qt_main_window.Window object at 0x00000161BE726A50>
812 Widget, cast('Viewer', self._qt_viewer.viewer)
813 )
815 # Add dock widget
816 dock_kwargs.pop('name', None)
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\napari\_qt\qt_main_window.py:1465, in _instantiate_dock_widget(wdg_cls=<class 'napari_live_recording.NapariLiveRecording'>, viewer=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}))
1460 break
1461 # cannot look for param.kind == param.VAR_KEYWORD because
1462 # QWidget allows **kwargs but errs on unknown keyword arguments
1463
1464 # instantiate the widget
-> 1465 return wdg_cls(**kwargs)
kwargs = {'napari_viewer': Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoom=1.0, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(1.0, 1.0), scaled=True, size=1, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=2, ndisplay=2, last_used=0, range=((0, 2, 1), (0, 2, 1)), current_step=(0, 0), order=(0, 1), axis_labels=('0', '1')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], help='', status='Ready', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x00000161B9B79260>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={})}
wdg_cls = <class 'napari_live_recording.NapariLiveRecording'>
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\napari_live_recording\__init__.py:11, in NapariLiveRecording.__init__(self=<napari_live_recording.NapariLiveRecording object>, napari_viewer=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}))
9 self.app = QApplication.instance()
10 self.mainController = MainController()
---> 11 self.anchor = ViewerAnchor(napari_viewer, self.mainController)
self.mainController = <napari_live_recording.control.MainController object at 0x00000161C8B688B0>
self = <napari_live_recording.NapariLiveRecording object at 0x00000161C8B47B50>
napari_viewer = Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoom=1.0, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(1.0, 1.0), scaled=True, size=1, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=2, ndisplay=2, last_used=0, range=((0, 2, 1), (0, 2, 1)), current_step=(0, 0), order=(0, 1), axis_labels=('0', '1')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], help='', status='Ready', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x00000161B9B79260>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={})
12 self.setLayout(self.anchor.mainLayout)
13 self.app.lastWindowClosed.connect(self.on_close_callback)
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\napari_live_recording\ui\__init__.py:40, in ViewerAnchor.__init__(self=<napari_live_recording.ui.ViewerAnchor object>, napari_viewer=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}), mainController=<napari_live_recording.control.MainController object>)
38 self.selectionWidget.setDeviceSelectionWidget(list(devicesDict.keys()))
39 self.selectionWidget.setAvailableCameras(list(devicesDict.keys()))
---> 40 self.recordingWidget = RecordHandling()
self = <napari_live_recording.ui.ViewerAnchor object at 0x00000161C8B4CC90>
RecordHandling = <class 'napari_live_recording.ui.widgets.RecordHandling'>
41 verticalSpacer = QSpacerItem(0, 1, QSizePolicy.Minimum, QSizePolicy.Minimum)
42 self.mainLayout.addWidget(self.selectionWidget.group)
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\napari_live_recording\ui\widgets.py:397, in RecordHandling.__init__(self=<napari_live_recording.ui.widgets.RecordHandling object>)
394 self.layout = QGridLayout()
396 self.formatLabel = QLabel("File format")
--> 397 self.formatComboBox = QEnumComboBox(enum_class=FileFormat)
self = <napari_live_recording.ui.widgets.RecordHandling object at 0x00000161C8B6A680>
QEnumComboBox = <class 'superqt.combobox._enum_combobox.QEnumComboBox'>
398 self.formatLabel.setAlignment(Qt.AlignmentFlag.AlignCenter)
400 self.folderTextEdit = QLineEdit(
401 os.path.join(os.path.expanduser("~"), "Documents")
402 )
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\superqt\combobox\_enum_combobox.py:42, in QEnumComboBox.__init__(self=<superqt.combobox._enum_combobox.QEnumComboBox object>, parent=None, enum_class=<enum 'FileFormat'>, allow_none=False)
40 self._allow_none = False
41 if enum_class is not None:
---> 42 self.setEnumClass(enum_class, allow_none)
self = <superqt.combobox._enum_combobox.QEnumComboBox object at 0x00000161C8B6A8C0>
enum_class = <enum 'FileFormat'>
allow_none = False
43 self.currentIndexChanged.connect(self._emit_signal)
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\superqt\combobox\_enum_combobox.py:53, in QEnumComboBox.setEnumClass(self=<superqt.combobox._enum_combobox.QEnumComboBox object>, enum=<enum 'FileFormat'>, allow_none=False)
51 super().addItem(NONE_STRING)
52 names = map(_get_name, self._enum_class.__members__.values())
---> 53 _names = dict.fromkeys(names) # remove duplicates/aliases, keep order
names = <map object at 0x00000161D146E560>
54 super().addItems(list(_names))
File E:\IMAGEJ24\napari_24\.venv\Lib\site-packages\superqt\combobox\_enum_combobox.py:16, in _get_name(enum_value=<FileFormat.ImageJ TIFF: 1>)
13 def _get_name(enum_value: Enum):
14 """Create human readable name if user does not implement `__str__`."""
15 if (
---> 16 enum_value.__str__.__module__ != "enum"
enum_value = <FileFormat.ImageJ TIFF: 1>
enum_value.__str__ = <method-wrapper '__repr__' of FileFormat object at 0x00000161C8B4C780>
17 and not enum_value.__str__.__module__.startswith("shibokensupport")
18 ):
19 # check if function was overloaded
20 name = str(enum_value)
21 else:
AttributeError: 'method-wrapper' object has no attribute '__module__'```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.