NeuroML / pyNeuroML

A single package in Python unifying scripts and modules for reading, writing, simulating and analysing NeuroML2/LEMS models.
https://docs.neuroml.org/Userdocs/Software/pyNeuroML.html
GNU Lesser General Public License v3.0
34 stars 30 forks source link

Add option to save vispy generated meshdata #278

Open sanjayankur31 opened 7 months ago

sanjayankur31 commented 7 months ago

This will allow visualisation in other tools, such as paraview.

This should be simple enough, given that vispy provides the required I/O functions. We only have to save the mesh after we generate it

https://vispy.org/api/vispy.io.mesh.html#vispy.io.mesh.read_mesh

Dhruvanshu-Joshi commented 4 months ago

Hi @sanjayankur31 , I would like to work on this issue. I did read the codebase and according to my understanding, the PlotMorphologyVispy currently uses vispy for visualisation. I believe that a solution to this would involve adding a new parameter to plot_3D_cell_morphology. Based on the truth value of this parameter, we can make calls to new functions: save_meshdata_to_file which will use vispy's write_mesh function to save the mesh files. Is this what you had in mind and can you please assign this issue to me?

sanjayankur31 commented 4 months ago

Hi @Dhruvanshu-Joshi , yes that sounds correct. Do take a look at what common formats for storing mesh data are. I think the paraview docs do have some information on that. The ideal case would be that our code generates the mesh in a standard format so that any other tools can be used to then visualise it.

(A complementary tweak could also be to allow our methods to then read these meshes and visualise them)

Assigning this to you now. Thanks very much for working on this.

A few notes:

Dhruvanshu-Joshi commented 4 months ago

Hi @sanjayankur31 , I am able to save the 3d mesh in .obj and .gz format only as these are the only formats supported by vispy yet.

sanjayankur31 commented 4 months ago

OK, lets use them to begin with then. I expect the user will have to specify the file name to save to, and we can check that it's either "obj" or "gz".

Could you please work on a PR that will add the new option to save the mesh to begin with?

Dhruvanshu-Joshi commented 3 months ago

Hey @sanjayankur31 I have opened a PR for this issue. Sorry it took a while as I am in between my mid semester exams.