Fraxinus  18.10
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 
59  if (mConnectedMovingImage)
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 */
Widget for displaying and manipulating an affine matrix, i.e. a rotation+translation matrix...
void setMatrix(const Transform3D &M)
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
ManualImageRegistrationWidget(RegServicesPtr services, QWidget *parent, QString objectName, QString windowTitle)
virtual void showEvent(QShowEvent *event)
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Transform3D getMatrix() const
Namespace for all CustusX production code.