Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
34 
35 #include <QPushButton>
36 #include <QLabel>
37 #include <QSpinBox>
38 #include <QCheckBox>
39 #include <QGroupBox>
40 #include <vtkCellArray.h>
41 #include "cxTypeConversions.h"
42 #include "cxLogger.h"
43 #include "cxTimedAlgorithm.h"
47 #include "cxMesh.h"
48 #include "cxView.h"
49 #include "cxGeometricRep.h"
50 #include "cxGraphicalPrimitives.h"
51 #include "cxRegistrationService.h"
52 #include "cxViewService.h"
53 #include "cxPatientModelService.h"
54 #include "cxICPWidget.h"
55 #include "cxMeshInView.h"
57 #include "cxSpaceProvider.h"
58 #include "cxSpaceListener.h"
59 #include "cxProfile.h"
60 
61 namespace cx
62 {
63 
65  ICPRegistrationBaseWidget(services, parent,
66  "org_custusx_registration_method_vessel_seans_widget",
67  "Seans Vessel Registration")
68 {
69 }
70 
72 {
73  mSpaceListenerMoving = mServices->spaceProvider()->createListener();
74  mSpaceListenerFixed = mServices->spaceProvider()->createListener();
75  connect(mSpaceListenerMoving.get(), &SpaceListener::changed, this, &SeansVesselRegistrationWidget::onSpacesChanged);
76  connect(mSpaceListenerFixed.get(), &SpaceListener::changed, this, &SeansVesselRegistrationWidget::onSpacesChanged);
77 
78  connect(mServices->registration().get(), &RegistrationService::fixedDataChanged,
80  connect(mServices->registration().get(), &RegistrationService::movingDataChanged,
82 
83  QVBoxLayout* layout = new QVBoxLayout(this);
84  QGridLayout* entryLayout = new QGridLayout;
85  entryLayout->setColumnStretch(1, 1);
86 
87  mFixedImage.reset(new StringPropertyRegistrationFixedImage(mServices->registration(), mServices->patient()));
88  new LabeledComboBoxWidget(this, mFixedImage, entryLayout, 0);
89  mMovingImage.reset(new StringPropertyRegistrationMovingImage(mServices->registration(), mServices->patient()));
90  new LabeledComboBoxWidget(this, mMovingImage, entryLayout, 1);
91 
92  layout->addLayout(entryLayout);
93  layout->addWidget(mICPWidget);
94 
95  this->inputChanged();
96  this->onSettingsChanged();
97 }
98 
100 {
101 }
102 
104 {
105  DataPtr moving = mServices->registration()->getMovingData();
106  DataPtr fixed = mServices->registration()->getFixedData();
107  QString logPath = mServices->patient()->getActivePatientFolder() + "/Logs/";
108 
109  mRegistrator->initialize(moving, fixed, logPath);
110 }
111 
113 {
114  if (mObscuredListener->isObscured())
115  return;
116 
117  DataPtr moving = mServices->registration()->getMovingData();
118  DataPtr fixed = mServices->registration()->getFixedData();
119 
120  mSpaceListenerFixed->setSpace(mServices->spaceProvider()->getD(fixed));
121  mSpaceListenerMoving->setSpace(mServices->spaceProvider()->getD(moving));
122 
123  this->onSpacesChanged();
124 }
125 
127 {
128  mServices->registration()->applyImage2ImageRegistration(delta, "Vessel based");
129 }
130 
132 {
133  this->inputChanged();
134 }
135 
136 
137 
138 
139 
140 }//namespace cx
virtual void applyRegistration(Transform3D delta)
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:41
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
SeansVesselRegistrationWidget(RegServicesPtr services, QWidget *parent)
Composite widget for string selection.
void fixedDataChanged(QString uid)
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class WidgetObscuredListener > mObscuredListener
void movingDataChanged(QString uid)