NorMIT-nav  22.09
An IGT application
cxManualRegistrationWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
13 #include <boost/bind.hpp>
14 #include <ctkPluginContext.h>
16 
17 #include "cxRegistrationService.h"
18 #include "cxData.h"
19 #include "cxTransform3DWidget.h"
20 
21 namespace cx
22 {
23 
24 ManualImageRegistrationWidget::ManualImageRegistrationWidget(RegServicesPtr services, QWidget* parent, QString objectName, QString windowTitle) :
25  BaseWidget(parent, objectName, windowTitle),
26  mVerticalLayout(new QVBoxLayout(this)),
27  mServices(services)
28 {
29  this->setToolTip("Set image position directly");
30  mVerticalLayout->setMargin(0);
31  mLabel = new QLabel("Data matrix rMd");
32  mVerticalLayout->addWidget(mLabel);
33  mMatrixWidget = new Transform3DWidget(this);
34  mVerticalLayout->addWidget(mMatrixWidget);
35  connect(mMatrixWidget, SIGNAL(changed()), this, SLOT(matrixWidgetChanged()));
36  mMatrixWidget->setEditable(true);
37 
38  mVerticalLayout->addStretch();
39 
40  connect(mServices->registration().get(), SIGNAL(movingDataChanged(QString)), this, SLOT(movingDataChanged()));
41 }
42 
44 {
45  this->imageMatrixChanged();
46  this->movingDataChanged();
47 }
48 
52 void ManualImageRegistrationWidget::movingDataChanged()
53 {
55  disconnect(mConnectedMovingImage.get(), SIGNAL(transformChanged()), this, SLOT(imageMatrixChanged()));
56 
57  mConnectedMovingImage = mServices->registration()->getMovingData();
58 
60  connect(mConnectedMovingImage.get(), SIGNAL(transformChanged()), this, SLOT(imageMatrixChanged()));
61 
62  mLabel->setText(this->getDescription());
63 
64  mMatrixWidget->setEnabled(mConnectedMovingImage!=0);
65  this->imageMatrixChanged();
66 }
67 
72 void ManualImageRegistrationWidget::matrixWidgetChanged()
73 {
75  return;
76  this->setMatrixFromWidget(mMatrixWidget->getMatrix());
77 }
78 
82 void ManualImageRegistrationWidget::imageMatrixChanged()
83 {
84  mMatrixWidget->blockSignals(true);
86  mMatrixWidget->setMatrix(this->getMatrixFromBackend());
87  else
88  mMatrixWidget->setMatrix(Transform3D::Identity());
89  mMatrixWidget->blockSignals(false);
90 }
91 
92 } /* namespace cx */
cx::Transform3DWidget
Widget for displaying and manipulating an affine matrix, i.e. a rotation+translation matrix.
Definition: cxTransform3DWidget.h:38
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::BaseWidget
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
cxLabeledComboBoxWidget.h
cxTransform3DWidget.h
cx::ManualImageRegistrationWidget::showEvent
virtual void showEvent(QShowEvent *event)
Definition: cxManualRegistrationWidget.cpp:43
cxManualRegistrationWidget.h
cxData.h
cx::ManualImageRegistrationWidget::mConnectedMovingImage
DataPtr mConnectedMovingImage
Definition: cxManualRegistrationWidget.h:52
cx::ManualImageRegistrationWidget::mServices
RegServicesPtr mServices
Definition: cxManualRegistrationWidget.h:54
cx::ManualImageRegistrationWidget::mVerticalLayout
QVBoxLayout * mVerticalLayout
Definition: cxManualRegistrationWidget.h:53
cx::RegServicesPtr
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
cx::Transform3DWidget::setMatrix
void setMatrix(const Transform3D &M)
Definition: cxTransform3DWidget.cpp:267
cx::Transform3DWidget::getMatrix
Transform3D getMatrix() const
Definition: cxTransform3DWidget.cpp:272
cx::Transform3DWidget::setEditable
void setEditable(bool edit)
Definition: cxTransform3DWidget.cpp:195
cx::ManualImageRegistrationWidget::ManualImageRegistrationWidget
ManualImageRegistrationWidget(RegServicesPtr services, QWidget *parent, QString objectName, QString windowTitle)
Definition: cxManualRegistrationWidget.cpp:24
cxRegistrationService.h