MathOnco / valis

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

TypeError:'NoneType' object is not subscriptable #110

Closed syy-create closed 6 months ago

syy-create commented 7 months ago

Hello author, after configuring the environment and running register.and_merge_cycif.py in the instance, I encountered this result during the output process. Do I need to handle these red and green characters? If not handled, will it have an impact? 1712047241039

The final result is as follows:

Traceback(most recent call last): File "/va1ls-main/examples/register _and merge_cycif.py", line 87, in merged img, channel_names, ome_xml = registrar.warp_and_merge_slides(dst_fFile "anaconda3/envs/torch11.6/lib/python3.8/site-packages/valis/valtils.py", line 121, in wrapper return f{*args,kwargs)File "anaconda3/envs/torch11.6/lib/python3.8/site packages/valis/registration.py", line 3904, in warp and merge siideswarped_slide = keep_channels[0].bandjoin(keep _channels[1:])IndexError:list index out of nange**

cdgatenbee commented 7 months ago

Hi @syy-create, The colored text in the screenshot should be safe to ignore. The text that is in red is usually white (not sure why they are red here), and green is of a less warning and more a messages to let you know what valis is doing. Based on the your output though, it looks like the registration completed, but there was an error merging the registered images (presumably immunofluorescent images). Were these results generated using the example images in examples/example_datasets/cycif , or some of your own? Please let me know and we can go from there.

Best, -Chandler

syy-create commented 7 months ago

Hi @cdgatenbee , Thank you for your answer. I have prepared the environment and successfully ran examples/example_datasets/cycif. But I encountered another problem, when I was running the example in the reference document, I found that there was one without a progress bar, displaying Measuring error. Excuse me, is this normal? Is it my problem (I didn't write this part of the code)。 1712480719564 1712480812302

cdgatenbee commented 7 months ago

Hi @syy-create, Based on the messages, it looks like valis is running without issue. It just looks like the "Measuring error" message got printed after the process began, which is why the progress bar is empty on that line. However, a few lines down the progress bar gets updated and completed (green arrow), indicating that the registration error was estimated for all samples:

image

So, while it looks like valis is running without error, the output is formatted differently than expected, as it should look more like this:

image

I'm not sure why the formatting of the messages is different, but it does at least seem that valis is running as expected.

Best, -Chandler

syy-create commented 7 months ago

HI @cdgatenbee , Thank you again. I am running the High resolution registration for the instance document, and the code is as follows: 1712669955447

I want to obtain a registration result of 40x at a magnification of 10x, but during operation, the program suddenly froze. I am not sure if it is a computer problem or a program problem, so I would like to inquire about the requirements for using computer equipment to ensure that it is not a hardware issue. Can you help me check where the problem lies? 1712670037960

cdgatenbee commented 7 months ago

Hi @syy-create, In this case it looks like the program was stopped due to excessive memory usage (see (https://stackoverflow.com/questions/43268156/process-finished-with-exit-code-137-in-pycharm). Does it work when micro_reg_fraction is smaller, maybe 0.1? If so, that would further suggest that this is probably a memory issue.

Best, -Chandler

syy-create commented 7 months ago

hi @cdgatenbee , Thank you, I will set the parameter to 0.1 and try again. By the way, may I ask

  1. The official document's Slide registration states that registration will be done at a low magnification. What is the registration magnification used for registration
  2. If my image has a maximum magnification of 40x and micro_reg'fraction=0.1, will it be registered in a 4x field of view?
syy-create commented 7 months ago

Hi @cdgatenbee , I'm sorry to bother you again, but I tried to set the micro_reg_fract parameter to 0.1 and luckily resolved the memory issue. But I encountered a new situation where it showed that I was returning a Nonetype. 1712672727554

syy-create commented 7 months ago

Hi @cdgatenbee , I'm sorry to bother you again, but I do need your help. In the example of running the slide registration document, the code works very well. However, when attempting High resolution registration, using one's own data or example data, the same error occurred when running the code. It returned an empty type, and I want to know how to handle this error. The code and error message are as follows: image

1713268524993

cdgatenbee commented 7 months ago

Hi @syy-create, Thanks for bringing this to my attention. I'll see if I can recreate the issue, but can you let me know which of the example datasets you're using? I'll test both, but I'll start with the same one that is causing the error.

Best, -Chandler

syy-create commented 7 months ago

Hi, @cdgatenbee Thank you. Yes,I will. The valis-wsi version I am using is 1.0.4. The sample code I am using(https://valis.readthedocs.io/en/latest/examples.html#high-resolution-registration), Use two datasets for testing, one for the data ihc in the example(https://github.com/MathOnco/valis/tree/main/examples/example_datasets/ihc), The other one is my own dataset, and I want to send this data. However, due to file size limitations, I am unable to send directly.

syy-create commented 6 months ago

Hi, @cdgatenbee , I would like to know if you have encountered the same problem. If so, how did you solve it? If not, it may be my unilateral problem, and I will try to find other solutions. Good luck!

cdgatenbee commented 6 months ago

Hi @syy-create, Many apologies, I've had a few deadlines to meet, and haven't yet been able to try to reproduce this issue. I'll be sure to let you know when I can though, which should be fairly soon.

Best, -Chandler

syy-create commented 6 months ago

Hi @syy-create, Many apologies, I've had a few deadlines to meet, and haven't yet been able to try to reproduce this issue. I'll be sure to let you know when I can though, which should be fairly soon.

Best, -Chandler

Hi @cdgatenbee , I am glad for your reply and look forward to your results. Because I really want to know if it's an error caused by myself or a problem with the code. Good luck!

ViriatoII commented 6 months ago

Hi @syy-create,

I have the same problem.

the bk_dxdy instance variable of the slide_obj object is NoneType instead of being a matrix

bk_dxdy : ndarray
    (2, N, M) numpy array of pixel displacements in
    the x and y directions. dx = bk_dxdy[0], and dy=bk_dxdy[1]. Used
    to warp images. Found using the rigidly aligned version of the
    processed image.
cdgatenbee commented 6 months ago

Hi @syy-create and @ViriatoII, Sorry for the delay, but I've finally knocked some things off the todo list and can get to investigating this again. @ViriatoII, are you have this issue with the example dataset as well?

Best, -Chandler