Skip to content
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

Annotations (from EyeLab tool) appear hindered when visualized using EyePy library #4

Open
Salmanshams67 opened this issue Oct 3, 2024 · 5 comments

Comments

@Salmanshams67
Copy link

Environment:

  • Eyepy library version: 0.11.3
  • Python version: 3.9.13

Description

I was annotating OCT scan images using the EyeLab tool and attempted to visualize these annotations using the eyepy library. However, the visualized annotations seem hindered or misaligned, suggesting that there might be an issue with how EyeLab is saving or formatting the annotations. I expected the annotations to be correctly visualized and aligned, just as they appear in the EyeLab tool.

Steps to Reproduce:

  1. Annotate any OCT scan using EyeLab.
  2. Save the annotations.
  3. Load the annotated file using the eyepy library and attempt to visualize it.
  4. Observe that the annotations appear hindered or misaligned in the saved .png file.

Expected Behavior:

Annotations should be correctly visualized and aligned when viewed using the eyepy library.

@Oli4 @actions-user

@Oli4
Copy link
Contributor

Oli4 commented Oct 4, 2024

Dear @Salmanshams67,

Thank you for bringing this to my attention. You are indeed correct—there appears to be a bug related to the layer annotations in EyeLab. Currently, EyeLab uses eyepy version 0.6.7, while the latest version is 0.12.2. At some point during the updates, I changed the orientation of the z-axis for layer annotations, which unfortunately led to a mismatch. When visualizing the first B-scan, the layers stored by EyeLab appear in the reverse order, displaying the last B-scan’s layers on the first B-scan’s image, and vice versa. Fortunately, this issue does not affect area annotations.

Regrettably, I don’t have the time at the moment to address this issue myself. However, you’re more than welcome to contribute a fix. There are a few potential solutions:

  • In eyepy, implement a simple function that flips the layer z-axis, making it easier to correct layer annotations imported from EyeLab.
  • Update EyeLab to use the latest version of eyepy, although this might introduce compatibility issues.
  • Alternatively, revert to the same eyepy version used by EyeLab (0.6.7) to ensure consistency.

Thank you again for your keen observation, and please let me know if you have any questions or need further clarification.

Best regards,
Olivier

@Salmanshams67
Copy link
Author

Salmanshams67 commented Oct 8, 2024

Dear @Oli4 ,

  • We successfully implemented a function that flips the layer along the z-axis.
  • Additionally, we modified the EyeLab dependency (eyepie==0.6.7) source code to facilitate the flipping of layers along the z-axis, allowing us to properly load the annotations generated by the Eyeseg model, as the layers were flipped previously.
  • We have updated EyeLab to utilize the latest version of eyepie (>=0.9.0). While we addressed the compatibility issues, running the eyelab/main.py file now results in the following error: AttributeError: module 'eyepy' has no attribute 'EyeVolumeVoxelAnnotation'.

Best regards,
Salman

@Oli4
Copy link
Contributor

Oli4 commented Oct 9, 2024

Dear @Salmanshams67,

The latest version of eyepy is v0.12.2. Initially, I was unable to publish the package under the correct name eyepy and had to use eyepie instead. Your issue with EyeVolumeVoxelAnnotation might be resolved in this version, although there have been other changes that could affect EyeLab.

I've been meaning to update EyeLab to the latest version of eyepy for some time now but haven't had the chance. If you're willing to make the update, I would be happy to review and accept a pull request.

Best regards,
Olivier

@Salmanshams67
Copy link
Author

Dear @Oli4 ,

I resolved the AttributeError: module 'eyepy' has no attribute 'EyeVolumeVoxelAnnotation' error, and now I can run the tool on both eyepy v0.12.2 and eyepie v0.11.3 (which is used by eyeseg). However, when I load the eyeseg-generated annotation (after running eyeseg segment) in EyeLab, the z-axis appears to be flipped. What could be the possible reason for this?

Best regards,
Salman

@Oli4
Copy link
Contributor

Oli4 commented Oct 13, 2024

Dear @Salmanshams67,

it might be enough to set the index in this function from index to len(data)-1-index. So we flip the axis here. This should also ensure that subsequent loading with eyepy works.

Let me know if this solved the issue.

Best Olivier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants