mlab.show_pipeline() #顯示管線層級,來打開管線對話框
Mayavi Scene:處於樹的最頂層的對象,他表示場景,配置界面中能夠設置場景的背景,前景色,場景中的燈光,以及其餘一些選項
>>> s = mlab.gcf() #獲取當前場景 >>> print(s) #獲取當前場景狀態 <mayavi.core.scene.Scene object at 0x00000000014E66D0> >>> print(s.scene.background) #輸出管線中的背景色 (0.5, 0.5, 0.5)
scalars標量數據,他就是傳遞給mesh的標量數組,他表示mesh表面的每一個點的數組
>>> source = s.children[0] #獲取GridSource對象,由於scene場景中有多個數據集合sources,咱們獲取當前惟一的這一個 >>> print(repr(source)) #打印返回的字符串 <mayavi.sources.vtk_data_source.VTKDataSource object at 0x0000000014117570> >>> print(source.name) #返回該節點的名稱 GridSource >>> print(repr(source.data.points)) #打印GridSource的座標(空間座標,三維) [(0.0, 1.0852211291184772, 0.0), ..., (-0.01969313518771439, -1.5671711510166164 , -0.00024748426251406075)], length = 126504 #length說明座標數組大小是126504 >>> print(repr(source.data.point_data.scalars)) #打印出每一個點對應的標量數組 [0.0, ..., -0.00024748426251406075], length = 126504
>>> manager = source.children[0] >>> print(manager) <mayavi.filters.poly_data_normals.PolyDataNormals object at 0x00000000163D1308>
>>> colors = manager.children[0] >>> colors.scalar_lut_manager.lut_mode = "Blues" >>> colors.scalar_lut_manager.show_legend = True
>>> surface = colors.children[0] #得到顏色的第一個子節點 >>> surface.actor.property.representation = "wireframe" >>> surface.actor.property.opacity = 0.6
1.獲取場景對象,mlab.gcf() 2.經過children屬性,在管線中找到須要修改的對象 3.當其配置窗口由多個選項卡,屬性須要一級一級得到
Mayavi管線:是層級管線,相互嵌套,須要使用children獲取下一級
TVTK管線:分爲可視化管線和圖形管線兩部分,用於將TVTK中各個對象穿連起來