1
1
import React from 'react' ;
2
2
import { Component } from 'react' ;
3
- import { View2D , vtkInteractorStyleMPRWindowLevel } from '@vtk-viewport' ;
3
+ import {
4
+ View2D ,
5
+ vtkInteractorStyleMPRWindowLevel ,
6
+ invertVolume ,
7
+ } from '@vtk-viewport' ;
4
8
import vtkHttpDataSetReader from 'vtk.js/Sources/IO/Core/HttpDataSetReader' ;
5
9
import vtkVolume from 'vtk.js/Sources/Rendering/Core/Volume' ;
6
10
import vtkVolumeMapper from 'vtk.js/Sources/Rendering/Core/VolumeMapper' ;
@@ -54,6 +58,12 @@ class VTKBasicExample extends Component {
54
58
this . updateAllViewports ( ) ;
55
59
} ;
56
60
61
+ invert = ( ) => {
62
+ const volume = this . state . volumes [ 0 ] ;
63
+
64
+ invertVolume ( volume , this . updateAllViewports ) ;
65
+ } ;
66
+
57
67
updateAllViewports = ( ) => {
58
68
Object . keys ( this . components ) . forEach ( viewportIndex => {
59
69
const component = this . components [ viewportIndex ] ;
@@ -143,8 +153,8 @@ class VTKBasicExample extends Component {
143
153
to obtain access to the VTK render window for one or more component.
144
154
It also shows how to provide an array of vtkVolumes to the component
145
155
for rendering. When we change the RGB Transfer Function for the
146
- volume using the Window/Level buttons, we can see that this is
147
- applied inside both components.
156
+ volume using the Window/Level and Invert buttons, we can see that
157
+ this is applied inside both components.
148
158
</ p >
149
159
</ div >
150
160
< div className = "col-xs-12" >
@@ -162,6 +172,9 @@ class VTKBasicExample extends Component {
162
172
>
163
173
Head
164
174
</ button >
175
+ < button className = "btn btn-primary" onClick = { ( ) => this . invert ( ) } >
176
+ Invert
177
+ </ button >
165
178
</ div >
166
179
</ div >
167
180
< div className = "col-xs-12 col-sm-6" >
0 commit comments