Signals | Public Member Functions | Static Public Attributes | Protected Slots | Protected Attributes | Friends

QmitkDeformableRegistrationView Class Reference
[Functionalities]

The DeformableRegistration functionality is used to perform deformable registration. More...

#include <QmitkDeformableRegistrationView.h>

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

List of all members.

Signals

void reinitFixed (const mitk::Geometry3D *)
 Signal that informs about that the fixed image should be reinitialized in the multi-widget.
void reinitMoving (const mitk::Geometry3D *)
 Signal that informs about that the moving image should be reinitialized in the multi-widget.
void calculateBSplineRegistration ()
 Signal that informs about that the BSpline registration should be performed.

Public Member Functions

 QmitkDeformableRegistrationView (QObject *parent=0, const char *name=0)
 default constructor
virtual ~QmitkDeformableRegistrationView ()
 default destructor
virtual void CreateQtPartControl (QWidget *parent)
 method for creating the applications main widget
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
 Sets the StdMultiWidget and connects it to the functionality.
virtual void StdMultiWidgetNotAvailable ()
 Removes the StdMultiWidget and disconnects it from the functionality.
virtual void CreateConnections ()
 method for creating the connections of main and control widget
virtual void Activated ()
 Method which is called when this functionality is selected in MITK.
virtual void Deactivated ()
 Method which is called whenever the functionality is deselected in MITK.
virtual void Visible ()
virtual void Hidden ()
void DataNodeHasBeenRemoved (const mitk::DataNode *node)

Static Public Attributes

static const std::string VIEW_ID = "org.mitk.views.deformableregistration"

Protected Slots

void FixedSelected (mitk::DataNode::Pointer fixedImage)
void MovingSelected (mitk::DataNode::Pointer movingImage)
bool CheckCalculate ()
void ShowRedGreen (bool show)
void OpacityUpdate (float opacity)
void OpacityUpdate (int opacity)
 Sets the selected opacity for moving image.
void SetImageColor (bool redGreen)
void CheckCalculateEnabled ()
 Checks whether the registration can be performed.
void Calculate ()
 Performs the registration.
void ApplyDeformationField ()
void SetImagesVisible (berry::ISelection::ConstPointer selection)
void TabChanged (int index)
void SwitchImages ()

Protected Attributes

berry::ISelectionListener::Pointer m_SelListener
berry::IStructuredSelection::ConstPointer m_CurrentSelection
QmitkStdMultiWidgetm_MultiWidget
Ui::QmitkDeformableRegistrationViewControls m_Controls
mitk::DataNode::Pointer m_MovingNode
mitk::DataNode::Pointer m_FixedNode
bool m_ShowRedGreen
float m_Opacity
float m_OriginalOpacity
mitk::Color m_FixedColor
mitk::Color m_MovingColor
bool m_Deactivated

Friends

struct SelListenerDeformableRegistration

Detailed Description

The DeformableRegistration functionality is used to perform deformable registration.

This functionality allows you to register two 2D as well as two 3D images in a non rigid manner. Register means to align two images, so that they become as similar as possible. Therefore you can select from different deformable registration methods. Registration results will directly be applied to the Moving Image. The result is shown in the multi-widget.

For more informations see: QmitkDeformableRegistrationUserManual

See also:
QmitkFunctionality

Definition at line 45 of file QmitkDeformableRegistrationView.h.


Constructor & Destructor Documentation

QmitkDeformableRegistrationView::QmitkDeformableRegistrationView ( QObject *  parent = 0,
const char *  name = 0 
)
QmitkDeformableRegistrationView::~QmitkDeformableRegistrationView (  ) [virtual]

Member Function Documentation

void QmitkDeformableRegistrationView::Activated (  ) [virtual]
void QmitkDeformableRegistrationView::ApplyDeformationField (  ) [protected, slot]

Prints the values of the deformationfield

Definition at line 238 of file QmitkDeformableRegistrationView.cpp.

References mitk::CastToItkImage(), mitk::CastToMitkImage(), QmitkFunctionality::GetDefaultDataStorage(), mitk::RenderingManager::GetInstance(), QmitkBSplineRegistrationView::m_Controls, m_Controls, Ui_QmitkBSplineRegistrationViewControls::m_DeformationField, m_FixedNode, m_MovingNode, Ui_QmitkDeformableRegistrationViewControls::m_QmitkBSplineRegistrationViewControls, mitk::StringProperty::New(), mitk::DataNode::New(), and mitk::Image::New().

Referenced by CreateConnections().

{
  
  ImageReaderType::Pointer reader  = ImageReaderType::New();
  reader->SetFileName( m_Controls.m_QmitkBSplineRegistrationViewControls->m_Controls.m_DeformationField->text().toStdString() );
  reader->Update();
      
  DeformationFieldType::Pointer deformationField = reader->GetOutput();

  mitk::Image * mimage = dynamic_cast<mitk::Image*> (m_MovingNode->GetData());
  mitk::Image * fimage = dynamic_cast<mitk::Image*> (m_FixedNode->GetData());
  
  typedef itk::Image<float, 3> FloatImageType;  

  FloatImageType::Pointer itkMovingImage = FloatImageType::New();
  FloatImageType::Pointer itkFixedImage = FloatImageType::New();
  mitk::CastToItkImage(mimage, itkMovingImage);
  mitk::CastToItkImage(fimage, itkFixedImage);

  typedef itk::WarpImageFilter<
                            FloatImageType, 
                            FloatImageType,
                            DeformationFieldType  >     WarperType;

  typedef itk::LinearInterpolateImageFunction<
                                    FloatImageType,
                                    double          >  InterpolatorType;

  WarperType::Pointer warper = WarperType::New();
  InterpolatorType::Pointer interpolator = InterpolatorType::New();

  warper->SetInput( itkMovingImage );
  warper->SetInterpolator( interpolator );
  warper->SetOutputSpacing( itkFixedImage->GetSpacing() );
  warper->SetOutputOrigin( itkFixedImage->GetOrigin() );
  warper->SetOutputDirection (itkFixedImage->GetDirection() );
  warper->SetDeformationField( deformationField );
  warper->Update();

  FloatImageType::Pointer outputImage = warper->GetOutput();
  mitk::Image::Pointer result = mitk::Image::New();

  mitk::CastToMitkImage(outputImage, result);

  // Create new DataNode
  mitk::DataNode::Pointer newNode = mitk::DataNode::New();
  newNode->SetData( result );   
  newNode->SetProperty( "name", mitk::StringProperty::New("warped image") );

  // add the new datatree node to the datatree
  this->GetDefaultDataStorage()->Add(newNode); 
  mitk::RenderingManager::GetInstance()->RequestUpdateAll(); 

  //Image::Pointer outputImage = this->GetOutput();
  //mitk::CastToMitkImage( warper->GetOutput(), outputImage );

  
}
void QmitkDeformableRegistrationView::Calculate (  ) [protected, slot]

Performs the registration.

Definition at line 541 of file QmitkDeformableRegistrationView.cpp.

References calculateBSplineRegistration(), QmitkDemonsRegistrationView::CalculateTransformation(), QmitkFunctionality::GetDataStorage(), QmitkDemonsRegistrationView::GetResultDeformationfield(), QmitkDemonsRegistrationView::GetResultImage(), m_Controls, Ui_QmitkDeformableRegistrationViewControls::m_DeformableTransform, m_FixedNode, m_MovingNode, Ui_QmitkDeformableRegistrationViewControls::m_QmitkBSplineRegistrationViewControls, Ui_QmitkDeformableRegistrationViewControls::m_QmitkDemonsRegistrationViewControls, mitk::VectorImageMapper2D::New(), mitk::LevelWindowProperty::New(), mitk::DataNode::New(), mitk::LevelWindow::SetAuto(), QmitkBSplineRegistrationView::SetFixedNode(), QmitkDemonsRegistrationView::SetFixedNode(), QmitkBSplineRegistrationView::SetMovingNode(), and QmitkDemonsRegistrationView::SetMovingNode().

Referenced by CreateConnections().

{
  if (m_Controls.m_DeformableTransform->tabText(m_Controls.m_DeformableTransform->currentIndex()) == "Demons")
  {
    m_Controls.m_QmitkDemonsRegistrationViewControls->SetFixedNode(m_FixedNode);
    m_Controls.m_QmitkDemonsRegistrationViewControls->SetMovingNode(m_MovingNode);
    try
    {
      m_Controls.m_QmitkDemonsRegistrationViewControls->CalculateTransformation();
    }
    catch (itk::ExceptionObject& excpt)
    {
      QMessageBox::information( NULL, "Registration exception", excpt.GetDescription(), QMessageBox::Ok );
      return;
    }
    mitk::Image::Pointer resultImage = m_Controls.m_QmitkDemonsRegistrationViewControls->GetResultImage();
    mitk::Image::Pointer resultDeformationField = m_Controls.m_QmitkDemonsRegistrationViewControls->GetResultDeformationfield();   
    if (resultImage.IsNotNull())
    {
      mitk::DataNode::Pointer resultImageNode = mitk::DataNode::New();
      resultImageNode->SetData(resultImage);
      mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
      mitk::LevelWindow levelWindow;
      levelWindow.SetAuto( resultImage );
      levWinProp->SetLevelWindow(levelWindow);
      resultImageNode->GetPropertyList()->SetProperty("levelwindow",levWinProp);
      resultImageNode->SetStringProperty("name", "DeformableRegistrationResultImage");
      this->GetDataStorage()->Add(resultImageNode, m_MovingNode);
    }
    if (resultDeformationField.IsNotNull())
    {
      mitk::DataNode::Pointer resultDeformationFieldNode = mitk::DataNode::New();
      resultDeformationFieldNode->SetData(resultDeformationField);
      mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
      mitk::LevelWindow levelWindow;
      levelWindow.SetAuto( resultDeformationField );
      levWinProp->SetLevelWindow(levelWindow);
      resultDeformationFieldNode->GetPropertyList()->SetProperty("levelwindow",levWinProp);
      resultDeformationFieldNode->SetStringProperty("name", "DeformableRegistrationResultDeformationField");
      mitk::VectorImageMapper2D::Pointer mapper = mitk::VectorImageMapper2D::New();
      resultDeformationFieldNode->SetMapper(1, mapper);
      resultDeformationFieldNode->SetVisibility(false);
      this->GetDataStorage()->Add(resultDeformationFieldNode, m_MovingNode);
    }
  }

  else if (m_Controls.m_DeformableTransform->tabText(m_Controls.m_DeformableTransform->currentIndex()) == "B-Spline")
  {
    m_Controls.m_QmitkBSplineRegistrationViewControls->SetFixedNode(m_FixedNode);
    m_Controls.m_QmitkBSplineRegistrationViewControls->SetMovingNode(m_MovingNode);
    emit calculateBSplineRegistration();
  }
}
void QmitkDeformableRegistrationView::calculateBSplineRegistration (  ) [signal]

Signal that informs about that the BSpline registration should be performed.

Referenced by Calculate(), and CreateConnections().

bool QmitkDeformableRegistrationView::CheckCalculate (  ) [protected, slot]

checks if registration is possible

Definition at line 479 of file QmitkDeformableRegistrationView.cpp.

References m_FixedNode, and m_MovingNode.

{
  if(m_MovingNode==m_FixedNode)
    return false;
  return true;
}
void QmitkDeformableRegistrationView::CheckCalculateEnabled (  ) [protected, slot]

Checks whether the registration can be performed.

Definition at line 529 of file QmitkDeformableRegistrationView.cpp.

References Ui_QmitkDeformableRegistrationViewControls::m_CalculateTransformation, m_Controls, m_FixedNode, and m_MovingNode.

Referenced by CreateQtPartControl(), FixedSelected(), and MovingSelected().

{
  if (m_FixedNode.IsNotNull() && m_MovingNode.IsNotNull())
  {
    m_Controls.m_CalculateTransformation->setEnabled(true);
  }
  else
  {
    m_Controls.m_CalculateTransformation->setEnabled(false);
  }
}
void QmitkDeformableRegistrationView::CreateConnections (  ) [virtual]

method for creating the connections of main and control widget

Definition at line 310 of file QmitkDeformableRegistrationView.cpp.

References ApplyDeformationField(), Calculate(), calculateBSplineRegistration(), Ui_QmitkBSplineRegistrationViewControls::m_ApplyDeformationField, Ui_QmitkDeformableRegistrationViewControls::m_CalculateTransformation, QmitkBSplineRegistrationView::m_Controls, m_Controls, Ui_QmitkDeformableRegistrationViewControls::m_DeformableTransform, Ui_QmitkDeformableRegistrationViewControls::m_OpacitySlider, Ui_QmitkDeformableRegistrationViewControls::m_QmitkBSplineRegistrationViewControls, Ui_QmitkDeformableRegistrationViewControls::m_ShowRedGreenValues, Ui_QmitkDeformableRegistrationViewControls::m_SwitchImages, OpacityUpdate(), ShowRedGreen(), SwitchImages(), and TabChanged().

Referenced by CreateQtPartControl().

{
  connect(m_Controls.m_ShowRedGreenValues, SIGNAL(toggled(bool)), this, SLOT(ShowRedGreen(bool)));
  connect(m_Controls.m_DeformableTransform, SIGNAL(currentChanged(int)), this, SLOT(TabChanged(int)));
  connect(m_Controls.m_OpacitySlider, SIGNAL(sliderMoved(int)), this, SLOT(OpacityUpdate(int)));
  connect(m_Controls.m_CalculateTransformation, SIGNAL(clicked()), this, SLOT(Calculate()));
  connect((QObject*)(m_Controls.m_SwitchImages),SIGNAL(clicked()),this,SLOT(SwitchImages()));
  connect(this,SIGNAL(calculateBSplineRegistration()),m_Controls.m_QmitkBSplineRegistrationViewControls,SLOT(CalculateTransformation()));
  connect( (QObject*)(m_Controls.m_QmitkBSplineRegistrationViewControls->m_Controls.m_ApplyDeformationField),
    SIGNAL(clicked()), 
    (QObject*) this,
    SLOT(ApplyDeformationField()) );
}
void QmitkDeformableRegistrationView::CreateQtPartControl ( QWidget *  parent ) [virtual]

method for creating the applications main widget

Implements berry::QtViewPart.

Definition at line 187 of file QmitkDeformableRegistrationView.cpp.

References CheckCalculateEnabled(), CreateConnections(), Ui_QmitkDeformableRegistrationViewControls::label, Ui_QmitkDeformableRegistrationViewControls::label_2, m_Controls, Ui_QmitkDeformableRegistrationViewControls::m_DeformableTransform, Ui_QmitkDeformableRegistrationViewControls::m_FixedLabel, Ui_QmitkDeformableRegistrationViewControls::m_MovingLabel, Ui_QmitkDeformableRegistrationViewControls::m_OpacityLabel, Ui_QmitkDeformableRegistrationViewControls::m_OpacitySlider, QmitkFunctionality::m_Parent, Ui_QmitkDeformableRegistrationViewControls::m_QmitkBSplineRegistrationViewControls, Ui_QmitkDeformableRegistrationViewControls::m_QmitkDemonsRegistrationViewControls, Ui_QmitkDeformableRegistrationViewControls::m_ShowRedGreenValues, Ui_QmitkDeformableRegistrationViewControls::m_SwitchImages, Ui_QmitkDeformableRegistrationViewControls::setupUi(), Ui_QmitkDeformableRegistrationViewControls::TextLabelFixed, and Ui_QmitkDeformableRegistrationViewControls::TextLabelMoving.

void QmitkDeformableRegistrationView::DataNodeHasBeenRemoved ( const mitk::DataNode node )

Definition at line 216 of file QmitkDeformableRegistrationView.cpp.

References Ui_QmitkDeformableRegistrationViewControls::label, Ui_QmitkDeformableRegistrationViewControls::label_2, Ui_QmitkDeformableRegistrationViewControls::m_CalculateTransformation, m_Controls, Ui_QmitkDeformableRegistrationViewControls::m_DeformableTransform, Ui_QmitkDeformableRegistrationViewControls::m_FixedLabel, m_FixedNode, Ui_QmitkDeformableRegistrationViewControls::m_MovingLabel, m_MovingNode, Ui_QmitkDeformableRegistrationViewControls::m_OpacityLabel, Ui_QmitkDeformableRegistrationViewControls::m_OpacitySlider, Ui_QmitkDeformableRegistrationViewControls::m_ShowRedGreenValues, Ui_QmitkDeformableRegistrationViewControls::m_StatusLabel, Ui_QmitkDeformableRegistrationViewControls::m_SwitchImages, Ui_QmitkDeformableRegistrationViewControls::TextLabelFixed, and Ui_QmitkDeformableRegistrationViewControls::TextLabelMoving.

Referenced by QmitkDeformableRegistrationView().

{
  if(node == m_FixedNode || node == m_MovingNode)
  {  
    m_Controls.m_StatusLabel->show();
    m_Controls.TextLabelFixed->hide();
    m_Controls.m_SwitchImages->hide();
    m_Controls.m_FixedLabel->hide();
    m_Controls.TextLabelMoving->hide();
    m_Controls.m_MovingLabel->hide();
    m_Controls.m_OpacityLabel->setEnabled(false);
    m_Controls.m_OpacitySlider->setEnabled(false);
    m_Controls.label->setEnabled(false);
    m_Controls.label_2->setEnabled(false);
    m_Controls.m_ShowRedGreenValues->setEnabled(false);
    m_Controls.m_DeformableTransform->hide();
    m_Controls.m_CalculateTransformation->setEnabled(false);
  }    

}
void QmitkDeformableRegistrationView::Deactivated (  ) [virtual]

Method which is called whenever the functionality is deselected in MITK.

Reimplemented from QmitkFunctionality.

Definition at line 361 of file QmitkDeformableRegistrationView.cpp.

References berry::WorkbenchPart::GetSite(), m_Deactivated, m_FixedNode, m_MovingNode, m_OriginalOpacity, m_SelListener, berry::ISelectionService::RemovePostSelectionListener(), and SetImageColor().

{
  m_Deactivated = true;
  this->SetImageColor(false);
  if (m_FixedNode.IsNotNull())
    m_FixedNode->SetOpacity(1.0);
  if (m_MovingNode.IsNotNull())
  {
    m_MovingNode->SetOpacity(m_OriginalOpacity);
  }
  m_FixedNode = NULL;
  m_MovingNode = NULL;
  berry::ISelectionService* s = GetSite()->GetWorkbenchWindow()->GetSelectionService();
  if(s)
    s->RemovePostSelectionListener(m_SelListener);
  m_SelListener = NULL;
}
void QmitkDeformableRegistrationView::FixedSelected ( mitk::DataNode::Pointer  fixedImage ) [protected, slot]

sets the fixed Image according to TreeNodeSelector widget

Definition at line 398 of file QmitkDeformableRegistrationView.cpp.

References CheckCalculateEnabled(), mitk::RenderingManager::GetInstance(), m_Controls, m_FixedColor, Ui_QmitkDeformableRegistrationViewControls::m_FixedLabel, m_FixedNode, m_ShowRedGreen, Ui_QmitkDeformableRegistrationViewControls::m_SwitchImages, mitk::BoolProperty::New(), SetImageColor(), and Ui_QmitkDeformableRegistrationViewControls::TextLabelFixed.

Referenced by SwitchImages().

{
  if (fixedImage.IsNotNull())
  {
    if (m_FixedNode != fixedImage)
    {
      // remove changes on previous selected node
      if (m_FixedNode.IsNotNull())
      {
        this->SetImageColor(false);
        m_FixedNode->SetOpacity(1.0);
        m_FixedNode->SetVisibility(false);
        m_FixedNode->SetProperty("selectedFixedImage", mitk::BoolProperty::New(false));
      }
      // get selected node
      m_FixedNode = fixedImage;
      m_FixedNode->SetOpacity(0.5);
      m_Controls.TextLabelFixed->setText(QString::fromStdString(m_FixedNode->GetName()));
      m_Controls.m_FixedLabel->show();
      m_Controls.TextLabelFixed->show();
      m_Controls.m_SwitchImages->show();
      mitk::ColorProperty::Pointer colorProperty;
      colorProperty = dynamic_cast<mitk::ColorProperty*>(m_FixedNode->GetProperty("color"));
      if ( colorProperty.IsNotNull() )
      {
        m_FixedColor = colorProperty->GetColor();
      }
      this->SetImageColor(m_ShowRedGreen);
      m_FixedNode->SetVisibility(true);
      mitk::RenderingManager::GetInstance()->RequestUpdateAll();
    }
  }
  else
  {
    m_FixedNode = fixedImage;
    m_Controls.m_FixedLabel->hide();
    m_Controls.TextLabelFixed->hide();
    m_Controls.m_SwitchImages->hide();
  }
  this->CheckCalculateEnabled();
}
void QmitkDeformableRegistrationView::Hidden (  ) [virtual]

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

Reimplemented from QmitkFunctionality.

Definition at line 379 of file QmitkDeformableRegistrationView.cpp.

{
  /*
  m_Deactivated = true;
  this->SetImageColor(false);
  if (m_MovingNode.IsNotNull())
  {
    m_MovingNode->SetOpacity(m_OriginalOpacity);
  }
  m_FixedNode = NULL;
  m_MovingNode = NULL;
  berry::ISelectionService* s = GetSite()->GetWorkbenchWindow()->GetSelectionService();
  if(s)
    s->RemovePostSelectionListener(m_SelListener);
  m_SelListener = NULL;*/
  //mitk::RenderingManager::GetInstance()->RequestUpdateAll();
  //QmitkFunctionality::Deactivated();
}
void QmitkDeformableRegistrationView::MovingSelected ( mitk::DataNode::Pointer  movingImage ) [protected, slot]

sets the moving Image according to TreeNodeSelector widget

Definition at line 440 of file QmitkDeformableRegistrationView.cpp.

References CheckCalculateEnabled(), mitk::RenderingManager::GetInstance(), m_Controls, m_FixedNode, m_MovingColor, Ui_QmitkDeformableRegistrationViewControls::m_MovingLabel, m_MovingNode, m_Opacity, m_OriginalOpacity, m_ShowRedGreen, OpacityUpdate(), SetImageColor(), and Ui_QmitkDeformableRegistrationViewControls::TextLabelMoving.

Referenced by SwitchImages().

{
  if (movingImage.IsNotNull())
  {
    if (m_MovingNode != movingImage)
    {
      if (m_MovingNode.IsNotNull())
      {
        m_MovingNode->SetOpacity(m_OriginalOpacity);
        if (m_FixedNode == m_MovingNode)
          m_FixedNode->SetOpacity(0.5);
        this->SetImageColor(false);
      }
      m_MovingNode = movingImage;
      m_Controls.TextLabelMoving->setText(QString::fromStdString(m_MovingNode->GetName()));
      m_Controls.m_MovingLabel->show();
      m_Controls.TextLabelMoving->show();
      mitk::ColorProperty::Pointer colorProperty;
      colorProperty = dynamic_cast<mitk::ColorProperty*>(m_MovingNode->GetProperty("color"));
      if ( colorProperty.IsNotNull() )
      {
        m_MovingColor = colorProperty->GetColor();
      }
      this->SetImageColor(m_ShowRedGreen);
      m_MovingNode->GetFloatProperty("opacity", m_OriginalOpacity);
      this->OpacityUpdate(m_Opacity);
      m_MovingNode->SetVisibility(true);
      mitk::RenderingManager::GetInstance()->RequestUpdateAll();
    }
  }
  else
  {
    m_MovingNode = NULL;
    m_Controls.m_MovingLabel->hide();
    m_Controls.TextLabelMoving->hide();
  }
  this->CheckCalculateEnabled();
}
void QmitkDeformableRegistrationView::OpacityUpdate ( float  opacity ) [protected, slot]

set the selected opacity for moving image

Parameters:
opacitythe selected opacity

Definition at line 513 of file QmitkDeformableRegistrationView.cpp.

References mitk::RenderingManager::GetInstance(), m_MovingNode, and m_Opacity.

Referenced by Activated(), CreateConnections(), MovingSelected(), and OpacityUpdate().

{
  m_Opacity = opacity;
  if (m_MovingNode.IsNotNull())
  {
    m_MovingNode->SetOpacity(m_Opacity);
  }
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkDeformableRegistrationView::OpacityUpdate ( int  opacity ) [protected, slot]

Sets the selected opacity for moving image.

Parameters:
opacitythe selected opacity

Definition at line 523 of file QmitkDeformableRegistrationView.cpp.

References OpacityUpdate().

{
  float fValue = ((float)opacity)/100.0f;
  this->OpacityUpdate(fValue);
}
void QmitkDeformableRegistrationView::reinitFixed ( const mitk::Geometry3D  ) [signal]

Signal that informs about that the fixed image should be reinitialized in the multi-widget.

void QmitkDeformableRegistrationView::reinitMoving ( const mitk::Geometry3D  ) [signal]

Signal that informs about that the moving image should be reinitialized in the multi-widget.

void QmitkDeformableRegistrationView::SetImageColor ( bool  redGreen ) [protected, slot]

sets the images to grayvalues or fixed image to red and moving image to green

Parameters:
redGreenif true, then images will be shown in red and green

Definition at line 492 of file QmitkDeformableRegistrationView.cpp.

References mitk::RenderingManager::GetInstance(), m_FixedColor, m_FixedNode, m_MovingColor, and m_MovingNode.

Referenced by Deactivated(), FixedSelected(), MovingSelected(), and ShowRedGreen().

{
  if (!redGreen && m_FixedNode.IsNotNull())
  {
    m_FixedNode->SetColor(m_FixedColor);
  }
  if (!redGreen && m_MovingNode.IsNotNull())
  {
    m_MovingNode->SetColor(m_MovingColor);
  }
  if (redGreen && m_FixedNode.IsNotNull())
  {
    m_FixedNode->SetColor(1.0f, 0.0f, 0.0f);
  }
  if (redGreen && m_MovingNode.IsNotNull())
  {
    m_MovingNode->SetColor(0.0f, 1.0f, 0.0f);
  }
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkDeformableRegistrationView::SetImagesVisible ( berry::ISelection::ConstPointer  selection ) [protected, slot]

Definition at line 595 of file QmitkDeformableRegistrationView.cpp.

References QmitkFunctionality::GetDataStorage(), and m_CurrentSelection.

{
  if (this->m_CurrentSelection->Size() == 0)
  {
    // show all images
    mitk::DataStorage::SetOfObjects::ConstPointer setOfObjects = this->GetDataStorage()->GetAll();
    for (mitk::DataStorage::SetOfObjects::ConstIterator nodeIt = setOfObjects->Begin()
      ; nodeIt != setOfObjects->End(); ++nodeIt)  // for each node
    {
      if ( (nodeIt->Value().IsNotNull()) && (nodeIt->Value()->GetProperty("visible")) && dynamic_cast<mitk::Geometry2DData*>(nodeIt->Value()->GetData())==NULL)
      {
        nodeIt->Value()->SetVisibility(true);
      }
    }
  }
  else
  {
    // hide all images
    mitk::DataStorage::SetOfObjects::ConstPointer setOfObjects = this->GetDataStorage()->GetAll();
    for (mitk::DataStorage::SetOfObjects::ConstIterator nodeIt = setOfObjects->Begin()
      ; nodeIt != setOfObjects->End(); ++nodeIt)  // for each node
    {
      if ( (nodeIt->Value().IsNotNull()) && (nodeIt->Value()->GetProperty("visible")) && dynamic_cast<mitk::Geometry2DData*>(nodeIt->Value()->GetData())==NULL)
      {
        nodeIt->Value()->SetVisibility(false);
      }
    }
  }
}
void QmitkDeformableRegistrationView::ShowRedGreen ( bool  show ) [protected, slot]

stores whether the image will be shown in grayvalues or in red for fixed image and green for moving image

Parameters:
showif true, then images will be shown in red and green

Definition at line 486 of file QmitkDeformableRegistrationView.cpp.

References m_ShowRedGreen, and SetImageColor().

Referenced by Activated(), and CreateConnections().

void QmitkDeformableRegistrationView::StdMultiWidgetAvailable ( QmitkStdMultiWidget stdMultiWidget ) [virtual]

Sets the StdMultiWidget and connects it to the functionality.

Reimplemented from QmitkFunctionality.

Definition at line 297 of file QmitkDeformableRegistrationView.cpp.

References m_MultiWidget, QmitkFunctionality::m_Parent, and QmitkStdMultiWidget::SetWidgetPlanesVisibility().

{
  m_Parent->setEnabled(true);
  m_MultiWidget = &stdMultiWidget;
  m_MultiWidget->SetWidgetPlanesVisibility(true);
}
void QmitkDeformableRegistrationView::StdMultiWidgetNotAvailable (  ) [virtual]

Removes the StdMultiWidget and disconnects it from the functionality.

Reimplemented from QmitkFunctionality.

Definition at line 304 of file QmitkDeformableRegistrationView.cpp.

References m_MultiWidget, and QmitkFunctionality::m_Parent.

{
  m_Parent->setEnabled(false);
  m_MultiWidget = NULL;
}
void QmitkDeformableRegistrationView::SwitchImages (  ) [protected, slot]

Definition at line 639 of file QmitkDeformableRegistrationView.cpp.

References FixedSelected(), m_FixedNode, m_MovingNode, and MovingSelected().

Referenced by CreateConnections().

{
  mitk::DataNode::Pointer newMoving = m_FixedNode;
  mitk::DataNode::Pointer newFixed = m_MovingNode;
  this->FixedSelected(newFixed);
  this->MovingSelected(newMoving);
}
void QmitkDeformableRegistrationView::TabChanged ( int  index ) [protected, slot]
void QmitkDeformableRegistrationView::Visible (  ) [virtual]

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

Reimplemented from QmitkFunctionality.

Definition at line 342 of file QmitkDeformableRegistrationView.cpp.

{
  /*
  m_Deactivated = false;
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
  QmitkFunctionality::Activated();
  if (m_SelListener.IsNull())
  {
    m_SelListener = berry::ISelectionListener::Pointer(new SelListenerDeformableRegistration(this));
    this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener("org.mitk.views.datamanager", m_SelListener);
    berry::ISelection::ConstPointer sel(
      this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
    m_CurrentSelection = sel.Cast<const IStructuredSelection>();
    m_SelListener.Cast<SelListenerDeformableRegistration>()->DoSelectionChanged(sel);
  }
  this->OpacityUpdate(m_Controls.m_OpacitySlider->value());
  this->ShowRedGreen(m_Controls.m_ShowRedGreenValues->isChecked());*/
}

Friends And Related Function Documentation

friend struct SelListenerDeformableRegistration [friend]

Definition at line 48 of file QmitkDeformableRegistrationView.h.

Referenced by Activated().


Member Data Documentation

Definition at line 204 of file QmitkDeformableRegistrationView.h.

Referenced by Activated(), and Deactivated().

Definition at line 202 of file QmitkDeformableRegistrationView.h.

Referenced by FixedSelected(), and SetImageColor().

Definition at line 203 of file QmitkDeformableRegistrationView.h.

Referenced by MovingSelected(), and SetImageColor().

default main widget containing 4 windows showing 3 orthogonal slices of the volume and a 3d render window

Definition at line 191 of file QmitkDeformableRegistrationView.h.

Referenced by StdMultiWidgetAvailable(), and StdMultiWidgetNotAvailable().

Definition at line 200 of file QmitkDeformableRegistrationView.h.

Referenced by MovingSelected(), and OpacityUpdate().

Definition at line 201 of file QmitkDeformableRegistrationView.h.

Referenced by Deactivated(), and MovingSelected().

Definition at line 199 of file QmitkDeformableRegistrationView.h.

Referenced by FixedSelected(), MovingSelected(), and ShowRedGreen().

const std::string QmitkDeformableRegistrationView::VIEW_ID = "org.mitk.views.deformableregistration" [static]

Definition at line 54 of file QmitkDeformableRegistrationView.h.


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