marksgraham / OCT-Converter

Tools for extracting the raw optical coherence tomography (OCT) and fundus data from proprietary file formats.
https://pypi.org/project/oct-converter/
MIT License
193 stars 70 forks source link

NameError: name 'laterality' is not defined #132

Closed opennog closed 8 months ago

opennog commented 8 months ago

Hi,

I just received some .e2e data, and when doing e2e.read_fundus_image() it does not seem to have chunk.type == 11, only chunk.type == 1073741824. So when this condition if chunk.ind == 0: # fundus data is satisfied the code fails with the following error:

NameError: name 'laterality' is not defined Traceback (most recent call last): File "/home/oscar/CODE/Test/venv38/lib/python3.8/site-packages/oct_converter/readers/e2e.py", line 368, in read_fundus_image laterality_dict[image_string] = laterality UnboundLocalError: local variable 'laterality' referenced before assignment

I'd appreciate if you fixed this on the latest version, in versions <0.6.0 it did not happen.

Unfortunately, I can not share the data, but I can test in local if you need me to :)

Best,

marksgraham commented 8 months ago

Hi,

Would you be able to tell me which version it started happening on, to help debugging? This is a list of the versions: https://pypi.org/project/oct-converter/#history

opennog commented 8 months ago

Yes, as I said, it started happening in 0.6.0. I think you just need to declare laterality=None before the loop.

In 0.5.12 the output is the following: image

Thanks

marksgraham commented 8 months ago

can you try the fix with pip install git+https://github.com/marksgraham/OCT-Converter. if that works i'll do a release

opennog commented 8 months ago

Thanks, yes, it works as expected. Thanks

marksgraham commented 8 months ago

released the new version https://pypi.org/project/oct-converter/0.6.2/