-
Notifications
You must be signed in to change notification settings - Fork 258
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
ENH: Reading and writing JSON/binary JSON based surface data (.jmsh and .bmsh) #1114
base: master
Are you sure you want to change the base?
Conversation
Hello @fangq, thank you for submitting the Pull Request!
To test for issues locally, |
Thanks @fangq! This is great to see. If I'm reading this right, One question I have is if it would be possible to load the metadata from files and then construct something like an array proxy so that the data arrays do not need to be loaded until called for? If I recall, your files are not actually gzipped, only the data arrays, so we can't use our existing file handlers and proxies as drop-in loaders, but I suspect we could figure something out. |
Thanks for the feedback. The JMesh spec actually permits one to attach node or triangle-associated data as Properties. The currently supported property keywords include In this case, should I derive JMesh from TriangularMesh class?
Loading array buffers from the file is handled in the parser level (i.e. the external By the way, do you have a code formatter (something like this for C++) so that I can get rid of CI warnings? also, what command to run all tests in nibabel? I just want to follow the examples of other modules and start building some tests. |
@effigies, sorry for dropping the ball. I would like to spend some time to get this PR polished. I see you had added a formatter (blue) in #1124, I would like to know what is the command I should run to apply the style to format my code. Also, per your earlier comment, jmesh can associate values to vertices/triangles - similar to Gifti, please let me know if the thanks |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1114 +/- ##
==========================================
- Coverage 92.16% 91.63% -0.54%
==========================================
Files 97 99 +2
Lines 12332 12428 +96
Branches 2534 2563 +29
==========================================
+ Hits 11366 11388 +22
- Misses 645 718 +73
- Partials 321 322 +1
... and 7 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Thanks @fangq. I'll try to have a look at this in more detail in the coming week. |
hi @effigies, I am following up on the discussions from #1065, and would like to use this thread to propose a patch to support .jmsh/.bmsh based surface mesh data formats.
To recap on my previous presentation during the surface mesh format meeting:
.jmsh
is basically a plain JSON file using JMesh annotations to store surface mesh data structures (nodes asMeshVertex3
, triangles asMeshTri3
).bmsh
is the same as .jmsh except that the underlying serialization uses a binary JSON format - BJDatathanks to @neurolabusc's mesh format benchmarks, the loading speed and file sizes of these files are summarized/compared in this post.
Here, I would like to show you a lightweight patch (draft) to allow nibabel to read/write .jmsh and .bmsh files. A screenshot showing the interface can be found below.
This patch requires two external lightweight packages as dependencies, both can be installed via pip:
because I am not entirely familiar with nibabel's IO classes, currently, I based the JMesh class over
FileBasedImage
. I understand thatCoordinateImage
is currently being developed in #1090, and perhaps it is the better root class for adding new mesh formats.Let me know if you have any comments about this draft. I would be happy to add some tests and open to suggestions to continue polishing this patch.