-
Notifications
You must be signed in to change notification settings - Fork 14
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
Unable to load histology image - object of type 'NoneType' has no len() #11
Comments
Hi Johannes,
Thank you for the feedback. May I know which version of Python are you using? 64bit 3.8.10? Or? Operating system? Which version of HERBS? Version of Pyqt5 and version of pyqtgraph? So I can re-produce the same error and debug. Many thanks 🙏
Best,
Jingyi
… 在 2022年10月3日,15:01,JHartig ***@***.***> 写道:
Hey guys. I installed HERBS a few days ago via Anaconda and python 3.8.
However, now I am unable to load any histological image, be it .tiff, .png or a .czi file.
It always gives me the following error type:
TypeError: object of type 'NoneType' has no len()
Also, after loading the atlas volume (Mouse brain, Allen, 10um), the atlas is properly display and everything's working in 3D, however there are these 2 error lines popping up. Any idea what this means:
Traceback (most recent call last):
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 5084, in load_previous_atlas
self.load_volume_atlas(atlas_folder)
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 5037, in load_volume_atlas
self.set_volume_atlas_3d(unique_label, meshdata, small_meshdata_list)
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4952, in set_volume_atlas_3d
mesh = gl.GLMeshItem(meshdata=small_meshdata_list[str(id)], smooth=True,
KeyError: '545'
test multi series
Traceback (most recent call last):
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4753, in load_image
self.load_single_image_file(self.current_img_path, image_file_type)
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4808, in load_single_image_file
self.image_view.set_data(image_file)
File "C:\Users\AG Ip\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'
All the best,
Johannes
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
|
Python 3.8.13, 64bit, windows 10 pro, pyqt5 =5.15.7, pyqtgraph=0.12.3, Version of HERBS should be the most current one |
For some I couldn't pull 3.8.10, but I hope that's not the issue, as generally everything is running. So whenever I open the downloaded 10um Allen mouse brain atlas, it gives me this error: Traceback (most recent call last): |
If you tell me how to find out which version of HERBS I downloaded, I'll happily tell you (Coding beginner here ;) ) |
UPDATE @JingyiGF : So the importing of images works now. Don't ask me why it works now. But the '545' error is still there after I imported the atlas. However until now that didn't affect functionality. I'd be interested nonetheless in what the 'scene 0' and '545' errors mean, in case I encounter them again. Many thanks. Best, Johannes :) |
Hi Johannes, Sorry for the late reply. And thank you for the checking and clear error messages and updates. it is a bit difficult for me to test and reply out of working hours. There were basically two errors, one is for '545' and the other one is for 'scene 0'. '545' is a the label for a brain region, this label exists in the segmentation/annotation file. However, if you check the meshes that can be downloaded from http://download.alleninstitute.org/informatics-archive/current-release/mouse_ccf/annotation/ccf_2017/structure_meshes you will see that there is no 545.obj file. This is because this brain region is labeled on only two voxels, which can not be made as a 3D mesh. Since there is no such a mesh file for label with id==545, I basically just ignore this file in the old code while processing it. But apparently it shows an error while loading the atlas. I update the code to deal with it now. Well, I had another open issue also stated the same problem while loading histological images. However I could not re-produce the error message, I am still debugging to see what the problem is. But for 'scene 0', it is the key I use to store multiple images when the loading file has .czi format. As .czi file can contains multiple images and each image can be viewed separately (with different scene), so 'scene x' indicates which image is displayed. When only one .jpg file loaded, there is only 'scene 0' as the whole file is considered to be as one image. I hope my explanation is clear and this helps. Please let me know when there is other issues or you find the problem while loading histological images. And please update the code and reprocess the atlas. Do you still have the problem while loading histological images? Best, |
Hey Jingyi,
Thanks a lot for taking the time to explain! I‘ll update the code and reload the atlas.
Is there a simple way to do it, such as „herbs_update.herbs()“ or do I have to create a new environment and do the pip install anew?
Indeed it was a .czi file, however I could load another one after a restart without any problem. Curious what kind of error that is though. Already thought that it’s probably the layering.
Best,
Johannes
…---------------------------------------------------------------------------
Dr. (UMF) J. Hartig, MD
Assistenzarzt/Clinician Scientist
Department of Neurology
Experimental Movement Disorders Group (AG Prof. Ip)
University Hospital Wuerzburg
Josef-Schneider Street No. 11, Haus B1
97080 Wuerzburg, Germany
+4993120123228
https://orcid.org/0000-0002-3669-8856
Bitte beachten Sie die Datenschutzhinweise des Universitätsklinikum Würzburg<https://www.ukw.de/recht/datenschutz/>!
________________________________
Von: Jingyi G. Fuglstad ***@***.***>
Gesendet: Dienstag, 4. Oktober 2022 12:50:13
An: JingyiGF/HERBS
Cc: Hartig, Johannes; Author
Betreff: [EXT] Re: [JingyiGF/HERBS] Unable to load histology image - object of type 'NoneType' has no len() (Issue #11)
Hi Johannes,
Sorry for the late reply. And thank you for the checking and clear error messages and updates. it is a bit difficult for me to test and reply out of working hours.
There were basically two errors, one is for '545' and the other one is for 'scene 0'. '545' is a the label for a brain region, this label exists in the segmentation/annotation file. However, if you check the meshes that can be downloaded from http://download.alleninstitute.org/informatics-archive/current-release/mouse_ccf/annotation/ccf_2017/structure_meshes
you will see that there is no 545.obj file. This is because this brain region is labeled on only two voxels, which can not be made as a 3D mesh.
Since there is no such a mesh file for label with id==545, I basically just ignore this file in the old code while processing it. But apparently it shows an error while loading the atlas. I update the code to deal with it now.
Well, I had another open issue also stated the same problem while loading histological images. However I could not re-produce the error message, I am still debugging to see what the problem is. But for 'scene 0', it is the key I use to store multiple images when the loading file has .czi format. As .czi file can contains multiple images and each image can be viewed separately (with different scene), so 'scene x' indicates which image is displayed. When only one .jpg file loaded, there is only 'scene 0' as the whole file is considered to be as one image.
I hope my explanation is clear and this helps. Please let me know when there is other issues or you find the problem while loading histological images. And please update the code and reprocess the atlas.
Do you still have the problem while loading histological images?
Best,
Jingyi
—
Reply to this email directly, view it on GitHub<#11 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3M2LDLT5JJKEADFIGA6HMDWBQDWLANCNFSM6AAAAAAQ3SMIJ4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Good idea. I will try to make one when I finish other things :-) I remember I have seen .czi file with the same type of problems. It was a file that contains no images, but only notes for scanning. Ok let us see how it looks, if you run the following code, where czi_path is a string of the path of your .czi file. from aicspylibczi import CziFile czi = CziFile(czi_path) len(dimensions) if you print out and show me czi_info, dimensions, is_mosaic, and pixel_type, we probably can find the problem :-) |
I was thinking to screen shot some anaconda updates thing and how to control packages thing when I was at work. But I eventually left work a bit earlier today.... you don't have to create a new env, just go to the terminal in the env you have, pip install herbs==0.0.17, other packages will be checked, but not installed again (because they are already there). I only have PyCharm and virtualenv at home, I will take screen shot for you tomorrow when I am at work. |
I made 2 screenshots and make a file 'create environment using Anaconda' in Tutorial on GitHub. Please go to HERBS-code to check. Hope this helps. |
Hey Jingyi. Thanks a lot for the detailed info. I got the new version running, and everything's going smoothly for now! I will let you know regarding the CZI thing, when I've got time to test it out |
Hey! Came across another error. I saved a project and tried to reload it. Traceback (most recent call last): |
Hey guys. I installed HERBS a few days ago via Anaconda and python 3.8.
However, now I am unable to load any histological image, be it .tiff, .png or a .czi file.
It always gives me the following error type:
TypeError: object of type 'NoneType' has no len()
Also, after loading the atlas volume (Mouse brain, Allen, 10um), the atlas is properly display and everything's working in 3D, however there are these 2 error lines popping up. Any idea what this means:
Traceback (most recent call last):
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 5084, in load_previous_atlas
self.load_volume_atlas(atlas_folder)
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 5037, in load_volume_atlas
self.set_volume_atlas_3d(unique_label, meshdata, small_meshdata_list)
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4952, in set_volume_atlas_3d
mesh = gl.GLMeshItem(meshdata=small_meshdata_list[str(id)], smooth=True,
KeyError: '545'
test multi series
Traceback (most recent call last):
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4753, in load_image
self.load_single_image_file(self.current_img_path, image_file_type)
File "C:\Users\AG Ip\Anaconda3\envs\herbs\lib\site-packages\herbs\herbsgui.py", line 4808, in load_single_image_file
self.image_view.set_data(image_file)
File "C:\Users\AG Ip\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'
All the best,
Johannes
The text was updated successfully, but these errors were encountered: