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

Pass the polygon data to self._viewer.add_shapes() in a more efficient way #56

Open
3 tasks
LucaMarconato opened this issue Apr 27, 2023 · 2 comments
Open
3 tasks

Comments

@LucaMarconato
Copy link
Member

LucaMarconato commented Apr 27, 2023

Right now we have the polygons data inside a geodataframe object, and we convert this to a list of list of floats to pass it to self._viewer.add_shapes() with this code

coordinates = polygons.geometry.apply(lambda x: np.array(x.exterior.coords).tolist()).tolist()

which takes 4 seconds for 160K polygons.

We have to check:

  • if there is a better way to access this information within the GeoDataFrame object (maybe some buffer). I don't think this is possible
  • if there is a better way to pass this data to napari, maybe the ragged array representation.
  • if we can parallelize the conversion of this data.
@melonora
Copy link
Collaborator

Would you think of using async?

@LucaMarconato
Copy link
Member Author

Yes, this could be an option. But in general even remaining single-threaded I think that there must be a more performant way to pass the data to napari without having to change data type and create a lot of new list objects.

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