コード例 #1
0
    # VTK =< 8
    from vtk.vtkImagingCore import vtkRTAnalyticSource

# Use VTK to get some data
data_source = vtkRTAnalyticSource()
data_source.Update()  # <= Execute source to produce an output
dataset = data_source.GetOutput()

# Use helper to get a volume structure that can be passed as-is to a Volume
volume_state = to_volume_state(dataset)  # No need to select field

content = dash_vtk.View([
    dash_vtk.VolumeRepresentation([
        # GUI to control Volume Rendering
        # + Setup good default at startup
        dash_vtk.VolumeController(),
        # Actual volume
        dash_vtk.Volume(state=volume_state),
    ]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "width": "100%",
        "height": "400px"
    },
    children=[content],
コード例 #2
0
# Use helper to get a volume structure that can be passed as-is to a Volume
volume_state = to_volume_state(dataset)  # No need to select field

content = dash_vtk.View([
    dash_vtk.VolumeRepresentation([
        # GUI to control Volume Rendering
        # + Setup good default at startup
        dash_vtk.VolumeController(),
        # Actual volume
        dash_vtk.ShareDataSet([
            dash_vtk.Volume(state=volume_state),
        ]),
    ]),
    dash_vtk.SliceRepresentation(iSlice=10,
                                 children=[
                                     dash_vtk.ShareDataSet(),
                                 ]),
    dash_vtk.SliceRepresentation(jSlice=10,
                                 children=[
                                     dash_vtk.ShareDataSet(),
                                 ]),
    dash_vtk.SliceRepresentation(kSlice=10,
                                 children=[
                                     dash_vtk.ShareDataSet(),
                                 ]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server
コード例 #3
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
vtk_view = dash_vtk.View(
    id="vtk-view",
    children=[
        dash_vtk.GeometryRepresentation(
            id="vtk-representation",
            children=[
                dash_vtk.PolyData(
                    id="vtk-polydata",
                    points=points,
                    polys=polys,
                    children=[
                        dash_vtk.PointData([
                            dash_vtk.DataArray(
                                id="vtk-array",
                                registration="setScalars",
                                name="elevation",
                                values=elevation,
                            )
                        ])
                    ],
                )
            ],
            colorMapPreset="erdc_blue2green_muted",
            colorDataRange=color_range,
            property={
                "edgeVisibility": True,
            },
        )
    ],
)
コード例 #4
0
content = dash_vtk.View(
    [
        dash_vtk.VolumeRepresentation(
            [
                dash_vtk.VolumeController(),
                dash_vtk.ShareDataSet(
                    [
                        dash_vtk.ImageData(
                            dimensions=[10, 10, 10],
                            spacing=[1, 1, 1],
                            origin=[-4, -4, -4],
                            children=[
                                dash_vtk.PointData(
                                    [
                                        dash_vtk.DataArray(
                                            registration="setScalars", values=field,
                                        )
                                    ]
                                )
                            ],
                        ),
                    ]
                ),
            ]
        ),
        dash_vtk.SliceRepresentation(
            property={"colorWindow": 500, "colorLevel": 200},
            iSlice=5,
            children=[dash_vtk.ShareDataSet()],
        ),
    ]
)
コード例 #5
0
content = dash_vtk.View([
    dash_vtk.GeometryRepresentation(
        children=[
            dash_vtk.PolyData(
                points=[
                  0,0,0,
                  1,0,0,
                  0,1,0,
                  1,1,0,
                ],
                lines=[3, 1, 3, 2],
                polys=[3, 0, 1, 2],
                children=[
                    dash_vtk.PointData([
                        dash_vtk.DataArray(
                            #registration='setScalars', # To activate field
                            name='onPoints',
                            values=[0, 0.33, 0.66, 1],
                        )
                    ]),
                    dash_vtk.CellData([
                        dash_vtk.DataArray(
                            # registration='setScalars', # To activate field
                            name='onCells',
                            values=[0, 1],
                        )
                    ])
                ],
            ),
        ],
    ),
])
コード例 #6
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
import vtk

# Data file path
demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
head_vti = os.path.join(demo_dir, "data", "head.vti")

# Load dataset from dist
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName(head_vti)
reader.Update()

volume_state = to_volume_state(reader.GetOutput())

vtk_view = dash_vtk.View(
    dash_vtk.VolumeRepresentation(children=[
        dash_vtk.VolumeController(),
        dash_vtk.Volume(state=volume_state),
    ]))

app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "height": "calc(100vh - 16px)",
        "width": "100%"
    },
    children=[html.Div(vtk_view, style={
        "height": "100%",
        "width": "100%"
    })],
コード例 #7
0
import dash_vtk
from dash_vtk.utils import to_mesh_state

from vtk.vtkImagingCore import vtkRTAnalyticSource

# Use VTK to get some data
data_source = vtkRTAnalyticSource()
data_source.Update()  # <= Execute source to produce an output
dataset = data_source.GetOutput()

# Use helper to get a mesh structure that can be passed as-is to a Mesh
# RTData is the name of the field
mesh_state = to_mesh_state(dataset)

content = dash_vtk.View([
    dash_vtk.GeometryRepresentation([dash_vtk.Mesh(state=mesh_state)]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "width": "100%",
        "height": "calc(100vh - 15px)"
    },
    children=[content],
)

if __name__ == "__main__":
コード例 #8
0
ファイル: app.py プロジェクト: mbataghva/dash-sample-apps
slice_property = {"colorWindow": 4095, "colorLevel": 1000}

slice_view = dash_vtk.View(
    id="slice-view",
    cameraPosition=[1, 0, 0],
    cameraViewUp=[0, 0, -1],
    cameraParallelProjection=False,
    background=[0.9, 0.9, 1],
    children=[
        dash_vtk.ShareDataSet(dash_vtk.Volume(state=volume_state)),
        dash_vtk.SliceRepresentation(
            id="slice-repr-i",
            iSlice=128,
            property=slice_property,
            children=dash_vtk.ShareDataSet(),
        ),
        dash_vtk.SliceRepresentation(
            id="slice-repr-j",
            jSlice=128,
            property=slice_property,
            children=dash_vtk.ShareDataSet(),
        ),
        dash_vtk.SliceRepresentation(
            id="slice-repr-k",
            kSlice=47,
            property=slice_property,
            children=dash_vtk.ShareDataSet(),
        ),
    ],
)

volume_view = dash_vtk.View(
コード例 #9
0
ファイル: app.py プロジェクト: singlemice/dash-sample-apps
def initial_loading(geometry):
    triggered = dash.callback_context.triggered
    if triggered:
        return dash.no_update

    return dash_vtk.View(id="vtk-view", children=vehicle_vtk + isosurfs_vtk)
コード例 #10
0
import dash_vtk

content = dash_vtk.View([
    dash_vtk.GeometryRepresentation(
        mapper={
            'colorByArrayName': 'layer',
            'scalarMode': 4,
            'interpolateScalarsBeforeMapping': False,
        },
        colorMapPreset="jet",
        colorDataRange=[0.2, 0.9],
        children=[
            dash_vtk.Algorithm(
                vtkClass="vtkConcentricCylinderSource",
                state={
                    'height': 0.25,
                    'radius': [0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    'cellFields': [0, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    'mask': [1, 0, 1, 0, 1, 0, 1, 1],
                    'resolution': 60,
                    'skipInnerFaces': True,
                    'startTheta': 45,
                    'endTheta': 315,
                    'center': [0, 0, 0.5],
                },
            ),
        ]),
])

# Dash setup
app = dash.Dash(__name__)
コード例 #11
0
points = dataset.points[selection]
xyz = points.ravel()
elevation = points[:, -1].ravel()
min_elevation = np.amin(elevation)
max_elevation = np.amax(elevation)
print(f"Number of points: {points.shape}")
print(f"Elevation range: [{min_elevation}, {max_elevation}]")

# Setup VTK rendering of PointCloud
app = dash.Dash(__name__)
server = app.server

vtk_view = dash_vtk.View([
    dash_vtk.PointCloudRepresentation(
        xyz=xyz,
        scalars=elevation,
        colorDataRange=[min_elevation, max_elevation],
        property={"pointSize": 2},
    )
])

app.layout = html.Div(
    style={"height": "calc(100vh - 16px)"},
    children=[html.Div(vtk_view, style={
        "height": "100%",
        "width": "100%"
    })],
)

if __name__ == "__main__":
    app.run_server(debug=True)
コード例 #12
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
import dash_core_components as dcc
from dash.dependencies import Input, Output, State

random.seed(42)

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server

vtk_view = dash_vtk.View(
    id="geometry-view",
    children=[
        dash_vtk.GeometryRepresentation([
            dash_vtk.Algorithm(
                id="vtk-algorithm",
                vtkClass="vtkConeSource",
                state={
                    "capping": False,
                    "resolution": 60
                },
            )
        ])
    ],
)

controls = dbc.Card([
    dbc.CardHeader("Controls"),
    dbc.CardBody([
        html.P("Resolution:"),
        dcc.Slider(
            id="slider-resolution",
            min=10,
コード例 #13
0
                                      "value": 1
                                  }],
                                  switch=True,
                                  value=[1])
                ],
                width=4),
            dbc.Col([
                html.Div(
                    html.Div(style={
                        "width": "100%",
                        "height": "100%"
                    },
                             children=[
                                 dash_vtk.View(
                                     id=f'{APP_ID}_geom_rep',
                                     children=None,
                                     pickingModes=['hover'],
                                 ),
                             ]),
                    style={"height": "100%"},
                ),
                html.Div(id=f'{APP_ID}_hover_info')
            ]),
        ]),
    ],
    fluid=True,
    style={"height": "75vh"},
)


def add_dash(app):
コード例 #14
0
slice_property = {"colorWindow": 4095, "colorLevel": 1000}

slice_view = dash_vtk.View(
    id="slice-view",
    cameraPosition=[1, 0, 0],
    cameraViewUp=[0, 0, -1],
    cameraParallelProjection=False,
    background=[0.9, 0.9, 1],
    children=[
        dash_vtk.ShareDataSet(dash_vtk.Volume(state=volume_state)),
        dash_vtk.SliceRepresentation(
            id="slice-repr-i",
            iSlice=128,
            property=slice_property,
            children=dash_vtk.ShareDataSet(),
        ),
        dash_vtk.SliceRepresentation(
            id="slice-repr-j",
            jSlice=128,
            property=slice_property,
            children=dash_vtk.ShareDataSet(),
        ),
        dash_vtk.SliceRepresentation(
            id="slice-repr-k",
            kSlice=47,
            property=slice_property,
            children=dash_vtk.ShareDataSet(),
        ),
    ],
)

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
コード例 #15
0
ファイル: flow.py プロジェクト: plotly/floris-dash-apps
import dash_core_components as dcc
import dash_html_components as html
import vtk
import dash_vtk
from dash_vtk.utils import to_mesh_state

reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName("./data/flow_pyevtk.vtu")
reader.Update()  # Needed because of GetScalarRange
output = reader.GetOutput()

mesh_state = to_mesh_state(reader.GetOutput())
vtk_view = dash_vtk.View(
    id="vtk-view",
    children=[
        dash_vtk.GeometryRepresentation(
            children=[dash_vtk.Mesh(state=mesh_state)], )
    ],
)

app = dash.Dash(__name__, external_stylesheets=[])
app.layout = html.Div(
    style={
        "height": "calc(100vh - 16px)",
        "width": "100%"
    },
    children=[html.Div(vtk_view, style={
        "height": "100%",
        "width": "100%"
    })],
)
コード例 #16
0
import dash
import random
import dash_html_components as html
import dash_vtk

field = [random.random() * i for i in range(10 * 10 * 10)]

content = dash_vtk.View([
    dash_vtk.VolumeRepresentation([
        dash_vtk.VolumeController(),
        dash_vtk.ImageData(
            dimensions=[10, 10, 10],
            spacing=[1, 1, 1],
            origin=[-4, -4, -4],
            children=[
                dash_vtk.PointData([
                    dash_vtk.DataArray(
                        registration="setScalars",
                        values=field,
                    )
                ])
            ],
        ),
    ]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
コード例 #17
0
import dash
import dash_html_components as html

import dash_vtk

content = dash_vtk.View([
    dash_vtk.VolumeRepresentation([
        # GUI to control Volume Rendering
        # + Setup good default at startup
        dash_vtk.VolumeController(),
        # Actual Imagedata
        dash_vtk.ImageData(
            dimensions=[5, 5, 5],
            origin=[-2, -2, -2],
            spacing=[1, 1, 1],
            children=[
                dash_vtk.PointData([
                    dash_vtk.DataArray(
                        registration="setScalars",
                        values=list(range(5*5*5)),
                    )
                ])
            ],
        ),
    ]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server
コード例 #18
0
ファイル: app.py プロジェクト: trivedisorabh/dash-sample-apps
vtk_view = dash_vtk.View(
    id="vtk-view",
    pickingModes=["hover"],
    children=[
        dash_vtk.GeometryRepresentation(
            id="vtk-representation",
            children=[
                dash_vtk.PolyData(
                    id="vtk-polydata",
                    points=points,
                    polys=polys,
                    children=[
                        dash_vtk.PointData([
                            dash_vtk.DataArray(
                                id="vtk-array",
                                registration="setScalars",
                                name="elevation",
                                values=elevation,
                            )
                        ])
                    ],
                )
            ],
            colorMapPreset="erdc_blue2green_muted",
            colorDataRange=color_range,
            property={"edgeVisibility": True},
            showCubeAxes=True,
            cubeAxesStyle={"axisLabels": ["", "", "Altitude"]},
        ),
        dash_vtk.GeometryRepresentation(
            id="pick-rep",
            actor={"visibility": False},
            children=[
                dash_vtk.Algorithm(
                    id="pick-sphere",
                    vtkClass="vtkSphereSource",
                    state={"radius": 100},
                )
            ],
        ),
    ],
)
コード例 #19
0
import dash
import dash_vtk
import dash_html_components as html
from dash.dependencies import Input, Output

# Get it here: https://github.com/plotly/dash-vtk/blob/master/demos/data/cow-nonormals.obj
with open("datasets/cow-nonormals.obj", 'r') as file:
    txt_content = file.read()

view = dash_vtk.View(
    id="click-info-view",
    pickingModes=["click"],
    children=[
        dash_vtk.GeometryRepresentation(id="cow-geometry", children=[
            dash_vtk.Reader(
                vtkClass="vtkOBJReader",
                parseAsText=txt_content,
            ),
        ]),
    ],
)

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div([
    html.Div(view, style={"width": "100%", "height": "300px"}),
    html.B("Output of clickInfo (try clicking on the object above):"),
    html.Pre(
        id="click-info-output",
コード例 #20
0
import dash
import dash_html_components as html
import dash_vtk

content = dash_vtk.View(
    [
        dash_vtk.GeometryRepresentation(
            children=[
                dash_vtk.PolyData(
                    points=[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0,],
                    lines=[3, 1, 3, 2],
                    polys=[3, 0, 1, 2],
                ),
            ],
        ),
    ]
)

# Dash setup
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div(
    style={"width": "100%", "height": "calc(100vh - 15px)"}, children=[content],
)

if __name__ == "__main__":
    app.run_server(debug=True)
コード例 #21
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
def dcm_to_volume(dir_path):
    itk_image = itk.imread(dir_path)
    vtk_image = itk.vtk_image_from_image(itk_image)
    volume_state = to_volume_state(vtk_image)

    return volume_state


# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc.
demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
volume_state = dcm_to_volume(os.path.join(demo_dir, "data", "mri_pancreas"))

app = dash.Dash(__name__)
server = app.server

vtk_view = dash_vtk.View(
    dash_vtk.VolumeRepresentation(
        [dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state)]
    )
)

app.layout = html.Div(
    style={"height": "calc(100vh - 50px)", "width": "100%"},
    children=[html.Div(style={"height": "100%", "width": "100%"}, children=vtk_view)],
)


if __name__ == "__main__":
    app.run_server(debug=True)
コード例 #22
0
import dash
import dash_html_components as html
import dash_vtk
import random

xyz = []
for i in range(10000):
    xyz.append(random.random())  # x
    xyz.append(random.random())  # y
    xyz.append(random.random() * 0.01)  # z

content = dash_vtk.View(children=[
    dash_vtk.GeometryRepresentation(
        property={'pointSize': 3},
        children=[dash_vtk.PolyData(points=xyz, connectivity='points')],
    ),
], )

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "width": "100%",
        "height": "calc(100vh - 15px)"
    },
    children=[content],
)

if __name__ == "__main__":
コード例 #23
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
        dbc.Label("Color Level"),
        dcc.Slider(
            min=0.01,
            max=1,
            value=0.5,
            step=0.01,
            id="color-level",
            tooltip={},
        ),
    ]),
    CustomSlider(data=fd.x, id="slider-slice-i", label="Slice i"),
    CustomSlider(data=fd.y, id="slider-slice-j", label="Slice j"),
    CustomSlider(data=fd.z, id="slider-slice-k", label="Slice k"),
]

vtk_view = dash_vtk.View(id="vtk-view")

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server  # gunicorn needs this for deployment

app.layout = dbc.Container(
    fluid=True,
    style={"height": "100vh"},
    children=[
        Header("Flow Visualization with FLORIS and VTK", app),
        html.Hr(),
        dbc.Row([
            dbc.Col(
                width=4,
                children=dbc.Card([
                    dbc.CardHeader("Controls"),
コード例 #24
0
ファイル: t05_reader.py プロジェクト: xhlulu/dash-vtk
# Data file path
files = [
    'cow-nonormals.obj', 'pumpkin_tall_10k.obj', 'teapot.obj', 'teddy.obj'
]
root_repo_path = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
obj_file = os.path.join(root_repo_path, "demos", "data", files[0])

txt_content = None
with open(obj_file, 'r') as file:
    txt_content = file.read()

content = dash_vtk.View([
    dash_vtk.GeometryRepresentation([
        dash_vtk.Reader(
            vtkClass="vtkOBJReader",
            parseAsText=txt_content,
        ),
    ]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "width": "100%",
        "height": "calc(100vh - 15px)"
    },
    children=[content],
)
コード例 #25
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
vtk_view = dash_vtk.View(
    id="vtk-view",
    children=[
        dash_vtk.GeometryRepresentation(
            id="bike-rep",
            children=[dash_vtk.Mesh(
                id="bike",
                state=viz.getBikeMesh(),
            )],
        ),
        dash_vtk.GeometryRepresentation(
            id="tubes-rep",
            colorMapPreset="erdc_rainbow_bright",
            colorDataRange=viz.getColorRange(),
            children=[
                dash_vtk.Mesh(
                    id="tubes-mesh",
                    state=viz.getTubesMesh("p"),
                )
            ],
        ),
        dash_vtk.GeometryRepresentation(
            id="seed-rep",
            property={
                "color": [0.8, 0, 0],
                "representation": 0,
                "pointSize": 8,
            },
            children=[
                dash_vtk.Algorithm(
                    id="seed-line",
                    vtkClass="vtkLineSource",
                    state=viz.getSeedState(),
                )
            ],
        ),
    ],
)
コード例 #26
0
ファイル: app.py プロジェクト: ziepakker/dash-sample-apps
import random

import dash
import dash_vtk
import dash_html_components as html

random.seed(42)

app = dash.Dash(__name__)
server = app.server

volume_view = dash_vtk.View(children=dash_vtk.VolumeDataRepresentation(
    spacing=[1, 1, 1],
    dimensions=[10, 10, 10],
    origin=[0, 0, 0],
    scalars=[random.random() for _ in range(1000)],
    rescaleColorMap=False,
))

app.layout = html.Div(
    style={"height": "calc(100vh - 16px)"},
    children=[
        html.Div(children=volume_view,
                 style={
                     "height": "100%",
                     "width": "100%"
                 })
    ],
)

if __name__ == "__main__":
コード例 #27
0
import dash_vtk

content = dash_vtk.View([
    dash_vtk.GeometryRepresentation(
        mapper={
            "colorByArrayName": "layer",
            "scalarMode": 4,
            "interpolateScalarsBeforeMapping": False,
        },
        colorMapPreset="jet",
        colorDataRange=[0.2, 0.9],
        children=[
            dash_vtk.Algorithm(
                vtkClass="vtkConcentricCylinderSource",
                state={
                    "height": 0.25,
                    "radius": [0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    "cellFields": [0, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    "mask": [1, 0, 1, 0, 1, 0, 1, 1],
                    "resolution": 60,
                    "skipInnerFaces": True,
                    "startTheta": 45,
                    "endTheta": 315,
                    "center": [0, 0, 0.5],
                },
            ),
        ],
    ),
])

# Dash setup
コード例 #28
0
ファイル: s07_vtk_volume.py プロジェクト: xhlulu/dash-vtk
repo_path = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
head_vti = os.path.join(repo_path, 'demos', 'data', 'head.vti')

# Load dataset from dist
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName(head_vti)
reader.Update()

# Get mesh to dash_vtk
volume_state = to_volume_state(reader.GetOutput())

content = dash_vtk.View([
    dash_vtk.VolumeRepresentation(
        [dash_vtk.VolumeController(),
         dash_vtk.Volume(state=volume_state)]),
])

# Dash setup
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div(
    style={
        "width": "100%",
        "height": "calc(100vh - 15px)"
    },
    children=[content],
)

if __name__ == "__main__":
コード例 #29
0
        id=f"{surf_name}-rep",
        property={"color": [1, 0, 0]},
        actor={"visibility": 0},
        children=[dash_vtk.Mesh(
            id=f"{surf_name}-mesh",
            state=mesh,
        )],
    )

    isosurfs_vtk.append(child)

# -----------------------------------------------------------------------------
# 3D Viz
# -----------------------------------------------------------------------------

vtk_view = dash_vtk.View(id="vtk-view", children=vehicle_vtk + isosurfs_vtk)

# -----------------------------------------------------------------------------
# Control UI
# -----------------------------------------------------------------------------

controls = [
    dbc.Card([
        dbc.CardHeader("Geometry"),
        dbc.CardBody([
            dcc.Checklist(
                id="geometry",
                options=[
                    {
                        "label": " body",
                        "value": "body"
コード例 #30
0
        colorDataRange=[0, 100],
        mapper={"scalarVisibility": False},
        children=[dash_vtk.Mesh(state=mesh, )],
    )
    vehicle_vtk.append(child)

cone_pointer = dash_vtk.GeometryRepresentation(
    property={"color": [1, 0, 0]},
    children=[dash_vtk.Algorithm(id="pointer", vtkClass="vtkConeSource")])

# -----------------------------------------------------------------------------
# 3D Viz
# -----------------------------------------------------------------------------

vtk_view = dash_vtk.View(id="vtk-view",
                         pickingModes=['hover'],
                         children=vehicle_vtk + [cone_pointer])

# -----------------------------------------------------------------------------
# App UI
# -----------------------------------------------------------------------------

app.layout = dbc.Container(
    fluid=True,
    children=[
        dbc.Row(
            [
                dbc.Col(
                    width=6,
                    children=[
                        html.H2("Vehicle Geometry with OpenFOAM"),