diff --git a/Modules/Bundles/CMakeLists.txt b/Modules/Bundles/CMakeLists.txt index 2adfcf8006..8dea3b08fe 100644 --- a/Modules/Bundles/CMakeLists.txt +++ b/Modules/Bundles/CMakeLists.txt @@ -1,40 +1,41 @@ 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.planarfigure + org.mitk.gui.qt.tofutil ) 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) diff --git a/Modules/Bundles/PluginList.cmake b/Modules/Bundles/PluginList.cmake index 66f20fe41d..b7841df34d 100644 --- a/Modules/Bundles/PluginList.cmake +++ b/Modules/Bundles/PluginList.cmake @@ -1,10 +1,11 @@ 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.planarfigure:ON org.mitk.gui.qt.datamanager:ON + org.mitk.gui.qt.tofutil:OFF ) diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.tofutil/CMakeLists.txt index 30022b1fbd..1a337da0d3 100644 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/CMakeLists.txt +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/CMakeLists.txt @@ -1,2 +1,11 @@ -MACRO_CREATE_MITK_PLUGIN(mitkToFHardware Qmitk QmitkExt mitkTOFUI) +# The project name must correspond to the directory name of your plug-in +# and must not contain periods. +PROJECT(org_mitk_gui_qt_tofutil) + +MACRO_CREATE_MITK_CTK_PLUGIN( + EXPORT_DIRECTIVE TOFUTIL_EXPORT + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDENCIES mitkToFHardware Qmitk QmitkExt mitkTOFUI +) + diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.tofutil/META-INF/MANIFEST.MF deleted file mode 100644 index 637385d21d..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: ToFUtil -Bundle-SymbolicName: org.mitk.gui.qt.tofutil -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.tofutil/files.cmake b/Modules/Bundles/org.mitk.gui.qt.tofutil/files.cmake index 446c70b030..a78dd195f6 100644 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/files.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/files.cmake @@ -1,36 +1,39 @@ SET(SRC_CPP_FILES ) SET(INTERNAL_CPP_FILES QmitkToFUtilView.cpp QmitkToFImageBackground.cpp + mitkPluginActivator.cpp ) SET(UI_FILES src/internal/QmitkToFUtilViewControls.ui ) SET(MOC_H_FILES src/internal/QmitkToFUtilView.h src/internal/QmitkToFImageBackground.h + src/internal/mitkPluginActivator.h ) -SET(RESOURCE_FILES +SET(CACHED_RESOURCE_FILES + plugin.xml resources/icon.xpm ) -SET(RES_FILES +SET(QRC_FILES resources/QmitkToFUtilView.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.tofutil/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.tofutil/manifest.cpp deleted file mode 100644 index 04d5df886e..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/manifest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $ -Version: $Revision: 21975 $ - -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/QmitkToFUtilView.h" - -POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart) - POCO_EXPORT_CLASS(::QmitkToFUtilView) -POCO_END_MANIFEST diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.tofutil/manifest_headers.cmake new file mode 100644 index 0000000000..9ee28f4ca0 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/manifest_headers.cmake @@ -0,0 +1,5 @@ +set(Plugin-Name "ToFUtil") +set(Plugin-Version "0.1") +set(Plugin-Vendor "DKFZ, Medical and Biological Informatics") +set(Plugin-ContactAddress "www.mitk.org/wiki/MITK-ToF") +set(Require-Plugin org.mitk.gui.qt.common) \ No newline at end of file diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.tofutil/plugin.xml index 000bc6af85..671765e05d 100644 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/plugin.xml +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/plugin.xml @@ -1,12 +1,12 @@ diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/src/TofutilDll.h b/Modules/Bundles/org.mitk.gui.qt.tofutil/src/TofutilDll.h deleted file mode 100644 index 11fb252fe1..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/src/TofutilDll.h +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $ -Version: $Revision: 21975 $ - -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 _TOFUTIL_EXPORT_DLL_H_ -#define _TOFUTIL_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_tofutil_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_tofutil_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_tofutil_EXPORTS) - #define TOFUTIL_EXPORT __declspec(dllexport) - #else - #define TOFUTIL_EXPORT __declspec(dllimport) - #endif -#endif - - -#if !defined(TOFUTIL_EXPORT) - #define TOFUTIL_EXPORT -#endif - -#endif /*_TOFUTIL_EXPORT_DLL_H_*/ diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.h b/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.h index 355661a71d..a49d43806f 100644 --- a/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.h +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.h @@ -1,271 +1,276 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $ Version: $Revision: 21975 $ 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 QmitkToFUtilView_h #define QmitkToFUtilView_h #include #include "QmitkToFImageBackground.h" #include #include #include #include #include #include #include #include #include #include #include #include typedef itk::Image ItkImageType2D; /*! \brief QmitkToFUtilView \warning This application is still under active development. Complete documentation will be added when class is finished. \sa QmitkFunctionality \ingroup Functionalities */ class QmitkToFUtilView : 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; QmitkToFUtilView(); - virtual ~QmitkToFUtilView(); + QmitkToFUtilView(const QmitkToFUtilView& other) + { + Q_UNUSED(other) + throw std::runtime_error("Copy constructor not implemented"); + } + ~QmitkToFUtilView(); virtual void CreateQtPartControl(QWidget *parent); /// \brief Called when the functionality is activated virtual void Activated(); virtual void Deactivated(); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); protected slots: /// \brief Called when the user clicks the GUI button void OnUpdateCamera(); /*! \This method is automatically called by the connection widgets when the configuration is completed */ void OnToFCameraConnected(); void OnToFCameraDisconnected(); void OnToFCameraStarted(); void OnToFCameraStopped(); void OnToFCameraStop(); void OnToFCameraSelected(int index); void OnSurfaceCheckBoxChecked(bool checked); void OnTextureCheckBoxChecked(bool checked); void OnVideoTextureCheckBoxChecked(bool checked); protected: static ITK_THREAD_RETURN_TYPE OnUpdateCameraITKThread(void* pInfoStruct); static void UpdateCamera(); void InitImage(mitk::Image::Pointer image, int numOfChannel); void InitTexture(unsigned char* &image, int width, int height); //void PrepareBinaryLut(vtkLookupTable* lut, double minRange, double maxRange); //void PrepareColorLut(vtkLookupTable* lut, double minRange, double maxRange); void PrepareImageForBackground(vtkLookupTable* lut, float* floadData, unsigned char* image); void PrepareImageForBackground(vtkColorTransferFunction* colorTransferFunction, float* floatData, unsigned char* image); void RemoveBackground(); // void CreateSurface(); Ui::QmitkToFUtilViewControls* m_Controls; QmitkStdMultiWidget* m_MultiWidget; QTimer* m_Frametimer; //int m_FrameRate; mitk::ToFImageGrabber* m_ToFImageGrabber; //mitk::ToFImageGrabber* m_ToFImageGrabber; mitk::Image::Pointer m_MitkInDistanceImage; ///< object to hold the distance image mitk::Image::Pointer m_MitkDistanceImage; ///< object to hold the distance image mitk::Image::Pointer m_MitkAmplitudeImage; ///< object to hold the amplitude image mitk::Image::Pointer m_MitkIntensityImage; ///< object to hold the amplitude image mitk::Image::Pointer m_MitkAllImage; ///< object to hold all image mitk::Image::Pointer m_MitkRawImage; ///< object to hold the raw image mitk::Image::Pointer m_SurfaceInputImage; mitk::Image::Pointer m_SurfaceTextureImage; mitk::Image::Pointer m_SurfaceIntensityImage; mitk::Surface::Pointer m_Surface; mitk::DataNode::Pointer m_DistanceImageNode; ///< DataNode to get the distance image into the DataStorage mitk::DataNode::Pointer m_AmplitudeImageNode; ///< DataNode to get the amplitude image into the DataStorage mitk::DataNode::Pointer m_IntensityImageNode; ///< DataNode to get the intensity image into the DataStorage mitk::DataNode::Pointer m_AllImageNode; ///< DataNode to get all images into the DataStorage mitk::DataNode::Pointer m_SurfaceNode; mitk::ToFImageRecorder::Pointer m_ToFImageRecorder; int m_ImageSequence; mitk::RealTimeClock::Pointer m_RealTimeClock; int m_StepsForFramerate; double m_TimeBefore, m_TimeAfter; double m_SurfaceTimeBefore, m_SurfaceTimeAfter; double m_2DTimeBefore, m_2DTimeAfter; double m_2DTimeSum; QmitkVideoBackground* m_QmitkVideoBackground; QmitkToFImageBackground* m_QmitkToFImageBackground1; QmitkToFImageBackground* m_QmitkToFImageBackground2; QmitkToFImageBackground* m_QmitkToFImageBackground3; mitk::OpenCVVideoSource::Pointer m_VideoSource; unsigned char* m_VideoTexture; unsigned char* m_Widget1Texture; unsigned char* m_Widget2Texture; unsigned char* m_Widget3Texture; vtkLookupTable* m_DistLut; vtkLookupTable* m_AmplLut; vtkLookupTable* m_IntenLut; int m_ToFCaptureWidth; int m_ToFCaptureHeight; int m_VideoCaptureWidth; int m_VideoCaptureHeight; // mitk::ToFSurfaceGenerationFilter::Pointer m_ToFSurfaceGenerationFilter; mitk::ToFDistanceImageToSurfaceFilter::Pointer m_ToFDistanceImageToSurfaceFilter; mitk::ToFCompositeFilter::Pointer m_ToFCompositeFilter; mitk::ToFVisualizationFilter::Pointer m_ToFVisualizationFilter; private: void RemoveNode(const char* nodename, mitk::DataNode::Pointer node); void CreateNode(const char* nodename, mitk::DataNode::Pointer& node); void* GetDataFromImage(std::string imageType); ItkImageType2D::Pointer ProcessThresholdFilter(ItkImageType2D::Pointer inputItkImage, int min, int max); void ProcessCVThresholdFilter(IplImage* inputIplImage, int min, int max); void ProcessCVEdgeFilter(IplImage* inputIplImage, float threshold); ItkImageType2D::Pointer ProcessItkBilateralFilter(ItkImageType2D::Pointer inputItkImage, int domainSigma, int rangeSigma, int kernelRadius); void ProcessCVBilateralFilter(IplImage* inputIplImage, IplImage* outputIplImage, int domainSigma, int rangeSigma, int kernelRadius); void ProcessCVMedianFilter(IplImage* inputIplImage, IplImage* outputIplImage, int radius = 3); void ProcessStreamedAverageImageFilter(float* data, int numOfImages); void ProcessStreamedMedianImageFilter(float* data, int numOfImages); void ProcessStreamedQuickSelectMedianImageFilter(IplImage* inputIplImage, int numOfImages); float quick_select(float arr[], int n); void AddNodesToDataStorage(); void RenderWidget(QmitkRenderWindow* mitkWidget, QmitkToFImageBackground* imageBackground, std::string& oldImageType, std::string newImageType, vtkColorTransferFunction* colorTransferFunction, unsigned char* videoTexture, unsigned char* tofTexture ); void SetBilateralFilterParameter(); void SetThresholdFilterParameter(); void ProcessVideoTransform(); bool m_DataNodesInitilized; bool m_TransferFunctionInitialized; bool m_SurfaceInitialized; float** m_DataBuffer; int m_DataBufferCurrentIndex; int m_DataBufferMaxSize; int** m_IndexBuffer; int m_SurfaceDisplayCount; int m_2DDisplayCount; bool m_VideoEnabled; IplImage* m_IplDistanceImage; IplImage* m_IplIntensityImage; IplImage* m_OutputIplImage; std::string m_Widget1ImageType; std::string m_Widget2ImageType; std::string m_Widget3ImageType; mitk::ToFSurfaceVtkMapper3D::Pointer m_ToFSurfaceVtkMapper3D; ItkImageType2D::Pointer m_ItkInputImage; ItkImageType2D::Pointer m_ItkOutputImage; }; #endif // _QMITKTOFUTILVIEW_H_INCLUDED diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/mitkPluginActivator.cpp new file mode 100644 index 0000000000..1ddbdb1a9d --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/mitkPluginActivator.cpp @@ -0,0 +1,20 @@ +#include "mitkPluginActivator.h" + +#include +#include "QmitkToFUtilView.h" + +namespace mitk { + +void PluginActivator::start(ctkPluginContext* context) +{ + BERRY_REGISTER_EXTENSION_CLASS(QmitkToFUtilView, context) +} + +void PluginActivator::stop(ctkPluginContext* context) +{ + Q_UNUSED(context) +} + +} + +Q_EXPORT_PLUGIN2(org_mitk_gui_qt_tofutil, mitk::PluginActivator) \ No newline at end of file diff --git a/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.tofutil/src/internal/mitkPluginActivator.h new file mode 100644 index 0000000000..70c968b98e --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.tofutil/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 \ No newline at end of file