isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.53k stars 2.32k forks source link

Periodic Boundary Conditions for Geometry and especially DBSCAN segmentation #3239

Open BartBruininks opened 3 years ago

BartBruininks commented 3 years ago

Is your feature request related to a problem? Please describe. A quick diagram of the topic is presented in the second post below.

Dear developers, I work in the field of molecular dynamics which basically results in a point cloud trajectory. I wrote object detection code using Open3d and it works very well, even for large point clouds. However, our point clouds are (cubic) periodic (snake2 rules). These PBC conditions are extremely important to minimize boundary artifacts in our simulations and are used in almost any molecular dynamics simulation. I would love to talk about this issues with the devs and see how we can fix this, for this would be a game changer for our field.

I can fix the results to adhere to PBC from i.e. a distance check between point clouds afterwards, but this is not always the case. The main reason I want to use Open3d is for its point cloud optimization and the DBSCAN segmentation. The biggest problem is that I cannot impose PBC after the DBSCAN, for internally the DBSCAN distance checks should take PBC into account.

This is a real bummer for I think open3d is probably the solution to many of our problems considering the efficient analysis of huge point clouds (100.000.000 points over thousands of frames).

Describe the solution you'd like The most complete solution for me and others in the molcular dynamics field would be to support N-dimensional periodicity. Since periodicity can be imposed as a post process step for most methods the smallest fix would be to allow for PBC DBSCAN segmentation.

Describe alternatives you've considered I have implemented the code myself, but it is not very efficient (not close to Open3d). I also tried scipy.ndimage but the explicit matrix approach is not so nice for large sytems (we are already dealing with 10000s of 2000**3 frames usually pretty sparse).

Additional context I have implemented my lipid leaflet analysis without PBC using open3d of which I added the result with a small test system. It is clear PBC is not respected (segments on the left should be the same as segments on the right etc.). I also linked the github of the project which shows our current slow implementation which gives all the correct results, but is slower (it uses explicit matrices as well).

lipid_leaflets_no-PBC_open3d A render of the results using Open3d script.

final A render from the results using the MDVoxelSegmentation (rendered with VMD).

https://github.com/marrink-lab/MDVoxelSegmentation

BartBruininks commented 3 years ago

A diagrim to clearify the issue. DBSCAN uses a sigma (the dotted lines) and a min density. The min density is wrong for PBC systems for points on the boundary.

PBC_distance