Skip to content

Error in cleaning after rigid registration: 'Valis' object has no attribute 'non_rigid_reg_kwargs' #218

@maxime915

Description

@maxime915

Hello,

I'm facing an issue when performing rigid registration (it doesn't happen in non-rigid/micro registration), which happens during the .cleanup method.

Measuring error: 100%|██████████| 2/2 [00:00<00:00, 1090.70image/s]
Traceback (most recent call last):
  File "/root/.local/lib/python3.12/site-packages/valis/registration.py", line 4763, in register
    self.cleanup()
  File "/root/.local/lib/python3.12/site-packages/valis/registration.py", line 4791, in cleanup
    self.non_rigid_reg_kwargs[NON_RIGID_REG_CLASS_KEY] = None
    ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Valis' object has no attribute 'non_rigid_reg_kwargs'. Did you mean: '_set_rigid_reg_kwargs'?

/root/.local/lib/python3.12/site-packages/valis/valtils.py:29: UserWarning: 'Valis' object has no attribute 'non_rigid_reg_kwargs'
  warnings.warn(warning_msg, warning_type)
JVM has been killed. If this was due to an error, then a new Python session will need to be started

This is the line which causes an issue.

self.non_rigid_reg_kwargs[NON_RIGID_REG_CLASS_KEY] = None

Because .cleanup is called in .register but non_rigid_reg_kwargs is only set if the registration is non-rigid.

self.cleanup()

I'd be happy to submit a PR that checks if those attribute exists before cleaning the registrar, if you're OK with that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions