MathOnco / valis

Virtual Alignment of pathoLogy Image Series
https://valis.readthedocs.io/en/latest/
MIT License
119 stars 29 forks source link

xmlschema.exceptions error on Windows WSL only #64

Closed Raoufsk closed 1 year ago

Raoufsk commented 1 year ago

Hello, We have been using VALIS in our Lab for some time in it is amazing. We use the docker installation on Ubuntu machines. Recently another team wanted to install it on their machine which is a Windows machine so I did all the necessary work (WSL, Docker, VALIS).

Using the same script and the same images that work in Ubuntu, we get this error which I do not understand since it is a docker installation and not a manual one.

Here is the error:

JVM has been initialized. Be sure to call registration.kill_jvm() or slide_io.kill_jvm() at the end of your script. ==== Converting images 100%|██████████| 2/2 [01:23<00:00, 41.65s/it] ==== Processing images 100%|██████████| 2/2 [00:29<00:00, 14.66s/it] ==== Normalizing images 100%|██████████| 2/2 [00:01<00:00, 1.91it/s] ==== Rigid registraration 100%|██████████| 2/2 [00:01<00:00, 1.02it/s] ======== Detecting features 100%|██████████| 2/2 [00:23<00:00, 11.77s/it] ======== Matching images 100%|██████████| 1/1 [00:29<00:00, 29.08s/it]
======== Sorting images 100%|██████████| 1/1 [00:29<00:00, 29.14s/it] ======== Calculating transformations 100%|██████████| 1/1 [00:00<00:00, 198.28it/s]
100%|██████████| 2/2 [00:00<00:00, 883.85it/s] ======== Rigid registration complete in 53.441 seconds ==== Non-rigid registraration ======== Preparing images for non-rigid registration 100%|██████████| 2/2 [00:23<00:00, 11.77s/it]
100%|██████████| 1/1 [00:15<00:00, 15.35s/it] ======== Non-rigid registration complete in 17.6 seconds ==== Measuring error 100%|██████████| 2/2 [00:01<00:00, 1.13it/s]
0%| | 0/2 [01:09<?, ?it/s]

Traceback (most recent call last):
File "/mnt/e/VALIS/register.py", line 27, in registrar.warp_and_save_slides(registered_slide_dst_dir, crop="overlap")

File "/usr/local/src/valis/valtils.py", line 29, in wrapper
return f(*args, kwargs)
File "/usr/local/src/valis/registration.py", line 4332, in warp_and_save_slides slide_obj.warp_and_save_slide(dst_f=dst_f, level = level,
File "/usr/local/src/valis/valtils.py", line 29, in wrapper
return f(*args, *kwargs)
File "/usr/local/src/valis/registration.py", line 983, in warp_and_save_slide
ome_xml_obj = slide_io.update_xml_for_new_img(current_ome_xml_str=slide_meta.original_xml,
File "/usr/local/src/valis/valtils.py", line 29, in wrapper
return f(
args,
kwargs)
File "/usr/local/src/valis/slide_io.py", line 2622, in update_xml_for_new_img
og_ome = ome_types.from_xml(current_ome_xml_str, parser="xmlschema")
File "/usr/local/src/.venv/lib/python3.10/site-packages/ome_types/_convenience.py", line 106, in from_xml
d = to_dict(os.fspath(xml), parser=parser, validate=validate)
File "/usr/local/src/.venv/lib/python3.10/site-packages/ome_types/_convenience.py", line 73, in to_dict
d = parser(xml) if validate is None else parser(xml, validate=validate)
File "/usr/local/src/.venv/lib/python3.10/site-packages/ome_types/_xmlschema.py", line 239, in xmlschema2dict
result = xmlschema.to_dict(xml, schema=schema, converter=converter, **kwargs)
File "/usr/local/src/.venv/lib/python3.10/site-packages/xmlschema/documents.py", line 296, in to_dict
source, _schema = get_context(xml_document, schema, cls, locations, base_url,
File "/usr/local/src/.venv/lib/python3.10/site-packages/xmlschema/documents.py", line 83, in get_context
raise XMLSchemaValueError(msg)
xmlschema.exceptions.XMLSchemaValueError: cannot get a schema for XML data, provide a schema argument

cdgatenbee commented 1 year ago

Hi @Raoufsk,

So happy to hear that you're finding valis useful, but sorry you're running into this issue. I don't have that much experience with Docker, and I too would think that it should work the same on the Windows machine as it does on the Ubuntu ones. This should especially be true since all of the Python dependencies are "pinned" (most relevantly, xmlschema 2.1.1 and ome-types 0.3.3), and so should be the same version no matter the platform. So, unfortunately, I don't I can be of much help here. However, I did notice that ome-types was recently updated to 0.4, and it looks like xmlschema is an optional dependency, so perhaps that will resolve this issue in the next update? Sorry I couldn't be of more help.

Best, -Chandler

Raoufsk commented 1 year ago

Hello Chandler, Thanks for the replay! The problem seems to be related to JAVA JRE installation. I don't understand much about it but my scripts are working once I installed JAVA JRE.

Best, Raouf

cdgatenbee commented 1 year ago

That's great news, glad you were able to figure it out, @Raoufsk! I'll go ahead and close the issue. Thanks for sharing your solution.

Best, -Chandler