I have installed napari in a micromamba environment on my Windows 10 Laptop.
I wanted to try out the elastix-napari plugin for 3D registration of 2 microscopy images.
I installed all the required libraries but I have the following error that raises (long version further down):
EmitLoopError: calling <psygnal._weak_callback._StrongFunction object at 0x000001B98DC73FA0> with args=(False,) caused TypeError: Expecting argument of type itkImageSS2 or itkImageSourceISS2..
I tried to trace back where the issue comes from but so far I failed.
Thank you very much for your reply.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\psygnal\_signal.py:972, in SignalInstance._run_emit_loop(self=<SignalInstance 'changed' on PushButton(value=False, annotation=None, name='call_button')>, args=(False,))
971 try:
--> 972 caller.cb(args)
caller = <psygnal._weak_callback._StrongFunction object at 0x000001B98DC73FA0>
args = (False,)
973 except Exception as e:
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\psygnal\_weak_callback.py:268, in _StrongFunction.cb(self=<psygnal._weak_callback._StrongFunction object>, args=())
267 args = args[: self._max_args]
--> 268 self._f(*self._args, *args, **self._kwargs)
args = ()
self._f = <function FunctionGui.__init__.<locals>._disable_button_and_call at 0x000001B98DC77700>
self = <psygnal._weak_callback._StrongFunction object at 0x000001B98DC73FA0>
self._args = ()
self._kwargs = {}
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\magicgui\widgets\_function_gui.py:218, in FunctionGui.__init__.<locals>._disable_button_and_call()
217 try:
--> 218 self.__call__()
self = <FunctionGui elastix_registration(fixed_image: napari.layers.image.image.Image = <Image layer 'Ref20131120pt14pl2' at 0x1b98dcab190>, moving_image: napari.layers.image.image.Image = <Image layer '140329MusOilLD_fish1_01' at 0x1b98dc7a310>, preset: str = 'affine', fixed_mask: napari.layers.image.image.Image = None, moving_mask: napari.layers.image.image.Image = None, fixed_ps: pathlib.Path = WindowsPath('.'), moving_ps: pathlib.Path = WindowsPath('.'), param1: pathlib.Path = WindowsPath('.'), param2: pathlib.Path = WindowsPath('.'), param3: pathlib.Path = WindowsPath('.'), init_trans: pathlib.Path = WindowsPath('.'), output_dir: pathlib.Path = WindowsPath('.'), metric: str = 'AdvancedMattesMutualInformation', resolutions: int = 4, max_iterations: int = 500, nr_spatial_samples: int = 512, max_step_length: float = 1.0, masks: bool = False, save_output: bool = False, advanced: bool = False) -> napari.layers.image.image.Image>
219 finally:
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\magicgui\widgets\_function_gui.py:331, in FunctionGui.__call__(self=<FunctionGui elastix_registration(fixed_image: n...bool = False) -> napari.layers.image.image.Image>, update_widget=False, *args=(), **kwargs={})
330 with _function_name_pointing_to_widget(self):
--> 331 value = self._function(*bound.args, **bound.kwargs)
self = <FunctionGui elastix_registration(fixed_image: napari.layers.image.image.Image = <Image layer 'Ref20131120pt14pl2' at 0x1b98dcab190>, moving_image: napari.layers.image.image.Image = <Image layer '140329MusOilLD_fish1_01' at 0x1b98dc7a310>, preset: str = 'affine', fixed_mask: napari.layers.image.image.Image = None, moving_mask: napari.layers.image.image.Image = None, fixed_ps: pathlib.Path = WindowsPath('.'), moving_ps: pathlib.Path = WindowsPath('.'), param1: pathlib.Path = WindowsPath('.'), param2: pathlib.Path = WindowsPath('.'), param3: pathlib.Path = WindowsPath('.'), init_trans: pathlib.Path = WindowsPath('.'), output_dir: pathlib.Path = WindowsPath('.'), metric: str = 'AdvancedMattesMutualInformation', resolutions: int = 4, max_iterations: int = 500, nr_spatial_samples: int = 512, max_step_length: float = 1.0, masks: bool = False, save_output: bool = False, advanced: bool = False) -> napari.layers.image.image.Image>
bound = <BoundArguments (fixed_image=<Image layer 'Ref20131120pt14pl2' at 0x1b98dcab190>, moving_image=<Image layer '140329MusOilLD_fish1_01' at 0x1b98dc7a310>, preset='affine', fixed_mask=None, moving_mask=None, fixed_ps=WindowsPath('.'), moving_ps=WindowsPath('.'), param1=WindowsPath('.'), param2=WindowsPath('.'), param3=WindowsPath('.'), init_trans=WindowsPath('.'), output_dir=WindowsPath('.'), metric='AdvancedMattesMutualInformation', resolutions=4, max_iterations=500, nr_spatial_samples=512, max_step_length=1.0, masks=False, save_output=False, advanced=False)>
self._function = <function elastix_registration at 0x000001B9890371F0>
333 self._call_count += 1
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\elastix_napari\elastix_registration.py:192, in elastix_registration(fixed_image=<itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, moving_image=<itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, preset='affine', fixed_mask=None, moving_mask=None, fixed_ps='', moving_ps='', param1=WindowsPath('.'), param2=WindowsPath('.'), param3=WindowsPath('.'), init_trans='', output_dir=WindowsPath('.'), metric='AdvancedMattesMutualInformation', resolutions=4, max_iterations=500, nr_spatial_samples=512, max_step_length=1.0, masks=False, save_output=False, advanced=False)
191 # Run elastix registration
--> 192 result_image, result_transform_parameters = itk.elastix_registration_method(**kwargs)
kwargs = {'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type
'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'parameter_object': <itk.elxParameterObjectPython.elastixParameterObject; proxy of <Swig Object of type 'elastixParameterObject *' at 0x000001B9A3AB7CC0> >, 'fixed_point_set_file_name': '', 'moving_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True}
itk = <module 'itk' from 'C:\\Users\\mbreuilly\\micromamba\\envs\\devbio-napari-env\\lib\\site-packages\\itk\\__init__.py'>
194 # Convert result (itk.Image) to napari layer
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\itk\support\helpers.py:176, in accept_array_like_xarray_torch.<locals>.image_filter_wrapper(*args=(), **kwargs={'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'fixed_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'moving_point_set_file_name': '', 'parameter_object': <itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >})
175 else:
--> 176 return image_filter(*args, **kwargs)
image_filter = <function elastix_registration_method at 0x000001B9A3C7A550>
args = ()
kwargs = {'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type
'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'parameter_object': <itk.elxParameterObjectPython.elastixParameterObject; proxy of <Swig Object of type 'elastixParameterObject *' at 0x000001B9A3AB7CC0> >, 'fixed_point_set_file_name': '', 'moving_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True}
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\itk\itkElastixRegistrationMethodPython.py:1746, in elastix_registration_method(fixed_image=<itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, moving_image=<itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, fixed_mask=Ellipsis, moving_mask=Ellipsis, parameter_object=<itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >, initial_transform_parameter_file_name='', initial_transform_parameter_object=Ellipsis, fixed_point_set_file_name='', moving_point_set_file_name='', output_directory=Ellipsis, log_file_name=Ellipsis, log_to_console=True, log_to_file=Ellipsis, log_level=Ellipsis, number_of_threads=Ellipsis, *args=(), **kwargs={'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'fixed_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'moving_point_set_file_name': '', 'parameter_object': <itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >})
1744 kwargs.update(specified_kwarg_typehints)
-> 1746 instance = itk.ElastixRegistrationMethod.New(*args, **kwargs)
kwargs = {'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type
'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'parameter_object': <itk.elxParameterObjectPython.elastixParameterObject; proxy of <Swig Object of type 'elastixParameterObject *' at 0x000001B9A3AB7CC0> >, 'initial_transform_parameter_file_name': '', 'fixed_point_set_file_name': '', 'moving_point_set_file_name': '', 'log_to_console': True}
itk.ElastixRegistrationMethod = <itkTemplate itk::ElastixRegistrationMethod>
args = ()
itk = <module 'itk' from 'C:\\Users\\mbreuilly\\micromamba\\envs\\devbio-napari-env\\lib\\site-packages\\itk\\__init__.py'>
1747 return instance.__internal_call__()
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\itk\support\template_class.py:735, in itkTemplate.New(self=<itkTemplate itk::ElastixRegistrationMethod>, *args=(), **kwargs={'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'fixed_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'moving_point_set_file_name': '', 'parameter_object': <itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >})
734 raise itk.TemplateTypeError(self, input_type)
--> 735 return self[list(keys)[0]].New(*args, **kwargs)
keys = odict_keys([(<class 'itk.itkImagePython.itkImageSS2'>, <class 'itk.itkImagePython.itkImageSS2'>), (<class 'itk.itkImagePython.itkImageSS3'>, <class 'itk.itkImagePython.itkImageSS3'>), (<class 'itk.itkImagePython.itkImageSS4'>, <class 'itk.itkImagePython.itkImageSS4'>), (<class 'itk.itkImagePython.itkImageUC2'>, <class 'itk.itkImagePython.itkImageUC2'>), (<class 'itk.itkImagePython.itkImageUC3'>, <class 'itk.itkImagePython.itkImageUC3'>), (<class 'itk.itkImagePython.itkImageUC4'>, <class 'itk.itkImagePython.itkImageUC4'>), (<class 'itk.itkImagePython.itkImageUS2'>, <class 'itk.itkImagePython.itkImageUS2'>), (<class 'itk.itkImagePython.itkImageUS3'>, <class 'itk.itkImagePython.itkImageUS3'>), (<class 'itk.itkImagePython.itkImageUS4'>, <class 'itk.itkImagePython.itkImageUS4'>), (<class 'itk.itkImagePython.itkImageF2'>, <class 'itk.itkImagePython.itkImageF2'>), (<class 'itk.itkImagePython.itkImageF3'>, <class 'itk.itkImagePython.itkImageF3'>), (<class 'itk.itkImagePython.itkImageF4'>, <class 'itk.itkImagePython.itkImageF4'>), (<class 'itk.itkImagePython.itkImageD2'>, <class 'itk.itkImagePython.itkImageD2'>), (<class 'itk.itkImagePython.itkImageD3'>, <class 'itk.itkImagePython.itkImageD3'>), (<class 'itk.itkImagePython.itkImageD4'>, <class 'itk.itkImagePython.itkImageD4'>)])
self = <itkTemplate itk::ElastixRegistrationMethod>
kwargs = {'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type
'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'parameter_object': <itk.elxParameterObjectPython.elastixParameterObject; proxy of <Swig Object of type 'elastixParameterObject *' at 0x000001B9A3AB7CC0> >, 'initial_transform_parameter_file_name': '', 'fixed_point_set_file_name': '', 'moving_point_set_file_name': '', 'log_to_console': True}
args = ()
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\itk\itkElastixRegistrationMethodPython.py:857, in itkElastixRegistrationMethodISS2ISS2.New(*args=(), **kargs={'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'fixed_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'moving_point_set_file_name': '', 'parameter_object': <itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >})
856 from itk.support import template_class
--> 857 template_class.New(obj, *args, **kargs)
obj = <itk.itkElastixRegistrationMethodPython.itkElastixRegistrationMethodISS2ISS2; proxy of <Swig Object of type 'itkElastixRegistrationMethodISS2ISS2 *' at 0x000001B9A3C7FE70> >
template_class = <module 'itk.support.template_class' from 'C:\\Users\\mbreuilly\\micromamba\\envs\\devbio-napari-env\\lib\\site-packages\\itk\\support\\template_class.py'>
args = ()
kargs = {'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'parameter_object': <itk.elxParameterObjectPython.elastixParameterObject; proxy of <Swig Object of type 'elastixParameterObject *' at 0x000001B9A3AB7CC0> >, 'initial_transform_parameter_file_name': '', 'fixed_point_set_file_name': '', 'moving_point_set_file_name': '', 'log_to_console': True}
858 return obj
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\itk\support\template_class.py:800, in New(self=<itk.itkElastixRegistrationMethodPython.itkElast...trationMethodISS2ISS2 *' at 0x000001B9A3C7FE70> >, *args=(), **kargs={'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'fixed_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'moving_point_set_file_name': '', 'parameter_object': <itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >})
798 import itk
--> 800 itk.set_inputs(self, args, kargs)
self = <itk.itkElastixRegistrationMethodPython.itkElastixRegistrationMethodISS2ISS2; proxy of <Swig Object of type 'itkElastixRegistrationMethodISS2ISS2 *' at 0x000001B9A3C7FE70> >
args = ()
kargs = {'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'parameter_object': <itk.elxParameterObjectPython.elastixParameterObject; proxy of <Swig Object of type 'elastixParameterObject *' at 0x000001B9A3AB7CC0> >, 'initial_transform_parameter_file_name': '', 'fixed_point_set_file_name': '', 'moving_point_set_file_name': '', 'log_to_console': True}
itk = <module 'itk' from 'C:\\Users\\mbreuilly\\micromamba\\envs\\devbio-napari-env\\lib\\site-packages\\itk\\__init__.py'>
802 # now, try to add observer to display progress
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\itk\support\extras.py:1580, in set_inputs(new_itk_object=<itk.itkElastixRegistrationMethodPython.itkElast...trationMethodISS2ISS2 *' at 0x000001B9A3C7FE70> >, inargs=(), inkargs={'fixed_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD540> >, 'fixed_point_set_file_name': '', 'initial_transform_parameter_file_name': '', 'log_to_console': True, 'moving_image': <itk.itkImagePython.itkImageF3; proxy of <Swig O...t of type 'itkImageF3 *' at 0x000001B9A30FD6C0> >, 'moving_point_set_file_name': '', 'parameter_object': <itk.elxParameterObjectPython.elastixParameterOb...lastixParameterObject *' at 0x000001B9A3AB7CC0> >})
1579 else:
-> 1580 attrib(itk.output(value))
value = <itk.itkImagePython.itkImageF3; proxy of <Swig Object of type 'itkImageF3 *' at 0x000001B9A30FD540> >
attrib = <bound method itkElastixRegistrationMethodISS2ISS2_SetFixedImage of <itk.itkElastixRegistrationMethodPython.itkElastixRegistrationMethodISS2ISS2; proxy of <Swig Object of type 'itkElastixRegistrationMethodISS2ISS2 *' at 0x000001B9A3C7FE70> >>
itk = <module 'itk' from 'C:\\Users\\mbreuilly\\micromamba\\envs\\devbio-napari-env\\lib\\site-packages\\itk\\__init__.py'>
TypeError: Expecting argument of type itkImageSS2 or itkImageSourceISS2.
The above exception was the direct cause of the following exception:
EmitLoopError Traceback (most recent call last)
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\magicgui\widgets\bases\_value_widget.py:65, in ValueWidget._on_value_change(self=PushButton(value=False, annotation=None, name='call_button'), value=False) 63 if value is self.null_value and not self._nullable:
64 return
---> 65 self.changed.emit(value)
value = False
self.changed = <SignalInstance 'changed' on PushButton(value=False, annotation=None, name='call_button')>
self = PushButton(value=False, annotation=None, name='call_button')
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\psygnal\_signal.py:927, in SignalInstance.emit(self=<SignalInstance 'changed' on PushButton(value=False, annotation=None, name='call_button')>, check_nargs=False, check_types=False, asynchronous=False, *args=(False,))
924 sd.start()
925 return sd
--> 927 self._run_emit_loop(args)
self = <SignalInstance 'changed' on PushButton(value=False, annotation=None, name='call_button')>
args = (False,)
928 return None
File ~\micromamba\envs\devbio-napari-env\lib\site-packages\psygnal\_signal.py:974, in SignalInstance._run_emit_loop(self=<SignalInstance 'changed' on PushButton(value=False, annotation=None, name='call_button')>, args=(False,))
972 caller.cb(args)
973 except Exception as e:
--> 974 raise EmitLoopError(
caller = <psygnal._weak_callback._StrongFunction object at 0x000001B98DC73FA0>
args = (False,)
975 slot_repr=repr(caller), args=args, exc=e
976 ) from e
978 return None
EmitLoopError: calling <psygnal._weak_callback._StrongFunction object at 0x000001B98DC73FA0> with args=(False,) caused TypeError: Expecting argument of type itkImageSS2 or itkImageSourceISS2...