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

Performance optimization of real-time neuronavigation #529

Closed
rmatsuda opened this issue Feb 27, 2023 · 6 comments
Closed

Performance optimization of real-time neuronavigation #529

rmatsuda opened this issue Feb 27, 2023 · 6 comments
Assignees
Labels
enhancement neuronavigation Issues related to neuronavigation software
Milestone

Comments

@rmatsuda
Copy link
Collaborator

The real-time neuronavigation feature of InVesalius currently works based on multi-threading using Queues, Events, and Jobs (look at #242). Optimization (utilizing the least memory, minimizing its CPU time, and offering high speed) is needed to improve neuronavigation performance.

Deliverables:
Characterize step-by-step code execution time for neuronavigation
Improve threads' sleep times
Investigate: WX GUI becomes slower when navigation is on
Optimize 3D rendering/updating scene

@rmatsuda
Copy link
Collaborator Author

Some examples that can be improved:

  • CenterOfMass function
  • some self.Refresh can be removed or replaced by self.interactor.Render() (inside the viewer_volume neuronavigation loop)

@Kaushik-Iyer
Copy link
Contributor

After looking at #242 some of the python files have unused imports, will removing them help in this issue?

@jsxs0
Copy link
Contributor

jsxs0 commented Mar 7, 2023

@rmatsuda (@paulojamorim)

CenterOfMass function

I think we can use NumPy to perform the calculations in bulk rather than in a loop for the following (this could significantly improve performance):

    n = surface.GetNumberOfPoints()
    for i in range(n):
        point = surface.GetPoint(i)
        barycenter[0] += point[0]
        barycenter[1] += point[1]
        barycenter[2] += point[2]
    barycenter[0] /= n
    barycenter[1] /= n
    barycenter[2] /= n

    return barycenter

@rmatsuda
Copy link
Collaborator Author

rmatsuda commented Mar 7, 2023

Thanks for the comments! @Kaushik-Iyer removing the imports will not significantly improve the navigation performance. @jsxs0 The numpy could be a good aproach for the center of mass function. Also the vtkCenterOfMass can do the job. I'm not sure which is the best (in terms of performance).

@vhosouza vhosouza added enhancement neuronavigation Issues related to neuronavigation software labels Jun 23, 2023
@vhosouza
Copy link
Member

@rmatsuda is this issue still valid or the latest updates you made to optimize the performance solve it? Shall we close or investigate further?

@vhosouza vhosouza added this to the 3.2 milestone Jun 26, 2023
@rmatsuda
Copy link
Collaborator Author

The pull request #540 and #600 improved significantly the neuronavigation performance. I will close, thanks!

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

No branches or pull requests

4 participants