------------------------------------------------------------------------------
| 187 | |
| 188 | //------------------------------------------------------------------------------ |
| 189 | void vtkImageViewer::SetupInteractor(vtkRenderWindowInteractor* rwi) |
| 190 | { |
| 191 | if (this->Interactor && rwi != this->Interactor) |
| 192 | { |
| 193 | this->Interactor->Delete(); |
| 194 | } |
| 195 | if (!this->InteractorStyle) |
| 196 | { |
| 197 | this->InteractorStyle = vtkInteractorStyleImage::New(); |
| 198 | vtkImageViewerCallback* cbk = vtkImageViewerCallback::New(); |
| 199 | cbk->IV = this; |
| 200 | this->InteractorStyle->AddObserver(vtkCommand::WindowLevelEvent, cbk); |
| 201 | this->InteractorStyle->AddObserver(vtkCommand::StartWindowLevelEvent, cbk); |
| 202 | this->InteractorStyle->AddObserver(vtkCommand::ResetWindowLevelEvent, cbk); |
| 203 | cbk->Delete(); |
| 204 | } |
| 205 | |
| 206 | if (!this->Interactor) |
| 207 | { |
| 208 | this->Interactor = rwi; |
| 209 | rwi->Register(this); |
| 210 | } |
| 211 | this->Interactor->SetInteractorStyle(this->InteractorStyle); |
| 212 | this->Interactor->SetRenderWindow(this->RenderWindow); |
| 213 | } |
| 214 | |
| 215 | //------------------------------------------------------------------------------ |
| 216 | void vtkImageViewer::Render() |