Skip to content

Commit e3ecc95

Browse files
committed
doc update
1 parent e9c25a1 commit e3ecc95

File tree

1 file changed

+64
-51
lines changed

1 file changed

+64
-51
lines changed

docs/README.md

Lines changed: 64 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Then we have the standard representation set or properties with their defaults:
440440

441441
### PointCloudRepresentation
442442

443-
The __PointCloudRepresentation__ is just a helper using the following structure to streamline rendering a point cloud dataset.
443+
The __PointCloudRepresentation__ is just a helper using the following structure to streamline rendering a point cloud dataset. The code snippet below is not fully accurate but it should provide you with some understanding of the kind of simplification that is happening under the hood.
444444

445445
```python
446446
def PointCloudRepresentation(**kwargs):
@@ -475,38 +475,39 @@ The set of convinient properties are as follow:
475475

476476
### VolumeDataRepresentation
477477

478-
The __VolumeDataRepresentation__ is just a helper using the following structure to streamline rendering a volume.
479-
480-
```html
481-
<VolumeRepresentation
482-
id={props.id}
483-
colorMapPreset={props.colorMapPreset}
484-
colorDataRange={props.colorDataRange}
485-
property={props.property}
486-
mapper={props.mapper}
487-
volume={props.volume}
488-
>
489-
{props.volumeController && (
490-
<VolumeController
491-
rescaleColorMap={props.rescaleColorMap}
492-
size={props.controllerSize}
493-
/>
494-
)}
495-
<ImageData
496-
dimensions={props.dimensions}
497-
origin={props.origin}
498-
spacing={props.spacing}
499-
>
500-
<PointData>
501-
<DataArray
502-
registration='setScalars'
503-
numberOfComponents={nbComponents}
504-
values={values}
505-
type={type}
506-
/>
507-
</PointData>
508-
</ImageData>
509-
</VolumeRepresentation>
478+
The __VolumeDataRepresentation__ is just a helper using the following structure to streamline rendering a volume. The code snippet below is not fully accurate but it should provide you with some understanding of the kind of simplification that is happening under the hood.
479+
480+
```python
481+
def VolumeDataRepresentation(**kwargs):
482+
return dash_vtk.VolumeRepresentation(
483+
id=kwargs.get('id'),
484+
colorMapPreset=kwargs.get('colorMapPreset'),
485+
colorDataRange=kwargs.get('colorDataRange'),
486+
property=kwargs.get('property'),
487+
mapper=kwargs.get('mapper'),
488+
volume=kwargs.get('volume'),
489+
children=[
490+
dash_vtk.VolumeController(
491+
rescaleColorMap=kwargs.get('rescaleColorMap'),
492+
size=kwargs.get('size'),
493+
),
494+
dash_vtk.ImageData(
495+
dimensions=kwargs.get('dimensions'),
496+
origin=kwargs.get('origin'),
497+
spacing=kwargs.get('spacing'),
498+
children=[
499+
dash_vtk.PointData([
500+
dash_vtk.DataArray(
501+
registration='setScalars',
502+
values=kwargs.get('scalars'),
503+
)
504+
])
505+
],
506+
),
507+
],
508+
)
509+
],
510+
)
510511
```
511512

512513
The set of convinient properties are as follow:
@@ -529,12 +530,18 @@ The set of convinient properties are as follow:
529530

530531
This element is a helper on top of __PolyData__ which has a Python helper function that goes with it which will help you map a __vtkDataSet__ into a single property of the __Mesh__ element.
531532

532-
```html
533-
<PolyData {...props.state.mesh}>
534-
<{props.state.field.location}>
535-
<DataArray {...props.state.field} />
536-
</{props.state.field.location}>
537-
</PolyData>
533+
```py
534+
def Mesh(**kwargs):
535+
return dash_vtk.PolyData(
536+
**kwargs.get('state').get('mesh'),
537+
children=[
538+
dash_vtk.[kwargs.get('state').get('field').get('location')]([
539+
dash_vtk.DataArray(
540+
**kwargs.get('state').get('field'),
541+
)
542+
])
543+
]
544+
)
538545
```
539546

540547
The __Mesh__ element expect a single __state__ property that is internaly split into 2 elements to represent the geometry and the field that you want to optionally attach to your mesh. The structure could be defined as follow:
@@ -558,12 +565,18 @@ The __Mesh__ element expect a single __state__ property that is internaly split
558565

559566
This element is a helper on top of __ImageData__ which has a Python helper function that goes with it which will help you map a __vtkImageData__ into a single property of the __Volume__ element.
560567

561-
```html
562-
<ImageData {...props.state.image}>
563-
<PointData>
564-
<DataArray {...props.state.field} />
565-
</PointData>
566-
</ImageData>
568+
```py
569+
def Volume(**kwargs):
570+
return dash_vtk.ImageData(
571+
**kwargs.get('state').get('image'),
572+
children=[
573+
dash_vtk.PointData([
574+
dash_vtk.DataArray(
575+
**kwargs.get('state').get('field'),
576+
)
577+
])
578+
]
579+
)
567580
```
568581

569582
The __Volume__ element expect a single __state__ property that is internaly split into 2 elements to represent the geometry and the field that you want to optionally attach to your mesh. The structure could be defined as follow:
@@ -797,32 +810,32 @@ Then we made several example using plain VTK for both a CFD example and some med
797810

798811
[dash_vtk](https://github.com/plotly/dash-vtk/blob/master/demos/pyvista-point-cloud/app.py) | [PyVista](https://docs.pyvista.org/examples/00-load/create-point-cloud.html)
799812

800-
![Preview](../../demos/pyvista-point-cloud/demo.jpg)
813+
![Preview](../demos/pyvista-point-cloud/demo.jpg)
801814

802815
### Terrain following mesh
803816

804817
[dash_vtk](https://github.com/plotly/dash-vtk/blob/master/demos/pyvista-terrain-following-mesh/app.py) | [PyVista](https://docs.pyvista.org/examples/00-load/terrain-mesh.html)
805-
![Preview](../../demos/pyvista-terrain-following-mesh/demo.jpg)
818+
![Preview](../demos/pyvista-terrain-following-mesh/demo.jpg)
806819

807820
### VTK dynamic streamlines Example
808821

809822
This example leverage plain VTK on the server side while providing UI controls in __dash__ and leverage __dash_vtk__ to enable local rendering of dynamically computed streamlines inside a wind-tunnel.
810823

811824
[dash_vtk](https://github.com/plotly/dash-vtk/blob/master/demos/usage-vtk-cfd/app.py)
812825

813-
![CFD Preview](../../demos/usage-vtk-cfd/demo.jpg)
826+
![CFD Preview](../demos/usage-vtk-cfd/demo.jpg)
814827

815828
### Medical examples
816829

817830
[Real medical image](https://github.com/plotly/dash-vtk/blob/master/demos/volume-rendering/app.py)
818831

819-
![Real medical image](../../demos/volume-rendering/demo.jpg)
832+
![Real medical image](../demos/volume-rendering/demo.jpg)
820833

821834

822835
[Randomly generated volume](https://github.com/plotly/dash-vtk/blob/master/demos/synthetic-volume-rendering/app.py)
823836

824-
![Randomly generated volume](../../demos/synthetic-volume-rendering/demo.jpg)
837+
![Randomly generated volume](../demos/synthetic-volume-rendering/demo.jpg)
825838

826839
[Multi-View with slicing](https://github.com/plotly/dash-vtk/blob/master/demos/slice-rendering/app.py)
827840

828-
![Multi-View with slicing](../../demos/slice-rendering/demo.jpg)
841+
![Multi-View with slicing](../demos/slice-rendering/demo.jpg)

0 commit comments

Comments
 (0)