NorMIT-nav  22.09
An IGT application
cxSeansVesselRegistrationWidget.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 
14 #include <QPushButton>
15 #include <QLabel>
16 #include <QSpinBox>
17 #include <QCheckBox>
18 #include <QGroupBox>
19 #include <vtkCellArray.h>
20 #include "cxTypeConversions.h"
21 #include "cxLogger.h"
22 #include "cxTimedAlgorithm.h"
26 #include "cxMesh.h"
27 #include "cxView.h"
28 #include "cxGeometricRep.h"
29 #include "cxGraphicalPrimitives.h"
30 #include "cxRegistrationService.h"
31 #include "cxViewService.h"
32 #include "cxPatientModelService.h"
33 #include "cxICPWidget.h"
34 #include "cxMeshInView.h"
36 #include "cxSpaceProvider.h"
37 #include "cxSpaceListener.h"
38 #include "cxProfile.h"
39 
40 namespace cx
41 {
42 
44  ICPRegistrationBaseWidget(services, parent,
45  "org_custusx_registration_method_vessel_seans_widget",
46  "Seans Vessel Registration")
47 {
48 }
49 
51 {
52  mSpaceListenerMoving = mServices->spaceProvider()->createListener();
53  mSpaceListenerFixed = mServices->spaceProvider()->createListener();
54  connect(mSpaceListenerMoving.get(), &SpaceListener::changed, this, &SeansVesselRegistrationWidget::onSpacesChanged);
55  connect(mSpaceListenerFixed.get(), &SpaceListener::changed, this, &SeansVesselRegistrationWidget::onSpacesChanged);
56 
57  connect(mServices->registration().get(), &RegistrationService::fixedDataChanged,
59  connect(mServices->registration().get(), &RegistrationService::movingDataChanged,
61 
62  QVBoxLayout* layout = new QVBoxLayout(this);
63  QGridLayout* entryLayout = new QGridLayout;
64  entryLayout->setColumnStretch(1, 1);
65 
66  mFixedImage.reset(new StringPropertyRegistrationFixedImage(mServices->registration(), mServices->patient()));
67  new LabeledComboBoxWidget(this, mFixedImage, entryLayout, 0);
68  mMovingImage.reset(new StringPropertyRegistrationMovingImage(mServices->registration(), mServices->patient()));
69  new LabeledComboBoxWidget(this, mMovingImage, entryLayout, 1);
70 
71  layout->addLayout(entryLayout);
72  layout->addWidget(mICPWidget);
73 
74  this->inputChanged();
75  this->onSettingsChanged();
76 }
77 
79 {
80 }
81 
83 {
84  DataPtr moving = mServices->registration()->getMovingData();
85  DataPtr fixed = mServices->registration()->getFixedData();
86  QString logPath = mServices->patient()->getActivePatientFolder() + "/Logs/";
87 
88  mRegistrator->initialize(moving, fixed, logPath);
89 }
90 
92 {
93  if (mObscuredListener->isObscured())
94  return;
95 
96  DataPtr moving = mServices->registration()->getMovingData();
97  DataPtr fixed = mServices->registration()->getFixedData();
98 
99  mSpaceListenerFixed->setSpace(mServices->spaceProvider()->getD(fixed));
100  mSpaceListenerMoving->setSpace(mServices->spaceProvider()->getD(moving));
101 
102  this->onSpacesChanged();
103 }
104 
106 {
107  mServices->registration()->addImage2ImageRegistration(delta, "Vessel based");
108 }
109 
111 {
112  this->inputChanged();
113 }
114 
115 
116 
117 
118 
119 }//namespace cx
cx::LabeledComboBoxWidget
Composite widget for string selection.
Definition: cxLabeledComboBoxWidget.h:36
cx::SeansVesselRegistrationWidget::onShown
virtual void onShown()
Definition: cxSeansVesselRegistrationWidget.cpp:110
cxLogger.h
cxSpaceListener.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ICPRegistrationBaseWidget::mICPWidget
ICPWidget * mICPWidget
Definition: cxICPRegistrationBaseWidget.h:97
cx::SpaceListener::changed
void changed()
cxLabeledComboBoxWidget.h
cx::ICPRegistrationBaseWidget
Definition: cxICPRegistrationBaseWidget.h:49
cxGraphicalPrimitives.h
cx::SeansVesselRegistrationWidget::inputChanged
virtual void inputChanged()
Definition: cxSeansVesselRegistrationWidget.cpp:91
cx::StringPropertyRegistrationMovingImage
Definition: cxRegistrationProperties.h:51
cxGeometricRep.h
cxSeansVesselRegistrationWidget.h
cx::ICPRegistrationBaseWidget::onSettingsChanged
void onSettingsChanged()
Definition: cxICPRegistrationBaseWidget.cpp:174
cxMeshInView.h
SeansVesselReg.hxx
cx::SeansVesselRegistrationWidget::setup
virtual void setup()
Definition: cxSeansVesselRegistrationWidget.cpp:50
cxICPWidget.h
cx::ICPRegistrationBaseWidget::mObscuredListener
boost::shared_ptr< class WidgetObscuredListener > mObscuredListener
Definition: cxICPRegistrationBaseWidget.h:100
cx::ICPRegistrationBaseWidget::mRegistrator
SeansVesselRegPtr mRegistrator
Definition: cxICPRegistrationBaseWidget.h:99
cx::RegistrationBaseWidget::mServices
RegServicesPtr mServices
Definition: cxRegistrationBaseWidget.h:35
cxProfile.h
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cxViewService.h
cxWidgetObscuredListener.h
cxTypeConversions.h
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::SeansVesselRegistrationWidget::initializeRegistrator
virtual void initializeRegistrator()
Definition: cxSeansVesselRegistrationWidget.cpp:82
cxView.h
cxPatientModelService.h
cx::RegistrationService::movingDataChanged
void movingDataChanged(QString uid)
cx::ICPRegistrationBaseWidget::onSpacesChanged
void onSpacesChanged()
Definition: cxICPRegistrationBaseWidget.cpp:161
cx::RegServicesPtr
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
cx::SeansVesselRegistrationWidget::SeansVesselRegistrationWidget
SeansVesselRegistrationWidget(RegServicesPtr services, QWidget *parent)
Definition: cxSeansVesselRegistrationWidget.cpp:43
cxRegistrationProperties.h
cx::StringPropertyRegistrationFixedImage
Definition: cxRegistrationProperties.h:31
cx::RegistrationService::fixedDataChanged
void fixedDataChanged(QString uid)
cxRegistrationService.h
cx::SeansVesselRegistrationWidget::~SeansVesselRegistrationWidget
virtual ~SeansVesselRegistrationWidget()
Definition: cxSeansVesselRegistrationWidget.cpp:78
cxMesh.h
cxTimedAlgorithm.h
cxSpaceProvider.h
cx::SeansVesselRegistrationWidget::applyRegistration
virtual void applyRegistration(Transform3D delta)
Definition: cxSeansVesselRegistrationWidget.cpp:105