diff --git a/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h b/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h index 85a5aabfd3..aad76afeff 100644 --- a/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h +++ b/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h @@ -1,52 +1,51 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKCORESERVICESPLUGIN_H_ #define MITKCORESERVICESPLUGIN_H_ #include #include -#include "mitkCoreServicesPluginDll.h" #include "mitkIDataStorageService.h" namespace mitk { -class MITK_CORE_SERVICES_PLUGIN org_mitk_core_services_Activator : public QObject, public ctkPluginActivator +class org_mitk_core_services_Activator : public QObject, public ctkPluginActivator { Q_OBJECT Q_INTERFACES(ctkPluginActivator) public: static const std::string PLUGIN_ID; void start(ctkPluginContext* context); void stop(ctkPluginContext* context); private: mitk::IDataStorageService::Pointer dataStorageService; }; typedef org_mitk_core_services_Activator PluginActivator; } #endif /*MITKCORESERVICESPLUGIN_H_*/ diff --git a/CoreUI/Bundles/org.mitk.core.services/src/mitkCoreServicesPluginDll.h b/CoreUI/Bundles/org.mitk.core.services/src/mitkCoreServicesPluginDll.h deleted file mode 100644 index f1fc12926f..0000000000 --- a/CoreUI/Bundles/org.mitk.core.services/src/mitkCoreServicesPluginDll.h +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef MITKCORESERVICESPLUGINDLL_H_ -#define MITKCORESERVICESPLUGINDLL_H_ - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the MITK_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// MITK_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) // && !defined(MITK_STATIC) - #if defined(org_mitk_core_services_EXPORTS) - #define MITK_CORE_SERVICES_PLUGIN __declspec(dllexport) - #else - #define MITK_CORE_SERVICES_PLUGIN __declspec(dllimport) - #endif -#endif - - -#if !defined(MITK_CORE_SERVICES_PLUGIN) - #define MITK_CORE_SERVICES_PLUGIN -#endif - -#endif /*MITKCORESERVICESPLUGINDLL_H_*/ diff --git a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h index d1335f581c..73630284de 100644 --- a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h +++ b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h @@ -1,48 +1,48 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKIDATASTORAGEREFERENCE_H_ #define MITKIDATASTORAGEREFERENCE_H_ #include #include -#include "mitkCoreServicesPluginDll.h" +#include #include namespace mitk { struct MITK_CORE_SERVICES_PLUGIN IDataStorageReference : public berry::Object { berryInterfaceMacro(IDataStorageReference, mitk); virtual DataStorage::Pointer GetDataStorage() const = 0; virtual bool IsDefault() const = 0; virtual std::string GetLabel() const = 0; virtual void SetLabel(const std::string& label) = 0; virtual bool operator==(const IDataStorageReference* o) const = 0; }; } #endif /*MITKIDATASTORAGEREFERENCE_H_*/ diff --git a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h index 01bcb01254..4bbfcc94ad 100644 --- a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h +++ b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h @@ -1,52 +1,52 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKIDATASTORAGESERVICE_H_ #define MITKIDATASTORAGESERVICE_H_ #include -#include "mitkCoreServicesPluginDll.h" +#include #include "mitkIDataStorageReference.h" #include #include namespace mitk { struct MITK_CORE_SERVICES_PLUGIN IDataStorageService : public berry::Service { berryInterfaceMacro(IDataStorageService, berry); static const std::string ID; virtual IDataStorageReference::Pointer CreateDataStorage(const std::string& label) = 0; virtual std::vector GetDataStorageReferences() const = 0; virtual IDataStorageReference::Pointer GetDefaultDataStorage() const = 0; virtual IDataStorageReference::Pointer GetActiveDataStorage() const = 0; virtual void SetActiveDataStorage(IDataStorageReference::Pointer dataStorageRef) = 0; }; } Q_DECLARE_INTERFACE(mitk::IDataStorageService, "org.mitk.service.IDataStorageService") #endif /*MITKIDATASTORAGESERVICE_H_*/ diff --git a/Modules/Bundles/CMakeLists.txt b/Modules/Bundles/CMakeLists.txt index 62cf2a82aa..4c8890f208 100644 --- a/Modules/Bundles/CMakeLists.txt +++ b/Modules/Bundles/CMakeLists.txt @@ -1,57 +1,59 @@ IF(MITK_USE_BLUEBERRY) SET(MITK_DEFAULT_SUBPROJECTS MITK-Plugins) SET(_mitk_bundles_default ) IF(QT4_FOUND) LIST(APPEND _mitk_bundles_default "org.mitk.gui.qt.imagenavigator") # BlueBerry depends on CTK which depends on Qt, so we # need the Qt include direcotries INCLUDE(${QT_USE_FILE}) ENDIF() SET(PLUGIN_EXCLUDE_LIST org.mitk.core.ext org.mitk.gui.qt.volumetry org.mitk.core.jobs org.mitk.diffusionimaging org.mitk.gui.qt.diffusionimaging org.mitk.gui.qt.ext org.mitk.gui.qt.extapplication org.mitk.gui.qt.datamanager org.mitk.gui.qt.regiongrowing org.mitk.gui.qt.segmentation org.mitk.planarfigure org.mitk.gui.qt.igtnavigationtoolmanager org.mitk.gui.qt.igttrackingtoolbox org.mitk.gui.qt.igttutorial org.mitk.gui.qt.igttoolpairnavigation org.mitk.gui.qt.basicimageprocessing org.mitk.gui.qt.colourimageprocessing org.mitk.gui.qt.navigationdataplayer org.mitk.gui.qt.tofutil org.mitk.gui.qt.toftutorial org.mitk.gui.qt.imagenavigator org.mitk.gui.qt.moviemaker org.mitk.gui.qt.deformableregistration org.mitk.gui.qt.rigidregistration org.mitk.gui.qt.imagestatistics org.mitk.gui.qt.materialeditor + org.mitk.gui.qt.simpleexample + org.mitk.gui.qt.ugvisualization ) MACRO_COLLECT_PLUGINS(OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ExtBundles CACHE_PLUGIN_SOURCE_DIRS MITK_MODULES_PLUGIN_SOURCE_DIRS CACHE_PLUGIN_OUTPUT_DIRS MITK_MODULES_PLUGIN_OUTPUT_DIRS CACHE_PLUGIN_TARGETS MITK_MODULES_ENABLED_PLUGINS BUNDLE_LIST_PATH "${MITK_BINARY_DIR}/Bundles/MITKModulesBundleList.cmake" CMAKE_CACHE_PREFIX "MITK" PLUGIN_DEFAULT_ON ${_mitk_bundles_default} PLUGIN_EXCLUDES ${PLUGIN_EXCLUDE_LIST} ${MITK_BUILD_ALL_PLUGINS_OPTION}) -ENDIF(MITK_USE_BLUEBERRY) \ No newline at end of file +ENDIF(MITK_USE_BLUEBERRY) diff --git a/Modules/Bundles/PluginList.cmake b/Modules/Bundles/PluginList.cmake index 2f25fbeffd..54310991aa 100644 --- a/Modules/Bundles/PluginList.cmake +++ b/Modules/Bundles/PluginList.cmake @@ -1,28 +1,30 @@ SET(MITK_EXT_PLUGINS org.mitk.core.ext:ON org.mitk.core.jobs:OFF org.mitk.diffusionimaging:OFF org.mitk.gui.qt.diffusionimaging:OFF org.mitk.gui.qt.ext:ON org.mitk.gui.qt.extapplication:ON org.mitk.gui.qt.segmentation:OFF org.mitk.planarfigure:ON org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.igtnavigationtoolmanager:OFF org.mitk.gui.qt.igttoolpairnavigation:ON org.mitk.gui.qt.igttrackingtoolbox:OFF org.mitk.gui.qt.regiongrowing:OFF org.mitk.gui.qt.navigationdataplayer:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.igttutorial:OFF org.mitk.gui.qt.colourimageprocessing:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.deformableregistration:ON org.mitk.gui.qt.rigidregistration:ON org.mitk.gui.qt.imagestatistics:OFF org.mitk.gui.qt.volumetry:OFF org.mitk.gui.qt.materialeditor:OFF + org.mitk.gui.qt.simpleexample:OFF + org.mitk.gui.qt.ugvisualization:OFF ) diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt index d1fae30ab7..90d9ffdce6 100644 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt @@ -1 +1,7 @@ -MACRO_CREATE_MITK_PLUGIN(QmitkExt) +PROJECT(org_mitk_gui_qt_simpleexample) + +MACRO_CREATE_MITK_CTK_PLUGIN( + EXPORT_DIRECTIVE SIMPLEEXAMPLE_EXPORTS + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDENCIES QmitkExt +) diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.simpleexample/META-INF/MANIFEST.MF deleted file mode 100644 index 18c26c25ae..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: Simple Example -Bundle-SymbolicName: org.mitk.gui.qt.simpleexample -Bundle-Version: 0.1 -Bundle-Vendor: DKFZ, Medical and Biological Informatics -Require-Bundle: org.mitk.gui.qt.common -Bundle-Activator: diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake b/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake index 26b999bfd2..b680fd4356 100644 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake @@ -1,40 +1,42 @@ SET(SRC_CPP_FILES ) SET(INTERNAL_CPP_FILES QmitkSimpleExampleView.cpp - + mitkPluginActivator.cpp ) SET(UI_FILES src/internal/QmitkSimpleExampleViewControls.ui ) SET(MOC_H_FILES src/internal/QmitkSimpleExampleView.h + src/internal/mitkPluginActivator.h ) -SET(RESOURCE_FILES +SET(CACHED_RESOURCE_FILES resources/SimpleExample.png + plugin.xml # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench ) -SET(RES_FILES +SET(QRC_FILES # uncomment the following line if you want to use Qt resources # resources/QmitkSimpleExampleView.qrc ) -SET(CPP_FILES manifest.cpp) +SET(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) SET(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) SET(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest.cpp deleted file mode 100644 index 547b94f479..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision: 17332 $ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include - -#include -#include "src/internal/QmitkSimpleExampleView.h" - - -POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart) - POCO_EXPORT_CLASS(::QmitkSimpleExampleView) -POCO_END_MANIFEST diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest_headers.cmake new file mode 100644 index 0000000000..35e72f60ca --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest_headers.cmake @@ -0,0 +1,5 @@ +set(Plugin-Name "Simple Example") +set(Plugin-Version "0.1") +set(Plugin-Vendor "DKFZ, Medical and Biological Informatics") +set(Plugin-ContactAddress "http://www.mitk.org") +set(Require-Plugin org.mitk.gui.qt.common) diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml index d0cce005c9..f32255274e 100644 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml @@ -1,11 +1,11 @@ + class="QmitkSimpleExampleView" + icon="resources/SimpleExample.png" /> diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/SimpleexampleDll.h b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/SimpleexampleDll.h deleted file mode 100644 index 64184b3ec4..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/SimpleexampleDll.h +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision: 17332 $ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef _SIMPLEEXAMPLE_EXPORTS_DLL_H_ -#define _SIMPLEEXAMPLE_EXPORTS_DLL_H_ - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_simpleexample_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// org_mitk_gui_qt_simpleexample_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) && !defined(MITK_STATIC) - #if defined(org_mitk_gui_qt_simpleexample_EXPORTS) - #define SIMPLEEXAMPLE_EXPORTS __declspec(dllexport) - #else - #define SIMPLEEXAMPLE_EXPORTS __declspec(dllimport) - #endif -#endif - - -#if !defined(SIMPLEEXAMPLE_EXPORTS) - #define SIMPLEEXAMPLE_EXPORTS -#endif - -#endif /*_SIMPLEEXAMPLE_EXPORTS_DLL_H_*/ diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp index f257a04a55..27b1653034 100644 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp @@ -1,300 +1,306 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 17332 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "QmitkSimpleExampleView.h" #include "mitkNodePredicateDataType.h" #include "QmitkDataStorageComboBox.h" #include "QmitkStdMultiWidget.h" #include #include #include "mitkNodePredicateProperty.h" #include "mitkNodePredicateNot.h" #include "mitkProperties.h" #include #include #include #include #include #include "vtkImageWriter.h" #include "vtkPNGWriter.h" #include "vtkJPEGWriter.h" #include "vtkRenderLargeImage.h" const std::string QmitkSimpleExampleView::VIEW_ID = "org.mitk.views.simpleexample"; QmitkSimpleExampleView::QmitkSimpleExampleView() : QmitkFunctionality(), m_Controls(NULL), m_MultiWidget(NULL), m_NavigatorsInitialized(false) { } +QmitkSimpleExampleView::QmitkSimpleExampleView(const QmitkSimpleExampleView& other) +{ + Q_UNUSED(other) + throw std::runtime_error("Copy constructor not implemented"); +} + QmitkSimpleExampleView::~QmitkSimpleExampleView() { } void QmitkSimpleExampleView::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkSimpleExampleViewControls; m_Controls->setupUi(parent); this->CreateConnections(); } } void QmitkSimpleExampleView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) { m_MultiWidget = &stdMultiWidget; new QmitkStepperAdapter(m_Controls->sliceNavigatorTransversal, m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice(), "sliceNavigatorTransversalFromSimpleExample"); new QmitkStepperAdapter(m_Controls->sliceNavigatorSagittal, m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice(), "sliceNavigatorSagittalFromSimpleExample"); new QmitkStepperAdapter(m_Controls->sliceNavigatorFrontal, m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice(), "sliceNavigatorFrontalFromSimpleExample"); new QmitkStepperAdapter(m_Controls->sliceNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromSimpleExample"); new QmitkStepperAdapter(m_Controls->movieNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "movieNavigatorTimeFromSimpleExample"); } void QmitkSimpleExampleView::StdMultiWidgetNotAvailable() { m_MultiWidget = NULL; } void QmitkSimpleExampleView::CreateConnections() { if ( m_Controls ) { connect(m_Controls->stereoSelect, SIGNAL(activated(int)), this, SLOT(stereoSelectionChanged(int)) ); connect(m_Controls->reInitializeNavigatorsButton, SIGNAL(clicked()), this, SLOT(initNavigators()) ); connect(m_Controls->genMovieButton, SIGNAL(clicked()), this, SLOT(generateMovie()) ); connect(m_Controls->m_RenderWindow1Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow1Clicked()) ); connect(m_Controls->m_RenderWindow2Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow2Clicked()) ); connect(m_Controls->m_RenderWindow3Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow3Clicked()) ); connect(m_Controls->m_RenderWindow4Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow4Clicked()) ); connect(m_Controls->m_TakeScreenshotBtn, SIGNAL(clicked()), this, SLOT(OnTakeScreenshot()) ); connect(m_Controls->m_TakeHighResScreenShotBtn, SIGNAL(clicked()), this, SLOT(OnTakeHighResolutionScreenshot()) ); } } void QmitkSimpleExampleView::Activated() { QmitkFunctionality::Activated(); } void QmitkSimpleExampleView::Deactivated() { QmitkFunctionality::Deactivated(); } void QmitkSimpleExampleView::initNavigators() { /* get all nodes that have not set "includeInBoundingBox" to false */ mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false))); mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred); /* calculate bounding geometry of these nodes */ mitk::TimeSlicedGeometry::Pointer bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs); /* initialize the views to the bounding geometry */ m_NavigatorsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews(bounds); //m_NavigatorsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews(GetDefaultDataStorage()); } void QmitkSimpleExampleView::generateMovie() { QmitkRenderWindow* movieRenderWindow = GetMovieRenderWindow(); //mitk::Stepper::Pointer stepper = multiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice(); mitk::Stepper::Pointer stepper = movieRenderWindow->GetSliceNavigationController()->GetSlice(); mitk::MovieGenerator::Pointer movieGenerator = mitk::MovieGenerator::New(); if (movieGenerator.IsNotNull()) { movieGenerator->SetStepper( stepper ); movieGenerator->SetRenderer( mitk::BaseRenderer::GetInstance(movieRenderWindow->GetRenderWindow()) ); QString movieFileName = QFileDialog::getSaveFileName(0, "Choose a file name", QString(), "Movie (*.avi)"); if (!movieFileName.isEmpty()) { movieGenerator->SetFileName( movieFileName.toStdString().c_str() ); movieGenerator->WriteMovie(); } } } void QmitkSimpleExampleView::stereoSelectionChanged( int id ) { /* From vtkRenderWindow.h tells us about stereo rendering: Set/Get what type of stereo rendering to use. CrystalEyes mode uses frame-sequential capabilities available in OpenGL to drive LCD shutter glasses and stereo projectors. RedBlue mode is a simple type of stereo for use with red-blue glasses. Anaglyph mode is a superset of RedBlue mode, but the color output channels can be configured using the AnaglyphColorMask and the color of the original image can be (somewhat maintained using AnaglyphColorSaturation; the default colors for Anaglyph mode is red-cyan. Interlaced stereo mode produces a composite image where horizontal lines alternate between left and right views. StereoLeft and StereoRight modes choose one or the other stereo view. Dresden mode is yet another stereoscopic interleaving. */ vtkRenderWindow * vtkrenderwindow = m_MultiWidget->mitkWidget4->GetRenderWindow(); // note: foreground vtkRenderers (at least the department logo renderer) produce errors in stereoscopic visualization. // Therefore, we disable the logo visualization during stereo rendering. switch(id) { case 0: vtkrenderwindow->StereoRenderOff(); break; case 1: vtkrenderwindow->SetStereoTypeToRedBlue(); vtkrenderwindow->StereoRenderOn(); m_MultiWidget->DisableDepartmentLogo(); break; case 2: vtkrenderwindow->SetStereoTypeToDresden(); vtkrenderwindow->StereoRenderOn(); m_MultiWidget->DisableDepartmentLogo(); break; } mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow())->SetMapperID(2); m_MultiWidget->RequestUpdate(); } QmitkRenderWindow* QmitkSimpleExampleView::GetMovieRenderWindow() { //check which RenderWindow should be used to generate the movie, e.g. which button is toggled if(m_Controls->m_RenderWindow1Button->isChecked()) { return m_MultiWidget->mitkWidget1; } else if(m_Controls->m_RenderWindow2Button->isChecked()) { return m_MultiWidget->mitkWidget2; } else if(m_Controls->m_RenderWindow3Button->isChecked()) { return m_MultiWidget->mitkWidget3; } else if(m_Controls->m_RenderWindow4Button->isChecked()) { return m_MultiWidget->mitkWidget4; } else //as default take widget1 { return m_MultiWidget->mitkWidget1; } } void QmitkSimpleExampleView::OnRenderWindow1Clicked() { m_Controls->m_RenderWindow2Button->setChecked(false); m_Controls->m_RenderWindow3Button->setChecked(false); m_Controls->m_RenderWindow4Button->setChecked(false); } void QmitkSimpleExampleView::OnRenderWindow2Clicked() { m_Controls->m_RenderWindow1Button->setChecked(false); m_Controls->m_RenderWindow3Button->setChecked(false); m_Controls->m_RenderWindow4Button->setChecked(false); } void QmitkSimpleExampleView::OnRenderWindow3Clicked() { m_Controls->m_RenderWindow2Button->setChecked(false); m_Controls->m_RenderWindow1Button->setChecked(false); m_Controls->m_RenderWindow4Button->setChecked(false); } void QmitkSimpleExampleView::OnRenderWindow4Clicked() { m_Controls->m_RenderWindow2Button->setChecked(false); m_Controls->m_RenderWindow3Button->setChecked(false); m_Controls->m_RenderWindow1Button->setChecked(false); } void QmitkSimpleExampleView::OnTakeHighResolutionScreenshot() { QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)"); // only works correctly for 3D RenderWindow vtkRenderer* renderer = m_MultiWidget->mitkWidget4->GetRenderer()->GetVtkRenderer(); if (renderer == NULL) return; this->TakeScreenshot(renderer, 4, fileName); } void QmitkSimpleExampleView::OnTakeScreenshot() { QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)"); QmitkRenderWindow* renWin = this->GetMovieRenderWindow(); if (renWin == NULL) return; vtkRenderer* renderer = renWin->GetRenderer()->GetVtkRenderer(); if (renderer == NULL) return; this->TakeScreenshot(renderer, 1, fileName); } void QmitkSimpleExampleView::TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName) { if ((renderer == NULL) ||(magnificationFactor < 1) || fileName.isEmpty()) return; bool doubleBuffering( renderer->GetRenderWindow()->GetDoubleBuffer() ); renderer->GetRenderWindow()->DoubleBufferOff(); vtkImageWriter* fileWriter; QFileInfo fi(fileName); QString suffix = fi.suffix(); if (suffix.compare("png", Qt::CaseInsensitive) == 0) { fileWriter = vtkPNGWriter::New(); } else // default is jpeg { vtkJPEGWriter* w = vtkJPEGWriter::New(); w->SetQuality(100); w->ProgressiveOff(); fileWriter = w; } vtkRenderLargeImage* magnifier = vtkRenderLargeImage::New(); magnifier->SetInput(renderer); magnifier->SetMagnification(magnificationFactor); //magnifier->Update(); fileWriter->SetInput(magnifier->GetOutput()); fileWriter->SetFileName(fileName.toLatin1()); // vtkRenderLargeImage has problems with different layers, therefore we have to // temporarily deactivate all other layers. // we set the background to white, because it is nicer than black... double oldBackground[3]; renderer->GetBackground(oldBackground); double white[] = {1.0, 1.0, 1.0}; renderer->SetBackground(white); m_MultiWidget->DisableColoredRectangles(); m_MultiWidget->DisableDepartmentLogo(); m_MultiWidget->DisableGradientBackground(); fileWriter->Write(); fileWriter->Delete(); m_MultiWidget->EnableColoredRectangles(); m_MultiWidget->EnableDepartmentLogo(); m_MultiWidget->EnableGradientBackground(); renderer->SetBackground(oldBackground); renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering); } diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h index 638a4e96db..d1ac1a164c 100644 --- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h @@ -1,103 +1,104 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 17332 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _QMITKSIMPLEEXAMPLEVIEW_H_INCLUDED #define _QMITKSIMPLEEXAMPLEVIEW_H_INCLUDED #include #include #include "ui_QmitkSimpleExampleViewControls.h" #include /*! * \ingroup org_mitk_gui_qt_simpleexample_internal * * \brief QmitkSimpleExampleView * * Document your class here. * * \sa QmitkFunctionality */ class QmitkSimpleExampleView : public QmitkFunctionality { // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: static const std::string VIEW_ID; QmitkSimpleExampleView(); + QmitkSimpleExampleView(const QmitkSimpleExampleView& other); virtual ~QmitkSimpleExampleView(); virtual void CreateQtPartControl(QWidget *parent); /// \brief Creation of the connections of main and control widget virtual void CreateConnections(); /// \brief Called when the functionality is activated virtual void Activated(); virtual void Deactivated(); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); protected slots: /*! qt slot for event processing from a qt widget defining the stereo mode of widget 4 */ void stereoSelectionChanged(int id); /*! initialize the transversal, sagittal, coronal and temporal slider according to the image dimensions */ void initNavigators(); /*! generate a movie as *.avi from the active render window */ void generateMovie(); /*! return the renderwindow of which the movie shall be created, what depends on the toggled button */ QmitkRenderWindow* GetMovieRenderWindow(); void OnRenderWindow1Clicked(); void OnRenderWindow2Clicked(); void OnRenderWindow3Clicked(); void OnRenderWindow4Clicked(); void OnTakeHighResolutionScreenshot(); ///< takes screenshot of the 3D window in 4x resolution of the render window void OnTakeScreenshot(); ///< takes screenshot of the selected render window protected: Ui::QmitkSimpleExampleViewControls* m_Controls; QmitkStdMultiWidget* m_MultiWidget; void TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName); ///< writes a screenshot in JPEG or PNG format to the file fileName bool m_NavigatorsInitialized; }; #endif // _QMITKSIMPLEEXAMPLEVIEW_H_INCLUDED diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.cpp new file mode 100644 index 0000000000..b6400eebf6 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.cpp @@ -0,0 +1,21 @@ +#include "mitkPluginActivator.h" + +#include + +#include "QmitkSimpleExampleView.h" + +namespace mitk { + +void PluginActivator::start(ctkPluginContext* context) +{ + BERRY_REGISTER_EXTENSION_CLASS(QmitkSimpleExampleView, context) +} + +void PluginActivator::stop(ctkPluginContext* context) +{ + Q_UNUSED(context) +} + +} + +Q_EXPORT_PLUGIN2(org_mitk_gui_qt_simpleexample, mitk::PluginActivator) diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.h new file mode 100644 index 0000000000..a34be34be4 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.h @@ -0,0 +1,23 @@ +#ifndef MITKPLUGINACTIVATOR_H +#define MITKPLUGINACTIVATOR_H + +#include + +namespace mitk { + +class PluginActivator : + public QObject, public ctkPluginActivator +{ + Q_OBJECT + Q_INTERFACES(ctkPluginActivator) + +public: + + void start(ctkPluginContext* context); + void stop(ctkPluginContext* context); + +}; // PluginActivator + +} + +#endif // MITKPLUGINACTIVATOR_H diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt index fba82a3726..429419ef9a 100644 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt @@ -1,2 +1,7 @@ +PROJECT(org_mitk_gui_qt_ugvisualization) -MACRO_CREATE_MITK_PLUGIN(QmitkExt) +MACRO_CREATE_MITK_CTK_PLUGIN( + EXPORT_DIRECTIVE UGVISUALIZATION_EXPORT + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDENCIES QmitkExt +) diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/META-INF/MANIFEST.MF deleted file mode 100644 index 25b86fcdbb..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: UG Visualization -Bundle-SymbolicName: org.mitk.gui.qt.ugvisualization -Bundle-Version: 0.1 -Bundle-Vendor: DKFZ, Medical and Biological Informatics -Require-Bundle: org.mitk.gui.qt.common -Bundle-Activator: diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake index fb1d90ad3b..e666250cd1 100644 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake @@ -1,35 +1,37 @@ SET(SRC_CPP_FILES ) SET(INTERNAL_CPP_FILES QmitkUGVisualizationView.cpp - + mitkPluginActivator.cpp ) SET(UI_FILES src/internal/QmitkUGVisualizationViewControls.ui ) SET(MOC_H_FILES src/internal/QmitkUGVisualizationView.h + src/internal/mitkPluginActivator.h ) -SET(RESOURCE_FILES +SET(CACHED_RESOURCE_FILES resources/icon.png + plugin.xml ) -SET(RES_FILES +SET(QRC_FILES ) -SET(CPP_FILES manifest.cpp) +SET(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) SET(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) SET(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest.cpp deleted file mode 100644 index 4540f48909..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include - - - -#include "src/internal/QmitkUGVisualizationView.h" - -POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart) - POCO_EXPORT_CLASS(::QmitkUGVisualizationView) -POCO_END_MANIFEST diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest_headers.cmake new file mode 100644 index 0000000000..071bc25705 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest_headers.cmake @@ -0,0 +1,5 @@ +set(Plugin-Name "UG Visualization") +set(Plugin-Version "0.1") +set(Plugin-Vendor "DKFZ, Medical and Biological Informatics") +set(Plugin-ContactAddress "http://www.mitk.org") +set(Require-Plugin org.mitk.gui.qt.common) diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml index 19d03ede9a..068fe5adbf 100644 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml @@ -1,12 +1,12 @@ diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/UGVisualizationDll.h b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/UGVisualizationDll.h deleted file mode 100644 index 71bada7bdd..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/UGVisualizationDll.h +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision$ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef _UGVISUALIZATION_EXPORT_DLL_H_ -#define _UGVISUALIZATION_EXPORT_DLL_H_ - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_ugvisualization_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// org_mitk_gui_qt_ugvisualization_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) && !defined(MITK_STATIC) - #if defined(org_mitk_gui_qt_ugvisualization_EXPORTS) - #define UGVISUALIZATION_EXPORT __declspec(dllexport) - #else - #define UGVISUALIZATION_EXPORT __declspec(dllimport) - #endif -#endif - - -#if !defined(UGVISUALIZATION_EXPORT) - #define UGVISUALIZATION_EXPORT -#endif - -#endif /*_UGVISUALIZATION_EXPORT_DLL_H_*/ diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp index a58cfb00d4..53ae45a723 100644 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp @@ -1,296 +1,302 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ // Blueberry #include #include // Qmitk #include "QmitkUGVisualizationView.h" #include "QmitkStdMultiWidget.h" #include #include #include #include #include #include #include #include class UGVisVolumeObserver : public mitk::PropertyView { public: UGVisVolumeObserver(mitk::BoolProperty* property, QmitkUGVisualizationView* view) : PropertyView(property), m_View(view), m_BoolProperty(property) { } protected: virtual void PropertyChanged() { m_View->m_VolumeMode = m_BoolProperty->GetValue(); m_View->UpdateEnablement(); } virtual void PropertyRemoved() { m_View->m_VolumeMode = false; m_Property = 0; m_BoolProperty = 0; } QmitkUGVisualizationView* m_View; mitk::BoolProperty* m_BoolProperty; }; const std::string QmitkUGVisualizationView::VIEW_ID = "org.mitk.views.ugvisualization"; QmitkUGVisualizationView::QmitkUGVisualizationView() : QmitkFunctionality(), m_MultiWidget(0), m_Outline2DAction(0), m_Outline2DWidget(0), m_LODAction(0), m_ScalarVisibilityAction(0), m_ScalarVisibilityWidget(0), m_FirstVolumeRepId(-1), m_ShowTFGeneratorWidget(true), m_ShowScalarOpacityWidget(false), m_ShowColorWidget(true), m_ShowGradientOpacityWidget(false), m_ShowTFGeneratorAction(0), m_ShowScalarOpacityAction(0), m_ShowColorAction(0), m_ShowGradientOpacityAction(0), m_VolumeModeObserver(0) { } +QmitkUGVisualizationView::QmitkUGVisualizationView(const QmitkUGVisualizationView& other) +{ + Q_UNUSED(other) + throw std::runtime_error("Copy constructor not implemented"); +} + QmitkUGVisualizationView::~QmitkUGVisualizationView() { delete m_VolumeModeObserver; } void QmitkUGVisualizationView::CreateQtPartControl( QWidget *parent ) { m_Controls.setupUi( parent ); m_Outline2DWidget = new QmitkBoolPropertyWidget("Outline 2D polygons", parent); m_Outline2DAction = new QWidgetAction(this); m_Outline2DAction->setDefaultWidget(m_Outline2DWidget); m_LODAction = new QAction("Enable LOD (Level Of Detail)", this); m_LODAction->setCheckable(true); m_ScalarVisibilityWidget = new QmitkBoolPropertyWidget("Visualize scalars", parent); m_ScalarVisibilityAction = new QWidgetAction(this); m_ScalarVisibilityAction->setDefaultWidget(m_ScalarVisibilityWidget); m_ShowColorAction = new QAction("Show color transfer function", this); m_ShowColorAction->setCheckable(true); m_ShowColorAction->setChecked(m_ShowColorWidget); m_ShowGradientOpacityAction = new QAction("Show gradient opacity function", this); m_ShowGradientOpacityAction->setCheckable(true); m_ShowGradientOpacityAction->setChecked(m_ShowGradientOpacityWidget); m_ShowScalarOpacityAction = new QAction("Show scalar opacity function", this); m_ShowScalarOpacityAction->setCheckable(true); m_ShowScalarOpacityAction->setChecked(m_ShowScalarOpacityWidget); m_ShowTFGeneratorAction = new QAction("Show transfer function generator", this); m_ShowTFGeneratorAction->setCheckable(true); m_ShowTFGeneratorAction->setChecked(m_ShowTFGeneratorWidget); QMenu* menu = new QMenu(parent); menu->addAction(m_ScalarVisibilityAction); menu->addAction(m_Outline2DAction); //menu->addAction(m_LODAction); menu->addSeparator(); menu->addAction(m_ShowTFGeneratorAction); menu->addAction(m_ShowScalarOpacityAction); menu->addAction(m_ShowColorAction); menu->addAction(m_ShowGradientOpacityAction); m_Controls.m_OptionsButton->setMenu(menu); m_Controls.m_TransferFunctionWidget->SetScalarLabel("Scalar value"); // const mitk::EnumerationProperty::EnumStringsContainerType& scalarStrings = scalarProp->GetEnumStrings(); // for (mitk::EnumerationProperty::EnumStringsContainerType::const_iterator it = scalarStrings.begin(); // it != scalarStrings.end(); ++it) // { // MITK_INFO << "ADding: " << it->first; // m_Controls.m_ScalarModeComboBox->addItem(QString::fromStdString(it->first), it->second); // } this->UpdateGUI(); CreateConnections(); } void QmitkUGVisualizationView::CreateConnections() { connect(m_Controls.m_ScalarModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateRenderWindow())); connect(m_Controls.m_RepresentationComboBox, SIGNAL(activated(int)), this, SLOT(UpdateRenderWindow())); connect(m_Outline2DWidget, SIGNAL(toggled(bool)), this, SLOT(UpdateRenderWindow())); connect(m_ScalarVisibilityWidget, SIGNAL(toggled(bool)), this, SLOT(UpdateRenderWindow())); connect(m_Controls.m_TransferFunctionGeneratorWidget, SIGNAL(SignalUpdateCanvas()), m_Controls.m_TransferFunctionWidget, SLOT(OnUpdateCanvas())); connect(m_ShowColorAction, SIGNAL(triggered(bool)), this, SLOT(ShowColorWidget(bool))); connect(m_ShowGradientOpacityAction, SIGNAL(triggered(bool)), this, SLOT(ShowGradientOpacityWidget(bool))); connect(m_ShowScalarOpacityAction, SIGNAL(triggered(bool)), this, SLOT(ShowScalarOpacityWidget(bool))); connect(m_ShowTFGeneratorAction, SIGNAL(triggered(bool)), this, SLOT(ShowTFGeneratorWidget(bool))); } void QmitkUGVisualizationView::UpdateRenderWindow() { mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } void QmitkUGVisualizationView::ShowTFGeneratorWidget(bool show) { m_ShowTFGeneratorWidget = show; UpdateEnablement(); } void QmitkUGVisualizationView::ShowScalarOpacityWidget(bool show) { m_ShowScalarOpacityWidget = show; UpdateEnablement(); } void QmitkUGVisualizationView::ShowColorWidget(bool show) { m_ShowColorWidget = show; UpdateEnablement(); } void QmitkUGVisualizationView::ShowGradientOpacityWidget(bool show) { m_ShowGradientOpacityWidget = show; UpdateEnablement(); } void QmitkUGVisualizationView::UpdateEnablement() { m_Controls.m_TransferFunctionGeneratorWidget->setVisible(m_ShowTFGeneratorWidget); m_Controls.m_TransferFunctionWidget->ShowScalarOpacityFunction(m_ShowScalarOpacityWidget); m_Controls.m_TransferFunctionWidget->ShowColorFunction(m_ShowColorWidget); m_Controls.m_TransferFunctionWidget->ShowGradientOpacityFunction(m_ShowGradientOpacityWidget); m_Controls.m_TransferFunctionGeneratorWidget->SetThresholdTabEnabled(m_VolumeMode); m_Controls.m_TransferFunctionGeneratorWidget->SetBellTabEnabled(m_VolumeMode); m_Controls.m_TransferFunctionWidget->SetScalarOpacityFunctionEnabled(m_VolumeMode); m_Controls.m_TransferFunctionWidget->SetGradientOpacityFunctionEnabled(m_VolumeMode); } void QmitkUGVisualizationView::UpdateGUI() { bool enable = false; mitk::DataNode* node = 0; std::vector nodes = this->GetDataManagerSelection(); if (!nodes.empty()) { node = nodes.front(); if (node) { // here we have a valid mitk::DataNode // a node itself is not very useful, we need its data item mitk::BaseData* data = node->GetData(); if (data) { // test if this data item is an unstructured grid enable = dynamic_cast( data ); } } } m_Controls.m_SelectedLabel->setVisible(enable); m_Controls.m_ErrorLabel->setVisible(!enable); m_Controls.m_ContainerWidget->setEnabled(enable); m_Controls.m_OptionsButton->setEnabled(enable); if (enable) { m_VolumeMode = false; node->GetBoolProperty("volumerendering", m_VolumeMode); m_Controls.m_SelectedLabel->setText(QString("Selected UG: ") + node->GetName().c_str()); m_Controls.m_TransferFunctionGeneratorWidget->SetDataNode(node); m_Controls.m_TransferFunctionWidget->SetDataNode(node); mitk::BoolProperty* outlineProp = 0; node->GetProperty(outlineProp, "outline polygons"); m_Outline2DWidget->SetProperty(outlineProp); mitk::BoolProperty* scalarVisProp = 0; node->GetProperty(scalarVisProp, "scalar visibility"); m_ScalarVisibilityWidget->SetProperty(scalarVisProp); mitk::VtkScalarModeProperty* scalarProp = 0; if (node->GetProperty(scalarProp, "scalar mode")) { m_Controls.m_ScalarModeComboBox->SetProperty(scalarProp); } mitk::GridRepresentationProperty* gridRepProp = 0; mitk::GridVolumeMapperProperty* gridVolumeProp = 0; mitk::BoolProperty* volumeProp = 0; node->GetProperty(gridRepProp, "grid representation"); node->GetProperty(gridVolumeProp, "volumerendering.mapper"); node->GetProperty(volumeProp, "volumerendering"); m_Controls.m_RepresentationComboBox->SetProperty(gridRepProp, gridVolumeProp, volumeProp); if (m_VolumeModeObserver) { delete m_VolumeModeObserver; m_VolumeModeObserver = 0; } if (volumeProp) { m_VolumeModeObserver = new UGVisVolumeObserver(volumeProp, this); } } UpdateEnablement(); } void QmitkUGVisualizationView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) { m_MultiWidget = &stdMultiWidget; } void QmitkUGVisualizationView::StdMultiWidgetNotAvailable() { m_MultiWidget = 0; } void QmitkUGVisualizationView::OnSelectionChanged( std::vector nodes ) { UpdateGUI(); } diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h index ff85b1b4b6..7992a88e2a 100644 --- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h @@ -1,117 +1,118 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkUGVisualizationView_h #define QmitkUGVisualizationView_h #include #include #include "ui_QmitkUGVisualizationViewControls.h" class QWidgetAction; class QmitkBoolPropertyWidget; namespace mitk { class PropertyObserver; } /*! \brief QmitkUGVisualizationView \warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation. \sa QmitkFunctionality \ingroup Functionalities */ class QmitkUGVisualizationView : public QmitkFunctionality { // this is needed for all Qt objects that should have a Qt meta-object // (everything that derives from QObject and wants to have signal/slots) Q_OBJECT public: static const std::string VIEW_ID; QmitkUGVisualizationView(); + QmitkUGVisualizationView(const QmitkUGVisualizationView& other); virtual ~QmitkUGVisualizationView(); virtual void CreateQtPartControl(QWidget *parent); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); protected slots: void UpdateRenderWindow(); void ShowTFGeneratorWidget(bool show); void ShowScalarOpacityWidget(bool show); void ShowColorWidget(bool show); void ShowGradientOpacityWidget(bool show); protected: /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged( std::vector nodes ); void CreateConnections(); private: friend class UGVisVolumeObserver; void UpdateGUI(); void UpdateEnablement(); Ui::QmitkUGVisualizationViewControls m_Controls; QmitkStdMultiWidget* m_MultiWidget; QWidgetAction* m_Outline2DAction; QmitkBoolPropertyWidget* m_Outline2DWidget; QAction* m_LODAction; QWidgetAction* m_ScalarVisibilityAction; QmitkBoolPropertyWidget* m_ScalarVisibilityWidget; int m_FirstVolumeRepId; QHash m_MapRepComboToEnumId; bool m_VolumeMode; bool m_ShowTFGeneratorWidget; bool m_ShowScalarOpacityWidget; bool m_ShowColorWidget; bool m_ShowGradientOpacityWidget; QAction* m_ShowTFGeneratorAction; QAction* m_ShowScalarOpacityAction; QAction* m_ShowColorAction; QAction* m_ShowGradientOpacityAction; mitk::PropertyObserver* m_VolumeModeObserver; }; #endif // _QMITKUGVISUALIZATIONVIEW_H_INCLUDED diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.cpp new file mode 100644 index 0000000000..921aface47 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.cpp @@ -0,0 +1,21 @@ +#include "mitkPluginActivator.h" + +#include + +#include "QmitkUGVisualizationView.h" + +namespace mitk { + +void PluginActivator::start(ctkPluginContext* context) +{ + BERRY_REGISTER_EXTENSION_CLASS(QmitkUGVisualizationView, context) +} + +void PluginActivator::stop(ctkPluginContext* context) +{ + Q_UNUSED(context) +} + +} + +Q_EXPORT_PLUGIN2(org_mitk_gui_qt_ugvisualization, mitk::PluginActivator) diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.h new file mode 100644 index 0000000000..a34be34be4 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.h @@ -0,0 +1,23 @@ +#ifndef MITKPLUGINACTIVATOR_H +#define MITKPLUGINACTIVATOR_H + +#include + +namespace mitk { + +class PluginActivator : + public QObject, public ctkPluginActivator +{ + Q_OBJECT + Q_INTERFACES(ctkPluginActivator) + +public: + + void start(ctkPluginContext* context); + void stop(ctkPluginContext* context); + +}; // PluginActivator + +} + +#endif // MITKPLUGINACTIVATOR_H