------------------------------------------------------------------------------
| 258 | |
| 259 | //------------------------------------------------------------------------------ |
| 260 | void vtkImageViewer2::SetSliceOrientation(int orientation) |
| 261 | { |
| 262 | if (orientation < vtkImageViewer2::SLICE_ORIENTATION_YZ || |
| 263 | orientation > vtkImageViewer2::SLICE_ORIENTATION_XY) |
| 264 | { |
| 265 | vtkErrorMacro("Error - invalid slice orientation " << orientation); |
| 266 | return; |
| 267 | } |
| 268 | |
| 269 | if (this->SliceOrientation == orientation) |
| 270 | { |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | this->SliceOrientation = orientation; |
| 275 | |
| 276 | // Update the viewer |
| 277 | |
| 278 | int* range = this->GetSliceRange(); |
| 279 | if (range) |
| 280 | { |
| 281 | this->Slice = static_cast<int>((range[0] + range[1]) * 0.5); |
| 282 | } |
| 283 | |
| 284 | this->UpdateOrientation(); |
| 285 | this->UpdateDisplayExtent(); |
| 286 | |
| 287 | if (this->Renderer && this->GetInput()) |
| 288 | { |
| 289 | double scale = this->Renderer->GetActiveCamera()->GetParallelScale(); |
| 290 | this->Renderer->ResetCamera(); |
| 291 | this->Renderer->GetActiveCamera()->SetParallelScale(scale); |
| 292 | } |
| 293 | |
| 294 | this->Render(); |
| 295 | } |
| 296 | |
| 297 | //------------------------------------------------------------------------------ |
| 298 | void vtkImageViewer2::UpdateOrientation() |