39 class QmitkStdMultiWidgetEditorPrivate
43 QmitkStdMultiWidgetEditorPrivate();
44 ~QmitkStdMultiWidgetEditorPrivate();
51 QString m_WidgetBackgroundColor1[4];
52 QString m_WidgetBackgroundColor2[4];
53 QString m_WidgetDecorationColor[4];
54 QString m_WidgetAnnotation[4];
55 bool m_MenuWidgetsEnabled;
56 QScopedPointer<berry::IPartListener> m_PartListener;
58 QHash<QString, QmitkRenderWindow*> m_RenderWindows;
64 QmitkStdMultiWidgetPartListener(QmitkStdMultiWidgetEditorPrivate* dd)
75 if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)
79 if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget())
81 d->m_StdMultiWidget->RemovePlanesFromDataStorage();
82 stdMultiWidgetEditor->RequestActivateMenuWidget(
false);
89 if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)
93 if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget())
95 stdMultiWidgetEditor->RequestActivateMenuWidget(
false);
102 if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)
106 if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget())
108 stdMultiWidgetEditor->RequestActivateMenuWidget(
true);
115 if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)
119 if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget())
121 d->m_StdMultiWidget->AddPlanesToDataStorage();
122 stdMultiWidgetEditor->RequestActivateMenuWidget(
true);
129 QmitkStdMultiWidgetEditorPrivate*
const d;
133 QmitkStdMultiWidgetEditorPrivate::QmitkStdMultiWidgetEditorPrivate()
134 : m_StdMultiWidget(0), m_MouseModeToolbar(0)
135 , m_MenuWidgetsEnabled(false)
136 , m_PartListener(new QmitkStdMultiWidgetPartListener(this))
139 QmitkStdMultiWidgetEditorPrivate::~QmitkStdMultiWidgetEditorPrivate()
143 const QString QmitkStdMultiWidgetEditor::EDITOR_ID =
"org.mitk.editors.stdmultiwidget";
146 : d(new QmitkStdMultiWidgetEditorPrivate)
152 this->
GetSite()->GetPage()->RemovePartListener(d->m_PartListener.data());
157 return d->m_StdMultiWidget;
162 if (d->m_StdMultiWidget)
return d->m_StdMultiWidget->GetRenderWindow1();
168 return d->m_RenderWindows;
173 if (d->m_RenderWindows.contains(
id))
174 return d->m_RenderWindows[
id];
181 return d->m_StdMultiWidget->GetCrossPosition();
186 d->m_StdMultiWidget->MoveCrossToPosition(pos);
193 enable ? d->m_StdMultiWidget->EnableColoredRectangles()
194 : d->m_StdMultiWidget->DisableColoredRectangles();
198 enable ? d->m_StdMultiWidget->EnableDepartmentLogo()
199 : d->m_StdMultiWidget->DisableDepartmentLogo();
203 d->m_StdMultiWidget->ActivateMenuWidget(enable);
207 enable ? d->m_StdMultiWidget->EnableGradientBackground()
208 : d->m_StdMultiWidget->DisableGradientBackground();
212 enable ? d->m_StdMultiWidget->SetCornerAnnotationVisibility(
true)
213 : d->m_StdMultiWidget->SetCornerAnnotationVisibility(
false);
221 return d->m_StdMultiWidget->IsColoredRectanglesEnabled();
225 return d->m_StdMultiWidget->IsColoredRectanglesEnabled();
229 return d->m_StdMultiWidget->IsMenuWidgetEnabled();
233 return d->m_StdMultiWidget->GetGradientBackgroundFlag();
237 return d->m_StdMultiWidget->IsCornerAnnotationVisible();
245 QStringList decorations;
252 d->m_StdMultiWidget->SetWidgetPlanesVisibility(enable);
258 if (node.IsNotNull())
260 bool visible =
false;
261 node->GetVisibility(visible, 0);
272 if (d->m_StdMultiWidget == 0)
274 QHBoxLayout* layout =
new QHBoxLayout(parent);
275 layout->setContentsMargins(0,0,0,0);
277 if (d->m_MouseModeToolbar == NULL)
280 layout->addWidget(d->m_MouseModeToolbar);
288 d->m_RenderWindows.insert(
"axial", d->m_StdMultiWidget->GetRenderWindow1());
289 d->m_RenderWindows.insert(
"sagittal", d->m_StdMultiWidget->GetRenderWindow2());
290 d->m_RenderWindows.insert(
"coronal", d->m_StdMultiWidget->GetRenderWindow3());
291 d->m_RenderWindows.insert(
"3d", d->m_StdMultiWidget->GetRenderWindow4());
293 d->m_MouseModeToolbar->setMouseModeSwitcher( d->m_StdMultiWidget->GetMouseModeSwitcher() );
295 layout->addWidget(d->m_StdMultiWidget);
300 d->m_StdMultiWidget->SetDataStorage(ds);
308 d->m_StdMultiWidget->GetRenderWindow4()->GetRenderer()->SetMapperID(
312 d->m_StdMultiWidget->EnableStandardLevelWindow();
316 d->m_StdMultiWidget->AddDisplayPlaneSubTree();
321 d->m_MenuWidgetsEnabled = d->m_StdMultiWidget->IsMenuWidgetEnabled();
323 this->
GetSite()->GetPage()->AddPartListener(d->m_PartListener.data());
345 bool logoFound =
false;
346 foreach (
const QString& key, currentNode->
Keys())
348 if( key ==
"DepartmentLogo")
350 QString departmentLogoLocation = currentNode->
Get(
"DepartmentLogo",
"");
352 if (departmentLogoLocation.isEmpty())
354 d->m_StdMultiWidget->DisableDepartmentLogo();
360 d->m_StdMultiWidget->DisableDepartmentLogo();
361 d->m_StdMultiWidget->SetDepartmentLogoPath(qPrintable(departmentLogoLocation));
362 d->m_StdMultiWidget->EnableDepartmentLogo();
369 if (logoFound)
break;
379 d->m_StdMultiWidget->SetGradientBackgroundColorForRenderWindow(upper, lower, 0);
382 d->m_StdMultiWidget->SetGradientBackgroundColorForRenderWindow(upper, lower, 1);
385 d->m_StdMultiWidget->SetGradientBackgroundColorForRenderWindow(upper, lower, 2);
388 d->m_StdMultiWidget->SetGradientBackgroundColorForRenderWindow(upper, lower, 3);
389 d->m_StdMultiWidget->EnableGradientBackground();
396 d->m_StdMultiWidget->SetDecorationColor(0, colorDecorationWidget1);
397 d->m_StdMultiWidget->SetDecorationColor(1, colorDecorationWidget2);
398 d->m_StdMultiWidget->SetDecorationColor(2, colorDecorationWidget3);
399 d->m_StdMultiWidget->SetDecorationColor(3, colorDecorationWidget4);
401 for(
unsigned int i = 0; i < 4; ++i)
403 d->m_StdMultiWidget->SetDecorationProperties(d->m_WidgetAnnotation[i].toStdString(),
407 int crosshairgapsize = prefs->
GetInt(
"crosshair gap size", 32);
408 d->m_StdMultiWidget->GetWidgetPlane1()->SetIntProperty(
"Crosshair.Gap Size", crosshairgapsize);
409 d->m_StdMultiWidget->GetWidgetPlane2()->SetIntProperty(
"Crosshair.Gap Size", crosshairgapsize);
410 d->m_StdMultiWidget->GetWidgetPlane3()->SetIntProperty(
"Crosshair.Gap Size", crosshairgapsize);
413 d->m_StdMultiWidget->EnableColoredRectangles();
416 bool constrainedZooming = prefs->
GetBool(
"Use constrained zooming and panning",
true);
425 bool showLevelWindowWidget = prefs->
GetBool(
"Show level/window widget",
true);
426 if (showLevelWindowWidget)
428 d->m_StdMultiWidget->EnableStandardLevelWindow();
432 d->m_StdMultiWidget->DisableStandardLevelWindow();
436 bool newMode = prefs->
GetBool(
"PACS like mouse interaction",
false);
437 d->m_MouseModeToolbar->setVisible( newMode );
443 QColor qColor(widgetColorInHex);
445 float colorMax = 255.0f;
446 if (widgetColorInHex.isEmpty())
448 returnColor[0] = 1.0;
449 returnColor[1] = 1.0;
450 returnColor[2] = 1.0;
451 MITK_ERROR <<
"Using default color for unknown widget " << qPrintable(widgetColorInHex);
455 returnColor[0] = qColor.red() / colorMax;
456 returnColor[1] = qColor.green() / colorMax;
457 returnColor[2] = qColor.blue() / colorMax;
465 float colorMax = 255.0f;
466 returnColor.setRed(static_cast<int>(color[0]* colorMax + 0.5));
467 returnColor.setGreen(static_cast<int>(color[1]* colorMax + 0.5));
468 returnColor.setBlue(static_cast<int>(color[2]* colorMax + 0.5));
469 return returnColor.name();
475 for(
unsigned int i = 0; i < 4; ++i)
477 d->m_WidgetDecorationColor[i] =
MitkColorToHex(d->m_StdMultiWidget->GetDecorationColor(i));
478 d->m_WidgetBackgroundColor1[i] =
MitkColorToHex(d->m_StdMultiWidget->GetGradientColors(i).first);
479 d->m_WidgetBackgroundColor2[i] =
MitkColorToHex(d->m_StdMultiWidget->GetGradientColors(i).second);
480 d->m_WidgetAnnotation[i] = QString::fromStdString(d->m_StdMultiWidget->GetCornerAnnotationText(i));
487 d->m_WidgetBackgroundColor1[0] = preferences->
Get(
"widget1 first background color", d->m_WidgetBackgroundColor1[0]);
488 d->m_WidgetBackgroundColor2[0] = preferences->
Get(
"widget1 second background color", d->m_WidgetBackgroundColor2[0]);
489 d->m_WidgetBackgroundColor1[1] = preferences->
Get(
"widget2 first background color", d->m_WidgetBackgroundColor1[1]);
490 d->m_WidgetBackgroundColor2[1] = preferences->
Get(
"widget2 second background color", d->m_WidgetBackgroundColor2[1]);
491 d->m_WidgetBackgroundColor1[2] = preferences->
Get(
"widget3 first background color", d->m_WidgetBackgroundColor1[2]);
492 d->m_WidgetBackgroundColor2[2] = preferences->
Get(
"widget3 second background color", d->m_WidgetBackgroundColor2[2]);
493 d->m_WidgetBackgroundColor1[3] = preferences->
Get(
"widget4 first background color", d->m_WidgetBackgroundColor1[3]);
494 d->m_WidgetBackgroundColor2[3] = preferences->
Get(
"widget4 second background color", d->m_WidgetBackgroundColor2[3]);
496 d->m_WidgetDecorationColor[0] = preferences->
Get(
"widget1 decoration color", d->m_WidgetDecorationColor[0]);
497 d->m_WidgetDecorationColor[1] = preferences->
Get(
"widget2 decoration color", d->m_WidgetDecorationColor[1]);
498 d->m_WidgetDecorationColor[2] = preferences->
Get(
"widget3 decoration color", d->m_WidgetDecorationColor[2]);
499 d->m_WidgetDecorationColor[3] = preferences->
Get(
"widget4 decoration color", d->m_WidgetDecorationColor[3]);
501 d->m_WidgetAnnotation[0] = preferences->
Get(
"widget1 corner annotation", d->m_WidgetAnnotation[0]);
502 d->m_WidgetAnnotation[1] = preferences->
Get(
"widget2 corner annotation", d->m_WidgetAnnotation[1]);
503 d->m_WidgetAnnotation[2] = preferences->
Get(
"widget3 corner annotation", d->m_WidgetAnnotation[2]);
504 d->m_WidgetAnnotation[3] = preferences->
Get(
"widget4 corner annotation", d->m_WidgetAnnotation[3]);
513 preferences->
Put(
"widget1 corner annotation", d->m_WidgetAnnotation[0]);
514 preferences->
Put(
"widget2 corner annotation", d->m_WidgetAnnotation[1]);
515 preferences->
Put(
"widget3 corner annotation", d->m_WidgetAnnotation[2]);
516 preferences->
Put(
"widget4 corner annotation", d->m_WidgetAnnotation[3]);
518 preferences->
Put(
"widget1 decoration color", d->m_WidgetDecorationColor[0]);
519 preferences->
Put(
"widget2 decoration color", d->m_WidgetDecorationColor[1]);
520 preferences->
Put(
"widget3 decoration color", d->m_WidgetDecorationColor[2]);
521 preferences->
Put(
"widget4 decoration color", d->m_WidgetDecorationColor[3]);
523 preferences->
Put(
"widget1 first background color", d->m_WidgetBackgroundColor1[0]);
524 preferences->
Put(
"widget2 first background color", d->m_WidgetBackgroundColor1[1]);
525 preferences->
Put(
"widget3 first background color", d->m_WidgetBackgroundColor1[2]);
526 preferences->
Put(
"widget4 first background color", d->m_WidgetBackgroundColor1[3]);
527 preferences->
Put(
"widget1 second background color", d->m_WidgetBackgroundColor2[0]);
528 preferences->
Put(
"widget2 second background color", d->m_WidgetBackgroundColor2[1]);
529 preferences->
Put(
"widget3 second background color", d->m_WidgetBackgroundColor2[2]);
530 preferences->
Put(
"widget4 second background color", d->m_WidgetBackgroundColor2[3]);
535 if (d->m_StdMultiWidget != 0)
536 d->m_StdMultiWidget->setFocus();
541 if (d->m_StdMultiWidget)
545 d->m_StdMultiWidget->ActivateMenuWidget(d->m_MenuWidgetsEnabled);
549 d->m_MenuWidgetsEnabled = d->m_StdMultiWidget->IsMenuWidgetEnabled();
550 d->m_StdMultiWidget->ActivateMenuWidget(
false);
virtual void PartHidden(const IWorkbenchPartReference::Pointer &)
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
virtual void SetConstrainedPanningZooming(bool _arg)
virtual void PartOpened(const IWorkbenchPartReference::Pointer &)
virtual bool GetBool(const QString &key, bool def) const =0
virtual mitk::DataStorage::Pointer GetDataStorage() const
static RenderingManager * GetInstance()
static const QString DECORATION_MENU
MITK implementation of the QVTKWidget.
virtual QStringList Keys() const =0
virtual IPreferences::Pointer Parent() const =0
static const QString DECORATION_CORNER_ANNOTATION
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
virtual void PartClosed(const IWorkbenchPartReference::Pointer &)
virtual QString Get(const QString &key, const QString &def) const =0
virtual void Put(const QString &key, const QString &value)=0
virtual void PartVisible(const IWorkbenchPartReference::Pointer &)
ObjectType * GetPointer() const
virtual berry::IPreferences::Pointer GetPreferences() const
static const QString DECORATION_BORDER
Qt toolbar representing mitk::MouseModeSwitcher.
virtual int GetInt(const QString &key, int def) const =0
static const QString DECORATION_LOGO
SmartPointer< Other > Cast() const
virtual Events::Types GetPartEventTypes() const =0
virtual void InitializeViewsByBoundingObjects(const DataStorage *)
Initializes the renderwindows by the aggregated geometry of all objects that are held in the data sto...
static const QString DECORATION_BACKGROUND
void RequestUpdate(mitk::RenderingManager::RequestType requestType=mitk::RenderingManager::REQUEST_UPDATE_ALL) override
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
IWorkbenchPartSite::Pointer GetSite() const override