| 320 | === Rendering a Subset of the Grid (Animated Volume of Interest) |
| 321 | Not only the data source, but also the output of !ParaView filters can be visualized. In this example we will use the !ExtractSubset filter to visualize a smaller part of the whole grid. |
| 322 | The input of the !ExtractSubset has to be connected to the output of the XDMF reader. |
| 323 | Then the scripts animates the volume of interest in 81 steps, fading away slices from the top and bottom side of the grid. At the end about 70 slices located at the middle of the grid are visible. |
| 324 | |
| 325 | {{{ |
| 326 | #!python |
| 327 | extractSubset = ExtractSubset(Input=vervet) |
| 328 | extractSubset.VOI = [0, 7759, 0, 7179, 0, 233] # we are using the subsampled data |
| 329 | Hide(vervet, renderView) |
| 330 | print "generating extract subset" |
| 331 | extractSubsetDisplay = Show(extractSubset, renderView) |
| 332 | # Properties modified on extractSubset1Display |
| 333 | extractSubsetDisplay.VolumeRenderingMode = 'OSPRay Based' |
| 334 | ColorBy(extractSubsetDisplay, ('POINTS', 'PLI')) |
| 335 | extractSubsetDisplay.RescaleTransferFunctionToDataRange(True, True) |
| 336 | extractSubsetDisplay.SetRepresentationType('Volume') |
| 337 | |
| 338 | camera.SetPosition(0.0, 0.0, 1.488) |
| 339 | camera.SetFocalPoint(0.0, 0.0, 0.0) |
| 340 | camera.SetViewUp(-1.0, 0.0, 0.0) |
| 341 | |
| 342 | imageNum = 0 |
| 343 | for i in range(1, 82): |
| 344 | extractSubset.VOI = [0, 7759, 0, 7179, i, 233-i] |
| 345 | print ("VOI change state: rendering image %04d" % (imageNum)) |
| 346 | Render() |
| 347 | WriteImage("voi_image_%04d.png" % (imageNum)) |
| 348 | imageNum = imageNum + 1 |
| 349 | }}} |
| 350 | |
| 351 | Resulting movie snippet: |
| 352 | [raw-attachment:voi.wmv Animation of volume of interest] |