void mitk::LevelWindowManager::CreatePropObserverLists() { if (m_DataStorage.IsNull()) //check if data storage is set {itkExceptionMacro("DataStorage not set");} /* add observers for all relevant nodes */ mitk::DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes(); for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it) { if ((it->Value().IsNull()) || (it->Value() == m_NodeMarkedToDelete)) {continue;} /* register listener for changes in visible property */ itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command->SetCallbackFunction(this, &LevelWindowManager::Update); unsigned long visIdx = it->Value()->GetProperty("visible")->AddObserver( itk::ModifiedEvent(), command ); m_PropObserverToNode[PropDataPair(visIdx, it->Value())] = it->Value()->GetProperty("visible"); /* register listener for changes in layer property */ itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command2 = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command2->SetCallbackFunction(this, &LevelWindowManager::Update); unsigned long layerIdx = it->Value()->GetProperty("layer")->AddObserver( itk::ModifiedEvent(), command2 ); m_PropObserverToNode2[PropDataPair(layerIdx, it->Value())] = it->Value()->GetProperty("layer"); /* register listener for changes in layer property */ itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command3 = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command3->SetCallbackFunction(this, &LevelWindowManager::Update); mitk::BaseProperty::Pointer imageRenderingMode = it->Value()->GetProperty("Image Rendering.Mode"); if( imageRenderingMode.IsNotNull() ) { unsigned long rendIdx = imageRenderingMode->AddObserver( itk::ModifiedEvent(), command3 ); m_PropObserverToNode3[PropDataPair(rendIdx, it->Value())] = imageRenderingMode.GetPointer(); } itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command4 = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command4->SetCallbackFunction(this, &LevelWindowManager::RecaluclateLevelWindowForSelectedComponent); mitk::BaseProperty::Pointer displayedImageComponent = it->Value()->GetProperty("Image.Displayed Component"); if( displayedImageComponent.IsNotNull() ) { unsigned long dispIdx = displayedImageComponent->AddObserver( itk::ModifiedEvent(), command4 ); m_PropObserverToNode4[PropDataPair(dispIdx, it->Value())] = displayedImageComponent.GetPointer(); } itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command5 = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command5->SetCallbackFunction(this, &LevelWindowManager::Update); mitk::BaseProperty::Pointer imgForLvlWin = it->Value()->GetProperty("imageForLevelWindow"); if( imgForLvlWin.IsNull() ) { it->Value()->SetBoolProperty( "imageForLevelWindow", false ); imgForLvlWin = it->Value()->GetProperty("imageForLevelWindow"); } unsigned long lvlWinIdx = imgForLvlWin->AddObserver( itk::ModifiedEvent(), command5 ); m_PropObserverToNode5[PropDataPair(lvlWinIdx, it->Value())] = it->Value()->GetProperty("imageForLevelWindow"); } }
void mitk::LevelWindowManager::CreatePropObserverLists() { if (m_DataStorage.IsNull()) //check if data storage is set {itkExceptionMacro("DataStorage not set");} /* add observers for all relevant nodes */ mitk::DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes(); for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it) { if ((it->Value().IsNull()) || (it->Value() == m_NodeMarkedToDelete)) {continue;} /* register listener for changes in visible property */ itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command->SetCallbackFunction(this, &LevelWindowManager::Update); unsigned long idx = it->Value()->GetProperty("visible")->AddObserver( itk::ModifiedEvent(), command ); m_PropObserverToNode[PropDataPair(idx, it->Value())] = it->Value()->GetProperty("visible"); } /* add observers for all layer properties*/ for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it) { if ((it->Value().IsNull()) || (it->Value() == m_NodeMarkedToDelete)) {continue;} /* register listener for changes in layer property */ itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command2 = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command2->SetCallbackFunction(this, &LevelWindowManager::Update); unsigned long idx = it->Value()->GetProperty("layer")->AddObserver( itk::ModifiedEvent(), command2 ); m_PropObserverToNode2[PropDataPair(idx, it->Value())] = it->Value()->GetProperty("layer"); } /* add observers for all Image rendering.mode properties*/ for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it) { if ((it->Value().IsNull()) || (it->Value() == m_NodeMarkedToDelete)) {continue;} /* register listener for changes in layer property */ itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command3 = itk::ReceptorMemberCommand<LevelWindowManager>::New(); command3->SetCallbackFunction(this, &LevelWindowManager::Update); mitk::BaseProperty::Pointer imageRenderingMode = it->Value()->GetProperty("Image Rendering.Mode"); if( imageRenderingMode.IsNotNull() ) { unsigned long idx = imageRenderingMode->AddObserver( itk::ModifiedEvent(), command3 ); m_PropObserverToNode3[PropDataPair(idx, it->Value())] = imageRenderingMode.GetPointer(); } } }