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

Non-Rigid Registration Error #141

Open
ewestlundicr opened this issue Jul 11, 2024 · 0 comments
Open

Non-Rigid Registration Error #141

ewestlundicr opened this issue Jul 11, 2024 · 0 comments

Comments

@ewestlundicr
Copy link

ewestlundicr commented Jul 11, 2024

Hi,

I have a set of 20 czi-images to align and merge with Valis. The majority have been working great, but in 6 of them I get the following error when I reach the non-rigid alignment step.


Preparing images for non-rigid registration:   0%|          | 0/2 [00:00<?, ?image/s]
[c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\valis\valtils.py:25](file:///C:/Users/ewestlund/Documents/Python/Nicole_valis_merge/valis_merge_venv/lib/site-packages/valis/valtils.py:25): UserWarning: 'NoneType' object has no attribute 'pointer'
  warnings.warn(warning_msg, warning_type)
Traceback (most recent call last):
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\valis\registration.py", line 4624, in register
    non_rigid_registrar = self.non_rigid_register(rigid_registrar, slide_processors)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\valis\registration.py", line 4077, in non_rigid_register
    self.prep_images_for_large_non_rigid_registration(max_img_dim=self.max_non_rigid_registration_dim_px,
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\valis\registration.py", line 3850, in prep_images_for_large_non_rigid_registration
    vips_level_img = slide_obj.slide2vips(closest_img_level)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\valis\registration.py", line 485, in slide2vips
    vips_img = self.reader.slide2vips(level=level, series=series, xywh=xywh)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\valis\slide_io.py", line 1300, in slide2vips
    vips_slide = pyvips.Image.arrayjoin(
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\pyvips\vimage.py", line 256, in call_function
    return pyvips.Operation.call(name, *args, **kwargs)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\pyvips\voperation.py", line 282, in call
    op.set(name, intro.details[name]['flags'], match_image, value)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\pyvips\voperation.py", line 216, in set
    super(Operation, self).set(name, value)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\pyvips\vobject.py", line 117, in set
    gv.set(value)
  File "c:\Users\ewestlund\Documents\Python\Nicole_valis_merge\valis_merge_venv\lib\site-packages\pyvips\gvalue.py", line 221, in set
    gobject_lib.g_object_ref(image.pointer)
AttributeError: 'NoneType' object has no attribute 'pointer'

This is the script I've been using


from valis import registration

slide_src_dir = "../TMA Slide 12/TMA Slide 12 Scene 01" # Original files directory
results_dst_dir = "../TMA Slide 12/TMA Slide 12 Scene 01/registration" # Registration results saved here
merged_slide_dst_f = "../TMA Slide 12/TMA Slide 12 Scene 01/merged/TMA Slide 12 Scene 01.ome.tiff" # Where to save merged slide

registrar = registration.Valis(slide_src_dir, results_dst_dir)
rigid_registrar, non_rigid_registrar, error_df = registrar.register()

registrar.warp_and_merge_slides(merged_slide_dst_f, non_rigid=False)

registration.kill_jvm() # Kill the JVM

I'm using Python v3.10 and Valis v1.1.0.

If anyone has any ideas of what is causing the error, I would be very grateful.

Thank you

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

No branches or pull requests

1 participant