JingyiGF / HERBS

MIT License
18 stars 15 forks source link

Unable to load histology image #8

Open ishiangoli opened 2 years ago

ishiangoli commented 2 years ago

Currently using HERBS on Windows 10. I am however unable to upload my own histology image and receive this error message in the terminal when I select an image to upload:

"...image_curves.py", line 277, in reset_plot for i in range(len(self.hist_data)): TypeError: object of type 'NoneType' has no len()

JingyiGF commented 2 years ago

Hi, what type of histological image did you upload? .jpg? .tif? .czi? OR?

ishiangoli commented 2 years ago

Hi I tried uploading .tif and then tried again with .jpg

JingyiGF commented 2 years ago

Both don’t work? Could you please state the procedure/steps you did? If ok for you, could you share the image with me so I can find the problem immediately without guessing the error here. As I can upload both format without problems. You can find my email address on the front page of my GitHub. Thanks.

Best,

在 2022年9月29日,14:22,ishiangoli @.***> 写道:

 Hi I tried uploading .tif and then tried again with .jpg

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

JingyiGF commented 2 years ago

We can not re-produce the problem you had. We have Windows 10 with virtual env or Conda. We have no problem uploading histological images within both env with 64bits operating system and 64bits Python. What is your operating system? 64 bit or 32 bit? What about Python? which version? 64bit Python or? What are the versions of all dependencies you have? did you make a new env before you install HERBS? Or do you have old dependencies installed for other projects?

nataliekoh commented 1 year ago

I am facing the same issue with the same error message on Windows 10, Python v3.9, with a new environment made before installing HERBS.

JingyiGF commented 1 year ago

Hi @nataliekoh, I wonder which type of image you tried? .czi?

JingyiGF commented 1 year ago

If it is not .czi, can you close HERBS and reopen it and try again, make sure there is no other error message before you load images.

If it is .czi, can you try the follow code, where czi_path is a string of the path of your .czi file.

from aicspylibczi import CziFile

czi = CziFile(czi_path) czi_info = czi.dims dimensions = czi.get_dims_shape() is_mosaic = czi.is_mosaic() pixel_type = czi.pixel_type

len(dimensions)

if you print out and show me czi_info, dimensions, is_mosaic, and pixel_type, we probably can find the problem :-)

nataliekoh commented 1 year ago

Hi Jingyi, thank you for replying so quickly! I tried uploading a couple of TIF images. I did close the conda terminal and HERBS application twice, but that didn't work.

Here are the error messages I am getting:

Python 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information.

import herbs herbs.run_herbs() test multi series Traceback (most recent call last): File "...\anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4507, in load_image self.load_single_image_file(self.current_img_path, image_file_type) File "...\anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4562, in load_single_image_file self.image_view.set_data(image_file) File "...\anaconda3\envs\herbs\lib\site-packages\herbs\image_view.py", line 262, in set_data self.volume_img = copy.deepcopy(self.image_file.data['scene 0']) KeyError: 'scene 0' test multi series Traceback (most recent call last): File "...\anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4507, in load_image self.load_single_image_file(self.current_img_path, image_file_type) File "...\anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4562, in load_single_image_file self.image_view.set_data(image_file) File "...\anaconda3\envs\herbs\lib\site-packages\herbs\image_view.py", line 243, in set_data self.curve_widget.reset_pressed() File "...\anaconda3\envs\herbs\lib\site-packages\herbs\image_curves.py", line 671, in reset_pressed self.curve_plot.change_line_type('gamma') File ...\anaconda3\envs\herbs\lib\site-packages\herbs\image_curves.py", line 317, in change_line_type self.reset_plot() File "...\anaconda3\envs\herbs\lib\site-packages\herbs\image_curves.py", line 277, in reset_plot for i in range(len(self.hist_data)): TypeError: object of type 'NoneType' has no len()

JingyiGF commented 1 year ago

Hmmmm, TIF... To be honest, .tif is in testing. the problem for me is that we don't have so many different TIFs to test. Our TIF images are too uniformly saved. So if you could share one of your tif file with me, I can fix the problem. you can find my email on the front page of this GitHub.

From the error messages you reported (there is a line says 'test multi series', it is what I write in the code to tell me it is in testing phase), either you tif contains multiple scenes or multiple pages or it is a big tiff. No matter which type, I do not have such a tif to test before. I would be very grateful if you could share one of the image with me 🥰

nataliekoh commented 1 year ago

Ah, okay. Yes, I'll email you a couple of TIF images! Thanks so much for looking into this!

ishiangoli commented 1 year ago

Hello, I just thought I would add that I am experiencing this issue too but also with .jpg files. When saving images on imageJ which we often use for histology it is usually in a tif or jpg format, I am not sure how to save as a czi.

JingyiGF commented 1 year ago

Hi, thank you all for the feedback. @ishiangoli, could you please share one jpg image with me that you can not upload? The best will be the jpg you saved from imageJ. I have update the tif reader on GitHub today, not on PyPI yet. Trying to finish some more before updating PyPI.

JingyiGF commented 1 year ago

Hi @nataliekoh, as what we discussed through emails. I update the code on GitHub and PyPI for your .tif file. I can upload your tif file locally without any problem now. Please let me know how it goes with you.

nataliekoh commented 1 year ago

Hi Jingyi, I am able to load my .tif images now. Thank you so much for resolving this issue!