diff --git a/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.cpp b/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.cpp index a65c7578f9..d8b9523905 100644 --- a/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.cpp +++ b/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.cpp @@ -1,131 +1,131 @@ /*=================================================================== 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 "mitkDisplayVectorInteractorLevelWindow.h" #include "mitkOperation.h" #include "mitkDisplayCoordinateOperation.h" #include "mitkStateEvent.h" #include "mitkInteractionConst.h" #include "mitkAction.h" #include "mitkStandaloneDataStorage.h" #include "mitkNodePredicateDataType.h" #include "mitkLevelWindowProperty.h" #include "mitkLevelWindow.h" void mitk::DisplayVectorInteractorLevelWindow::ExecuteOperation(Operation* itkNotUsed( operation ) ) { } bool mitk::DisplayVectorInteractorLevelWindow::ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) { bool ok=false; const DisplayPositionEvent* posEvent=dynamic_cast(stateEvent->GetEvent()); if(posEvent==NULL) return false; int actionId = action->GetActionId(); switch(actionId) { case AcINITMOVE: // MITK_INFO << "AcINITMOVE"; { m_Sender=posEvent->GetSender(); m_StartDisplayCoordinate=posEvent->GetDisplayPosition(); m_LastDisplayCoordinate=posEvent->GetDisplayPosition(); m_CurrentDisplayCoordinate=posEvent->GetDisplayPosition(); ok = true; break; } case AcLEVELWINDOW: { m_LastDisplayCoordinate=m_CurrentDisplayCoordinate; m_CurrentDisplayCoordinate=posEvent->GetDisplayPosition(); mitk::DataStorage::Pointer storage = m_Sender->GetDataStorage(); mitk::DataNode::Pointer node = NULL; mitk::DataStorage::SetOfObjects::ConstPointer allImageNodes = storage->GetSubset(mitk::NodePredicateDataType::New( "Image") ); for ( unsigned int i = 0; i < allImageNodes->size() ; i++ ) { bool isActiveImage = false; bool propFound = allImageNodes->at( i )->GetBoolProperty( "imageForLevelWindow", isActiveImage ); if ( propFound && isActiveImage ) { node = allImageNodes->at( i ); continue; } } if ( node.IsNull() ) { node = storage->GetNode( mitk::NodePredicateDataType::New( "Image" ) ); } if ( node.IsNull() ) { return false; } mitk::LevelWindow lv = mitk::LevelWindow(); node->GetLevelWindow(lv); - int level = static_cast(lv.GetLevel()); - int window = static_cast(lv.GetWindow()); + ScalarType level = lv.GetLevel(); + ScalarType window = lv.GetWindow(); - level += static_cast(( m_CurrentDisplayCoordinate[0] - m_LastDisplayCoordinate[0] )*2); - window += static_cast(( m_CurrentDisplayCoordinate[1] - m_LastDisplayCoordinate[1] )*2); + level += ( m_CurrentDisplayCoordinate[0] - m_LastDisplayCoordinate[0] )*static_cast(2); + window += ( m_CurrentDisplayCoordinate[1] - m_LastDisplayCoordinate[1] )*static_cast(2); lv.SetLevelWindow( level, window ); dynamic_cast(node->GetProperty("levelwindow"))->SetLevelWindow( lv ); m_Sender->GetRenderingManager()->RequestUpdateAll(); ok = true; break; } case AcFINISHMOVE: // MITK_INFO << "AcFINISHMOVE"; { ok = true; break; } default: ok = false; break; } return ok; } mitk::DisplayVectorInteractorLevelWindow::DisplayVectorInteractorLevelWindow(const char * type) : mitk::StateMachine(type), m_Sender(NULL) { m_StartDisplayCoordinate.Fill(0); m_LastDisplayCoordinate.Fill(0); m_CurrentDisplayCoordinate.Fill(0); m_UndoEnabled = false; } mitk::DisplayVectorInteractorLevelWindow::~DisplayVectorInteractorLevelWindow() { }