Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

QmitkFunctionality Class Reference

The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Functionality") More...

#include <QmitkFunctionality.h>

Inheritance diagram for QmitkFunctionality:
Inheritance graph
[legend]
Collaboration diagram for QmitkFunctionality:
Collaboration graph
[legend]

List of all members.

Classes

class  SelectionProvider

Public Member Functions

 berryObjectMacro (QmitkFunctionality) QmitkFunctionality()
virtual ~QmitkFunctionality ()
virtual void ClosePart ()
virtual void OnSelectionChanged (std::vector< mitk::DataNode * >)
virtual void OnPreferencesChanged (const berry::IBerryPreferences *)
void SetHandleMultipleDataStorages (bool multiple)
bool HandlesMultipleDataStorages () const
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
virtual void StdMultiWidgetClosed (QmitkStdMultiWidget &stdMultiWidget)
virtual void StdMultiWidgetNotAvailable ()
virtual void Activated ()
bool IsActivated () const
virtual void Deactivated ()
virtual bool IsExclusiveFunctionality () const
void FireNodeSelected (mitk::DataNode *node)
void FireNodesSelected (std::vector< mitk::DataNode * > nodes)
virtual void Visible ()
bool IsVisible () const
virtual void Hidden ()
void CreatePartControl (void *parent)
void SetFocus ()
void NodeAddedProxy (const mitk::DataNode *node)
void NodeRemovedProxy (const mitk::DataNode *node)
void NodeChangedProxy (const mitk::DataNode *node)
void SetVisible (bool visible)
void SetActivated (bool activated)
void ClosePartProxy ()

Protected Member Functions

virtual void NodeAdded (const mitk::DataNode *node)
virtual void NodeChanged (const mitk::DataNode *)
virtual void NodeRemoved (const mitk::DataNode *node)
virtual void DataStorageChanged ()
std::vector< mitk::DataNode * > GetCurrentSelection () const
std::vector< mitk::DataNode * > GetDataManagerSelection () const
berry::IPreferences::Pointer GetPreferences () const
mitk::DataStorage::Pointer GetDataStorage () const
mitk::DataStorage::Pointer GetDefaultDataStorage () const
QmitkStdMultiWidgetGetActiveStdMultiWidget ()
void HandleException (std::exception &e, QWidget *parent=NULL, bool showDialog=true) const
void HandleException (const char *str, QWidget *parent=NULL, bool showDialog=true) const
void WaitCursorOn ()
void WaitCursorOff ()
void BusyCursorOn ()
void BusyCursorOff ()
void RestoreOverrideCursor ()
void AfterCreateQtPartControl ()
void ActivateLastVisibleFunctionality ()
void BlueBerrySelectionChanged (berry::IWorkbenchPart::Pointer sourcepart, berry::ISelection::ConstPointer selection)
std::vector< mitk::DataNode * > DataNodeSelectionToVector (mitk::DataNodeSelection::ConstPointer currentSelection) const

Protected Attributes

QWidget * m_Parent
bool m_Active
bool m_Visible

Friends

struct berry::SelectionChangedAdapter< QmitkFunctionality >

Detailed Description

The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Functionality")

QmitkFunctionality provides several convenience methods that eases the introduction of a new view:

  1. Access to the DataStorage (~ the shared data repository)
  2. Access to the StdMultiWidget (the 2x2 RenderWindow arrangement)
  3. Access to and update notification for the functionality/view preferences
  4. Access to and update notification for the current DataNode selection / to DataNode selection events send through the SelectionService
  5. Methods to send DataNode selections through the SelectionService
  6. Some events for unproblematic inter-View communication (e.g. when to add/remove interactors)
  7. Some minor important convenience methods (like changing the mouse cursor/exception handling)

Please use the Activated/Deactivated method to add/remove interactors, disabling multiwidget crosshair or anything which may "affect" other functionalities. For further reading please have a look at QmitkFunctionality::IsExclusiveFunctionality().

Definition at line 67 of file QmitkFunctionality.h.


Constructor & Destructor Documentation

QmitkFunctionality::~QmitkFunctionality (  ) [virtual]

Disconnects all standard event listeners

Definition at line 199 of file QmitkFunctionality.cpp.

References ClosePartProxy(), berry::Object::Register(), and berry::Object::UnRegister().

{
  this->Register();
  this->ClosePartProxy();

  this->UnRegister(false);
}

Member Function Documentation

void QmitkFunctionality::Activated (  ) [virtual]
void QmitkFunctionality::ActivateLastVisibleFunctionality (  ) [protected]

code to activate the last visible functionality

void QmitkFunctionality::AfterCreateQtPartControl (  ) [protected]

Called immediately after CreateQtPartControl(). Here standard event listeners for a QmitkFunctionality are registered

Definition at line 125 of file QmitkFunctionality.cpp.

References BlueBerrySelectionChanged(), berry::SmartPointer< TObjectType >::Cast(), GetActiveStdMultiWidget(), GetDataManagerSelection(), GetDefaultDataStorage(), berry::SmartPointer< TObjectType >::GetPointer(), GetPreferences(), berry::WorkbenchPart::GetSite(), berry::SmartPointer< TObjectType >::IsNotNull(), NodeAddedProxy(), NodeChangedProxy(), NodeRemovedProxy(), OnPreferencesChanged(), OnSelectionChanged(), and StdMultiWidgetAvailable().

Referenced by CreatePartControl().

{
  // REGISTER DATASTORAGE LISTENER
  this->GetDefaultDataStorage()->AddNodeEvent.AddListener( mitk::MessageDelegate1<QmitkFunctionality, const mitk::DataNode*>
    ( this, &QmitkFunctionality::NodeAddedProxy ) );
  this->GetDefaultDataStorage()->ChangedNodeEvent.AddListener( mitk::MessageDelegate1<QmitkFunctionality, const mitk::DataNode*>
    ( this, &QmitkFunctionality::NodeChangedProxy ) );
  this->GetDefaultDataStorage()->RemoveNodeEvent.AddListener( mitk::MessageDelegate1<QmitkFunctionality, const mitk::DataNode*>
    ( this, &QmitkFunctionality::NodeRemovedProxy ) );

  // REGISTER PREFERENCES LISTENER
  berry::IBerryPreferences::Pointer prefs = this->GetPreferences().Cast<berry::IBerryPreferences>();
  if(prefs.IsNotNull())
    prefs->OnChanged.AddListener(berry::MessageDelegate1<QmitkFunctionality
    , const berry::IBerryPreferences*>(this, &QmitkFunctionality::OnPreferencesChanged));

  // REGISTER FOR WORKBENCH SELECTION EVENTS
  m_BlueBerrySelectionListener = berry::ISelectionListener::Pointer(new berry::SelectionChangedAdapter<QmitkFunctionality>(this
    , &QmitkFunctionality::BlueBerrySelectionChanged));
  this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_BlueBerrySelectionListener);

  // REGISTER A SELECTION PROVIDER
  QmitkFunctionality::SelectionProvider::Pointer _SelectionProvider
    = QmitkFunctionality::SelectionProvider::New(this);
  m_SelectionProvider = _SelectionProvider.GetPointer();
  this->GetSite()->SetSelectionProvider(berry::ISelectionProvider::Pointer(m_SelectionProvider));
  
  // EMULATE INITIAL SELECTION EVENTS

  // by default a a multi widget is always available
  this->StdMultiWidgetAvailable(*this->GetActiveStdMultiWidget());

  // send datamanager selection
  this->OnSelectionChanged(this->GetDataManagerSelection());

  // send preferences changed event
  this->OnPreferencesChanged(this->GetPreferences().Cast<berry::IBerryPreferences>().GetPointer());
}
QmitkFunctionality::berryObjectMacro ( QmitkFunctionality   )

Creates smartpointer typedefs Nothing to do in the standard ctor. Initiliaze your GUI in CreateQtPartControl(QWidget*)

See also:
berry::QtViewPart::CreateQtPartControl(QWidget*)
void QmitkFunctionality::BlueBerrySelectionChanged ( berry::IWorkbenchPart::Pointer  sourcepart,
berry::ISelection::ConstPointer  selection 
) [protected]

reactions to selection events from data manager (and potential other senders)

Definition at line 231 of file QmitkFunctionality.cpp.

References berry::SmartPointer< TObjectType >::Cast(), DataNodeSelectionToVector(), berry::SmartPointer< TObjectType >::IsNull(), and OnSelectionChanged().

Referenced by AfterCreateQtPartControl().

{
  if(sourcepart.IsNull() || sourcepart->GetSite()->GetId() != "org.mitk.views.datamanager")
    return;

  mitk::DataNodeSelection::ConstPointer _DataNodeSelection 
    = selection.Cast<const mitk::DataNodeSelection>();
  this->OnSelectionChanged(this->DataNodeSelectionToVector(_DataNodeSelection));
}
void QmitkFunctionality::BusyCursorOff (  ) [protected]

Convenient method to restore the standard cursor

Definition at line 389 of file QmitkFunctionality.cpp.

References RestoreOverrideCursor().

Referenced by QmitkBasicImageProcessing::StartButton2Clicked(), and QmitkBasicImageProcessing::StartButtonClicked().

{
  this->RestoreOverrideCursor();
}
void QmitkFunctionality::BusyCursorOn (  ) [protected]

Convenient method to set and reset a busy cursor

Definition at line 379 of file QmitkFunctionality.cpp.

Referenced by QmitkBasicImageProcessing::StartButton2Clicked(), and QmitkBasicImageProcessing::StartButtonClicked().

{
  QApplication::setOverrideCursor( QCursor(Qt::BusyCursor) );
}
void QmitkFunctionality::ClosePart (  ) [virtual]

Called, when the WorkbenchPart gets closed by the user directly or by closing the whole app (e.g. for removing event listeners)

Definition at line 164 of file QmitkFunctionality.cpp.

Referenced by ClosePartProxy().

{

}
void QmitkFunctionality::ClosePartProxy (  )

Called, when the WorkbenchPart gets closed for removing event listeners Internally this method calls ClosePart after it removed the listeners registered by QmitkFunctionality. By having this proxy method the user does not have to call QmitkFunctionality::ClosePart() when overwriting ClosePart()

Definition at line 169 of file QmitkFunctionality.cpp.

References berry::SmartPointer< TObjectType >::Cast(), ClosePart(), GetDefaultDataStorage(), GetPreferences(), berry::WorkbenchPart::GetSite(), berry::SmartPointer< TObjectType >::IsNotNull(), NodeAddedProxy(), NodeChangedProxy(), NodeRemovedProxy(), OnPreferencesChanged(), and berry::ISelectionService::RemovePostSelectionListener().

Referenced by ~QmitkFunctionality().

{
  this->GetDefaultDataStorage()->AddNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkFunctionality, const mitk::DataNode*>
    ( this, &QmitkFunctionality::NodeAddedProxy ) );
  this->GetDefaultDataStorage()->RemoveNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkFunctionality, const mitk::DataNode*>
    ( this, &QmitkFunctionality::NodeRemovedProxy) );
  this->GetDefaultDataStorage()->ChangedNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkFunctionality, const mitk::DataNode*>
    ( this, &QmitkFunctionality::NodeChangedProxy ) );

  berry::IBerryPreferences::Pointer prefs = this->GetPreferences().Cast<berry::IBerryPreferences>();
  if(prefs.IsNotNull())
  {
    prefs->OnChanged.RemoveListener(berry::MessageDelegate1<QmitkFunctionality
    , const berry::IBerryPreferences*>(this, &QmitkFunctionality::OnPreferencesChanged));
    // flush the preferences here (disabled, everyone should flush them by themselves at the right moment)
    // prefs->Flush();
  }

  // REMOVE SELECTION PROVIDER
  this->GetSite()->SetSelectionProvider(berry::ISelectionProvider::Pointer(NULL));

  berry::ISelectionService* s = GetSite()->GetWorkbenchWindow()->GetSelectionService();
  if(s)
  {
    s->RemovePostSelectionListener(m_BlueBerrySelectionListener);
  }

    this->ClosePart();
}
void QmitkFunctionality::CreatePartControl ( void *  parent ) [virtual]

Creates a scroll area for this view and calls CreateQtPartControl then

Reimplemented from berry::QtViewPart.

Definition at line 89 of file QmitkFunctionality.cpp.

References AfterCreateQtPartControl(), berry::QtViewPart::CreateQtPartControl(), and m_Parent.

{

  // scrollArea
  QScrollArea* scrollArea = new QScrollArea;  
  //QVBoxLayout* scrollAreaLayout = new QVBoxLayout(scrollArea);
  scrollArea->setFrameShadow(QFrame::Plain);
  scrollArea->setFrameShape(QFrame::NoFrame);
  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

  // m_Parent
  m_Parent = new QWidget;
  //m_Parent->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
  this->CreateQtPartControl(m_Parent);

  //scrollAreaLayout->addWidget(m_Parent);
  //scrollArea->setLayout(scrollAreaLayout);

  // set the widget now
  scrollArea->setWidgetResizable(true);
  scrollArea->setWidget(m_Parent);

  // add the scroll area to the real parent (the view tabbar)
  QWidget* parentQWidget = static_cast<QWidget*>(parent);
  QVBoxLayout* parentLayout = new QVBoxLayout(parentQWidget);
  parentLayout->setMargin(0);
  parentLayout->setSpacing(0);
  parentLayout->addWidget(scrollArea);

  // finally set the layout containing the scroll area to the parent widget (= show it)
  parentQWidget->setLayout(parentLayout);

  this->AfterCreateQtPartControl();
}
std::vector< mitk::DataNode * > QmitkFunctionality::DataNodeSelectionToVector ( mitk::DataNodeSelection::ConstPointer  currentSelection ) const [protected]

Converts a mitk::DataNodeSelection to a std::vector<mitk::DataNode*> (possibly empty

Definition at line 242 of file QmitkFunctionality.cpp.

References mitk::DataNodeObject::GetDataNode(), and berry::SmartPointer< TObjectType >::IsNull().

Referenced by BlueBerrySelectionChanged(), GetCurrentSelection(), and GetDataManagerSelection().

{

  std::vector<mitk::DataNode*> selectedNodes;
  if(currentSelection.IsNull())
    return selectedNodes;

  mitk::DataNodeObject* _DataNodeObject = 0;
  mitk::DataNode* _DataNode = 0;

  for(mitk::DataNodeSelection::iterator it = currentSelection->Begin();
    it != currentSelection->End(); ++it)
  {
    _DataNodeObject = dynamic_cast<mitk::DataNodeObject*>((*it).GetPointer());
    if(_DataNodeObject)
    {
      _DataNode = _DataNodeObject->GetDataNode();
      if(_DataNode)
        selectedNodes.push_back(_DataNode);
    }
  }

  return selectedNodes;
}
void QmitkFunctionality::DataStorageChanged (  ) [protected, virtual]

Called when a DataStorage add *or* remove *or* change event was thrown. May be reimplemented by deriving classes.

Reimplemented in QmitkIsoSurface, and QmitkMovieMaker.

Definition at line 326 of file QmitkFunctionality.cpp.

Referenced by NodeAddedProxy(), NodeChangedProxy(), and NodeRemovedProxy().

{

}
void QmitkFunctionality::Deactivated (  ) [virtual]
void QmitkFunctionality::FireNodeSelected ( mitk::DataNode node )

Informs other parts of the workbench that node is selected via the blueberry selection service.

Definition at line 496 of file QmitkFunctionality.cpp.

References FireNodesSelected().

Referenced by QmitkSegmentationView::CreateNewSegmentation(), and QmitkSegmentationView::NewNodeObjectsGenerated().

{
  std::vector<mitk::DataNode*> nodes;
  nodes.push_back(node);
  this->FireNodesSelected(nodes);
}
void QmitkFunctionality::FireNodesSelected ( std::vector< mitk::DataNode * >  nodes )

Informs other parts of the workbench that the nodes are selected via the blueberry selection service.

Definition at line 503 of file QmitkFunctionality.cpp.

References QmitkFunctionality::SelectionProvider::FireNodesSelected().

Referenced by QmitkSimpleMeasurement::AddAngleSimpleMeasurement(), QmitkSimpleMeasurement::AddDistanceSimpleMeasurement(), QmitkSimpleMeasurement::AddPathSimpleMeasurement(), FireNodeSelected(), and QmitkPointSetInteractionView::OnAddPointSetClicked().

{
  if( !m_SelectionProvider )
    return;

  std::vector<mitk::DataNode::Pointer> nodesSmartPointers;
  for (std::vector<mitk::DataNode*>::iterator it = nodes.begin()
    ; it != nodes.end(); it++)
  {
    nodesSmartPointers.push_back( *it );
  }
  m_SelectionProvider->FireNodesSelected(nodesSmartPointers);

}
QmitkStdMultiWidget * QmitkFunctionality::GetActiveStdMultiWidget (  ) [protected]

Returns the default and active StdMultiWidget. If there is not StdMultiWidget yet a new one is created in this method!

Definition at line 331 of file QmitkFunctionality.cpp.

References berry::SmartPointer< TObjectType >::Cast(), QmitkStdMultiWidgetEditor::EDITOR_ID, and berry::WorkbenchPart::GetSite().

Referenced by QmitkMeasurement::Activated(), AfterCreateQtPartControl(), QmitkMeasurement::AssertDrawingIsPossible(), QmitkBasicImageProcessing::CreateConnections(), QmitkVideoPlayer::CreateQtPartControl(), QmitkIsoSurface::CreateSurface(), QmitkMeasurement::Deactivated(), QmitkRigidRegistrationView::FixedSelected(), QmitkIGTRecorderView::OnStartRecording(), QmitkMeasurement::PlanarFigureSelectionChanged(), QmitkIGTRecorderView::RecordFrame(), QmitkToolPairNavigationView::RenderScene(), and QmitkImageStatistics::UpdateStatistics().

{
  QmitkStdMultiWidget* activeStdMultiWidget = 0;
  berry::IEditorPart::Pointer editor =
    this->GetSite()->GetPage()->GetActiveEditor();

  if (editor.Cast<QmitkStdMultiWidgetEditor>().IsNotNull())
  {
    activeStdMultiWidget = editor.Cast<QmitkStdMultiWidgetEditor>()->GetStdMultiWidget();
  }
  else
  {
    mitk::DataStorageEditorInput::Pointer editorInput;
    editorInput = new mitk::DataStorageEditorInput();
    // open a new multi-widget editor, but do not give it the focus
    berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false);
    activeStdMultiWidget = editor.Cast<QmitkStdMultiWidgetEditor>()->GetStdMultiWidget();
  }

  return activeStdMultiWidget;
}
std::vector< mitk::DataNode * > QmitkFunctionality::GetCurrentSelection (  ) const [protected]
Returns:
the selection of the currently active part of the workbench or an empty vector if nothing is selected

Definition at line 207 of file QmitkFunctionality.cpp.

References berry::SmartPointer< TObjectType >::Cast(), DataNodeSelectionToVector(), and berry::WorkbenchPart::GetSite().

{
  berry::ISelection::ConstPointer selection( this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection());
  // buffer for the data manager selection
  mitk::DataNodeSelection::ConstPointer currentSelection = selection.Cast<const mitk::DataNodeSelection>();
  return this->DataNodeSelectionToVector(currentSelection);
}
std::vector< mitk::DataNode * > QmitkFunctionality::GetDataManagerSelection (  ) const [protected]

Returns the current selection made in the datamanager bundle or an empty vector if nothing`s selected or if the bundle does not exist

Definition at line 215 of file QmitkFunctionality.cpp.

References berry::SmartPointer< TObjectType >::Cast(), DataNodeSelectionToVector(), and berry::WorkbenchPart::GetSite().

Referenced by QmitkSimpleMeasurement::Activated(), QmitkPointSetInteractionView::Activated(), QmitkMeasurement::AddFigureToDataStorage(), AfterCreateQtPartControl(), QmitkRegionGrowingView::DoImageProcessing(), QmitkMeasurement::PlanarFigureSelected(), and QmitkImageStatistics::Visible().

{
  berry::ISelection::ConstPointer selection( this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
    // buffer for the data manager selection
  mitk::DataNodeSelection::ConstPointer currentSelection = selection.Cast<const mitk::DataNodeSelection>();
  return this->DataNodeSelectionToVector(currentSelection);
}
mitk::DataStorage::Pointer QmitkFunctionality::GetDataStorage (  ) const [protected]

Returns the default or the currently active DataStorage if m_HandlesMultipleDataStorages is set to true

See also:
SetHandleMultipleDataStorages(bool)
HandlesMultipleDataStorages()

Definition at line 64 of file QmitkFunctionality.cpp.

References berry::Platform::GetServiceRegistry(), ID, and berry::SmartPointer< TObjectType >::IsNotNull().

Referenced by QmitkSimpleMeasurement::AddAngleSimpleMeasurement(), QmitkSimpleMeasurement::AddDistanceSimpleMeasurement(), QmitkMeasurement::AddFigureToDataStorage(), QmitkRigidRegistrationView::AddNewTransformationToUndoList(), QmitkSimpleMeasurement::AddPathSimpleMeasurement(), QmitkDeformableRegistrationView::Calculate(), QmitkSegmentationView::CreateSegmentationFromSurface(), QmitkPointBasedRegistrationView::Deactivated(), QmitkRigidRegistrationView::FixedSelected(), QmitkPointBasedRegistrationView::FixedSelected(), QmitkSimpleExampleView::initNavigators(), QmitkRigidRegistrationView::MovingSelected(), QmitkPointBasedRegistrationView::MovingSelected(), QmitkDeformableRegistrationView::QmitkDeformableRegistrationView(), QmitkPointBasedRegistrationView::QmitkPointBasedRegistrationView(), QmitkRigidRegistrationView::QmitkRigidRegistrationView(), QmitkRigidRegistrationView::RedoTransformation(), QmitkRigidRegistrationView::Rotate(), QmitkRigidRegistrationView::Scale(), QmitkRigidRegistrationView::SetImagesVisible(), QmitkPointBasedRegistrationView::SetImagesVisible(), QmitkDeformableRegistrationView::SetImagesVisible(), QmitkRigidRegistrationView::Translate(), and QmitkRigidRegistrationView::UndoTransformation().

{
  mitk::IDataStorageService::Pointer service = 
    berry::Platform::GetServiceRegistry().GetServiceById<mitk::IDataStorageService>(mitk::IDataStorageService::ID);
  
  if (service.IsNotNull())
  {
    if (m_HandlesMultipleDataStorages)
      return service->GetActiveDataStorage()->GetDataStorage();
    else
      return service->GetDefaultDataStorage()->GetDataStorage();
  }
  
  return 0;
}
mitk::DataStorage::Pointer QmitkFunctionality::GetDefaultDataStorage (  ) const [protected]
Returns:
always returns the default DataStorage

Definition at line 81 of file QmitkFunctionality.cpp.

References berry::Platform::GetServiceRegistry(), and ID.

Referenced by QmitkMeasurement::Activated(), QmitkImageCropper::AddBoundingObjectToNode(), AfterCreateQtPartControl(), QmitkQBallReconstructionView::AnalyticalQBallReconstruction(), QmitkDeformableRegistrationView::ApplyDeformationField(), ClosePartProxy(), QmitkSegmentationView::CreateNewSegmentation(), QmitkVolumetryView::CreateOverlayChild(), QmitkVolumetryView::CreateQtPartControl(), QmitkSegmentationView::CreateQtPartControl(), QmitkRegionGrowingView::CreateQtPartControl(), QmitkMeasurement::CreateQtPartControl(), QmitkIsoSurface::CreateQtPartControl(), QmitkImageCropper::CreateQtPartControl(), QmitkIGTRecorderView::CreateQtPartControl(), QmitkBasicImageProcessing::CreateQtPartControl(), QmitkIsoSurface::CreateSurface(), QmitkMeasurement::Deactivated(), QmitkDiffusionDicomImport::DicomLoadStartLoad(), QmitkToolPairNavigationView::Disconnected(), QmitkSegmentationView::ForceDisplayPreferencesUponAllImages(), QmitkRegionGrowingView::ItkImageProcessing(), QmitkMeasurement::NodeAddedInDataStorage(), QmitkPointSetInteractionView::OnAddPointSetClicked(), QmitkColourImageProcessingView::OnCombineRGBA(), QmitkColourImageProcessingView::OnConvertImageMaskColorToRGBAImage(), QmitkColourImageProcessingView::OnConvertToRGBAImage(), QmitkVolumetryView::OnImageSelected(), QmitkIGTExampleView::OnPlayingToggle(), QmitkViewInitializationView::OnResetAll(), QmitkSegmentationView::OnSelectionChanged(), QmitkMeasurement::OnSelectionChanged(), QmitkImageStatistics::OnSelectionChanged(), QmitkImageGuidedTherapyTutorialView::OnStartIGT(), QmitkIGTRecorderView::OnStartRecording(), QmitkImageGuidedTherapyTutorialView::OnStopIGT(), QmitkIGTExampleView::OnTestNavigation(), QmitkMeasurement::PlanarFigureSelected(), QmitkDiffusionQuantificationView::QBIQuantification(), QmitkImageCropper::RemoveBoundingObjectFromNode(), QmitkImageStatistics::RemoveOrphanImages(), QmitkSegmentationView::SetMultiWidget(), QmitkToolPairNavigationView::SetNavigationUp(), QmitkToolPairNavigationView::SetupIGTPipeline(), QmitkIGTRecorderView::SetupIGTPipeline(), QmitkBasicImageProcessing::StartButton2Clicked(), QmitkBasicImageProcessing::StartButtonClicked(), QmitkDiffusionQuantificationView::TensorQuantification(), and QmitkMeasurement::~QmitkMeasurement().

{
  mitk::IDataStorageService::Pointer service = 
    berry::Platform::GetServiceRegistry().GetServiceById<mitk::IDataStorageService>(mitk::IDataStorageService::ID);

  return service->GetDefaultDataStorage()->GetDataStorage();
}
berry::IPreferences::Pointer QmitkFunctionality::GetPreferences (  ) const [protected]

Returns the Preferences object for this Functionality. Important: When refering to this preferences, e.g. in a PreferencePage: The ID for this preferences object is "/<VIEW-ID>", e.g. "/org.mitk.views.datamanager"

Definition at line 399 of file QmitkFunctionality.cpp.

References berry::SmartPointer< TObjectType >::IsNotNull(), and berry::WeakPointer< TObjectType >::Lock().

Referenced by AfterCreateQtPartControl(), QmitkSegmentationView::ApplyDisplayOptions(), ClosePartProxy(), QmitkSegmentationView::CreateNewSegmentation(), QmitkIsoSurface::CreateQtPartControl(), and QmitkIsoSurface::~QmitkIsoSurface().

{
  berry::IPreferencesService::Pointer prefService = m_PreferencesService.Lock();
  // const_cast workaround for bad programming: const uncorrectness this->GetViewSite() should be const
  std::string id = "/" + (const_cast<QmitkFunctionality*>(this))->GetViewSite()->GetId();
  return prefService.IsNotNull() ? prefService->GetSystemPreferences()->Node(id): berry::IPreferences::Pointer(0);
}
void QmitkFunctionality::HandleException ( std::exception &  e,
QWidget *  parent = NULL,
bool  showDialog = true 
) const [protected]

Outputs an error message to the console and displays a message box containing the exception description.

Parameters:
ethe exception which should be handled
showDialogcontrols, whether additionally a message box should be displayed to inform the user that something went wrong

Definition at line 364 of file QmitkFunctionality.cpp.

Referenced by QmitkMeasurement::AssertDrawingIsPossible(), and QmitkSegmentationView::CreateSegmentationFromSurface().

{
  HandleException( e.what(), parent, showDialog );
}
void QmitkFunctionality::HandleException ( const char *  str,
QWidget *  parent = NULL,
bool  showDialog = true 
) const [protected]

Calls HandleException ( std::exception&, QWidget*, bool ) internally

See also:
HandleException ( std::exception&, QWidget*, bool )

Definition at line 353 of file QmitkFunctionality.cpp.

References MITK_ERROR.

{
  //itkGenericOutputMacro( << "Exception caught: " << str );
  MITK_ERROR << str;
  if ( showDialog )
  {
    QMessageBox::critical ( parent, "Exception caught!", str );
  }
}
bool QmitkFunctionality::HandlesMultipleDataStorages (  ) const
Returns:
true if this view handles multiple DataStorages, false otherwise

Definition at line 58 of file QmitkFunctionality.cpp.

{
  return m_HandlesMultipleDataStorages;
}
void QmitkFunctionality::Hidden (  ) [virtual]

Called when this functionality is hidden ( no matter what IsExclusiveFunctionality() returns )

Reimplemented in QmitkDeformableRegistrationView, QmitkPointBasedRegistrationView, and QmitkRigidRegistrationView.

Definition at line 412 of file QmitkFunctionality.cpp.

{

}
bool QmitkFunctionality::IsActivated (  ) const
bool QmitkFunctionality::IsExclusiveFunctionality (  ) const [virtual]

Some functionalities need to add special interactors, removes the crosshair from the stdmultiwidget, etc. In this case the functionality has to tidy up when changing to another functionality which also wants to change the "default configuration". In the old Qt3-based version of MITK, two functionalities could never be opened at the same time so that the methods Activated() and Deactivated() were the right place for the functionalitites to add/remove their interactors, etc. This is still true for the new MITK Workbench, but as there can be several functionalities visible at the same time, the behaviour concerning when Activated() and Deactivated() are called has changed:

1. Activated() and Deactivated() are only called if IsExclusiveFunctionality() returns true

2. If only one standalone functionality is or becomes visible, Activated() will be called on that functionality

3. If two or more standalone functionalities are visible, Activated() will be called on the functionality that receives focus, Deactivated() will be called on the one that looses focus, gets hidden or closed

As a consequence of 1. if you overwrite IsExclusiveFunctionality() and let it return false, you signalize the MITK Workbench that this functionality does nothing to the "default configuration" and can easily be visible while other functionalities are also visible.

By default the method returns true.

Returns:
true if this functionality is meant to work as a standalone view, false otherwise

Reimplemented in QmitkPropertyListView, QmitkImageStatistics, QmitkPointSetInteractionView, QmitkSimpleMeasurement, and QmitkVideoPlayer.

Definition at line 434 of file QmitkFunctionality.cpp.

Referenced by QmitkFunctionalityCoordinator::ActivateStandaloneFunctionality().

{
  return true;
}
bool QmitkFunctionality::IsVisible (  ) const
Returns:
true if this view is currently visible, false otherwise

Definition at line 267 of file QmitkFunctionality.cpp.

References m_Visible.

Referenced by QmitkImageCropper::CreateNewBoundingObject(), and QmitkImageStatistics::OnSelectionChanged().

{
  return m_Visible;
}
void QmitkFunctionality::NodeAdded ( const mitk::DataNode node ) [protected, virtual]

Called when a DataStorage Add event was thrown. May be reimplemented by deriving classes.

Definition at line 304 of file QmitkFunctionality.cpp.

Referenced by NodeAddedProxy().

{

}
void QmitkFunctionality::NodeAddedProxy ( const mitk::DataNode node )

Called when a DataStorage Add Event was thrown. Sets m_InDataStorageChanged to true and calls NodeAdded afterwards.

See also:
m_InDataStorageChanged

Definition at line 291 of file QmitkFunctionality.cpp.

References DataStorageChanged(), and NodeAdded().

Referenced by AfterCreateQtPartControl(), and ClosePartProxy().

{
  // garantuee no recursions when a new node event is thrown in NodeAdded()
  if(!m_InDataStorageChanged)
  {
    m_InDataStorageChanged = true;
    this->NodeAdded(node);
    this->DataStorageChanged();
    m_InDataStorageChanged = false;
  }

}
void QmitkFunctionality::NodeChanged ( const mitk::DataNode  ) [protected, virtual]

Called when a DataStorage Changed event was thrown. May be reimplemented by deriving classes.

Reimplemented in QmitkMeasurement, and QmitkPointSetInteractionView.

Definition at line 417 of file QmitkFunctionality.cpp.

Referenced by NodeChangedProxy().

{

}
void QmitkFunctionality::NodeChangedProxy ( const mitk::DataNode node )

Called when a DataStorage changed event was thrown. Sets m_InDataStorageChanged to true and calls NodeChanged afterwards.

See also:
m_InDataStorageChanged

Definition at line 422 of file QmitkFunctionality.cpp.

References DataStorageChanged(), and NodeChanged().

Referenced by AfterCreateQtPartControl(), and ClosePartProxy().

{
  // garantuee no recursions when a new node event is thrown in NodeAdded()
  if(!m_InDataStorageChanged)
  {
    m_InDataStorageChanged = true;
    this->NodeChanged(node);
    this->DataStorageChanged();
    m_InDataStorageChanged = false;
  }
}
void QmitkFunctionality::NodeRemoved ( const mitk::DataNode node ) [protected, virtual]

Called when a DataStorage Remove event was thrown. May be reimplemented by deriving classes.

Reimplemented in QmitkImageCropper, QmitkMeasurement, and QmitkSimpleMeasurement.

Definition at line 321 of file QmitkFunctionality.cpp.

Referenced by NodeRemovedProxy().

{

}
void QmitkFunctionality::NodeRemovedProxy ( const mitk::DataNode node )

Called when a DataStorage remove event was thrown. Sets m_InDataStorageChanged to true and calls NodeRemoved afterwards.

See also:
m_InDataStorageChanged

Definition at line 309 of file QmitkFunctionality.cpp.

References DataStorageChanged(), and NodeRemoved().

Referenced by AfterCreateQtPartControl(), and ClosePartProxy().

{
  // garantuee no recursions when a new node event is thrown in NodeAdded()
  if(!m_InDataStorageChanged)
  {
    m_InDataStorageChanged = true;
    this->NodeRemoved(node);
    this->DataStorageChanged();
    m_InDataStorageChanged = false;
  }
}
void QmitkFunctionality::OnPreferencesChanged ( const berry::IBerryPreferences  ) [virtual]

Called when the preferences object of this view changed.

See also:
GetPreferences()

Reimplemented in QmitkSegmentationView.

Definition at line 223 of file QmitkFunctionality.cpp.

Referenced by AfterCreateQtPartControl(), and ClosePartProxy().

{
}
void QmitkFunctionality::OnSelectionChanged ( std::vector< mitk::DataNode * >   ) [virtual]
void QmitkFunctionality::RestoreOverrideCursor (  ) [protected]

Convenient method to restore the standard cursor

Definition at line 394 of file QmitkFunctionality.cpp.

Referenced by BusyCursorOff(), and WaitCursorOff().

{
  QApplication::restoreOverrideCursor();
}
void QmitkFunctionality::SetActivated ( bool  activated )

Toggles the activated flag m_Activated

Definition at line 444 of file QmitkFunctionality.cpp.

References m_Active.

Referenced by QmitkFunctionalityCoordinator::ActivateStandaloneFunctionality(), and QmitkFunctionalityCoordinator::DeactivateStandaloneFunctionality().

{
  m_Active = activated;
}
void QmitkFunctionality::SetFocus (  ) [virtual]

Called when this view receives the focus. Same as Activated()

See also:
Activated()

Implements berry::WorkbenchPart.

Reimplemented in QmitkMockFunctionality, and QmitkVolumeVisualizationView.

Definition at line 272 of file QmitkFunctionality.cpp.

{
}
void QmitkFunctionality::SetHandleMultipleDataStorages ( bool  multiple )

Make this view manage multiple DataStorage. If set to true GetDataStorage() will return the currently active DataStorage (and not the default one).

See also:
GetDataStorage()

Definition at line 53 of file QmitkFunctionality.cpp.

{
  m_HandlesMultipleDataStorages = multiple;
}
void QmitkFunctionality::SetVisible ( bool  visible )

Toggles the visible flag m_Visible

Definition at line 439 of file QmitkFunctionality.cpp.

References m_Visible.

{
  m_Visible = visible;
}
void QmitkFunctionality::StdMultiWidgetAvailable ( QmitkStdMultiWidget stdMultiWidget ) [virtual]
void QmitkFunctionality::StdMultiWidgetClosed ( QmitkStdMultiWidget stdMultiWidget ) [virtual]

Called when a StdMultiWidget is available. Should not be used anymore, see GetActiveStdMultiWidget()

See also:
GetActiveStdMultiWidget()

Reimplemented in QmitkPointSetInteractionView, and QmitkSegmentationView.

Definition at line 369 of file QmitkFunctionality.cpp.

{
  
}
void QmitkFunctionality::StdMultiWidgetNotAvailable (  ) [virtual]
void QmitkFunctionality::Visible (  ) [virtual]

Called when this functionality becomes visible ( no matter what IsExclusiveFunctionality() returns )

Reimplemented in QmitkDeformableRegistrationView, QmitkImageStatistics, QmitkPointBasedRegistrationView, and QmitkRigidRegistrationView.

Definition at line 407 of file QmitkFunctionality.cpp.

{

}
void QmitkFunctionality::WaitCursorOff (  ) [protected]
void QmitkFunctionality::WaitCursorOn (  ) [protected]

Convenient method to set and reset a wait cursor ("hourglass")

Definition at line 374 of file QmitkFunctionality.cpp.

Referenced by QmitkIGTExampleView::OnStop(), QmitkIGTExampleView::OnTestNavigation(), QmitkIGTExampleView::OnTestTracking(), and QmitkImageStatistics::UpdateStatistics().

{
  QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
}

Friends And Related Function Documentation

helper stuff to observe BlueBerry selections

Definition at line 402 of file QmitkFunctionality.h.


Member Data Documentation

bool QmitkFunctionality::m_Active [protected]

Saves if this view is the currently active one.

Definition at line 411 of file QmitkFunctionality.h.

Referenced by IsActivated(), and SetActivated().

QWidget* QmitkFunctionality::m_Parent [protected]

Saves if this view is visible

Reimplemented in QmitkMeasurement.

Definition at line 415 of file QmitkFunctionality.h.

Referenced by IsVisible(), and SetVisible().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines