00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 11450 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 // #include "QmitkPointBasedRegistrationView.h" // includes mitkConfig, where BUILD_TESTING is defined 00019 // #include "ui_QmitkPointBasedRegistrationViewControls.h" 00020 // 00021 // #ifdef BUILD_TESTING // only if we build a test driver 00022 // 00023 // #include "QmitkStdMultiWidget.h" 00024 // #include "QmitkSelectableGLWidget.h" 00025 // #include "QmitkUserInputSimulation.h" 00026 // #include "QmitkMessageBoxHelper.h" 00027 // #include "QmitkTreeNodeSelector.h" 00028 // #include <QmitkStdMultiWidget.h> 00029 // #include "QmitkCommonFunctionality.h" 00030 // #include "qradiobutton.h" 00031 // #include "qpushbutton.h" 00032 // #include "qslider.h" 00033 // #include "qcheckbox.h" 00034 // #include "qlistbox.h" 00035 // #include <qcombobox.h> 00036 // #include <qapplication.h> 00037 // #include "QmitkMessageBoxHelper.h" 00038 // #include "QmitkPointListWidget.h" 00039 // 00040 // #include <mitkInteractionConst.h> 00041 // #include <mitkPositionEvent.h> 00042 // 00043 // #include <ctime> 00044 // 00045 // 00046 // int QmitkPointBasedRegistration::TestYourself() 00047 // { 00048 // m_MessageBox = false; 00049 // 00050 // std::cout << std::endl; 00051 // time_t randomInit = std::time(0); 00052 // //randomInit = 1200058324; 00053 // std::cout << "Initializing random number generator with " << randomInit << std::endl; 00054 // std::srand(randomInit); 00055 // 00056 // if (m_Controls->m_FixedSelector->GetSelectedNode() == NULL) 00057 // { 00058 // std::cout << "No Fixed Image available! Won't apply test (l. " << __LINE__ << ")" << std::endl; 00059 // return EXIT_SUCCESS; 00060 // } 00061 // mitk::DataNode::Pointer node = NULL; 00062 // if (m_Controls->m_MovingSelector->GetSelectedNode() == NULL) 00063 // { 00064 // node = mitk::DataNode::New(); 00065 // //Create Image out of nowhere 00066 // mitk::Image::Pointer image; 00067 // m_Controls->m_FixedSelector->GetSelectedNode()->GetData(); 00068 // mitk::PixelType pt(typeid(int)); 00069 // unsigned int dim[]={100,100,20}; 00070 // 00071 // std::cout << "Creating image: "; 00072 // image = mitk::Image::New(); 00073 // image->Initialize(mitk::PixelType(typeid(int)), 3, dim); 00074 // int *p = (int*)image->GetData(); 00075 // 00076 // int size = dim[0]*dim[1]*dim[2]; 00077 // int i; 00078 // for(i=0; i<size; ++i, ++p) 00079 // { 00080 // *p=i; 00081 // } 00082 // node->SetData(image); 00083 // node->SetProperty("name", mitk::StringProperty::New("new created node for PointBasedRegistrationTest")); 00084 // mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New(); 00085 // mitk::LevelWindow levelWindow; 00086 // levelWindow.SetAuto( image ); 00087 // levWinProp->SetLevelWindow(levelWindow); 00088 // node->GetPropertyList()->SetProperty("levelwindow",levWinProp); 00089 // mitk::DataTreeIteratorClone it; 00090 // it = *m_Controls->m_FixedSelector->GetSelectedIterator(); 00091 // it->GoToParent(); 00092 // it->Add(node); 00093 // std::cout<<"[PASSED]"<<std::endl; 00094 // } 00095 // 00096 // if (m_Controls->m_MovingSelector->GetSelectedNode() == NULL) 00097 // { 00098 // std::cerr << "No Moving Image available! Won't apply test (l. " << __LINE__ << ")" << std::endl; 00099 // return EXIT_FAILURE; 00100 // } 00101 // 00102 // // test Show Images Red/Green 00103 // std::cout << "Test show images red/green:" << std::endl; 00104 // QmitkUserInputSimulation::MouseClick( m_Controls->m_ShowRedGreenValues, Qt::LeftButton ); 00105 // m_Controls->m_ShowRedGreenValues->setChecked(true); 00106 // std::cout << " [PASSED]" << std::endl; 00107 // 00108 // // test for Select model 00109 // QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_SetPoints, Qt::LeftButton ); 00110 // if (!m_Controls->m_FixedPointListWidget->m_SetPoints->isOn()) 00111 // { 00112 // std::cerr << "Select Fixed Image was not toggled (l. " << __LINE__ << ")" << std::endl; 00113 // return EXIT_FAILURE; 00114 // } 00115 // if (m_Controls->m_MovingPointListWidget->m_SetPoints->isOn()) 00116 // { 00117 // std::cerr << "Select Moving Image was toggled (l. " << __LINE__ << ")" << std::endl; 00118 // return EXIT_FAILURE; 00119 // } 00120 // 00121 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); 00122 // if (!m_Controls->m_MovingPointListWidget->m_SetPoints->isOn()) 00123 // { 00124 // std::cerr << "Select Moving Image was not toggled (l. " << __LINE__ << ")" << std::endl; 00125 // return EXIT_FAILURE; 00126 // } 00127 // if (m_Controls->m_FixedPointListWidget->m_SetPoints->isOn()) 00128 // { 00129 // std::cerr << "Select Fixed Image was toggled (l. " << __LINE__ << ")" << std::endl; 00130 // return EXIT_FAILURE; 00131 // } 00132 // 00133 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); 00134 // if (m_Controls->m_MovingPointListWidget->m_SetPoints->isOn()) 00135 // { 00136 // std::cerr << "Select Moving Image was toggled (l. " << __LINE__ << ")" << std::endl; 00137 // return EXIT_FAILURE; 00138 // } 00139 // if (m_Controls->m_FixedPointListWidget->m_SetPoints->isOn()) 00140 // { 00141 // std::cerr << "Select Fixed Image was toggled (l. " << __LINE__ << ")" << std::endl; 00142 // return EXIT_FAILURE; 00143 // } 00144 // 00145 // // test for undobutton at start 00146 // if (m_Controls->m_UndoTransformation->isEnabled()) 00147 // { 00148 // std::cerr << "Undo Transformation was enabled but there was no transformation before (l. " << __LINE__ << ")" << std::endl; 00149 // return EXIT_FAILURE; 00150 // } 00151 // 00152 // // test for redobutton at start 00153 // if (m_Controls->m_RedoTransformation->isEnabled()) 00154 // { 00155 // std::cerr << "Redo Transformation was enabled but there was no transformation before (l. " << __LINE__ << ")" << std::endl; 00156 // return EXIT_FAILURE; 00157 // } 00158 // 00159 // // test reinit buttons 00160 // std::cout << "Test reinit buttons:" << std::endl; 00161 // QmitkUserInputSimulation::MouseClick( m_Controls->m_ReinitFixedButton, Qt::LeftButton ); 00162 // QmitkUserInputSimulation::MouseClick( m_Controls->m_ReinitMovingButton, Qt::LeftButton ); 00163 // m_Controls->globalReinitClicked(); 00164 // std::cout << " [PASSED]" << std::endl; 00165 // 00166 // // test opacity slider 00167 // std::cout << "Test opacity slider:" << std::endl; 00168 // m_Controls->m_OpacitySlider->setValue(m_Controls->m_OpacitySlider->minValue()); 00169 // m_Controls->m_OpacitySlider->setValue(m_Controls->m_OpacitySlider->maxValue()); 00170 // std::cout << " [PASSED]" << std::endl; 00171 // 00172 // bool testOK = this->TestAllTools(); 00173 // 00174 // // clean up 00175 // if (m_FixedPointSetNode.IsNotNull()) 00176 // { 00177 // this->GetDefaultDataStorage()->Remove(m_FixedPointSetNode); 00178 // m_FixedPointSetNode = NULL; 00179 // } 00180 // if (m_MovingPointSetNode) 00181 // if (node.IsNotNull()) 00182 // { 00183 // this->GetDefaultDataStorage()->Remove(m_MovingPointSetNode); 00184 // m_MovingPointSetNode = NULL; 00185 // } 00186 // 00187 // // recenter all remaining datatreenodes 00188 // m_Controls->globalReinitClicked(); 00189 // 00190 // if (testOK) 00191 // { 00192 // std::cout << "Whole functionality testing [PASSED]" << std::endl; 00193 // return EXIT_SUCCESS; 00194 // } 00195 // else 00196 // { 00197 // std::cout << "Whole functionality testing [FAILED]" << std::endl; 00198 // return EXIT_FAILURE; 00199 // } 00200 // } 00201 // 00202 // bool QmitkPointBasedRegistration::TestAllTools() 00203 // { 00204 // QWidget* sliceWidget; 00205 // m_MultiWidget->changeLayoutToDefault(); 00206 // 00207 // std::cout << "Creating landmarks:" << std::endl; 00208 // QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_SetPoints, Qt::LeftButton ); 00209 // 00210 // for (unsigned int window = 1; window < 4; ++window) 00211 // { 00212 // switch (window) 00213 // { 00214 // case 1: 00215 // sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget 00216 // break; 00217 // case 2: 00218 // sliceWidget = m_MultiWidget->mitkWidget2; 00219 // break; 00220 // case 3: 00221 // default: 00222 // sliceWidget = m_MultiWidget->mitkWidget3; 00223 // break; 00224 // } 00225 // float w = (float)sliceWidget->width()-10; 00226 // float h = (float)sliceWidget->height()-10; 00227 // for (unsigned int i = 0; i < 5; ++i ) 00228 // { 00229 // double r; 00230 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00231 // float x = r * w; 00232 // 00233 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00234 // float y = r * h; 00235 // 00236 // QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); 00237 // QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); 00238 // } 00239 // } 00240 // 00241 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); 00242 // 00243 // for (unsigned int window = 1; window < 4; ++window) 00244 // { 00245 // switch (window) 00246 // { 00247 // case 1: 00248 // sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget 00249 // break; 00250 // case 2: 00251 // sliceWidget = m_MultiWidget->mitkWidget2; 00252 // break; 00253 // case 3: 00254 // default: 00255 // sliceWidget = m_MultiWidget->mitkWidget3; 00256 // break; 00257 // } 00258 // float w = (float)sliceWidget->width(); 00259 // float h = (float)sliceWidget->height(); 00260 // for (unsigned int i = 0; i < 5; ++i ) 00261 // { 00262 // double r; 00263 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00264 // float x = r * w; 00265 // 00266 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00267 // float y = r * h; 00268 // QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); 00269 // QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); 00270 // } 00271 // } 00272 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); 00273 // std::cout << " [PASSED]" << std::endl; 00274 // 00275 // /////// test for deleting points from fixed point list 00276 // std::cout << "Delete Landmarks out of order:" << std::endl; 00277 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(4, true); 00278 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_FixedPointListWidget->InteractivePointList, Qt::Key_Return ); 00279 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00280 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(8,true); 00281 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00282 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(13,true); 00283 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00284 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(0,true); 00285 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00286 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(7,true); 00287 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00288 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(7,true); 00289 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00290 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(3,true); 00291 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00292 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(4,true); 00293 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00294 // for (int i = 0; i < 7; i++) 00295 // { 00296 // m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(0,true); 00297 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00298 // } 00299 // /////// test for deleting points from moving point list 00300 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(0,true); 00301 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_MovingPointListWidget->InteractivePointList, Qt::Key_Return ); 00302 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00303 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(14,true); 00304 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00305 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(11,true); 00306 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00307 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(8,true); 00308 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00309 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(6,true); 00310 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00311 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(2,true); 00312 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00313 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(2,true); 00314 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00315 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(2,true); 00316 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00317 // for (int i = 0; i < 7; i++) 00318 // { 00319 // m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(0,true); 00320 // QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); 00321 // } 00322 // std::cout << " [PASSED]" << std::endl; 00323 // 00324 // ////// create new points 00325 // std::cout << "Create new landmarks:" << std::endl; 00326 // std::cout << "Creating landmarks:" << std::endl; 00327 // QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_SetPoints, Qt::LeftButton ); 00328 // 00329 // for (unsigned int window = 1; window < 4; ++window) 00330 // { 00331 // switch (window) 00332 // { 00333 // case 1: 00334 // sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget 00335 // break; 00336 // case 2: 00337 // sliceWidget = m_MultiWidget->mitkWidget2; 00338 // break; 00339 // case 3: 00340 // default: 00341 // sliceWidget = m_MultiWidget->mitkWidget3; 00342 // break; 00343 // } 00344 // float w = (float)sliceWidget->width()-10; 00345 // float h = (float)sliceWidget->height()-10; 00346 // for (unsigned int i = 0; i < 5; ++i ) 00347 // { 00348 // double r; 00349 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00350 // float x = r * w; 00351 // 00352 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00353 // float y = r * h; 00354 // 00355 // QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); 00356 // QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); 00357 // } 00358 // } 00359 // 00360 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); 00361 // 00362 // for (unsigned int window = 1; window < 4; ++window) 00363 // { 00364 // switch (window) 00365 // { 00366 // case 1: 00367 // sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget 00368 // break; 00369 // case 2: 00370 // sliceWidget = m_MultiWidget->mitkWidget2; 00371 // break; 00372 // case 3: 00373 // default: 00374 // sliceWidget = m_MultiWidget->mitkWidget3; 00375 // break; 00376 // } 00377 // float w = (float)sliceWidget->width(); 00378 // float h = (float)sliceWidget->height(); 00379 // for (unsigned int i = 0; i < 5; ++i ) 00380 // { 00381 // double r; 00382 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00383 // float x = r * w; 00384 // 00385 // r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); 00386 // float y = r * h; 00387 // QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); 00388 // QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); 00389 // } 00390 // } 00391 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); 00392 // std::cout << " [PASSED]" << std::endl; 00393 // 00394 // //// Rigid with ICP 00395 // // a helper object to close popping up message boxes 00396 // QmitkMessageBoxHelper* helper1 = new QmitkMessageBoxHelper(m_Controls); 00397 // connect( helper1, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); 00398 // helper1->WaitForDialogAndCallback( "QMessageBox" ); 00399 // if (m_Controls->m_Calculate->isEnabled()) 00400 // { 00401 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00402 // std::cout << "Rigid with ICP [PASSED]" << std::endl; 00403 // } 00404 // else 00405 // { 00406 // std::cout << "Rigid with ICP [FAILED]" << std::endl; 00407 // helper1->StopWaitForDialogAndCallback(); 00408 // return false; 00409 // } 00410 // helper1->StopWaitForDialogAndCallback(); 00411 // if (!m_MessageBox) 00412 // { 00413 // if (m_Controls->m_UndoTransformation->isEnabled()) 00414 // { 00415 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00416 // std::cout << "Undo [PASSED]" << std::endl; 00417 // } 00418 // else 00419 // { 00420 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00421 // return false; 00422 // } 00423 // if (m_Controls->m_UndoTransformation->isEnabled()) 00424 // { 00425 // std::cout << "Undo was enabled [FAILED]" << std::endl; 00426 // return false; 00427 // } 00428 // if (m_Controls->m_RedoTransformation->isEnabled()) 00429 // { 00430 // QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); 00431 // std::cout << "Redo [PASSED]" << std::endl; 00432 // } 00433 // else 00434 // { 00435 // std::cout << "Redo was not enabled [FAILED]" << std::endl; 00436 // return false; 00437 // } 00438 // if (m_Controls->m_RedoTransformation->isEnabled()) 00439 // { 00440 // std::cout << "Redo was enabled [FAILED]" << std::endl; 00441 // return false; 00442 // } 00443 // if (m_Controls->m_UndoTransformation->isEnabled()) 00444 // { 00445 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00446 // std::cout << "Undo [PASSED]" << std::endl; 00447 // } 00448 // else 00449 // { 00450 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00451 // return false; 00452 // } 00453 // if (m_Controls->m_UndoTransformation->isEnabled()) 00454 // { 00455 // std::cout << "Undo was enabled [FAILED]" << std::endl; 00456 // return false; 00457 // } 00458 // } 00459 // m_MessageBox = false; 00460 // 00461 // 00462 // //// Similarity with ICP 00463 // QmitkMessageBoxHelper* helper2 = new QmitkMessageBoxHelper(m_Controls); 00464 // connect( helper2, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); 00465 // helper2->WaitForDialogAndCallback( "QMessageBox" ); 00466 // m_Controls->m_SelectedTransformationClass->setFocus(); 00467 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); 00468 // if (m_Controls->m_Calculate->isEnabled()) 00469 // { 00470 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00471 // std::cout << "Similarity with ICP [PASSED]" << std::endl; 00472 // } 00473 // else 00474 // { 00475 // std::cout << "Similarity with ICP [FAILED]" << std::endl; 00476 // helper2->StopWaitForDialogAndCallback(); 00477 // return false; 00478 // } 00479 // helper2->StopWaitForDialogAndCallback(); 00480 // if(!m_MessageBox) 00481 // { 00482 // if (m_Controls->m_UndoTransformation->isEnabled()) 00483 // { 00484 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00485 // std::cout << "Undo [PASSED]" << std::endl; 00486 // } 00487 // else 00488 // { 00489 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00490 // return false; 00491 // } 00492 // if (m_Controls->m_RedoTransformation->isEnabled()) 00493 // { 00494 // QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); 00495 // std::cout << "Redo [PASSED]" << std::endl; 00496 // } 00497 // else 00498 // { 00499 // std::cout << "Redo was not enabled [FAILED]" << std::endl; 00500 // return false; 00501 // } 00502 // if (m_Controls->m_UndoTransformation->isEnabled()) 00503 // { 00504 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00505 // std::cout << "Undo [PASSED]" << std::endl; 00506 // } 00507 // else 00508 // { 00509 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00510 // return false; 00511 // } 00512 // } 00513 // m_MessageBox = false; 00514 // 00515 // 00516 // //// Affine with ICP 00517 // QmitkMessageBoxHelper* helper3 = new QmitkMessageBoxHelper(m_Controls); 00518 // connect( helper3, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); 00519 // helper3->WaitForDialogAndCallback( "QMessageBox" ); 00520 // m_Controls->m_SelectedTransformationClass->setFocus(); 00521 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); 00522 // if (m_Controls->m_Calculate->isEnabled()) 00523 // { 00524 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00525 // std::cout << "Affine with ICP [PASSED]" << std::endl; 00526 // } 00527 // else 00528 // { 00529 // std::cout << "Affine with ICP [FAILED]" << std::endl; 00530 // helper3->StopWaitForDialogAndCallback(); 00531 // return false; 00532 // } 00533 // helper3->StopWaitForDialogAndCallback(); 00534 // if(!m_MessageBox) 00535 // { 00536 // if (m_Controls->m_UndoTransformation->isEnabled()) 00537 // { 00538 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00539 // std::cout << "Undo [PASSED]" << std::endl; 00540 // } 00541 // else 00542 // { 00543 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00544 // return false; 00545 // } 00546 // if (m_Controls->m_RedoTransformation->isEnabled()) 00547 // { 00548 // QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); 00549 // std::cout << "Redo [PASSED]" << std::endl; 00550 // } 00551 // else 00552 // { 00553 // std::cout << "Redo was not enabled [FAILED]" << std::endl; 00554 // return false; 00555 // } 00556 // if (m_Controls->m_UndoTransformation->isEnabled()) 00557 // { 00558 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00559 // std::cout << "Undo [PASSED]" << std::endl; 00560 // } 00561 // else 00562 // { 00563 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00564 // return false; 00565 // } 00566 // } 00567 // m_MessageBox = false; 00568 // 00569 // //// Rigid without ICP 00570 // m_Controls->m_SelectedTransformationClass->setFocus(); 00571 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); 00572 // // a helper object to close popping up message boxes 00573 // QmitkMessageBoxHelper* helper4 = new QmitkMessageBoxHelper(m_Controls); 00574 // connect( helper4, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); 00575 // helper4->WaitForDialogAndCallback( "QMessageBox" ); 00576 // if (m_Controls->m_Calculate->isEnabled()) 00577 // { 00578 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00579 // std::cout << "Rigid [PASSED]" << std::endl; 00580 // } 00581 // else 00582 // { 00583 // std::cout << "Rigid [FAILED]" << std::endl; 00584 // helper4->StopWaitForDialogAndCallback(); 00585 // return false; 00586 // } 00587 // helper4->StopWaitForDialogAndCallback(); 00588 // if(!m_MessageBox) 00589 // { 00590 // if (m_Controls->m_UndoTransformation->isEnabled()) 00591 // { 00592 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00593 // std::cout << "Undo [PASSED]" << std::endl; 00594 // } 00595 // else 00596 // { 00597 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00598 // return false; 00599 // } 00600 // if (m_Controls->m_RedoTransformation->isEnabled()) 00601 // { 00602 // QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); 00603 // std::cout << "Redo [PASSED]" << std::endl; 00604 // } 00605 // else 00606 // { 00607 // std::cout << "Redo was not enabled [FAILED]" << std::endl; 00608 // return false; 00609 // } 00610 // if (m_Controls->m_UndoTransformation->isEnabled()) 00611 // { 00612 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00613 // std::cout << "Undo [PASSED]" << std::endl; 00614 // } 00615 // else 00616 // { 00617 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00618 // return false; 00619 // } 00620 // } 00621 // m_MessageBox = false; 00622 // 00623 // //// Similarity without ICP 00624 // m_Controls->m_SelectedTransformationClass->setFocus(); 00625 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); 00626 // // a helper object to close popping up message boxes 00627 // QmitkMessageBoxHelper* helper5 = new QmitkMessageBoxHelper(m_Controls); 00628 // connect( helper5, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); 00629 // helper5->WaitForDialogAndCallback( "QMessageBox" ); 00630 // if (m_Controls->m_Calculate->isEnabled()) 00631 // { 00632 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00633 // std::cout << "Similarity [PASSED]" << std::endl; 00634 // } 00635 // else 00636 // { 00637 // std::cout << "Similarity [FAILED]" << std::endl; 00638 // helper5->StopWaitForDialogAndCallback(); 00639 // return false; 00640 // } 00641 // helper5->StopWaitForDialogAndCallback(); 00642 // if(!m_MessageBox) 00643 // { 00644 // if (m_Controls->m_UndoTransformation->isEnabled()) 00645 // { 00646 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00647 // std::cout << "Undo [PASSED]" << std::endl; 00648 // } 00649 // else 00650 // { 00651 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00652 // return false; 00653 // } 00654 // if (m_Controls->m_RedoTransformation->isEnabled()) 00655 // { 00656 // QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); 00657 // std::cout << "Redo [PASSED]" << std::endl; 00658 // } 00659 // else 00660 // { 00661 // std::cout << "Redo was not enabled [FAILED]" << std::endl; 00662 // return false; 00663 // } 00664 // if (m_Controls->m_UndoTransformation->isEnabled()) 00665 // { 00666 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00667 // std::cout << "Undo [PASSED]" << std::endl; 00668 // } 00669 // else 00670 // { 00671 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00672 // return false; 00673 // } 00674 // } 00675 // m_MessageBox = false; 00676 // 00677 // //// Affine without ICP 00678 // m_Controls->m_SelectedTransformationClass->setFocus(); 00679 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); 00680 // // a helper object to close popping up message boxes 00681 // QmitkMessageBoxHelper* helper6 = new QmitkMessageBoxHelper(m_Controls); 00682 // connect( helper6, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); 00683 // helper6->WaitForDialogAndCallback( "QMessageBox" ); 00684 // if (m_Controls->m_Calculate->isEnabled()) 00685 // { 00686 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00687 // std::cout << "Affine [PASSED]" << std::endl; 00688 // } 00689 // else 00690 // { 00691 // std::cout << "Affine [FAILED]" << std::endl; 00692 // helper6->StopWaitForDialogAndCallback(); 00693 // return false; 00694 // } 00695 // helper6->StopWaitForDialogAndCallback(); 00696 // if(!m_MessageBox) 00697 // { 00698 // if (m_Controls->m_UndoTransformation->isEnabled()) 00699 // { 00700 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00701 // std::cout << "Undo [PASSED]" << std::endl; 00702 // } 00703 // else 00704 // { 00705 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00706 // return false; 00707 // } 00708 // if (m_Controls->m_RedoTransformation->isEnabled()) 00709 // { 00710 // QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); 00711 // std::cout << "Redo [PASSED]" << std::endl; 00712 // } 00713 // else 00714 // { 00715 // std::cout << "Redo was not enabled [FAILED]" << std::endl; 00716 // return false; 00717 // } 00718 // if (m_Controls->m_UndoTransformation->isEnabled()) 00719 // { 00720 // QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); 00721 // std::cout << "Undo [PASSED]" << std::endl; 00722 // } 00723 // else 00724 // { 00725 // std::cout << "Undo was not enabled [FAILED]" << std::endl; 00726 // return false; 00727 // } 00728 // } 00729 // m_MessageBox = false; 00730 // /* 00731 // //// LandmarkWarping 00732 // if (dynamic_cast<mitk::Image*>(m_Controls->m_FixedSelector->GetSelectedNode()->GetData()) != NULL && 00733 // (dynamic_cast<mitk::Image*>(m_Controls->m_FixedSelector->GetSelectedNode()->GetData())->GetDimension() == 2 || 00734 // dynamic_cast<mitk::Image*>(m_Controls->m_FixedSelector->GetSelectedNode()->GetData())->GetDimension() == 3)) 00735 // { 00736 // m_Controls->m_SelectedTransformationClass->setFocus(); 00737 // QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); 00738 // if (m_Controls->m_Calculate->isEnabled()) 00739 // { 00740 // QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); 00741 // std::cout << "LandmarkWarping [PASSED]" << std::endl; 00742 // } 00743 // else 00744 // { 00745 // std::cout << "LandmarkWarping [FAILED]" << std::endl; 00746 // return false; 00747 // } 00748 // if (m_Controls->m_UndoTransformation->isEnabled()) 00749 // { 00750 // std::cout << "Undo [FAILED]" << std::endl; 00751 // return false; 00752 // } 00753 // else 00754 // { 00755 // std::cout << "Undo [PASSED]" << std::endl; 00756 // } 00757 // if (m_Controls->m_RedoTransformation->isEnabled()) 00758 // { 00759 // std::cout << "Redo [FAILED]" << std::endl; 00760 // return false; 00761 // } 00762 // else 00763 // { 00764 // std::cout << "Redo [PASSED]" << std::endl; 00765 // } 00766 // }*/ 00767 // 00768 // //// end registrationmethods test 00769 // 00770 // QmitkMessageBoxHelper* helper7 = new QmitkMessageBoxHelper(m_Controls); 00771 // connect( helper7, SIGNAL(DialogFound(QWidget*)), this, SLOT(ClearPointSetDialogFound(QWidget*)) ); 00772 // helper7->WaitForDialogAndCallback( "QMessageBox" ); 00773 // QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_ClearPointSet, Qt::LeftButton ); 00774 // 00775 // QmitkMessageBoxHelper* helper8 = new QmitkMessageBoxHelper(m_Controls); 00776 // connect( helper8, SIGNAL(DialogFound(QWidget*)), this, SLOT(ClearPointSetDialogFound(QWidget*)) ); 00777 // helper8->WaitForDialogAndCallback( "QMessageBox" ); 00778 // QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_ClearPointSet, Qt::LeftButton ); 00779 // 00780 // if(this->m_FixedLandmarks->GetSize() > 0) 00781 // { 00782 // std::cout << "Not all fixed points are deleted! [FAILED]" << std::endl; 00783 // return false; 00784 // } 00785 // if(m_MovingLandmarks->GetSize() > 0) 00786 // { 00787 // std::cout << "Not all moving points are deleted! [FAILED]" << std::endl; 00788 // return false; 00789 // } 00790 // 00791 // return true; 00792 // } 00793 // 00794 // void QmitkPointBasedRegistration::RegistrationErrorDialogFound( QWidget* widget ) 00795 // { 00796 // if (!widget) return; 00797 // 00798 // // close message box 00799 // widget->close(); 00800 // std::cout<<"Message box closed!"<<std::endl; 00801 // m_MessageBox = true; 00802 // } 00803 // 00804 // void QmitkPointBasedRegistration::ClearPointSetDialogFound( QWidget* widget ) 00805 // { 00806 // if (!widget) return; 00807 // 00808 // // close message box 00809 // QmitkUserInputSimulation::KeyboardTypeKey( widget, Qt::Key_Return ); 00810 // std::cout<<"Message box closed!"<<std::endl; 00811 // m_MessageBox = true; 00812 // } 00813 00814 00815 //#endif