diff --git a/Modules/Segmentation/Interactions/mitkSegmentationInteractor.cpp b/Modules/Segmentation/Interactions/mitkSegmentationInteractor.cpp index 5cbc3921b9..10defccf89 100644 --- a/Modules/Segmentation/Interactions/mitkSegmentationInteractor.cpp +++ b/Modules/Segmentation/Interactions/mitkSegmentationInteractor.cpp @@ -1,64 +1,63 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkSegmentationInteractor.h" #include "mitkInteractionPositionEvent.h" #include "mitkLabelSetImage.h" #include "mitkToolManager.h" #include "mitkToolManagerProvider.h" #include #include void mitk::SegmentationInteractor::ConnectActionsAndFunctions() { Superclass::ConnectActionsAndFunctions(); // CONNECT_FUNCTION("change_active_label", ChangeActiveLabel); } -bool mitk::SegmentationInteractor::ChangeActiveLabel(StateMachineAction *, InteractionEvent *interactionEvent) +void mitk::SegmentationInteractor::ChangeActiveLabel(StateMachineAction*, InteractionEvent* interactionEvent) { BaseRenderer::Pointer sender = interactionEvent->GetSender(); auto positionEvent = static_cast(interactionEvent); auto toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager(); assert(toolManager); DataNode *workingNode(toolManager->GetWorkingData(0)); if (workingNode && positionEvent) { //TODO T28561 //Code uses a deprecated method. deactivated whole code until the refactorization is done. throw "TODO T28561. Was forgot to refactor in context of T28524. The new MultiLabelSegmentation class will have a dedicated function for querying the label of world position."; //auto *workingImage = dynamic_cast(workingNode->GetData()); //assert(workingImage); //const auto timestep = positionEvent->GetSender()->GetTimeStep(workingImage); //int pixelValue = static_cast(workingImage->GetPixelValueByWorldCoordinate(positionEvent->GetPositionInWorld(), timestep)); //workingImage->GetActiveLabelSet()->SetActiveLabel(pixelValue); // can be the background // // Call Events // // workingImage->ActiveLabelEvent.Send(pixelValue); // // MLI TODO // // toolManager->WorkingDataModified.Send(); //TODO END Refactor with T28524 } RenderingManager::GetInstance()->RequestUpdateAll(); - return true; } diff --git a/Modules/Segmentation/Interactions/mitkSegmentationInteractor.h b/Modules/Segmentation/Interactions/mitkSegmentationInteractor.h index b5fcb1f559..4fce3da3c2 100644 --- a/Modules/Segmentation/Interactions/mitkSegmentationInteractor.h +++ b/Modules/Segmentation/Interactions/mitkSegmentationInteractor.h @@ -1,51 +1,52 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef mitkSegmentationInteractor_h #define mitkSegmentationInteractor_h #include "MitkSegmentationExports.h" -#include "mitkDisplayInteractor.h" +#include namespace mitk { /** *\class SegmentationInteractor *@brief Observer that adds interaction with a multi-label segmentation session to the default display interaction. * * At the moment, this includes changing the active label. * * @ingroup Interaction **/ - class MITKSEGMENTATION_EXPORT SegmentationInteractor : public DisplayInteractor + class MITKSEGMENTATION_EXPORT SegmentationInteractor : public DisplayActionEventBroadcast { public: - mitkClassMacro(SegmentationInteractor, DisplayInteractor); + mitkClassMacro(SegmentationInteractor, DisplayActionEventBroadcast); itkNewMacro(Self); - protected : SegmentationInteractor(){}; + protected: + SegmentationInteractor(){}; ~SegmentationInteractor() override{}; /** * Derived function. * Connects the action names used in the state machine pattern with functions implemented within * this InteractionEventObserver. This is only necessary here because the events are processed by the state machine. */ void ConnectActionsAndFunctions() override; /** * Changes the active label. */ - bool ChangeActiveLabel(StateMachineAction *, InteractionEvent *); + void ChangeActiveLabel(StateMachineAction*, InteractionEvent*); }; } #endif