Skip to content

Conversation

@spyke7
Copy link

@spyke7 spyke7 commented Dec 27, 2025

Hi @orbeckst
I have added OpenVDB.py inside gridData that simply export files in .vdb format. Also I have added test_vdb.py inside tests and it successfully passes.
It resolves issue #141

Required Libraries -
openvdb

  • conda install -c conda-forge openvdb

There are many things that need to be updated like docs, etc, but I have just provided the file and test so that you can review it, and I can fix the problems. Please let me know if anything needs to be changed and updated.

@codecov
Copy link

codecov bot commented Dec 27, 2025

Codecov Report

❌ Patch coverage is 24.56140% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.20%. Comparing base (abd0feb) to head (22a5995).

Files with missing lines Patch % Lines
gridData/OpenVDB.py 21.27% 37 Missing ⚠️
gridData/core.py 25.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #148      +/-   ##
==========================================
- Coverage   87.70%   83.20%   -4.50%     
==========================================
  Files           5        6       +1     
  Lines         748      804      +56     
  Branches       97      107      +10     
==========================================
+ Hits          656      669      +13     
- Misses         56       99      +43     
  Partials       36       36              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@spyke7
Copy link
Author

spyke7 commented Dec 27, 2025

@orbeckst , please review the OpenVDB.py file. After that, I will add some more test covering all the missing parts

@orbeckst
Copy link
Member

orbeckst commented Dec 27, 2025 via email

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. Before going further, can you please try your own code and demonstrate that it works? For instance, take some of the bundled test files such as 1jzv.ccp4 or nAChR_M2_water.plt, write it to OpenVDB, load it in blender, and show an image of the rendered density?

Once we know that it's working in principle, we'll need proper tests (you can look at PR #147 for good example of minimal testing for writing functionality).

Comment on lines +20 to +22

* Added `OpenVDB.py` inside `gridData` to simply export and write in .vdb format
* Added `test_vdb.py` inside `gridData\tests`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, too much detail; see other entries for example. Just the user-relevant changes in functionality

Comment on lines +24 to +26
Fixes

* Adding openVDB formats (Issue #141)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a fix but an Enhancement – put it into the existing 1.1.0 section and add you name there.

sufficient to export density data for visualization in Blender.
The OpenVDB format uses a sparse tree structure to efficiently store
volumetric data. It is the native format for Blender's volume system.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention and link to the openvdb library/package

Comment on lines +57 to +60
try:
import pyopenvdb as vdb
except ImportError:
vdb = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may have to make openvdb optional and then this requires more robust handling of missing packages.

Comment on lines +183 to +188
for i in range(self.grid.shape[0]):
for j in range(self.grid.shape[1]):
for k in range(self.grid.shape[2]):
value = float(self.grid[i, j, k])
if abs(value) > threshold:
accessor.setValueOn((i, j, k), value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really slow — iterating over a grid explicitly. For a start, you can find all cells above a threshold with numpy operations (np.abs(g) > threshold) and then ideally use it in a vectorized form to set the accessor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are not testing OpenVDB so remove until you have real tests.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yes
Let me first run the thing on blender and then provide you with more details
I will try my best as I am new in this, so it may take some time also :-)

@orbeckst orbeckst self-assigned this Jan 9, 2026
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

Successfully merging this pull request may close these issues.

2 participants