MCPcopy Create free account
hub / github.com/MITK/MITK / SetupWidgets

Method SetupWidgets

Examples/Tutorial/Step6/Step6.cpp:146–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void Step6::SetupWidgets()
147{
148 //*************************************************************************
149 // Part I: Create windows and pass the datastorage to it
150 //*************************************************************************
151
152 // Create toplevel widget with vertical layout
153 QVBoxLayout *vlayout = new QVBoxLayout(this);
154 vlayout->setContentsMargins({});
155 vlayout->setSpacing(2);
156
157 // Create viewParent widget with horizontal layout
158 QWidget *viewParent = new QWidget(this);
159 vlayout->addWidget(viewParent);
160
161 QHBoxLayout *hlayout = new QHBoxLayout(viewParent);
162 hlayout->setContentsMargins({});
163 hlayout->setSpacing(2);
164
165 //*************************************************************************
166 // Part Ia: 3D view
167 //*************************************************************************
168
169 // Create a renderwindow
170 QmitkRenderWindow *renderWindow = new QmitkRenderWindow(viewParent);
171 hlayout->addWidget(renderWindow);
172
173 // Tell the renderwindow which (part of) the tree to render
174 renderWindow->GetRenderer()->SetDataStorage(m_DataStorage);
175
176 // Use it as a 3D view
177 renderWindow->GetRenderer()->SetMapperID(mitk::BaseRenderer::Standard3D);
178
179 // Reposition the camera to include all visible actors
180 renderWindow->GetRenderer()->GetVtkRenderer()->ResetCamera();
181
182 //*************************************************************************
183 // Part Ib: 2D view for slicing axially
184 //*************************************************************************
185
186 // Create QmitkSliceWidget, which is based on the class
187 // QmitkRenderWindow, but additionally provides sliders
188 QmitkSliceWidget *view2 = new QmitkSliceWidget(viewParent);
189 hlayout->addWidget(view2);
190
191 // Tell the QmitkSliceWidget which (part of) the tree to render.
192 // By default, it slices the data axially
193 view2->SetDataStorage(m_DataStorage);
194 mitk::DataStorage::SetOfObjects::ConstPointer rs = m_DataStorage->GetAll();
195 view2->SetData(rs->Begin(), mitk::AnatomicalPlane::Axial);
196
197 // We want to see the position of the slice in 2D and the
198 // slice itself in 3D: add it to the tree!
199 m_DataStorage->Add(view2->GetRenderer()->GetCurrentWorldPlaneGeometryNode());
200
201 //*************************************************************************
202 // Part Ic: 2D view for slicing sagittally
203 //*************************************************************************

Callers 1

InitializeMethod · 0.95

Calls 8

GetAllMethod · 0.80
SetDataStorageMethod · 0.45
GetRendererMethod · 0.45
SetMapperIDMethod · 0.45
GetVtkRendererMethod · 0.45
SetDataMethod · 0.45
BeginMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected