Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to register / change preset / use masks/ use advanced options #23

Closed
LemonJust opened this issue Feb 10, 2023 · 1 comment · Fixed by #25
Closed

Error when trying to register / change preset / use masks/ use advanced options #23

LemonJust opened this issue Feb 10, 2023 · 1 comment · Fixed by #25

Comments

@LemonJust
Copy link

LemonJust commented Feb 10, 2023

Hello everyone,

I tried using your plugin, and I encountered a problem when trying to run it. Specifically, when I choose the fixed image, the moving image, keep the rigid preset, and hit "register," the plugin is giving me an error ( traceback below ).
Other errors are happening when I try to click anything else (see a short video).
I am running Windows 10, and I'm including the list of packages I have installed.

elastix_issue.mp4

Thank you for making this plugin and for any assistance you can provide.

Best regards,
Anna


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
File src\psygnal\_signal.py:851, in _run_emit_loop()

File src\psygnal\_signal.py:1181, in __call__()

File ~\miniconda3\envs\napari-plugin-test\lib\site-packages\magicgui\widgets\_function_gui.py:212, in FunctionGui.__init__.<locals>._disable_button_and_call()
    211 try:
--> 212     self.__call__()
        self = <FunctionGui elastix_registration(fixed: napari.layers.image.image.Image = <Image layer '33' at 0x1d921ffc730>, moving: napari.layers.image.image.Image = <Image layer '0' at 0x1d92375ba90>, preset: str = 'rigid', fixed_mask: napari.layers.image.image.Image = None, moving_mask: napari.layers.image.image.Image = None, fixed_ps: Sequence[pathlib.Path] = (), moving_ps: Sequence[pathlib.Path] = (), param1: Sequence[pathlib.Path] = (), param2: Sequence[pathlib.Path] = (), param3: Sequence[pathlib.Path] = (), init_trans: Sequence[pathlib.Path] = (), metric: str = 'AdvancedMattesMutualInformation', resolutions: int = 4, max_iterations: int = 500, nr_spatial_samples: int = 512, max_step_length: float = 1.0, masks: bool = False, advanced: bool = False) -> napari.layers.image.image.Image>
    213 finally:

File ~\miniconda3\envs\napari-plugin-test\lib\site-packages\magicgui\widgets\_function_gui.py:324, in FunctionGui.__call__(self=<FunctionGui elastix_registration(fixed: napari....bool = False) -> napari.layers.image.image.Image>, update_widget=False, *args=(), **kwargs={})
    323 with _function_name_pointing_to_widget(self):
--> 324     value = self._function(*bound.args, **bound.kwargs)
        self = <FunctionGui elastix_registration(fixed: napari.layers.image.image.Image = <Image layer '33' at 0x1d921ffc730>, moving: napari.layers.image.image.Image = <Image layer '0' at 0x1d92375ba90>, preset: str = 'rigid', fixed_mask: napari.layers.image.image.Image = None, moving_mask: napari.layers.image.image.Image = None, fixed_ps: Sequence[pathlib.Path] = (), moving_ps: Sequence[pathlib.Path] = (), param1: Sequence[pathlib.Path] = (), param2: Sequence[pathlib.Path] = (), param3: Sequence[pathlib.Path] = (), init_trans: Sequence[pathlib.Path] = (), metric: str = 'AdvancedMattesMutualInformation', resolutions: int = 4, max_iterations: int = 500, nr_spatial_samples: int = 512, max_step_length: float = 1.0, masks: bool = False, advanced: bool = False) -> napari.layers.image.image.Image>
        bound = <BoundArguments (fixed=<Image layer '33' at 0x1d921ffc730>, moving=<Image layer '0' at 0x1d92375ba90>, preset='rigid', fixed_mask=None, moving_mask=None, fixed_ps=(), moving_ps=(), param1=(), param2=(), param3=(), init_trans=(), metric='AdvancedMattesMutualInformation', resolutions=4, max_iterations=500, nr_spatial_samples=512, max_step_length=1.0, masks=False, advanced=False)>
        self._function = <function elastix_registration at 0x000001D928A08280>
    326 self._call_count += 1

File ~\miniconda3\envs\napari-plugin-test\lib\site-packages\elastix_napari\elastix_registration.py:110, in elastix_registration(fixed=<Image layer '33'>, moving=<Image layer '0'>, preset='rigid', fixed_mask=None, moving_mask=None, fixed_ps=(), moving_ps=(), param1=(), param2=(), param3=(), init_trans=(), metric='AdvancedMattesMutualInformation', resolutions=4, max_iterations=500, nr_spatial_samples=512, max_step_length=1.0, masks=False, advanced=False)
    109     return utils.error("No images selected for registration.")
--> 110 if utils.check_filename(fixed_ps) != utils.check_filename(moving_ps):
        fixed_ps = ()
        moving_ps = ()
        utils = <module 'elastix_napari.utils' from 'C:\\Users\\Lemon\\miniconda3\\envs\\napari-plugin-test\\lib\\site-packages\\elastix_napari\\utils.py'>
    111     print("Select both fixed and moving point set.")

File ~\miniconda3\envs\napari-plugin-test\lib\site-packages\elastix_napari\utils.py:21, in check_filename(filename=())
     18 """
     19 Checks if filename adheres to the correct format.
     20 """
---> 21 if '.txt' in str(filename[0]) or '.vtk' in str(filename[0]):
        filename = ()
     22     return True

IndexError: tuple index out of range

The above exception was the direct cause of the following exception:

EmitLoopError                             Traceback (most recent call last)
File ~\miniconda3\envs\napari-plugin-test\lib\site-packages\magicgui\widgets\_bases\value_widget.py:57, in ValueWidget._on_value_change(self=PushButton(value=False, annotation=None, name='call_button'), value=False)
     55 if value is self.null_value and not self._nullable:
     56     return
---> 57 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 src\psygnal\_signal.py:805, in emit()

File src\psygnal\_signal.py:856, in _run_emit_loop()

EmitLoopError: calling <function FunctionGui.__init__.<locals>._disable_button_and_call at 0x000001D93D8AB4C0> with args=(False,) caused IndexError in emit loop.

Package                       Version
----------------------------- ----------
alabaster                     0.7.12
app-model                     0.1.1
appdirs                       1.4.4
asttokens                     2.2.1
attrs                         22.2.0
Babel                         2.11.0
backcall                      0.2.0
build                         0.9.0
cachey                        0.2.1
certifi                       2022.12.7
charset-normalizer            2.1.1
click                         8.1.3
cloudpickle                   2.2.0
colorama                      0.4.6
comm                          0.1.2
commonmark                    0.9.1
dask                          2022.12.1
debugpy                       1.6.5
decorator                     5.1.1
docstring-parser              0.15
docutils                      0.17.1
elastix-napari                0.1.7
entrypoints                   0.4
executing                     1.2.0
freetype-py                   2.3.0
fsspec                        2022.11.0
HeapDict                      1.0.1
hsluv                         5.0.3
idna                          3.4
imageio                       2.23.0
imagesize                     1.4.1
importlib-metadata            6.0.0
in-n-out                      0.1.6
ipykernel                     6.19.4
ipython                       8.8.0
ipython-genutils              0.2.0
itk                           5.3.0
itk-core                      5.3.0
itk-elastix                   0.15.0
itk-filtering                 5.3.0
itk-io                        5.3.0
itk_napari_conversion         0.3.1
itk-numerics                  5.3.0
itk-registration              5.3.0
itk-segmentation              5.3.0
jedi                          0.18.2
Jinja2                        3.1.2
jsonschema                    4.17.3
jupyter_client                7.4.8
jupyter_core                  5.1.2
kiwisolver                    1.4.4
locket                        1.0.0
magicgui                      0.6.1
MarkupSafe                    2.1.1
matplotlib-inline             0.1.6
mypy-extensions               0.4.3
napari                        0.4.17
napari-console                0.0.7
napari-itk-io                 0.2.0
napari-plugin-engine          0.2.0
napari-svg                    0.1.6
napari-vodex                  0.0.6
nest-asyncio                  1.5.6
networkx                      3.0
npe2                          0.6.1
numpy                         1.24.1
numpydoc                      1.5.0
packaging                     23.0
pandas                        1.5.2
parso                         0.8.3
partd                         1.3.0
pathlib                       1.0.1
pep517                        0.13.0
pickleshare                   0.7.5
Pillow                        9.4.0
Pint                          0.20.1
pip                           22.3.1
platformdirs                  2.6.2
pooch                         1.6.0
prompt-toolkit                3.0.36
psutil                        5.9.4
psygnal                       0.7.0
pure-eval                     0.2.2
pydantic                      1.10.4
Pygments                      2.14.0
PyOpenGL                      3.1.6
PyQt5                         5.15.7
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.11.0
pyrsistent                    0.19.3
python-dateutil               2.8.2
pytomlpp                      1.0.11
pytz                          2022.7
PyWavelets                    1.4.1
pywin32                       305
PyYAML                        6.0
pyzmq                         24.0.1
qtconsole                     5.4.0
QtPy                          2.3.0
requests                      2.28.1
rich                          13.0.1
scikit-image                  0.19.3
scipy                         1.10.0
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        4.5.0
sphinxcontrib.applehelp       1.0.3
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
stack-data                    0.6.2
superqt                       0.4.1
tifffile                      2022.10.10
tomli                         2.0.1
toolz                         0.12.0
tornado                       6.2
tqdm                          4.64.1
traitlets                     5.8.0
typer                         0.7.0
typing_extensions             4.4.0
urllib3                       1.26.13
vispy                         0.11.0
vodex                         1.0.7
wcwidth                       0.2.5
wheel                         0.38.4
wrapt                         1.14.1
zipp                          3.11.0
@ntatsisk
Copy link
Collaborator

ntatsisk commented May 8, 2023

Hi @LemonJust, thanks! The issue got fixed and hopefully the latest version 0.1.8 of plugin works now. I noticed that I closed the issue (long ago) without letting you know - sorry for that.

FYI,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants