Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkDataManagerView.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "QmitkDataManagerView.h"
18 
19 //# Own Includes
20 //## mitk
24 #include "mitkCoreObjectFactory.h"
25 #include "mitkColorProperty.h"
26 #include "mitkCommon.h"
27 #include "mitkNodePredicateData.h"
28 #include "mitkNodePredicateNot.h"
29 #include "mitkNodePredicateOr.h"
33 #include "mitkProperties.h"
34 #include <mitkNodePredicateAnd.h>
35 #include <mitkITKImageImport.h>
37 #include <mitkIRenderingManager.h>
38 #include <mitkImageCast.h>
39 //## Qmitk
40 #include <QmitkDnDFrameWidget.h>
41 #include <QmitkIOUtil.h>
43 #include <QmitkCustomVariants.h>
44 #include <QmitkFileSaveAction.h>
47 #include "src/internal/QmitkNodeTableViewKeyFilter.h"
48 #include "src/internal/QmitkInfoDialog.h"
49 #include "src/internal/QmitkDataManagerItemDelegate.h"
50 //## Berry
51 #include <berryIEditorPart.h>
52 #include <berryIWorkbenchPage.h>
54 #include <berryPlatform.h>
55 #include <berryPlatformUI.h>
56 #include <berryIEditorRegistry.h>
57 
58 //# Toolkit Includes
59 #include <QTableView>
60 #include <QGroupBox>
61 #include <QGridLayout>
62 #include <QHBoxLayout>
63 #include <QVBoxLayout>
64 #include <QLabel>
65 #include <QListView>
66 #include <QMenu>
67 #include <QAction>
68 #include <QComboBox>
69 #include <QApplication>
70 #include <QCursor>
71 #include <QHeaderView>
72 #include <QTreeView>
73 #include <QWidgetAction>
74 #include <QSplitter>
75 #include <QPushButton>
76 #include <QFileDialog>
77 #include <QMessageBox>
78 #include <QToolBar>
79 #include <QKeyEvent>
80 #include <QColor>
81 #include <QColorDialog>
82 #include <QSizePolicy>
83 #include <QSortFilterProxyModel>
84 #include <QSignalMapper>
85 
86 #include "mitkDataNodeObject.h"
87 #include "mitkIContextMenuAction.h"
90 
91 const QString QmitkDataManagerView::VIEW_ID = "org.mitk.views.datamanager";
92 
94  : m_GlobalReinitOnNodeDelete(true),
95  m_ItemDelegate(NULL)
96 {
97 }
98 
100 {
101  //Remove all registered actions from each descriptor
102  for (std::vector< std::pair< QmitkNodeDescriptor*, QAction* > >::iterator it = m_DescriptorActionList.begin();it != m_DescriptorActionList.end(); it++)
103  {
104  // first== the NodeDescriptor; second== the registered QAction
105  (it->first)->RemoveAction(it->second);
106  }
107 }
108 
110 {
111  m_CurrentRowCount = 0;
112  m_Parent = parent;
113  //# Preferences
115 
117  = (prefService->GetSystemPreferences()->Node(VIEW_ID))
118  .Cast<berry::IBerryPreferences>();
119  assert( prefs );
120  prefs->OnChanged.AddListener( berry::MessageDelegate1<QmitkDataManagerView
121  , const berry::IBerryPreferences*>( this
123 
124  //# GUI
126  m_NodeTreeModel->setParent( parent );
128  prefs->GetBool("Place new nodes on top", true) );
130  prefs->GetBool("Allow changing of parent node", false));
131  m_SurfaceDecimation = prefs->GetBool("Use surface decimation", false);
132  // Prepare filters
137 
139  m_FilterModel->setSourceModel(m_NodeTreeModel);
142 
143  //# Tree View (experimental)
144  m_NodeTreeView = new QTreeView;
145  m_NodeTreeView->setHeaderHidden(true);
146  m_NodeTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
147  m_NodeTreeView->setSelectionBehavior( QAbstractItemView::SelectRows );
148  m_NodeTreeView->setAlternatingRowColors(true);
149  m_NodeTreeView->setDragEnabled(true);
150  m_NodeTreeView->setDropIndicatorShown(true);
151  m_NodeTreeView->setAcceptDrops(true);
152  m_NodeTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
153  m_NodeTreeView->setModel(m_FilterModel);
154  m_NodeTreeView->setTextElideMode(Qt::ElideMiddle);
155  m_NodeTreeView->installEventFilter(new QmitkNodeTableViewKeyFilter(this));
156 
157  m_ItemDelegate = new QmitkDataManagerItemDelegate(m_NodeTreeView);
158  m_NodeTreeView->setItemDelegate(m_ItemDelegate);
159 
160  QObject::connect( m_NodeTreeView, SIGNAL(customContextMenuRequested(const QPoint&))
161  , this, SLOT(NodeTableViewContextMenuRequested(const QPoint&)) );
162  QObject::connect( m_NodeTreeModel, SIGNAL(rowsInserted (const QModelIndex&, int, int))
163  , this, SLOT(NodeTreeViewRowsInserted ( const QModelIndex&, int, int )) );
164  QObject::connect( m_NodeTreeModel, SIGNAL(rowsRemoved (const QModelIndex&, int, int))
165  , this, SLOT(NodeTreeViewRowsRemoved( const QModelIndex&, int, int )) );
166  QObject::connect( m_NodeTreeView->selectionModel()
167  , SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection & ) )
168  , this
169  , SLOT( NodeSelectionChanged ( const QItemSelection &, const QItemSelection & ) ) );
170 
171  //# m_NodeMenu
172  m_NodeMenu = new QMenu(m_NodeTreeView);
173 
174  // # Actions
176  QList<berry::IEditorDescriptor::Pointer> editors = editorRegistry->GetEditors("*.mitk");
177  if (editors.size() > 1)
178  {
179  m_ShowInMapper = new QSignalMapper(this);
180  foreach(berry::IEditorDescriptor::Pointer descriptor, editors)
181  {
182  QAction* action = new QAction(descriptor->GetLabel(), this);
183  m_ShowInActions << action;
184  m_ShowInMapper->connect(action, SIGNAL(triggered()), m_ShowInMapper, SLOT(map()));
185  m_ShowInMapper->setMapping(action, descriptor->GetId());
186  }
187  connect(m_ShowInMapper, SIGNAL(mapped(QString)), this, SLOT(ShowIn(QString)));
188  }
189 
190  auto unknownDataNodeDescriptor =
192 
193  auto imageDataNodeDescriptor =
195 
196  auto multiComponentImageDataNodeDescriptor =
197  QmitkNodeDescriptorManager::GetInstance()->GetDescriptor("MultiComponentImage");
198 
199  auto diffusionImageDataNodeDescriptor =
201 
202  auto surfaceDataNodeDescriptor =
204 
205  auto labelSetImageDataNodeDescriptor =
207 
208  auto pointSetNodeDescriptor =
210 
211  auto planarLineNodeDescriptor =
213  auto planarCircleNodeDescriptor =
215  auto planarEllipseNodeDescriptor =
217  auto planarAngleNodeDescriptor =
219  auto planarFourPointAngleNodeDescriptor =
220  QmitkNodeDescriptorManager::GetInstance()->GetDescriptor("PlanarFourPointAngle");
221  auto planarRectangleNodeDescriptor =
223  auto planarPolygonNodeDescriptor =
225  auto planarPathNodeDescriptor =
227  auto planarDoubleEllipseNodeDescriptor =
228  QmitkNodeDescriptorManager::GetInstance()->GetDescriptor("PlanarDoubleEllipse");
229  auto planarBezierCurveNodeDescriptor =
231  auto planarSubdivisionPolygonNodeDescriptor =
232  QmitkNodeDescriptorManager::GetInstance()->GetDescriptor("PlanarSubdivisionPolygon");
233 
234  QAction* globalReinitAction = new QAction(QIcon(":/org.mitk.gui.qt.datamanager/Refresh_48.png"), tr("Global Reinit"), this);
235  QObject::connect( globalReinitAction, SIGNAL( triggered(bool) )
236  , this, SLOT( GlobalReinit(bool) ) );
237  unknownDataNodeDescriptor->AddAction(globalReinitAction);
238  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor, globalReinitAction));
239 
240  QAction* saveAction = new QmitkFileSaveAction(QIcon(":/org.mitk.gui.qt.datamanager/Save_48.png"),
241  this->GetSite()->GetWorkbenchWindow());
242  unknownDataNodeDescriptor->AddAction(saveAction);
243  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor,saveAction));
244 
245  QAction* removeAction = new QAction(QIcon(":/org.mitk.gui.qt.datamanager/Remove_48.png"), tr("Remove"), this);
246  QObject::connect( removeAction, SIGNAL( triggered(bool) )
247  , this, SLOT( RemoveSelectedNodes(bool) ) );
248  unknownDataNodeDescriptor->AddAction(removeAction);
249  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor,removeAction));
250 
251  QAction* reinitAction = new QAction(QIcon(":/org.mitk.gui.qt.datamanager/Refresh_48.png"), tr("Reinit"), this);
252  QObject::connect( reinitAction, SIGNAL( triggered(bool) )
253  , this, SLOT( ReinitSelectedNodes(bool) ) );
254  unknownDataNodeDescriptor->AddAction(reinitAction);
255  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor,reinitAction));
256 
257  // find contextMenuAction extension points and add them to the node descriptor
259  QList<berry::IConfigurationElement::Pointer> cmActions(
260  extensionPointService->GetConfigurationElementsFor("org.mitk.gui.qt.datamanager.contextMenuActions") );
261  QList<berry::IConfigurationElement::Pointer>::iterator cmActionsIt;
262 
263  QmitkNodeDescriptor* tmpDescriptor;
264  QAction* contextMenuAction;
265  QVariant cmActionDataIt;
266  m_ConfElements.clear();
267 
268  int i=1;
269  for (cmActionsIt = cmActions.begin()
270  ; cmActionsIt != cmActions.end()
271  ; ++cmActionsIt)
272  {
273  QString cmNodeDescriptorName = (*cmActionsIt)->GetAttribute("nodeDescriptorName");
274  QString cmLabel = (*cmActionsIt)->GetAttribute("label");
275  QString cmClass = (*cmActionsIt)->GetAttribute("class");
276  if(!cmNodeDescriptorName.isEmpty() &&
277  !cmLabel.isEmpty() &&
278  !cmClass.isEmpty())
279  {
280  QString cmIcon = (*cmActionsIt)->GetAttribute("icon");
281  // create context menu entry here
282  tmpDescriptor = QmitkNodeDescriptorManager::GetInstance()->GetDescriptor(cmNodeDescriptorName);
283  if(!tmpDescriptor)
284  {
285  MITK_WARN << "cannot add action \"" << cmLabel << "\" because descriptor " << cmNodeDescriptorName << " does not exist";
286  continue;
287  }
288  // check if the user specified an icon attribute
289  if ( !cmIcon.isEmpty() )
290  {
291  contextMenuAction = new QAction( QIcon(cmIcon), cmLabel, parent);
292  }
293  else
294  {
295  contextMenuAction = new QAction( cmLabel, parent);
296  }
297  tmpDescriptor->AddAction(contextMenuAction);
298  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(tmpDescriptor,contextMenuAction));
299  m_ConfElements[contextMenuAction] = *cmActionsIt;
300 
301  cmActionDataIt.setValue<int>(i);
302  contextMenuAction->setData( cmActionDataIt );
303  connect( contextMenuAction, SIGNAL( triggered(bool) ) , this, SLOT( ContextMenuActionTriggered(bool) ) );
304  ++i;
305  }
306  }
307 
308  m_OpacitySlider = new QSlider;
309  m_OpacitySlider->setMinimum(0);
310  m_OpacitySlider->setMaximum(100);
311  m_OpacitySlider->setOrientation(Qt::Horizontal);
312  QObject::connect( m_OpacitySlider, SIGNAL( valueChanged(int) )
313  , this, SLOT( OpacityChanged(int) ) );
314 
315  QLabel* _OpacityLabel = new QLabel(tr("Opacity: "));
316  QHBoxLayout* _OpacityWidgetLayout = new QHBoxLayout;
317  _OpacityWidgetLayout->setContentsMargins(4,4,4,4);
318  _OpacityWidgetLayout->addWidget(_OpacityLabel);
319  _OpacityWidgetLayout->addWidget(m_OpacitySlider);
320  QWidget* _OpacityWidget = new QWidget;
321  _OpacityWidget->setLayout(_OpacityWidgetLayout);
322 
323  QWidgetAction* opacityAction = new QWidgetAction(this);
324  opacityAction ->setDefaultWidget(_OpacityWidget);
325  QObject::connect( opacityAction , SIGNAL( changed() )
326  , this, SLOT( OpacityActionChanged() ) );
327  unknownDataNodeDescriptor->AddAction(opacityAction , false);
328  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor,opacityAction));
329 
330  m_ColorButton = new QPushButton;
331  m_ColorButton->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
332  //m_ColorButton->setText("Change color");
333  QObject::connect( m_ColorButton, SIGNAL( clicked() )
334  , this, SLOT( ColorChanged() ) );
335 
336  QLabel* _ColorLabel = new QLabel(tr("Color: "));
337  _ColorLabel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
338  QHBoxLayout* _ColorWidgetLayout = new QHBoxLayout;
339  _ColorWidgetLayout->setContentsMargins(4,4,4,4);
340  _ColorWidgetLayout->addWidget(_ColorLabel);
341  _ColorWidgetLayout->addWidget(m_ColorButton);
342  QWidget* _ColorWidget = new QWidget;
343  _ColorWidget->setLayout(_ColorWidgetLayout);
344 
345  QWidgetAction* colorAction = new QWidgetAction(this);
346  colorAction->setDefaultWidget(_ColorWidget);
347  QObject::connect( colorAction, SIGNAL( changed() )
348  , this, SLOT( ColorActionChanged() ) );
349 
350  { // only give the color context menu option where appropriate
351  if (imageDataNodeDescriptor != NULL)
352  {
353  imageDataNodeDescriptor->AddAction(colorAction, false);
354  m_DescriptorActionList.push_back(
355  std::pair<QmitkNodeDescriptor *, QAction *>(imageDataNodeDescriptor, colorAction));
356  }
357  if (multiComponentImageDataNodeDescriptor != NULL)
358  {
359  multiComponentImageDataNodeDescriptor->AddAction(colorAction, false);
360  m_DescriptorActionList.push_back(
361  std::pair<QmitkNodeDescriptor *, QAction *>(multiComponentImageDataNodeDescriptor, colorAction));
362  }
363  if (diffusionImageDataNodeDescriptor != NULL)
364  {
365  diffusionImageDataNodeDescriptor->AddAction(colorAction, false);
366  m_DescriptorActionList.push_back(
367  std::pair<QmitkNodeDescriptor *, QAction *>(diffusionImageDataNodeDescriptor, colorAction));
368  }
369  if (surfaceDataNodeDescriptor != NULL)
370  {
371  surfaceDataNodeDescriptor->AddAction(colorAction, false);
372  m_DescriptorActionList.push_back(
373  std::pair<QmitkNodeDescriptor *, QAction *>(surfaceDataNodeDescriptor, colorAction));
374  }
375  if (pointSetNodeDescriptor != NULL)
376  {
377  pointSetNodeDescriptor->AddAction(colorAction, false);
378  m_DescriptorActionList.push_back(
379  std::pair<QmitkNodeDescriptor *, QAction *>(pointSetNodeDescriptor, colorAction));
380  }
381 
382  if (planarLineNodeDescriptor != NULL)
383  {
384  planarLineNodeDescriptor->AddAction(colorAction, false);
385  m_DescriptorActionList.push_back(
386  std::pair<QmitkNodeDescriptor *, QAction *>(planarLineNodeDescriptor, colorAction));
387  }
388 
389  if (planarCircleNodeDescriptor != NULL)
390  {
391  planarCircleNodeDescriptor->AddAction(colorAction, false);
392  m_DescriptorActionList.push_back(
393  std::pair<QmitkNodeDescriptor *, QAction *>(planarCircleNodeDescriptor, colorAction));
394  }
395 
396  if (planarEllipseNodeDescriptor != NULL)
397  {
398  planarEllipseNodeDescriptor->AddAction(colorAction, false);
399  m_DescriptorActionList.push_back(
400  std::pair<QmitkNodeDescriptor *, QAction *>(planarEllipseNodeDescriptor, colorAction));
401  }
402 
403  if (planarAngleNodeDescriptor != NULL)
404  {
405  planarAngleNodeDescriptor->AddAction(colorAction, false);
406  m_DescriptorActionList.push_back(
407  std::pair<QmitkNodeDescriptor *, QAction *>(planarAngleNodeDescriptor, colorAction));
408  }
409 
410  if (planarFourPointAngleNodeDescriptor != NULL)
411  {
412  planarFourPointAngleNodeDescriptor->AddAction(colorAction, false);
413  m_DescriptorActionList.push_back(
414  std::pair<QmitkNodeDescriptor *, QAction *>(planarFourPointAngleNodeDescriptor, colorAction));
415  }
416 
417  if (planarRectangleNodeDescriptor != NULL)
418  {
419  planarRectangleNodeDescriptor->AddAction(colorAction, false);
420  m_DescriptorActionList.push_back(
421  std::pair<QmitkNodeDescriptor *, QAction *>(planarRectangleNodeDescriptor, colorAction));
422  }
423 
424  if (planarPolygonNodeDescriptor != NULL)
425  {
426  planarPolygonNodeDescriptor->AddAction(colorAction, false);
427  m_DescriptorActionList.push_back(
428  std::pair<QmitkNodeDescriptor *, QAction *>(planarPolygonNodeDescriptor, colorAction));
429  }
430 
431  if (planarPathNodeDescriptor != NULL)
432  {
433  planarPathNodeDescriptor->AddAction(colorAction, false);
434  m_DescriptorActionList.push_back(
435  std::pair<QmitkNodeDescriptor *, QAction *>(planarPathNodeDescriptor, colorAction));
436  }
437 
438  if (planarDoubleEllipseNodeDescriptor != NULL)
439  {
440  planarDoubleEllipseNodeDescriptor->AddAction(colorAction, false);
441  m_DescriptorActionList.push_back(
442  std::pair<QmitkNodeDescriptor *, QAction *>(planarDoubleEllipseNodeDescriptor, colorAction));
443  }
444 
445  if (planarBezierCurveNodeDescriptor != NULL)
446  {
447  planarBezierCurveNodeDescriptor->AddAction(colorAction, false);
448  m_DescriptorActionList.push_back(
449  std::pair<QmitkNodeDescriptor *, QAction *>(planarBezierCurveNodeDescriptor, colorAction));
450  }
451 
452  if (planarSubdivisionPolygonNodeDescriptor != NULL)
453  {
454  planarSubdivisionPolygonNodeDescriptor->AddAction(colorAction, false);
455  m_DescriptorActionList.push_back(
456  std::pair<QmitkNodeDescriptor *, QAction *>(planarSubdivisionPolygonNodeDescriptor, colorAction));
457  }
458  }
459 
461  m_ComponentSlider->setOrientation(Qt::Horizontal);
462  //QObject::connect( m_OpacitySlider, SIGNAL( valueChanged(int) )
463  // , this, SLOT( OpacityChanged(int) ) );
464 
465  QLabel* _ComponentLabel = new QLabel(tr("Component: "));
466  QHBoxLayout* _ComponentWidgetLayout = new QHBoxLayout;
467  _ComponentWidgetLayout->setContentsMargins(4,4,4,4);
468  _ComponentWidgetLayout->addWidget(_ComponentLabel);
469  _ComponentWidgetLayout->addWidget(m_ComponentSlider);
470  QLabel* _ComponentValueLabel = new QLabel();
471  _ComponentWidgetLayout->addWidget(_ComponentValueLabel);
472  connect(m_ComponentSlider, SIGNAL(valueChanged(int)), _ComponentValueLabel, SLOT(setNum(int)));
473  QWidget* _ComponentWidget = new QWidget;
474  _ComponentWidget->setLayout(_ComponentWidgetLayout);
475 
476  QWidgetAction* componentAction = new QWidgetAction(this);
477  componentAction->setDefaultWidget(_ComponentWidget);
478  QObject::connect( componentAction , SIGNAL( changed() )
479  , this, SLOT( ComponentActionChanged() ) );
480  multiComponentImageDataNodeDescriptor->AddAction(componentAction, false);
481  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(multiComponentImageDataNodeDescriptor,componentAction));
482  if (diffusionImageDataNodeDescriptor!=NULL)
483  {
484  diffusionImageDataNodeDescriptor->AddAction(componentAction, false);
485  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(diffusionImageDataNodeDescriptor,componentAction));
486  }
487 
488  m_TextureInterpolation = new QAction(tr("Texture Interpolation"), this);
489  m_TextureInterpolation->setCheckable ( true );
490  QObject::connect( m_TextureInterpolation, SIGNAL( changed() )
491  , this, SLOT( TextureInterpolationChanged() ) );
492  QObject::connect( m_TextureInterpolation, SIGNAL( toggled(bool) )
493  , this, SLOT( TextureInterpolationToggled(bool) ) );
494  imageDataNodeDescriptor->AddAction(m_TextureInterpolation, false);
495  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(imageDataNodeDescriptor,m_TextureInterpolation));
496  if (diffusionImageDataNodeDescriptor!=NULL)
497  {
498  diffusionImageDataNodeDescriptor->AddAction(m_TextureInterpolation, false);
499  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(diffusionImageDataNodeDescriptor,m_TextureInterpolation));
500  }
501 
502  m_ColormapAction = new QAction(tr("Colormap"), this);
503  m_ColormapAction->setMenu(new QMenu);
504  QObject::connect( m_ColormapAction->menu(), SIGNAL( aboutToShow() )
505  , this, SLOT( ColormapMenuAboutToShow() ) );
506  imageDataNodeDescriptor->AddAction(m_ColormapAction, false);
507  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(imageDataNodeDescriptor, m_ColormapAction));
508  if (diffusionImageDataNodeDescriptor!=NULL)
509  {
510  diffusionImageDataNodeDescriptor->AddAction(m_ColormapAction, false);
511  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(diffusionImageDataNodeDescriptor, m_ColormapAction));
512  }
513 
514  m_SurfaceRepresentation = new QAction(tr("Surface Representation"), this);
515  m_SurfaceRepresentation->setMenu(new QMenu(m_NodeTreeView));
516  QObject::connect( m_SurfaceRepresentation->menu(), SIGNAL( aboutToShow() )
517  , this, SLOT( SurfaceRepresentationMenuAboutToShow() ) );
518  surfaceDataNodeDescriptor->AddAction(m_SurfaceRepresentation, false);
519  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(surfaceDataNodeDescriptor, m_SurfaceRepresentation));
520 
521  QAction* showOnlySelectedNodes
522  = new QAction(QIcon(":/org.mitk.gui.qt.datamanager/ShowSelectedNode_48.png")
523  , tr("Show only selected nodes"), this);
524  QObject::connect( showOnlySelectedNodes, SIGNAL( triggered(bool) )
525  , this, SLOT( ShowOnlySelectedNodes(bool) ) );
526  unknownDataNodeDescriptor->AddAction(showOnlySelectedNodes);
527  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor, showOnlySelectedNodes));
528 
529  QAction* toggleSelectedVisibility
530  = new QAction(QIcon(":/org.mitk.gui.qt.datamanager/InvertShowSelectedNode_48.png")
531  , tr("Toggle visibility"), this);
532  QObject::connect( toggleSelectedVisibility, SIGNAL( triggered(bool) )
533  , this, SLOT( ToggleVisibilityOfSelectedNodes(bool) ) );
534  unknownDataNodeDescriptor->AddAction(toggleSelectedVisibility);
535  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor,toggleSelectedVisibility));
536 
537  QAction* actionShowInfoDialog
538  = new QAction(QIcon(":/org.mitk.gui.qt.datamanager/ShowDataInfo_48.png")
539  , tr("Details..."), this);
540  QObject::connect( actionShowInfoDialog, SIGNAL( triggered(bool) )
541  , this, SLOT( ShowInfoDialogForSelectedNodes(bool) ) );
542  unknownDataNodeDescriptor->AddAction(actionShowInfoDialog);
543  m_DescriptorActionList.push_back(std::pair<QmitkNodeDescriptor*, QAction*>(unknownDataNodeDescriptor,actionShowInfoDialog));
544 
545  QGridLayout* _DndFrameWidgetLayout = new QGridLayout;
546  _DndFrameWidgetLayout->addWidget(m_NodeTreeView, 0, 0);
547  _DndFrameWidgetLayout->setContentsMargins(0,0,0,0);
548 
550  m_DndFrameWidget->setLayout(_DndFrameWidgetLayout);
551 
552  QVBoxLayout* layout = new QVBoxLayout(parent);
553  layout->addWidget(m_DndFrameWidget);
554  layout->setContentsMargins(0,0,0,0);
555 
556  m_Parent->setLayout(layout);
557 }
558 
560 {
561 }
562 
564 {
565  QAction* action = qobject_cast<QAction*> ( sender() );
566 
567  std::map<QAction*, berry::IConfigurationElement::Pointer>::iterator it
568  = m_ConfElements.find( action );
569  if( it == m_ConfElements.end() )
570  {
571  MITK_WARN << "associated conf element for action " << action->text().toStdString() << " not found";
572  return;
573  }
574  berry::IConfigurationElement::Pointer confElem = it->second;
575  mitk::IContextMenuAction* contextMenuAction = confElem->CreateExecutableExtension<mitk::IContextMenuAction>("class");
576 
577  QString className = confElem->GetAttribute("class");
578  QString smoothed = confElem->GetAttribute("smoothed");
579 
580  contextMenuAction->SetDataStorage(this->GetDataStorage());
581 
582  if(className == "QmitkCreatePolygonModelAction")
583  {
584  if(smoothed == "false")
585  {
586  contextMenuAction->SetSmoothed(false);
587  }
588  else
589  {
590  contextMenuAction->SetSmoothed(true);
591  }
592  contextMenuAction->SetDecimated(m_SurfaceDecimation);
593  }
594  else if(className == "QmitkStatisticsAction")
595  {
596  contextMenuAction->SetFunctionality(this);
597  }
598 
599  contextMenuAction->Run( this->GetCurrentSelection() ); // run the action
600 }
601 
603 {
604  if( m_NodeTreeModel->GetPlaceNewNodesOnTopFlag() != prefs->GetBool("Place new nodes on top", true) )
606 
607  bool hideHelperObjects = !prefs->GetBool("Show helper objects", false);
609  {
610  if (hideHelperObjects)
611  {
613  }
614  else
615  {
617  }
618  }
619  bool hideNodesWithNoData = !prefs->GetBool("Show nodes containing no data", false);
620 
622  {
623  if (hideNodesWithNoData)
624  {
626  }
627  else
628  {
630  }
631  }
632 
633  m_GlobalReinitOnNodeDelete = prefs->GetBool("Call global reinit if node is deleted", true);
634 
635  m_NodeTreeView->expandAll();
636 
637  m_SurfaceDecimation = prefs->GetBool("Use surface decimation", false);
638 
640  prefs->GetBool("Allow changing of parent node", false));
641 
642  this->GlobalReinit();
643 
644 
645 }
646 
648 {
649  QModelIndex selectedProxy = m_NodeTreeView->indexAt ( pos );
650  QModelIndex selected = m_FilterModel->mapToSource(selectedProxy);
652  QList<mitk::DataNode::Pointer> selectedNodes = this->GetCurrentSelection();
653 
654  if(!selectedNodes.isEmpty())
655  {
656  m_NodeMenu->clear();
657  QList<QAction*> actions;
658  if(selectedNodes.size() == 1 )
659  {
661 
662  for(QList<QAction*>::iterator it = actions.begin(); it != actions.end(); ++it)
663  {
664  (*it)->setData(QVariant::fromValue(node.GetPointer()));
665  }
666  }
667  else
668  actions = QmitkNodeDescriptorManager::GetInstance()->GetActions(selectedNodes);
669 
670  if (!m_ShowInActions.isEmpty())
671  {
672  QMenu* showInMenu = m_NodeMenu->addMenu(tr("Show In"));
673  showInMenu->addActions(m_ShowInActions);
674  }
675  m_NodeMenu->addActions(actions);
676  m_NodeMenu->popup(QCursor::pos());
677  }
678 }
679 
681 {
682  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
683  if(node)
684  {
685  float opacity = static_cast<float>(value)/100.0f;
686  node->SetFloatProperty("opacity", opacity);
688  }
689 }
690 
692 {
693  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
694  if(node)
695  {
696  float opacity = 0.0;
697  if(node->GetFloatProperty("opacity", opacity))
698  {
699  m_OpacitySlider->setValue(static_cast<int>(opacity*100));
700  }
701  }
702 }
703 
705 {
706  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
707  mitk::IntProperty* componentProperty = NULL;
708  int numComponents = 0;
709  if(node)
710  {
711  componentProperty =
712  dynamic_cast<mitk::IntProperty*>(node->GetProperty("Image.Displayed Component"));
713  mitk::Image* img = dynamic_cast<mitk::Image*>(node->GetData());
714  if (img != NULL)
715  {
716  numComponents = img->GetPixelType().GetNumberOfComponents();
717  }
718  }
719  if (componentProperty && numComponents > 1)
720  {
721  m_ComponentSlider->SetProperty(componentProperty);
723  m_ComponentSlider->setMaxValue(numComponents-1);
724  }
725  else
726  {
727  m_ComponentSlider->SetProperty(static_cast<mitk::IntProperty*>(NULL));
728  }
729 }
730 
732  {
733  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
734  if(node)
735  {
736  mitk::Color color;
738  node->GetProperty(colorProp,"color");
739  if(colorProp.IsNull())
740  return;
741  color = colorProp->GetValue();
742  QColor initial(color.GetRed()*255,color.GetGreen()*255,color.GetBlue()*255);
743  QColor qcolor = QColorDialog::getColor(initial,0,QString(tr("Change color")));
744  if (!qcolor.isValid())
745  return;
746  m_ColorButton->setAutoFillBackground(true);
747  node->SetProperty("color",mitk::ColorProperty::New(qcolor.red()/255.0,qcolor.green()/255.0,qcolor.blue()/255.0));
748  if (node->GetProperty("binaryimage.selectedcolor"))
749  {
750  node->SetProperty("binaryimage.selectedcolor",mitk::ColorProperty::New(qcolor.red()/255.0,qcolor.green()/255.0,qcolor.blue()/255.0));
751  }
753  }
754  }
755 
757 {
758  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
759  if(node)
760  {
761  mitk::Color color;
763  node->GetProperty(colorProp,"color");
764  if(colorProp.IsNull())
765  return;
766  color = colorProp->GetValue();
767 
768  QString styleSheet = "background-color:rgb(";
769  styleSheet.append(QString::number(color[0]*255));
770  styleSheet.append(",");
771  styleSheet.append(QString::number(color[1]*255));
772  styleSheet.append(",");
773  styleSheet.append(QString::number(color[2]*255));
774  styleSheet.append(")");
775  m_ColorButton->setStyleSheet(styleSheet);
776  }
777 }
778 
780 {
781  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
782  if(node)
783  {
784  bool textureInterpolation = false;
785  node->GetBoolProperty("texture interpolation", textureInterpolation);
786  m_TextureInterpolation->setChecked(textureInterpolation);
787  }
788 }
789 
791 {
792  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
793  if(node)
794  {
795  node->SetBoolProperty("texture interpolation", checked);
797  }
798 
799 }
800 
802 {
803  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
804  if(!node)
805  return;
806 
807  mitk::LookupTableProperty::Pointer lookupTableProperty =
808  dynamic_cast<mitk::LookupTableProperty*>(node->GetProperty("LookupTable"));
809  if (!lookupTableProperty)
810  return;
811 
812  QAction* senderAction = qobject_cast<QAction*>(QObject::sender());
813  if(!senderAction)
814  return;
815 
816  std::string activatedItem = senderAction->text().toStdString();
817 
818  mitk::LookupTable::Pointer lookupTable = lookupTableProperty->GetValue();
819  if (!lookupTable)
820  return;
821 
822  lookupTable->SetType(activatedItem);
823  lookupTableProperty->SetValue(lookupTable);
825  dynamic_cast<mitk::RenderingModeProperty*>(node->GetProperty("Image Rendering.Mode"));
828 }
829 
831 {
832  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
833  if(!node)
834  return;
835 
836  mitk::LookupTableProperty::Pointer lookupTableProperty =
837  dynamic_cast<mitk::LookupTableProperty*>(node->GetProperty("LookupTable"));
838  if (!lookupTableProperty)
839  {
841  lookupTableProperty = mitk::LookupTableProperty::New();
842  lookupTableProperty->SetLookupTable(mitkLut);
843  node->SetProperty("LookupTable", lookupTableProperty);
844  }
845 
846  mitk::LookupTable::Pointer lookupTable = lookupTableProperty->GetValue();
847  if (!lookupTable)
848  return;
849 
850  m_ColormapAction->menu()->clear();
851  QAction* tmp;
852 
853  int i = 0;
854  std::string lutType = lookupTable->typenameList[i];
855 
856  while (lutType != "END_OF_ARRAY")
857  {
858  tmp = m_ColormapAction->menu()->addAction(QString::fromStdString(lutType));
859  tmp->setCheckable(true);
860 
861  if (lutType == lookupTable->GetActiveTypeAsString())
862  {
863  tmp->setChecked(true);
864  }
865 
866  QObject::connect(tmp, SIGNAL(triggered(bool)), this, SLOT(ColormapActionToggled(bool)));
867 
868  lutType = lookupTable->typenameList[++i];
869  }
870 }
871 
873 {
874  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
875  if(!node)
876  return;
877 
878  mitk::EnumerationProperty* representationProp =
879  dynamic_cast<mitk::EnumerationProperty*> (node->GetProperty("material.representation"));
880  if(!representationProp)
881  return;
882 
883  // clear menu
884  m_SurfaceRepresentation->menu()->clear();
885  QAction* tmp;
886 
887  // create menu entries
888  for(mitk::EnumerationProperty::EnumConstIterator it=representationProp->Begin(); it!=representationProp->End()
889  ; it++)
890  {
891  tmp = m_SurfaceRepresentation->menu()->addAction(QString::fromStdString(it->second));
892  tmp->setCheckable(true);
893 
894  if(it->second == representationProp->GetValueAsString())
895  {
896  tmp->setChecked(true);
897  }
898 
899  QObject::connect( tmp, SIGNAL( triggered(bool) )
900  , this, SLOT( SurfaceRepresentationActionToggled(bool) ) );
901  }
902 }
903 
905 {
906  mitk::DataNode* node = m_NodeTreeModel->GetNode(m_FilterModel->mapToSource(m_NodeTreeView->selectionModel()->currentIndex()));
907  if(!node)
908  return;
909 
910  mitk::EnumerationProperty* representationProp =
911  dynamic_cast<mitk::EnumerationProperty*> (node->GetProperty("material.representation"));
912  if(!representationProp)
913  return;
914 
915  QAction* senderAction = qobject_cast<QAction*> ( QObject::sender() );
916 
917  if(!senderAction)
918  return;
919 
920  std::string activatedItem = senderAction->text().toStdString();
921 
922  if ( activatedItem != representationProp->GetValueAsString() )
923  {
924  if ( representationProp->IsValidEnumerationValue( activatedItem ) )
925  {
926  representationProp->SetValue( activatedItem );
927  representationProp->InvokeEvent( itk::ModifiedEvent() );
928  representationProp->Modified();
929 
931  }
932  }
933 
934 }
935 
937 {
938  mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
939 
940  if (renderWindow == NULL)
941  renderWindow = this->OpenRenderWindowPart(false);
942 
943  QList<mitk::DataNode::Pointer> selectedNodes = this->GetCurrentSelection();
944 
945  foreach(mitk::DataNode::Pointer node, selectedNodes)
946  {
947  mitk::BaseData::Pointer basedata = node->GetData();
948  if ( basedata.IsNotNull() &&
949  basedata->GetTimeGeometry()->IsValid() )
950  {
951  renderWindow->GetRenderingManager()->InitializeViews(
952  basedata->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
953  }
954  }
955 }
956 
958 {
959  QModelIndexList indexesOfSelectedRowsFiltered = m_NodeTreeView->selectionModel()->selectedRows();
960  QModelIndexList indexesOfSelectedRows;
961  for (int i = 0; i < indexesOfSelectedRowsFiltered.size(); ++i)
962  {
963  indexesOfSelectedRows.push_back(m_FilterModel->mapToSource(indexesOfSelectedRowsFiltered[i]));
964  }
965  if(indexesOfSelectedRows.size() < 1)
966  {
967  return;
968  }
969  std::vector<mitk::DataNode::Pointer> selectedNodes;
970 
971  mitk::DataNode::Pointer node = 0;
972  QString question = tr("Do you really want to remove ");
973 
974  for (QModelIndexList::iterator it = indexesOfSelectedRows.begin()
975  ; it != indexesOfSelectedRows.end(); it++)
976  {
977  node = m_NodeTreeModel->GetNode(*it);
978  // if node is not defined or if the node contains geometry data do not remove it
979  if ( node.IsNotNull() /*& strcmp(node->GetData()->GetNameOfClass(), "PlaneGeometryData") != 0*/ )
980  {
981  selectedNodes.push_back(node);
982  question.append(QString::fromStdString(node->GetName()));
983  question.append(", ");
984  }
985  }
986  // remove the last two characters = ", "
987  question = question.remove(question.size()-2, 2);
988  question.append(tr(" from data storage?"));
989 
990  QMessageBox::StandardButton answerButton = QMessageBox::question( m_Parent
991  , tr("DataManager")
992  , question
993  , QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
994 
995  if(answerButton == QMessageBox::Yes)
996  {
997  for (std::vector<mitk::DataNode::Pointer>::iterator it = selectedNodes.begin()
998  ; it != selectedNodes.end(); it++)
999  {
1000  node = *it;
1001  this->GetDataStorage()->Remove(node);
1003  this->GlobalReinit(false);
1004  }
1005  }
1006 }
1007 
1009 {
1010  QList<mitk::DataNode::Pointer> nodes = m_NodeTreeModel->GetNodeSet();
1011 
1012  foreach(mitk::DataNode::Pointer node, nodes)
1013  {
1014  node->SetVisibility(false);
1015  }
1017 }
1018 
1020 {
1021  QList<mitk::DataNode::Pointer> selectedNodes = this->GetCurrentSelection();
1022  QList<mitk::DataNode::Pointer> allNodes = m_NodeTreeModel->GetNodeSet();
1023 
1024  foreach(mitk::DataNode::Pointer node, allNodes)
1025  {
1026  node->SetVisibility(selectedNodes.contains(node));
1027  }
1029 }
1030 
1032 {
1033  QList<mitk::DataNode::Pointer> selectedNodes = this->GetCurrentSelection();
1034 
1035  bool isVisible = false;
1036  foreach(mitk::DataNode::Pointer node, selectedNodes)
1037  {
1038  isVisible = false;
1039  node->GetBoolProperty("visible", isVisible);
1040  node->SetVisibility(!isVisible);
1041  }
1043 }
1044 
1046 {
1047  QList<mitk::DataNode::Pointer> selectedNodes = this->GetCurrentSelection();
1048 
1049  QmitkInfoDialog _QmitkInfoDialog(selectedNodes, this->m_Parent);
1050  _QmitkInfoDialog.exec();
1051 }
1052 
1054 {
1055  // m_FilterModel->invalidate();
1056  // fix as proposed by R. Khlebnikov in the mitk-users mail from 02.09.2014
1057  QMetaObject::invokeMethod( m_FilterModel, "invalidate", Qt::QueuedConnection );
1058 }
1059 
1060 QItemSelectionModel *QmitkDataManagerView::GetDataNodeSelectionModel() const
1061 {
1062  return m_NodeTreeView->selectionModel();
1063 }
1064 
1066 {
1067  mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
1068 
1069  if (renderWindow == NULL)
1070  renderWindow = this->OpenRenderWindowPart(false);
1071 
1072  // no render window available
1073  if (renderWindow == NULL) return;
1074 
1076 }
1077 
1079  const QModelIndex & /*parent*/, int /*start*/, int /*end*/ )
1080 {
1082 }
1083 void QmitkDataManagerView::NodeTreeViewRowsInserted( const QModelIndex & parent, int, int )
1084 {
1085  QModelIndex viewIndex = m_FilterModel->mapFromSource(parent);
1086  m_NodeTreeView->setExpanded(viewIndex, true);
1087 
1088  // a new row was inserted
1089  if( m_CurrentRowCount == 0 && m_NodeTreeModel->rowCount() == 1 )
1090  {
1091  this->OpenRenderWindowPart();
1093  }
1094 }
1095 
1096 void QmitkDataManagerView::NodeSelectionChanged( const QItemSelection & /*selected*/, const QItemSelection & /*deselected*/ )
1097 {
1098  QList<mitk::DataNode::Pointer> nodes = m_NodeTreeModel->GetNodeSet();
1099 
1100  foreach(mitk::DataNode::Pointer node, nodes)
1101  {
1102  if ( node.IsNotNull() )
1103  node->SetBoolProperty("selected", false);
1104  }
1105 
1106  nodes.clear();
1107  nodes = this->GetCurrentSelection();
1108 
1109  foreach(mitk::DataNode::Pointer node, nodes)
1110  {
1111  if ( node.IsNotNull() )
1112  node->SetBoolProperty("selected", true);
1113  }
1114  //changing the selection does NOT require any rendering processes!
1115  //mitk::RenderingManager::GetInstance()->RequestUpdateAll();
1116 }
1117 
1118 void QmitkDataManagerView::ShowIn(const QString &editorId)
1119 {
1120  berry::IWorkbenchPage::Pointer page = this->GetSite()->GetPage();
1122  page->OpenEditor(input, editorId, false, berry::IWorkbenchPage::MATCH_ID);
1123 }
1124 
1125 mitk::IRenderWindowPart* QmitkDataManagerView::OpenRenderWindowPart(bool activatedEditor)
1126 {
1127  if (activatedEditor)
1128  {
1130  }
1131  else
1132  {
1134  }
1135 }
QmitkNodeDescriptor * GetUnknownDataNodeDescriptor() const
QSignalMapper * m_ShowInMapper
Maps "Show in" actions to editor ids.
virtual bool SetValue(const std::string &name)
mitk::IRenderWindowPart * GetRenderWindowPart(IRenderWindowPartStrategies strategies=NONE) const
virtual void CreateQtPartControl(QWidget *parent) override
Create the view here.
virtual std::string GetValueAsString() const override
QAction * m_ColormapAction
Lookuptable selection action.
virtual ~QmitkDataManagerView()
Standard dtor.
void ShowIn(const QString &editorId)
Opens the editor with the given id using the current data storage.
mitk::NodePredicateBase::Pointer m_NodeWithNoDataFilterPredicate
QPushButton * m_ColorButton
button to change the color of a node
virtual bool IsValidEnumerationValue(const IdType &val) const
QmitkNodeQmitkNodeDescriptor is Decorator class for the mitk::DataNode which enhances certain mitk::D...
void MakeAllNodesInvisible(bool checked=false)
Invoked when the visibility of the selected nodes should be toggled.
vcl_size_t m_CurrentRowCount
saves the current amount of rows shown in the datamanager
virtual mitk::IRenderingManager * GetRenderingManager() const =0
bool m_GlobalReinitOnNodeDelete
if true, GlobalReinit() is called if a node is deleted
static Pointer New()
QmitkDataStorageTreeModel * m_NodeTreeModel
A plain widget as the base pane.
void SetAllowHierarchyChange(bool allowHierarchyChange)
Set whether to allow hierarchy changes by dragging and dropping.
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
static Pointer New()
Interface for a MITK Workbench Part providing a render window.
virtual void Run(const QList< mitk::DataNode::Pointer > &selectedNodes)=0
Executes the action, that linked to the context menu entry.
QmitkDataManagerItemDelegate * m_ItemDelegate
virtual SmartPointer< IPreferences > GetSystemPreferences()=0
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void NodeTableViewContextMenuRequested(const QPoint &index)
Shows a node context menu.
QmitkDataStorageFilterProxyModel * m_FilterModel
std::vector< std::pair< QmitkNodeDescriptor *, QAction * > > m_DescriptorActionList
A list of ALL actions for the Context Menu
virtual void SetDataStorage(mitk::DataStorage *dataStorage)=0
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
virtual bool InitializeViews(const BaseGeometry *geometry, RenderingManager::RequestType type=RenderingManager::REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)=0
QmitkNumberPropertySlider * m_ComponentSlider
A Slider widget to change the rendered vector component of an image.
virtual bool GetBool(const QString &key, bool def) const =0
QSlider * m_OpacitySlider
A Slider widget to change the opacity of a node.
mitk::NodePredicateBase::Pointer m_HelperObjectFilterPredicate
static const QString VIEW_ID
std::map< QAction *, berry::IConfigurationElement::Pointer > m_ConfElements
An editor input based on a mitk::DataStorage.
void SetPlaceNewNodesOnTop(bool _PlaceNewNodesOnTop)
QAction * m_SurfaceRepresentation
SurfaceRepresentation action.
static Pointer New()
void OnPreferencesChanged(const berry::IBerryPreferences *) override
void ColormapActionToggled(bool)
changes the active colormap
void SetProperty(mitk::IntProperty *property)
QList< QAction * > m_ShowInActions
A list of "Show in" actions.
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting float properties (instances of FloatProperty)
void NodeTreeViewRowsInserted(const QModelIndex &parent, int start, int end)
When rows are inserted auto expand them.
QmitkDnDFrameWidget * m_DndFrameWidget
QAction * m_TextureInterpolation
TextureInterpolation action.
mitk::IDataStorageReference::Pointer GetDataStorageReference() const
#define MITK_WARN
Definition: mitkLogMacros.h:23
The LookupTableProperty class Property to associate mitk::LookupTable to an mitk::DataNode.
void TextureInterpolationToggled(bool checked)
A View class that can show all data tree nodes of a certain DataStorage.
static Pointer New(mitk::BaseData *_arg)
static Pointer New()
virtual QList< IEditorDescriptor::Pointer > GetEditors(const QString &fileName)=0
static RenderingManager * GetInstance()
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty)
void SurfaceRepresentationActionToggled(bool checked)
static IWorkbench * GetWorkbench()
EnumIdsContainerType::const_iterator EnumConstIterator
Image class for storing images.
Definition: mitkImage.h:76
virtual QList< SmartPointer< IConfigurationElement > > GetConfigurationElementsFor(const QString &extensionPointId) const =0
static IExtensionRegistry * GetExtensionRegistry()
QMenu * m_NodeMenu
The context menu that shows up when right clicking on a node.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
bool HasFilterPredicate(mitk::NodePredicateBase::Pointer pred)
bool RemoveFilterPredicate(mitk::NodePredicateBase::Pointer pred)
mitk::DataNode::Pointer GetNode(const QModelIndex &index) const
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
Definition: mitkImage.cpp:105
Enables loading data into a MITK application via Drag'n Drop.
QmitkNodeDescriptor * GetDescriptor(const mitk::DataNode *_Node) const
static Pointer New(const char *_arg)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
void RemoveSelectedNodes(bool checked=false)
Invoked when an element should be removed.
void AddFilterPredicate(mitk::NodePredicateBase::Pointer pred)
void ColormapMenuAboutToShow()
Agreggates available colormaps.
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty)
virtual EnumConstIterator End() const
QTreeView * m_NodeTreeView
The Table view to show the selected nodes.
virtual QList< mitk::DataNode::Pointer > GetNodeSet() const
virtual void NodeChanged(const mitk::DataNode *) override
virtual EnumConstIterator Begin() const
virtual void SetFunctionality(berry::QtViewPart *functionality)=0
void NodeSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Whenever the selection changes set the "selected" property respectively.
void ReinitSelectedNodes(bool checked=false)
Invoked when an element should be reinitiliased.
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
virtual void SetDecimated(bool decimated)=0
void ShowOnlySelectedNodes(bool checked=false)
Makes all selected nodes visible, all other nodes invisible.
virtual void SetSmoothed(bool smoothed)=0
void ShowInfoDialogForSelectedNodes(bool checked=false)
Invoked when infos of the selected nodes should be shown in a dialog.
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=NULL, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
QList< QAction * > GetActions(const mitk::DataNode *_Node) const
bool m_SurfaceDecimation
flag indicating whether a surface created from a selected decimation is decimated with vtkQuadricDeci...
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
void NodeTreeViewRowsRemoved(const QModelIndex &parent, int start, int end)
will setup m_CurrentRowCount
QmitkDataManagerView()
Standard ctor.
void ToggleVisibilityOfSelectedNodes(bool checked=false)
Invoked when the visibility of the selected nodes should be toggled.
static Pointer New()
mitk::DataStorage::Pointer GetDataStorage() const
virtual void InitializeViewsByBoundingObjects(const DataStorage *)
Initializes the renderwindows by the aggregated geometry of all objects that are held in the data sto...
virtual IEditorRegistry * GetEditorRegistry() const =0
QList< mitk::DataNode::Pointer > GetCurrentSelection() const
void GlobalReinit(bool checked=false)
Reinits everything.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
static QmitkNodeDescriptorManager * GetInstance()
virtual void AddAction(QAction *action, bool isBatchAction=true)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
IWorkbenchPartSite::Pointer GetSite() const override
void ContextMenuActionTriggered(bool)
will be toggled when a extension point context menu action is toggled this is a proxy method which wi...
static IPreferencesService * GetPreferencesService()