diff --git a/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp b/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp index efb1d8777c..60438abf1c 100644 --- a/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp +++ b/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp @@ -1,43 +1,46 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include -#include "mitkContourManagerImpl.h" +#include "mitkToolManagerProvider.h" namespace mitk { class SegmentationModuleActivator : public mitk::ModuleActivator { public: void Load(mitk::ModuleContext* context) { + /*register ToolManager provider service*/ + m_ToolManagerProvider = mitk::ToolManagerProvider::New(); + context->RegisterService(m_ToolManagerProvider); } void Unload(ModuleContext*) { } private: - mitk::ContourManagerImpl::Pointer m_ContourManagerImpl; + mitk::ToolManagerProvider::Pointer m_ToolManagerProvider; }; } US_EXPORT_MODULE_ACTIVATOR(Segmentation, mitk::SegmentationModuleActivator) diff --git a/Modules/Segmentation/Controllers/mitkToolManagerProviderImpl.cpp b/Modules/Segmentation/Controllers/mitkToolManagerProvider.cpp similarity index 55% rename from Modules/Segmentation/Controllers/mitkToolManagerProviderImpl.cpp rename to Modules/Segmentation/Controllers/mitkToolManagerProvider.cpp index 25b033b64d..f874bf9d72 100644 --- a/Modules/Segmentation/Controllers/mitkToolManagerProviderImpl.cpp +++ b/Modules/Segmentation/Controllers/mitkToolManagerProvider.cpp @@ -1,29 +1,39 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ -#include "mitkToolManagerProviderImpl.h" +#include "mitkToolManagerProvider.h" -mitk::ToolManagerProviderImpl::ToolManagerProviderImpl() + + +mitk::ToolManagerProvider::ToolManagerProvider() +{ + this->m_ToolManager = mitk::ToolManager::New(NULL); +} + +mitk::ToolManagerProvider::~ToolManagerProvider() { + this->m_ToolManager = NULL; } -mitk::ToolManagerProviderImpl::~ToolManagerProviderImpl() + +mitk::ToolManager* mitk::ToolManagerProvider::GetToolManager() { + return this->m_ToolManager; } -bool mitk::ToolManagerProviderImpl::Dummy() +mitk::ToolManagerProvider* mitk::ToolManagerProvider::GetInstance() { - return true; + return NULL; } diff --git a/Modules/Segmentation/Controllers/mitkToolManagerProvider.h b/Modules/Segmentation/Controllers/mitkToolManagerProvider.h index 19ccaed4a1..d1fa5ff83d 100644 --- a/Modules/Segmentation/Controllers/mitkToolManagerProvider.h +++ b/Modules/Segmentation/Controllers/mitkToolManagerProvider.h @@ -1,42 +1,57 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITK_TOOLMANAGERPROVIDER_H #define MITK_TOOLMANAGERPROVIDER_H +#include #include -namespace mitk { +#include "mitkToolManager.h" +#include +#include +//class SegmentationModuleActivator; - /** - * \ingroup MicroServices_Interfaces - * - */ - struct ToolManagerProvider +namespace mitk +{ + + class ToolManagerProvider : public itk::LightObject { - virtual ~ToolManagerProvider() {} + public: + mitkClassMacro(ToolManagerProvider, itk::LightObject); + itkNewMacro(ToolManagerProvider); - virtual bool Dummy() = 0; + virtual mitk::ToolManager* GetToolManager(); - }; + static mitk::ToolManagerProvider* GetInstance(); -} + //friend class SegmentationModuleActivator; + + protected: + //mitkClassMacro(ToolManagerProvider, itk::LightObject); + //itkNewMacro(Self); + ToolManagerProvider(); + virtual ~ToolManagerProvider(); + + mitk::ToolManager::Pointer m_ToolManager; + }; +} - US_DECLARE_SERVICE_INTERFACE(mitk::ToolManagerProvider, "org.mitk.services.ToolManagerProvider") +US_DECLARE_SERVICE_INTERFACE(mitk::ToolManagerProvider, "org.mitk.services.ToolManagerProvider") #endif diff --git a/Modules/Segmentation/Controllers/mitkToolManagerProviderImpl.h b/Modules/Segmentation/Controllers/mitkToolManagerProviderImpl.h deleted file mode 100644 index 8b06338a28..0000000000 --- a/Modules/Segmentation/Controllers/mitkToolManagerProviderImpl.h +++ /dev/null @@ -1,48 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef MITK_TOOLMANAGERPROVIDER_IMPL_H -#define MITK_TOOLMANAGERPROVIDER_IMPL_H - -#include - -#include "mitkContourManager.h" - -#include -#include - -namespace mitk -{ - - class ToolManagerProviderImpl : public itk::LightObject, public ToolManagerProvider - { - public: - mitkClassMacro(ToolManagerProviderImpl, itk::LightObject); - itkNewMacro(Self); - - virtual bool Dummy(); - //friend class mitk::SegmentationModuleActivator; - - protected: - //mitkClassMacro(ToolManagerProviderImpl, itk::LightObject); - //itkNewMacro(Self); - - ToolManagerProviderImpl(); - virtual ~ToolManagerProviderImpl(); - }; -} - -#endif diff --git a/Modules/Segmentation/Testing/mitkToolManagerProviderTest.cpp b/Modules/Segmentation/Testing/mitkToolManagerProviderTest.cpp index e6b2a18418..b0afcb8f57 100644 --- a/Modules/Segmentation/Testing/mitkToolManagerProviderTest.cpp +++ b/Modules/Segmentation/Testing/mitkToolManagerProviderTest.cpp @@ -1,41 +1,46 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkTestingMacros.h" #include "mitkToolManagerProvider.h" #include "itkLightObject.h" #include #include "mitkModuleContext.h" #include "mitkServiceReference.h" + class mitkToolManagerProviderTestClass { public: - + static void RegisterService(){ + mitk::GetModuleContext()->RegisterService(mitk::ToolManagerProvider::New().GetPointer()); + } }; int mitkToolManagerProviderTest(int, char* []) { MITK_TEST_BEGIN("ToolManagerProvider") - + mitkToolManagerProviderTestClass::RegisterService(); mitk::ServiceReference serviceRef = mitk::GetModuleContext()->GetServiceReference< mitk::ToolManagerProvider >(); mitk::ToolManagerProvider* service = mitk::GetModuleContext()->GetService< mitk::ToolManagerProvider >(serviceRef); + + MITK_TEST_CONDITION(service!=NULL,"Service was succesfully called"); - MITK_TEST_CONDITION(service->Dummy(), "Dummy call"); + MITK_TEST_CONDITION((service->GetToolManager()) == NULL, "Dummy call"); MITK_TEST_END() } diff --git a/Modules/Segmentation/files.cmake b/Modules/Segmentation/files.cmake index 081debd03e..84af3c4f0e 100644 --- a/Modules/Segmentation/files.cmake +++ b/Modules/Segmentation/files.cmake @@ -1,112 +1,112 @@ set(CPP_FILES Algorithms/mitkCalculateSegmentationVolume.cpp Algorithms/mitkContourModelSource.cpp Algorithms/mitkContourModelSubDivisionFilter.cpp Algorithms/mitkContourModelToPointSetFilter.cpp Algorithms/mitkContourModelToSurfaceFilter.cpp Algorithms/mitkContourSetToPointSetFilter.cpp Algorithms/mitkContourUtils.cpp Algorithms/mitkCorrectorAlgorithm.cpp Algorithms/mitkDiffImageApplier.cpp Algorithms/mitkDiffSliceOperation.cpp Algorithms/mitkDiffSliceOperationApplier.cpp Algorithms/mitkImageLiveWireContourModelFilter.cpp Algorithms/mitkImageToContourFilter.cpp Algorithms/mitkImageToContourModelFilter.cpp Algorithms/mitkImageToLiveWireContourFilter.cpp Algorithms/mitkManualSegmentationToSurfaceFilter.cpp Algorithms/mitkOtsuSegmentationFilter.cpp Algorithms/mitkOverwriteDirectedPlaneImageFilter.cpp Algorithms/mitkOverwriteSliceImageFilter.cpp Algorithms/mitkSegmentationObjectFactory.cpp Algorithms/mitkSegmentationSink.cpp Algorithms/mitkShapeBasedInterpolationAlgorithm.cpp Algorithms/mitkShowSegmentationAsSmoothedSurface.cpp Algorithms/mitkShowSegmentationAsSurface.cpp Algorithms/mitkVtkImageOverwrite.cpp Controllers/mitkSegmentationInterpolationController.cpp Controllers/mitkToolManager.cpp Controllers/mitkSegmentationModuleActivator.cpp - Controllers/mitkToolManagerProviderImpl.cpp + Controllers/mitkToolManagerProvider.cpp DataManagement/mitkContour.cpp DataManagement/mitkContourElement.cpp DataManagement/mitkContourModel.cpp DataManagement/mitkContourSet.cpp DataManagement/mitkExtrudedContour.cpp Interactions/mitkAdaptiveRegionGrowingTool.cpp Interactions/mitkAddContourTool.cpp Interactions/mitkAutoCropTool.cpp Interactions/mitkAutoSegmentationTool.cpp Interactions/mitkBinaryThresholdTool.cpp Interactions/mitkBinaryThresholdULTool.cpp Interactions/mitkCalculateGrayValueStatisticsTool.cpp Interactions/mitkCalculateVolumetryTool.cpp Interactions/mitkContourInteractor.cpp Interactions/mitkContourModelInteractor.cpp Interactions/mitkContourModelLiveWireInteractor.cpp Interactions/mitkContourTool.cpp Interactions/mitkCorrectorTool2D.cpp Interactions/mitkCreateSurfaceTool.cpp Interactions/mitkDrawPaintbrushTool.cpp Interactions/mitkErasePaintbrushTool.cpp Interactions/mitkEraseRegionTool.cpp Interactions/mitkExtrudedContourInteractor.cpp Interactions/mitkFastMarchingTool.cpp Interactions/mitkFastMarchingTool3D.cpp Interactions/mitkFeedbackContourTool.cpp Interactions/mitkFillRegionTool.cpp Interactions/mitkLiveWireTool2D.cpp Interactions/mitkOtsuTool3D.cpp Interactions/mitkPaintbrushTool.cpp Interactions/mitkPixelManipulationTool.cpp Interactions/mitkRegionGrow3DTool.cpp Interactions/mitkRegionGrowingTool.cpp Interactions/mitkSegmentationsProcessingTool.cpp Interactions/mitkSetRegionTool.cpp Interactions/mitkSegTool2D.cpp Interactions/mitkSubtractContourTool.cpp Interactions/mitkTool.cpp Interactions/mitkToolCommand.cpp Interactions/mitkWatershedTool.cpp IO/mitkContourModelIOFactory.cpp IO/mitkContourModelReader.cpp IO/mitkContourModelWriter.cpp IO/mitkContourModelWriterFactory.cpp Rendering/mitkContourMapper2D.cpp Rendering/mitkContourModelGLMapper2D.cpp Rendering/mitkContourModelMapper2D.cpp Rendering/mitkContourModelMapper3D.cpp Rendering/mitkContourSetMapper2D.cpp Rendering/mitkContourSetVtkMapper3D.cpp Rendering/mitkContourVtkMapper3D.cpp SegmentationUtilities/BooleanOperations/mitkBooleanOperation.cpp SegmentationUtilities/MorphologicalOperations/mitkMorphologicalOperations.cpp ) set(RESOURCE_FILES Add_48x48.png Add_Cursor_32x32.png Correction_48x48.png Correction_Cursor_32x32.png Erase_48x48.png Erase_Cursor_32x32.png FastMarching_48x48.png FastMarching_Cursor_32x32.png Fill_48x48.png Fill_Cursor_32x32.png LiveWire_48x48.png LiveWire_Cursor_32x32.png Otsu_48x48.png Paint_48x48.png Paint_Cursor_32x32.png RegionGrowing_48x48.png RegionGrowing_Cursor_32x32.png Subtract_48x48.png Subtract_Cursor_32x32.png Threshold_48x48.png TwoThresholds_48x48.png Watershed_48x48.png Watershed_Cursor_32x32.png Wipe_48x48.png Wipe_Cursor_32x32.png )