MathOnco / valis

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

UnboundLocalError: local variable 'reader' referenced before assignment #74

Closed WXY-Belief closed 1 year ago

WXY-Belief commented 1 year ago

Hello, I would like to ask for assistance with the following error I encountered while using this tool. How can I resolve it?

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. JVM has been initialized. Be sure to call registration.kill_jvm() or slide_io.kill_jvm() at the end of your script.

==== Converting images

0%| | 0/3 [00:00<?, ?it/s]C:\Users\24667.conda\envs\align_img\lib\site-packages\valis\valtils.py:21: UserWarning: Attempting to read C:\Users\24667\PycharmProjects\Align_img\ISS_DATA\data_2\DAPI_1.tif created the following error: Traceback (most recent call last): File "C:\Users\24667.conda\envs\align_img\lib\site-packages\valis\registration.py", line 3930, in register self.convert_imgs(series=self.series, reader_cls=reader_cls) File "C:\Users\24667.conda\envs\align_img\lib\site-packages\valis\registration.py", line 2255, in convert_imgs slide_dims = reader.metadata.slide_dimensions UnboundLocalError: local variable 'reader' referenced before assignment

invalid index to scalar variable. warnings.warn(warning_msg, warning_type) 0%| | 0/3 [00:00<?, ?it/s] C:\Users\24667.conda\envs\align_img\lib\site-packages\valis\valtils.py:21: UserWarning: local variable 'reader' referenced before assignment warnings.warn(warning_msg, warning_type) Traceback (most recent call last): File "C:\Users\24667\PycharmProjects\Align_img\1.py", line 36, in merged_img, channel_names, ome_xml = registrar.warp_and_merge_slides(dst_f, File "C:\Users\24667.conda\envs\align_img\lib\site-packages\valis\valtils.py", line 29, in wrapper return f(*args, **kwargs) File "C:\Users\24667.conda\envs\align_img\lib\site-packages\valis\registration.py", line 4423, in warp_and_merge_slides slide_obj = self.slide_dict[slide_name] KeyError: 'DAPI_1' JVM has been killed. If this was due to an error, then a new Python session will need to be started

Process finished with exit code 1

cdgatenbee commented 1 year ago

Hi @WXY-Belief, It looks like there was a problem finding the correct image reader, but I made some changes to the code that may have fixed it. Could you maybe try this again using the most recent update (1.0.1) and let me know if you get the same error?

Best, -Chandler

WXY-Belief commented 1 year ago

This problem might have been caused by incorrect parameter combinations. It's been a long time, and I've forgotten how to resolve it. However, this should be a relatively easy issue to fix.