------------------------------------------------------------------------------
| 616 | |
| 617 | //------------------------------------------------------------------------------ |
| 618 | void vtkImageViewer2::Render() |
| 619 | { |
| 620 | if (this->FirstRender) |
| 621 | { |
| 622 | // Initialize the size if not set yet |
| 623 | |
| 624 | vtkAlgorithm* input = this->GetInputAlgorithm(); |
| 625 | if (input) |
| 626 | { |
| 627 | input->UpdateInformation(); |
| 628 | int* w_ext = |
| 629 | this->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); |
| 630 | int xs = 0, ys = 0; |
| 631 | |
| 632 | switch (this->SliceOrientation) |
| 633 | { |
| 634 | case vtkImageViewer2::SLICE_ORIENTATION_XY: |
| 635 | default: |
| 636 | xs = w_ext[1] - w_ext[0] + 1; |
| 637 | ys = w_ext[3] - w_ext[2] + 1; |
| 638 | break; |
| 639 | |
| 640 | case vtkImageViewer2::SLICE_ORIENTATION_XZ: |
| 641 | xs = w_ext[1] - w_ext[0] + 1; |
| 642 | ys = w_ext[5] - w_ext[4] + 1; |
| 643 | break; |
| 644 | |
| 645 | case vtkImageViewer2::SLICE_ORIENTATION_YZ: |
| 646 | xs = w_ext[3] - w_ext[2] + 1; |
| 647 | ys = w_ext[5] - w_ext[4] + 1; |
| 648 | break; |
| 649 | } |
| 650 | |
| 651 | // if it would be smaller than 150 by 100 then limit to 150 by 100 |
| 652 | if (this->RenderWindow->GetSize()[0] == 0) |
| 653 | { |
| 654 | this->RenderWindow->SetSize(xs < 150 ? 150 : xs, ys < 100 ? 100 : ys); |
| 655 | } |
| 656 | |
| 657 | if (this->Renderer) |
| 658 | { |
| 659 | this->Renderer->ResetCamera(); |
| 660 | this->Renderer->GetActiveCamera()->SetParallelScale(xs < 150 ? 75 : (xs - 1) / 2.0); |
| 661 | } |
| 662 | this->FirstRender = 0; |
| 663 | } |
| 664 | } |
| 665 | if (this->GetInput()) |
| 666 | { |
| 667 | this->RenderWindow->Render(); |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | //------------------------------------------------------------------------------ |
| 672 | const char* vtkImageViewer2::GetWindowName() |
no test coverage detected