00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "QmitkDeformableRegistrationView.h"
00019 #include "ui_QmitkDeformableRegistrationViewControls.h"
00020
00021 #include "QmitkStdMultiWidget.h"
00022 #include "QmitkCommonFunctionality.h"
00023 #include "qinputdialog.h"
00024 #include "qmessagebox.h"
00025 #include "qcursor.h"
00026 #include "qapplication.h"
00027 #include "qradiobutton.h"
00028 #include "qslider.h"
00029
00030 #include <vtkTransform.h>
00031
00032 #include "mitkNodePredicateDataType.h"
00033 #include "mitkNodePredicateProperty.h"
00034 #include "mitkNodePredicateAnd.h"
00035 #include "mitkNodePredicateNot.h"
00036 #include "mitkVectorImageMapper2D.h"
00037
00038 #include "itkImageFileReader.h"
00039 #include "itkWarpImageFilter.h"
00040
00041 #include "mitkDataNodeObject.h"
00042
00043 #include "berryIWorkbenchWindow.h"
00044 #include "berryISelectionService.h"
00045
00046 typedef itk::Vector< float, 3 > VectorType;
00047 typedef itk::Image< VectorType, 3 > DeformationFieldType;
00048
00049 typedef itk::ImageFileReader< DeformationFieldType > ImageReaderType;
00050
00051 const std::string QmitkDeformableRegistrationView::VIEW_ID = "org.mitk.views.deformableregistration";
00052
00053 using namespace berry;
00054
00055 struct SelListenerDeformableRegistration : ISelectionListener
00056 {
00057 berryObjectMacro(SelListenerDeformableRegistration);
00058
00059 SelListenerDeformableRegistration(QmitkDeformableRegistrationView* view)
00060 {
00061 m_View = view;
00062 }
00063
00064 void DoSelectionChanged(ISelection::ConstPointer selection)
00065 {
00066
00067
00068
00069 m_View->m_CurrentSelection = selection.Cast<const IStructuredSelection>();
00070
00071
00072 if(m_View->m_CurrentSelection)
00073 {
00074 if (m_View->m_CurrentSelection->Size() != 2)
00075 {
00076 if (m_View->m_FixedNode.IsNull() || m_View->m_MovingNode.IsNull())
00077 {
00078 m_View->m_Controls.m_StatusLabel->show();
00079 m_View->m_Controls.TextLabelFixed->hide();
00080 m_View->m_Controls.m_SwitchImages->hide();
00081 m_View->m_Controls.m_FixedLabel->hide();
00082 m_View->m_Controls.TextLabelMoving->hide();
00083 m_View->m_Controls.m_MovingLabel->hide();
00084 m_View->m_Controls.m_OpacityLabel->setEnabled(false);
00085 m_View->m_Controls.m_OpacitySlider->setEnabled(false);
00086 m_View->m_Controls.label->setEnabled(false);
00087 m_View->m_Controls.label_2->setEnabled(false);
00088 m_View->m_Controls.m_ShowRedGreenValues->setEnabled(false);
00089 }
00090 }
00091 else
00092 {
00093 m_View->m_Controls.m_StatusLabel->hide();
00094 bool foundFixedImage = false;
00095 mitk::DataNode::Pointer fixedNode;
00096
00097 for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin();
00098 i != m_View->m_CurrentSelection->End(); ++i)
00099 {
00100
00101 if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
00102 {
00103 mitk::DataNode::Pointer node = nodeObj->GetDataNode();
00104
00105 if(QString("Image").compare(node->GetData()->GetNameOfClass())==0)
00106 {
00107 if (dynamic_cast<mitk::Image*>(node->GetData())->GetDimension() == 4)
00108 {
00109 m_View->m_Controls.m_StatusLabel->show();
00110 QMessageBox::information( NULL, "DeformableRegistration", "Only 2D or 3D images can be processed.", QMessageBox::Ok );
00111 return;
00112 }
00113 if (foundFixedImage == false)
00114 {
00115 fixedNode = node;
00116 foundFixedImage = true;
00117 }
00118 else
00119 {
00120 m_View->SetImagesVisible(selection);
00121 m_View->FixedSelected(fixedNode);
00122 m_View->MovingSelected(node);
00123 m_View->m_Controls.m_StatusLabel->hide();
00124 m_View->m_Controls.TextLabelFixed->show();
00125 m_View->m_Controls.m_SwitchImages->show();
00126 m_View->m_Controls.m_FixedLabel->show();
00127 m_View->m_Controls.TextLabelMoving->show();
00128 m_View->m_Controls.m_MovingLabel->show();
00129 m_View->m_Controls.m_OpacityLabel->setEnabled(true);
00130 m_View->m_Controls.m_OpacitySlider->setEnabled(true);
00131 m_View->m_Controls.label->setEnabled(true);
00132 m_View->m_Controls.label_2->setEnabled(true);
00133 m_View->m_Controls.m_ShowRedGreenValues->setEnabled(true);
00134 }
00135 }
00136 else
00137 {
00138 m_View->m_Controls.m_StatusLabel->show();
00139 return;
00140 }
00141 }
00142 }
00143 }
00144 }
00145 else if (m_View->m_FixedNode.IsNull() || m_View->m_MovingNode.IsNull())
00146 {
00147 m_View->m_Controls.m_StatusLabel->show();
00148 }
00149 }
00150
00151 void SelectionChanged(IWorkbenchPart::Pointer part, ISelection::ConstPointer selection)
00152 {
00153
00154 if (part)
00155 {
00156 QString partname(part->GetPartName().c_str());
00157 if(partname.compare("Datamanager")==0)
00158 {
00159
00160 DoSelectionChanged(selection);
00161 }
00162 }
00163 }
00164
00165 QmitkDeformableRegistrationView* m_View;
00166 };
00167
00168 QmitkDeformableRegistrationView::QmitkDeformableRegistrationView(QObject * , const char * )
00169 : QmitkFunctionality() , m_MultiWidget(NULL), m_MovingNode(NULL), m_FixedNode(NULL), m_ShowRedGreen(false),
00170 m_Opacity(0.5), m_OriginalOpacity(1.0), m_Deactivated(false)
00171 {
00172 this->GetDataStorage()->RemoveNodeEvent.AddListener(mitk::MessageDelegate1<QmitkDeformableRegistrationView,
00173 const mitk::DataNode*> ( this, &QmitkDeformableRegistrationView::DataNodeHasBeenRemoved ));
00174 }
00175
00176 QmitkDeformableRegistrationView::~QmitkDeformableRegistrationView()
00177 {
00178 if (m_SelListener.IsNotNull())
00179 {
00180 berry::ISelectionService* s = GetSite()->GetWorkbenchWindow()->GetSelectionService();
00181 if(s)
00182 s->RemovePostSelectionListener(m_SelListener);
00183 m_SelListener = NULL;
00184 }
00185 }
00186
00187 void QmitkDeformableRegistrationView::CreateQtPartControl(QWidget* parent)
00188 {
00189 m_Controls.setupUi(parent);
00190 m_Parent->setEnabled(false);
00191 this->CreateConnections();
00192 m_Controls.TextLabelFixed->hide();
00193 m_Controls.m_SwitchImages->hide();
00194 m_Controls.m_FixedLabel->hide();
00195 m_Controls.TextLabelMoving->hide();
00196 m_Controls.m_MovingLabel->hide();
00197 m_Controls.m_OpacityLabel->setEnabled(false);
00198 m_Controls.m_OpacitySlider->setEnabled(false);
00199 m_Controls.label->setEnabled(false);
00200 m_Controls.label_2->setEnabled(false);
00201 m_Controls.m_ShowRedGreenValues->setEnabled(false);
00202 m_Controls.m_DeformableTransform->hide();
00203 if (m_Controls.m_DeformableTransform->currentIndex() == 0)
00204 {
00205 m_Controls.m_QmitkDemonsRegistrationViewControls->show();
00206 m_Controls.m_QmitkBSplineRegistrationViewControls->hide();
00207 }
00208 else
00209 {
00210 m_Controls.m_QmitkDemonsRegistrationViewControls->hide();
00211 m_Controls.m_QmitkBSplineRegistrationViewControls->show();
00212 }
00213 this->CheckCalculateEnabled();
00214 }
00215
00216 void QmitkDeformableRegistrationView::DataNodeHasBeenRemoved(const mitk::DataNode* node)
00217 {
00218 if(node == m_FixedNode || node == m_MovingNode)
00219 {
00220 m_Controls.m_StatusLabel->show();
00221 m_Controls.TextLabelFixed->hide();
00222 m_Controls.m_SwitchImages->hide();
00223 m_Controls.m_FixedLabel->hide();
00224 m_Controls.TextLabelMoving->hide();
00225 m_Controls.m_MovingLabel->hide();
00226 m_Controls.m_OpacityLabel->setEnabled(false);
00227 m_Controls.m_OpacitySlider->setEnabled(false);
00228 m_Controls.label->setEnabled(false);
00229 m_Controls.label_2->setEnabled(false);
00230 m_Controls.m_ShowRedGreenValues->setEnabled(false);
00231 m_Controls.m_DeformableTransform->hide();
00232 m_Controls.m_CalculateTransformation->setEnabled(false);
00233 }
00234
00235 }
00236
00237
00238 void QmitkDeformableRegistrationView::ApplyDeformationField()
00239 {
00240
00241 ImageReaderType::Pointer reader = ImageReaderType::New();
00242 reader->SetFileName( m_Controls.m_QmitkBSplineRegistrationViewControls->m_Controls.m_DeformationField->text().toStdString() );
00243 reader->Update();
00244
00245 DeformationFieldType::Pointer deformationField = reader->GetOutput();
00246
00247 mitk::Image * mimage = dynamic_cast<mitk::Image*> (m_MovingNode->GetData());
00248 mitk::Image * fimage = dynamic_cast<mitk::Image*> (m_FixedNode->GetData());
00249
00250 typedef itk::Image<float, 3> FloatImageType;
00251
00252 FloatImageType::Pointer itkMovingImage = FloatImageType::New();
00253 FloatImageType::Pointer itkFixedImage = FloatImageType::New();
00254 mitk::CastToItkImage(mimage, itkMovingImage);
00255 mitk::CastToItkImage(fimage, itkFixedImage);
00256
00257 typedef itk::WarpImageFilter<
00258 FloatImageType,
00259 FloatImageType,
00260 DeformationFieldType > WarperType;
00261
00262 typedef itk::LinearInterpolateImageFunction<
00263 FloatImageType,
00264 double > InterpolatorType;
00265
00266 WarperType::Pointer warper = WarperType::New();
00267 InterpolatorType::Pointer interpolator = InterpolatorType::New();
00268
00269 warper->SetInput( itkMovingImage );
00270 warper->SetInterpolator( interpolator );
00271 warper->SetOutputSpacing( itkFixedImage->GetSpacing() );
00272 warper->SetOutputOrigin( itkFixedImage->GetOrigin() );
00273 warper->SetOutputDirection (itkFixedImage->GetDirection() );
00274 warper->SetDeformationField( deformationField );
00275 warper->Update();
00276
00277 FloatImageType::Pointer outputImage = warper->GetOutput();
00278 mitk::Image::Pointer result = mitk::Image::New();
00279
00280 mitk::CastToMitkImage(outputImage, result);
00281
00282
00283 mitk::DataNode::Pointer newNode = mitk::DataNode::New();
00284 newNode->SetData( result );
00285 newNode->SetProperty( "name", mitk::StringProperty::New("warped image") );
00286
00287
00288 this->GetDefaultDataStorage()->Add(newNode);
00289 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
00290
00291
00292
00293
00294
00295 }
00296
00297 void QmitkDeformableRegistrationView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
00298 {
00299 m_Parent->setEnabled(true);
00300 m_MultiWidget = &stdMultiWidget;
00301 m_MultiWidget->SetWidgetPlanesVisibility(true);
00302 }
00303
00304 void QmitkDeformableRegistrationView::StdMultiWidgetNotAvailable()
00305 {
00306 m_Parent->setEnabled(false);
00307 m_MultiWidget = NULL;
00308 }
00309
00310 void QmitkDeformableRegistrationView::CreateConnections()
00311 {
00312 connect(m_Controls.m_ShowRedGreenValues, SIGNAL(toggled(bool)), this, SLOT(ShowRedGreen(bool)));
00313 connect(m_Controls.m_DeformableTransform, SIGNAL(currentChanged(int)), this, SLOT(TabChanged(int)));
00314 connect(m_Controls.m_OpacitySlider, SIGNAL(sliderMoved(int)), this, SLOT(OpacityUpdate(int)));
00315 connect(m_Controls.m_CalculateTransformation, SIGNAL(clicked()), this, SLOT(Calculate()));
00316 connect((QObject*)(m_Controls.m_SwitchImages),SIGNAL(clicked()),this,SLOT(SwitchImages()));
00317 connect(this,SIGNAL(calculateBSplineRegistration()),m_Controls.m_QmitkBSplineRegistrationViewControls,SLOT(CalculateTransformation()));
00318 connect( (QObject*)(m_Controls.m_QmitkBSplineRegistrationViewControls->m_Controls.m_ApplyDeformationField),
00319 SIGNAL(clicked()),
00320 (QObject*) this,
00321 SLOT(ApplyDeformationField()) );
00322 }
00323
00324 void QmitkDeformableRegistrationView::Activated()
00325 {
00326 m_Deactivated = false;
00327 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
00328 QmitkFunctionality::Activated();
00329 if (m_SelListener.IsNull())
00330 {
00331 m_SelListener = berry::ISelectionListener::Pointer(new SelListenerDeformableRegistration(this));
00332 this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener( m_SelListener);
00333 berry::ISelection::ConstPointer sel(
00334 this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
00335 m_CurrentSelection = sel.Cast<const IStructuredSelection>();
00336 m_SelListener.Cast<SelListenerDeformableRegistration>()->DoSelectionChanged(sel);
00337 }
00338 this->OpacityUpdate(m_Controls.m_OpacitySlider->value());
00339 this->ShowRedGreen(m_Controls.m_ShowRedGreenValues->isChecked());
00340 }
00341
00342 void QmitkDeformableRegistrationView::Visible()
00343 {
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359 }
00360
00361 void QmitkDeformableRegistrationView::Deactivated()
00362 {
00363 m_Deactivated = true;
00364 this->SetImageColor(false);
00365 if (m_FixedNode.IsNotNull())
00366 m_FixedNode->SetOpacity(1.0);
00367 if (m_MovingNode.IsNotNull())
00368 {
00369 m_MovingNode->SetOpacity(m_OriginalOpacity);
00370 }
00371 m_FixedNode = NULL;
00372 m_MovingNode = NULL;
00373 berry::ISelectionService* s = GetSite()->GetWorkbenchWindow()->GetSelectionService();
00374 if(s)
00375 s->RemovePostSelectionListener(m_SelListener);
00376 m_SelListener = NULL;
00377 }
00378
00379 void QmitkDeformableRegistrationView::Hidden()
00380 {
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396 }
00397
00398 void QmitkDeformableRegistrationView::FixedSelected(mitk::DataNode::Pointer fixedImage)
00399 {
00400 if (fixedImage.IsNotNull())
00401 {
00402 if (m_FixedNode != fixedImage)
00403 {
00404
00405 if (m_FixedNode.IsNotNull())
00406 {
00407 this->SetImageColor(false);
00408 m_FixedNode->SetOpacity(1.0);
00409 m_FixedNode->SetVisibility(false);
00410 m_FixedNode->SetProperty("selectedFixedImage", mitk::BoolProperty::New(false));
00411 }
00412
00413 m_FixedNode = fixedImage;
00414 m_FixedNode->SetOpacity(0.5);
00415 m_Controls.TextLabelFixed->setText(QString::fromStdString(m_FixedNode->GetName()));
00416 m_Controls.m_FixedLabel->show();
00417 m_Controls.TextLabelFixed->show();
00418 m_Controls.m_SwitchImages->show();
00419 mitk::ColorProperty::Pointer colorProperty;
00420 colorProperty = dynamic_cast<mitk::ColorProperty*>(m_FixedNode->GetProperty("color"));
00421 if ( colorProperty.IsNotNull() )
00422 {
00423 m_FixedColor = colorProperty->GetColor();
00424 }
00425 this->SetImageColor(m_ShowRedGreen);
00426 m_FixedNode->SetVisibility(true);
00427 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
00428 }
00429 }
00430 else
00431 {
00432 m_FixedNode = fixedImage;
00433 m_Controls.m_FixedLabel->hide();
00434 m_Controls.TextLabelFixed->hide();
00435 m_Controls.m_SwitchImages->hide();
00436 }
00437 this->CheckCalculateEnabled();
00438 }
00439
00440 void QmitkDeformableRegistrationView::MovingSelected(mitk::DataNode::Pointer movingImage)
00441 {
00442 if (movingImage.IsNotNull())
00443 {
00444 if (m_MovingNode != movingImage)
00445 {
00446 if (m_MovingNode.IsNotNull())
00447 {
00448 m_MovingNode->SetOpacity(m_OriginalOpacity);
00449 if (m_FixedNode == m_MovingNode)
00450 m_FixedNode->SetOpacity(0.5);
00451 this->SetImageColor(false);
00452 }
00453 m_MovingNode = movingImage;
00454 m_Controls.TextLabelMoving->setText(QString::fromStdString(m_MovingNode->GetName()));
00455 m_Controls.m_MovingLabel->show();
00456 m_Controls.TextLabelMoving->show();
00457 mitk::ColorProperty::Pointer colorProperty;
00458 colorProperty = dynamic_cast<mitk::ColorProperty*>(m_MovingNode->GetProperty("color"));
00459 if ( colorProperty.IsNotNull() )
00460 {
00461 m_MovingColor = colorProperty->GetColor();
00462 }
00463 this->SetImageColor(m_ShowRedGreen);
00464 m_MovingNode->GetFloatProperty("opacity", m_OriginalOpacity);
00465 this->OpacityUpdate(m_Opacity);
00466 m_MovingNode->SetVisibility(true);
00467 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
00468 }
00469 }
00470 else
00471 {
00472 m_MovingNode = NULL;
00473 m_Controls.m_MovingLabel->hide();
00474 m_Controls.TextLabelMoving->hide();
00475 }
00476 this->CheckCalculateEnabled();
00477 }
00478
00479 bool QmitkDeformableRegistrationView::CheckCalculate()
00480 {
00481 if(m_MovingNode==m_FixedNode)
00482 return false;
00483 return true;
00484 }
00485
00486 void QmitkDeformableRegistrationView::ShowRedGreen(bool redGreen)
00487 {
00488 m_ShowRedGreen = redGreen;
00489 this->SetImageColor(m_ShowRedGreen);
00490 }
00491
00492 void QmitkDeformableRegistrationView::SetImageColor(bool redGreen)
00493 {
00494 if (!redGreen && m_FixedNode.IsNotNull())
00495 {
00496 m_FixedNode->SetColor(m_FixedColor);
00497 }
00498 if (!redGreen && m_MovingNode.IsNotNull())
00499 {
00500 m_MovingNode->SetColor(m_MovingColor);
00501 }
00502 if (redGreen && m_FixedNode.IsNotNull())
00503 {
00504 m_FixedNode->SetColor(1.0f, 0.0f, 0.0f);
00505 }
00506 if (redGreen && m_MovingNode.IsNotNull())
00507 {
00508 m_MovingNode->SetColor(0.0f, 1.0f, 0.0f);
00509 }
00510 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
00511 }
00512
00513 void QmitkDeformableRegistrationView::OpacityUpdate(float opacity)
00514 {
00515 m_Opacity = opacity;
00516 if (m_MovingNode.IsNotNull())
00517 {
00518 m_MovingNode->SetOpacity(m_Opacity);
00519 }
00520 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
00521 }
00522
00523 void QmitkDeformableRegistrationView::OpacityUpdate(int opacity)
00524 {
00525 float fValue = ((float)opacity)/100.0f;
00526 this->OpacityUpdate(fValue);
00527 }
00528
00529 void QmitkDeformableRegistrationView::CheckCalculateEnabled()
00530 {
00531 if (m_FixedNode.IsNotNull() && m_MovingNode.IsNotNull())
00532 {
00533 m_Controls.m_CalculateTransformation->setEnabled(true);
00534 }
00535 else
00536 {
00537 m_Controls.m_CalculateTransformation->setEnabled(false);
00538 }
00539 }
00540
00541 void QmitkDeformableRegistrationView::Calculate()
00542 {
00543 if (m_Controls.m_DeformableTransform->tabText(m_Controls.m_DeformableTransform->currentIndex()) == "Demons")
00544 {
00545 m_Controls.m_QmitkDemonsRegistrationViewControls->SetFixedNode(m_FixedNode);
00546 m_Controls.m_QmitkDemonsRegistrationViewControls->SetMovingNode(m_MovingNode);
00547 try
00548 {
00549 m_Controls.m_QmitkDemonsRegistrationViewControls->CalculateTransformation();
00550 }
00551 catch (itk::ExceptionObject& excpt)
00552 {
00553 QMessageBox::information( NULL, "Registration exception", excpt.GetDescription(), QMessageBox::Ok );
00554 return;
00555 }
00556 mitk::Image::Pointer resultImage = m_Controls.m_QmitkDemonsRegistrationViewControls->GetResultImage();
00557 mitk::Image::Pointer resultDeformationField = m_Controls.m_QmitkDemonsRegistrationViewControls->GetResultDeformationfield();
00558 if (resultImage.IsNotNull())
00559 {
00560 mitk::DataNode::Pointer resultImageNode = mitk::DataNode::New();
00561 resultImageNode->SetData(resultImage);
00562 mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
00563 mitk::LevelWindow levelWindow;
00564 levelWindow.SetAuto( resultImage );
00565 levWinProp->SetLevelWindow(levelWindow);
00566 resultImageNode->GetPropertyList()->SetProperty("levelwindow",levWinProp);
00567 resultImageNode->SetStringProperty("name", "DeformableRegistrationResultImage");
00568 this->GetDataStorage()->Add(resultImageNode, m_MovingNode);
00569 }
00570 if (resultDeformationField.IsNotNull())
00571 {
00572 mitk::DataNode::Pointer resultDeformationFieldNode = mitk::DataNode::New();
00573 resultDeformationFieldNode->SetData(resultDeformationField);
00574 mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
00575 mitk::LevelWindow levelWindow;
00576 levelWindow.SetAuto( resultDeformationField );
00577 levWinProp->SetLevelWindow(levelWindow);
00578 resultDeformationFieldNode->GetPropertyList()->SetProperty("levelwindow",levWinProp);
00579 resultDeformationFieldNode->SetStringProperty("name", "DeformableRegistrationResultDeformationField");
00580 mitk::VectorImageMapper2D::Pointer mapper = mitk::VectorImageMapper2D::New();
00581 resultDeformationFieldNode->SetMapper(1, mapper);
00582 resultDeformationFieldNode->SetVisibility(false);
00583 this->GetDataStorage()->Add(resultDeformationFieldNode, m_MovingNode);
00584 }
00585 }
00586
00587 else if (m_Controls.m_DeformableTransform->tabText(m_Controls.m_DeformableTransform->currentIndex()) == "B-Spline")
00588 {
00589 m_Controls.m_QmitkBSplineRegistrationViewControls->SetFixedNode(m_FixedNode);
00590 m_Controls.m_QmitkBSplineRegistrationViewControls->SetMovingNode(m_MovingNode);
00591 emit calculateBSplineRegistration();
00592 }
00593 }
00594
00595 void QmitkDeformableRegistrationView::SetImagesVisible(berry::ISelection::ConstPointer )
00596 {
00597 if (this->m_CurrentSelection->Size() == 0)
00598 {
00599
00600 mitk::DataStorage::SetOfObjects::ConstPointer setOfObjects = this->GetDataStorage()->GetAll();
00601 for (mitk::DataStorage::SetOfObjects::ConstIterator nodeIt = setOfObjects->Begin()
00602 ; nodeIt != setOfObjects->End(); ++nodeIt)
00603 {
00604 if ( (nodeIt->Value().IsNotNull()) && (nodeIt->Value()->GetProperty("visible")) && dynamic_cast<mitk::Geometry2DData*>(nodeIt->Value()->GetData())==NULL)
00605 {
00606 nodeIt->Value()->SetVisibility(true);
00607 }
00608 }
00609 }
00610 else
00611 {
00612
00613 mitk::DataStorage::SetOfObjects::ConstPointer setOfObjects = this->GetDataStorage()->GetAll();
00614 for (mitk::DataStorage::SetOfObjects::ConstIterator nodeIt = setOfObjects->Begin()
00615 ; nodeIt != setOfObjects->End(); ++nodeIt)
00616 {
00617 if ( (nodeIt->Value().IsNotNull()) && (nodeIt->Value()->GetProperty("visible")) && dynamic_cast<mitk::Geometry2DData*>(nodeIt->Value()->GetData())==NULL)
00618 {
00619 nodeIt->Value()->SetVisibility(false);
00620 }
00621 }
00622 }
00623 }
00624
00625 void QmitkDeformableRegistrationView::TabChanged(int index)
00626 {
00627 if (index == 0)
00628 {
00629 m_Controls.m_QmitkDemonsRegistrationViewControls->show();
00630 m_Controls.m_QmitkBSplineRegistrationViewControls->hide();
00631 }
00632 else
00633 {
00634 m_Controls.m_QmitkDemonsRegistrationViewControls->hide();
00635 m_Controls.m_QmitkBSplineRegistrationViewControls->show();
00636 }
00637 }
00638
00639 void QmitkDeformableRegistrationView::SwitchImages()
00640 {
00641 mitk::DataNode::Pointer newMoving = m_FixedNode;
00642 mitk::DataNode::Pointer newFixed = m_MovingNode;
00643 this->FixedSelected(newFixed);
00644 this->MovingSelected(newMoving);
00645 }