00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 1.12 $ 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 #ifndef QmitkSegmentationView_h 00019 #define QmitkSegmentationView_h 00020 00021 #include "QmitkFunctionality.h" 00022 00023 #include <berryIBerryPreferences.h> 00024 00025 #include "ui_QmitkSegmentationControls.h" 00026 00027 class QmitkRenderWindow; 00028 class QmitkSegmentationPostProcessing; 00029 00034 class QmitkSegmentationView : public QObject, public QmitkFunctionality 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 00040 QmitkSegmentationView(); 00041 virtual ~QmitkSegmentationView(); 00042 00046 virtual void OnSelectionChanged(mitk::DataNode* node); 00047 virtual void OnSelectionChanged(std::vector<mitk::DataNode*> nodes); 00048 00049 // reaction to new segmentations being created by segmentation tools 00050 void NewNodesGenerated(); 00051 void NewNodeObjectsGenerated(mitk::ToolManager::DataVectorType*); 00052 00053 // QmitkFunctionality's activate/deactivate 00054 virtual void Activated(); 00055 virtual void Deactivated(); 00056 00057 // QmitkFunctionality's changes regarding THE QmitkStdMultiWidget 00058 virtual void StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget); 00059 virtual void StdMultiWidgetNotAvailable(); 00060 virtual void StdMultiWidgetClosed(QmitkStdMultiWidget& stdMultiWidget); 00061 00062 // BlueBerry's notification about preference changes (e.g. from a dialog) 00063 virtual void OnPreferencesChanged(const berry::IBerryPreferences*); 00064 00065 // observer to mitk::RenderingManager's RenderingManagerViewsInitializedEvent event 00066 void RenderingManagerReinitialized(const itk::EventObject&); 00067 00068 // observer to mitk::SliceController's SliceRotation event 00069 void SliceRotation(const itk::EventObject&); 00070 00071 protected slots: 00072 00073 void OnComboBoxSelectionChanged(const mitk::DataNode* node); 00074 00075 // reaction to the button "New segmentation" 00076 void CreateNewSegmentation(); 00077 00078 // reaction to the button "New segmentation" 00079 void CreateSegmentationFromSurface(); 00080 00081 // called when a segmentation tool is activated 00082 void ManualToolSelected(int id); 00083 00084 // called when one of "Manual", "Organ", "Lesion" pages of the QToolbox is selected 00085 void ToolboxStackPageChanged(int id); 00086 00087 void OnSurfaceSelectionChanged(); 00088 00089 protected: 00090 00091 // a type for handling lists of DataNodes 00092 typedef std::vector<mitk::DataNode*> NodeList; 00093 00094 // set available multiwidget 00095 void SetMultiWidget(QmitkStdMultiWidget* multiWidget); 00096 00097 // actively query the current selection of data manager 00098 //void PullCurrentDataManagerSelection(); 00099 00100 // reactions to selection events from data manager (and potential other senders) 00101 //void BlueBerrySelectionChanged(berry::IWorkbenchPart::Pointer sourcepart, berry::ISelection::ConstPointer selection); 00102 mitk::DataNode::Pointer FindFirstRegularImage( std::vector<mitk::DataNode*> nodes ); 00103 mitk::DataNode::Pointer FindFirstSegmentation( std::vector<mitk::DataNode*> nodes ); 00104 00105 // propagate BlueBerry selection to ToolManager for manual segmentation 00106 void SetToolManagerSelection(const mitk::DataNode* referenceData, const mitk::DataNode* workingData); 00107 00108 // checks if selected reference image is aligned with the slices stack orientation of the StdMultiWidget 00109 void CheckImageAlignment(); 00110 00111 // checks if given render window aligns with the slices of given image 00112 bool IsRenderWindowAligned(QmitkRenderWindow* renderWindow, mitk::Image* image); 00113 00114 // make sure all images/segmentations look as selected by the users in this view's preferences 00115 void ForceDisplayPreferencesUponAllImages(); 00116 00117 // decorates a DataNode according to the user preference settings 00118 void ApplyDisplayOptions(mitk::DataNode* node); 00119 00120 // GUI setup 00121 void CreateQtPartControl(QWidget* parent); 00122 00123 // handling of a list of known (organ name, organ color) combination 00124 // ATTENTION these methods are defined in QmitkSegmentationOrganNamesHandling.cpp 00125 QStringList GetDefaultOrganColorString(); 00126 void UpdateOrganList(QStringList& organColors, const QString& organname, mitk::Color colorname); 00127 void AppendToOrganList(QStringList& organColors, const QString& organname, int r, int g, int b); 00128 00129 // the Qt parent of our GUI (NOT of this object) 00130 QWidget* m_Parent; 00131 00132 // our GUI 00133 Ui::QmitkSegmentationControls * m_Controls; 00134 00135 // THE currently existing QmitkStdMultiWidget 00136 QmitkStdMultiWidget * m_MultiWidget; 00137 00138 QmitkSegmentationPostProcessing* m_PostProcessing; 00139 00140 unsigned long m_RenderingManagerObserverTag; 00141 unsigned long m_SlicesRotationObserverTag1; 00142 unsigned long m_SlicesRotationObserverTag2; 00143 }; 00144 00145 #endif /*QMITKsegmentationVIEW_H_*/ 00146