Public Member Functions | Public Attributes

TrSelListener Struct Reference

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

List of all members.

Public Member Functions

 berryObjectMacro (TrSelListener)
 TrSelListener (QmitkTensorReconstructionView *view)
void DoSelectionChanged (ISelection::ConstPointer selection)
void SelectionChanged (IWorkbenchPart::Pointer part, ISelection::ConstPointer selection)

Public Attributes

QmitkTensorReconstructionViewm_View

Detailed Description

Definition at line 62 of file QmitkTensorReconstructionView.cpp.


Constructor & Destructor Documentation

TrSelListener::TrSelListener ( QmitkTensorReconstructionView view ) [inline]

Definition at line 67 of file QmitkTensorReconstructionView.cpp.

  {
    m_View = view;
  }

Member Function Documentation

TrSelListener::berryObjectMacro ( TrSelListener   )
void TrSelListener::DoSelectionChanged ( ISelection::ConstPointer  selection ) [inline]

Definition at line 72 of file QmitkTensorReconstructionView.cpp.

References berry::SmartPointer< TObjectType >::Cast(), and QmitkTensorReconstructionView::m_CurrentSelection.

  {
    //    if(!m_View->IsVisible())
    //      return;
    // save current selection in member variable
    m_View->m_CurrentSelection = selection.Cast<const IStructuredSelection>();

    // do something with the selected items
    if(m_View->m_CurrentSelection)
    {
      bool foundDwiVolume = false;
      bool foundTensorVolume = false;

      // iterate selection
      for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin(); 
        i != m_View->m_CurrentSelection->End(); ++i)
      {

        // extract datatree node
        if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
        {
          mitk::DataNode::Pointer node = nodeObj->GetDataNode();

          // only look at interesting types
          if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
          {
            foundDwiVolume = true;
          }

          // only look at interesting types
          if(QString("TensorImage").compare(node->GetData()->GetNameOfClass())==0)
          {
            foundTensorVolume = true;
          }
        }
      }

      m_View->m_Controls->m_ItkReconstruction->setEnabled(foundDwiVolume);
      m_View->m_Controls->m_TeemReconstruction->setEnabled(foundDwiVolume);

      m_View->m_Controls->m_TensorsToDWIButton->setEnabled(foundTensorVolume);

    }
  }
void TrSelListener::SelectionChanged ( IWorkbenchPart::Pointer  part,
ISelection::ConstPointer  selection 
) [inline, virtual]

Implements berry::ISelectionListener.

Definition at line 117 of file QmitkTensorReconstructionView.cpp.

  {
    // check, if selection comes from datamanager
    if (part)
    {
      QString partname(part->GetPartName().c_str());
      if(partname.compare("Datamanager")==0)
      {

        // apply selection
        DoSelectionChanged(selection);

      }
    }
  }

Member Data Documentation

Definition at line 133 of file QmitkTensorReconstructionView.cpp.


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