所以我想出了一個很好的折衷。我開始與git的代碼如下所述:
http://www.shocksolution.com/microfluidics-and-biotechnology/visualization/python-vtk-paraview/
這只是一個Python文件。要點是代碼允許您爲點提供x,y,z位置和半徑,並輸出VTK格式的XML文件。所以要做粒子,我只把它交給x,y,z位置,然後對所有粒子的半徑進行一個常量。然後我只在數據集上製作一個球形字形。
對於我使用完全相同的代碼的框。對於每個盒子,我仍輸出x,y,z座標,其中x,y,z值是盒子中心的座標。然後,對於「半徑」參數,我使用立方體的邊長。這是有效的,因爲在paraview中我再次爲這些盒子標出數據點。我使用框標誌符號,並通過標量以標量爲半徑的比例進行縮放。如果您不定位方框字形並將標量因子設置爲1,則會得到期望的結果。這裏有一個簡單的例子,一切統一:

所以我只輸出在我的C數據結構到CSV文件,然後在文件蟒蛇拉,並使用代碼的鏈接,打開與結果的座標paraview包。以下是我如何使用鏈接上的代碼:
from vtktools import VTK_XML_Serial_Unstructured
import sys
if len(sys.argv) > 2:
treeFile = sys.argv[1]
bodyFile = sys.argv[2]
else:
print 'No input files'
exit(4)
x = []
y = []
z = []
r = []
f = open(treeFile, 'r')
for line in f:
v = line.split(',')
x.append(float(v[0].strip()))
y.append(float(v[1].strip()))
z.append(float(v[2].strip()))
r.append(float(v[3].strip()))
f.close()
temp = treeFile.split('/')
if (len(temp) == 1):
temp = temp[0]
else:
temp = temp[-1]
tree_writer = VTK_XML_Serial_Unstructured()
tree_writer.snapshot(temp.split('.',1)[0] + '.vtu', x, y, z, [], [], [], [], [], [], r)
tree_writer.writePVD("octree.pvd")
x = []
y = []
z = []
r = []
f = open(bodyFile, 'r')
for line in f:
v = line.split(',')
x.append(float(v[0].strip()))
y.append(float(v[1].strip()))
z.append(float(v[2].strip()))
r.append(float(v[3].strip()))
f.close()
temp = bodyFile.split('/')
if (len(temp) == 1):
temp = temp[0]
else:
temp = temp[-1]
body_writer = VTK_XML_Serial_Unstructured()
body_writer.snapshot(temp.split('.',1)[0] + '.vtu', x, y, z, [], [], [], [], [], [], r)
body_writer.writePVD("distribution.pvd")
我認爲paraview將是我的選擇。你有沒有嘗試使用VTK文件?他們真的不那麼複雜。你可以編寫二進制文件,這對大型數據集很有用。 – angainor
想要顯示的框,是指將座標系設置爲該「框」,或繪製一個框並在3D中繪製一個點? – macduff
沒有嘗試vtk文件。可以查看導入vtk文件? – user926914