CustusX  22.04-rc2
An IGT application
cxRegistrationProperties.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 =========================================================================*/
12 #include "cxTypeConversions.h"
13 #include "cxRegistrationService.h"
14 #include "cxPatientModelService.h"
15 #include "cxData.h"
16 
17 namespace cx
18 {
19 
20 
22  SelectDataStringPropertyBase(patientModelService),
23  mRegistrationService(registrationService),
24  mPatientModelService(patientModelService)
25 {
26  mValueName = "Fixed Data";
27  mHelp = "Select the fixed registration data";
28  connect(mRegistrationService.get(), SIGNAL(fixedDataChanged(QString)), this, SIGNAL(changed()));
29 }
30 
32 {
33  DataPtr newImage = mPatientModelService->getData(value);
34  if (newImage == mRegistrationService->getFixedData())
35  return false;
36  mRegistrationService->setFixedData(newImage);
37  return true;
38 }
40 {
41  DataPtr image = mRegistrationService->getFixedData();
42  if (!image)
43  return "";
44  return qstring_cast(image->getUid());
45 }
46 
47 //---------------------------------------------------------
48 //---------------------------------------------------------
49 //---------------------------------------------------------
50 
52  SelectDataStringPropertyBase(patientModelService),
53  mRegistrationService(registrationService),
54  mPatientModelService(patientModelService)
55 {
56  mValueName = "Moving Data";
57  mHelp = "Select the moving registration data";
58  connect(mRegistrationService.get(), SIGNAL(movingDataChanged(QString)), this, SIGNAL(changed()));
59 }
60 
62 {
63  DataPtr newImage = mPatientModelService->getData(value);
64  if (newImage == mRegistrationService->getMovingData())
65  return false;
66  mRegistrationService->setMovingData(newImage);
67  return true;
68 }
69 
71 {
72  DataPtr image = mRegistrationService->getMovingData();
73  if (!image)
74  return "";
75  return qstring_cast(image->getUid());
76 }
77 
78 }
QString qstring_cast(const T &val)
boost::shared_ptr< class RegistrationService > RegistrationServicePtr
virtual QString getValue() const
get the data value.
StringPropertyRegistrationFixedImage(RegistrationServicePtr registrationService, PatientModelServicePtr patientModelService)
virtual bool setValue(const QString &value)
set the data value.
StringPropertyRegistrationMovingImage(RegistrationServicePtr registrationService, PatientModelServicePtr patientModelService)
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void changed()
emit when the underlying data value is changed: The user interface will be updated.
virtual QString getValue() const
get the data value.
virtual bool setValue(const QString &value)
set the data value.
Namespace for all CustusX production code.