Open garyo opened 5 years ago
There is no support for that directly in NGL but you can load them yourself and then create a volume object or directly write a volume parser (see the dx parser as an example https://github.com/arose/ngl/blob/master/src/parser/dx-parser.ts).
NGL support plenty of volume formats (MRC/MAP/CCP4, DX/DXBIN, CUBE, BRIX/DSN6, XPLOR/CNS) so you can also convert your data to one of them
Thanks -- DX looks pretty simple and there's a python/numpy parser/writer for it too. That said, here's a test DX file I created that doesn't import very well in NGL. If you import it into the current web viewer, you'll see a few things:
(If you'd like me to resubmit this as a separate ticket, I'd be happy to.)
# OpenDX written by gridData.OpenDX
# from https://github.com/MDAnalysis/GridDataFormats
object 1 class gridpositions counts 5 5 5
origin -5.000000 -5.000000 -5.000000
delta 2.000000 0.000000 0.000000
delta 0.000000 2.000000 0.000000
delta 0.000000 0.000000 2.000000
object 2 class gridconnections counts 5 5 5
object 3 class array type "double" rank 0 items 125 data follows
8.660254037844387 7.500000000000000 7.071067811865476
7.500000000000000 8.660254037844387 7.500000000000000
6.123724356957945 5.590169943749475 6.123724356957945
7.500000000000000 7.071067811865476 5.590169943749475
5.000000000000000 5.590169943749475 7.071067811865476
7.500000000000000 6.123724356957945 5.590169943749475
6.123724356957945 7.500000000000000 8.660254037844387
7.500000000000000 7.071067811865476 7.500000000000000
8.660254037844387 7.500000000000000 6.123724356957945
5.590169943749475 6.123724356957945 7.500000000000000
6.123724356957945 4.330127018922194 3.535533905932738
4.330127018922194 6.123724356957945 5.590169943749475
3.535533905932738 2.500000000000000 3.535533905932738
5.590169943749475 6.123724356957945 4.330127018922194
3.535533905932738 4.330127018922194 6.123724356957945
7.500000000000000 6.123724356957945 5.590169943749475
6.123724356957945 7.500000000000000 7.071067811865476
5.590169943749475 5.000000000000000 5.590169943749475
7.071067811865476 5.590169943749475 3.535533905932738
2.500000000000000 3.535533905932738 5.590169943749475
5.000000000000000 2.500000000000000 0.000000000000000
2.500000000000000 5.000000000000000 5.590169943749475
3.535533905932738 2.500000000000000 3.535533905932738
5.590169943749475 7.071067811865476 5.590169943749475
5.000000000000000 5.590169943749475 7.071067811865476
7.500000000000000 6.123724356957945 5.590169943749475
6.123724356957945 7.500000000000000 6.123724356957945
4.330127018922194 3.535533905932738 4.330127018922194
6.123724356957945 5.590169943749475 3.535533905932738
2.500000000000000 3.535533905932738 5.590169943749475
6.123724356957945 4.330127018922194 3.535533905932738
4.330127018922194 6.123724356957945 7.500000000000000
6.123724356957945 5.590169943749475 6.123724356957945
7.500000000000000 8.660254037844387 7.500000000000000
7.071067811865476 7.500000000000000 8.660254037844387
7.500000000000000 6.123724356957945 5.590169943749475
6.123724356957945 7.500000000000000 7.071067811865476
5.590169943749475 5.000000000000000 5.590169943749475
7.071067811865476 7.500000000000000 6.123724356957945
5.590169943749475 6.123724356957945 7.500000000000000
8.660254037844387 7.500000000000000 7.071067811865476
7.500000000000000 8.660254037844387
attribute "dep" string "positions"
object "density" class field
component "positions" value 1
component "connections" value 2
component "data" value 3
I have a set of registered slice images (density) I'd like to display in ngl as a volume (isosurface). Is that doable or do I need to convert the images to another format first that ngl understands?