00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "Step8.h" 00019 00020 #include "QmitkStdMultiWidget.h" 00021 00022 #include "mitkGlobalInteraction.h" 00023 #include "mitkRenderingManager.h" 00024 00025 #include <QHBoxLayout> 00026 #include <QVBoxLayout> 00027 00028 //##Documentation 00029 //## @brief As Step6, but with QmitkStdMultiWidget as widget 00030 Step8::Step8(int argc, char* argv[], QWidget *parent) : 00031 Step6(argc, argv, parent) 00032 { 00033 } 00034 00035 void Step8::SetupWidgets() 00036 { 00037 //************************************************************************* 00038 // Part I: Create windows and pass the tree to it 00039 //************************************************************************* 00040 00041 // Create toplevel widget with vertical layout 00042 QVBoxLayout* vlayout = new QVBoxLayout(this); 00043 vlayout->setMargin(0); 00044 vlayout->setSpacing(2); 00045 00046 // Create viewParent widget with horizontal layout 00047 QWidget* viewParent = new QWidget(this); 00048 vlayout->addWidget(viewParent); 00049 QHBoxLayout* hlayout = new QHBoxLayout(viewParent); 00050 hlayout->setMargin(0); 00051 00052 //************************************************************************* 00053 // Part Ia: create and initialize QmitkStdMultiWidget 00054 //************************************************************************* 00055 QmitkStdMultiWidget* multiWidget = new QmitkStdMultiWidget(viewParent); 00056 00057 hlayout->addWidget(multiWidget); 00058 00059 // Tell the multiWidget which DataStorage to render 00060 multiWidget->SetDataStorage(m_DataStorage); 00061 00062 // Initialize views as transversal, sagittal, coronar (from 00063 // top-left to bottom) 00064 mitk::TimeSlicedGeometry::Pointer geo = m_DataStorage->ComputeBoundingGeometry3D( 00065 m_DataStorage->GetAll()); 00066 mitk::RenderingManager::GetInstance()->InitializeViews(geo); 00067 00068 // Initialize bottom-right view as 3D view 00069 multiWidget->GetRenderWindow4()->GetRenderer()->SetMapperID( 00070 mitk::BaseRenderer::Standard3D); 00071 00072 // Enable standard handler for levelwindow-slider 00073 multiWidget->EnableStandardLevelWindow(); 00074 00075 // Add the displayed views to the DataStorage to see their positions in 2D and 3D 00076 multiWidget->AddDisplayPlaneSubTree(); 00077 multiWidget->AddPlanesToDataStorage(); 00078 multiWidget->SetWidgetPlanesVisibility(true); 00079 00080 //************************************************************************* 00081 // Part II: Setup standard interaction with the mouse 00082 //************************************************************************* 00083 00084 // Moving the cut-planes to click-point 00085 multiWidget->EnableNavigationControllerEventListening(); 00086 00087 // Zooming and panning 00088 mitk::GlobalInteraction::GetInstance()->AddListener( 00089 multiWidget->GetMoveAndZoomInteractor()); 00090 }