NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxSelectDataStringProperty.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 "cxImage.h"
15 #include "cxMesh.h"
16 #include "cxTrackedStream.h"
17 #include "cxTypeConversions.h"
19 #include "cxActiveData.h"
20 
21 namespace cx
22 {
23 
25  SelectDataStringPropertyBase(patientModelService, typeRegexp)
26 {
27  mValueName = "Active Data";
28  mHelp = "Select the active data obejct";
29 
30  mActiveData = mPatientModelService->getActiveData();
33 }
34 
35 bool StringPropertyActiveData::setValue(const QString& value)
36 {
37  DataPtr newData = mPatientModelService->getData(value);
38  if (newData == mActiveData->getActive())
39  return false;
40  mActiveData->setActive(newData);
41  return true;
42 }
43 
45 {
46  QString retval = "";
47  DataPtr activeData = mActiveData->getActiveUsingRegexp(mTypeRegexp);
48 
49  if(activeData)
50  retval = activeData->getUid();
51  return retval;
52 }
53 
55  SelectDataStringPropertyBase(patientModelService, Image::getTypeName())
56 {
57  mValueName = "Active Volume";
58  mHelp = "Select the active volume";
59 
60  mActiveData = mPatientModelService->getActiveData();
63 }
64 
65 bool StringPropertyActiveImage::setValue(const QString& value)
66 {
67  ImagePtr newImage = mPatientModelService->getData<Image>(value);
68  if (newImage==mActiveData->getActive<Image>())
69  return false;
70  mActiveData->setActive(newImage);
71  return true;
72 }
73 
75 {
76  return mActiveData->getActiveImageUid();
77 }
78 
79 //---------------------------------------------------------
80 //---------------------------------------------------------
81 //---------------------------------------------------------
82 
84  SelectDataStringPropertyBase(patientModelService, Image::getTypeName())
85 {
86  mValueName = "Select volume";
87  mHelp = "Select a volume";
88 }
89 
90 bool StringPropertySelectImage::setValue(const QString& value)
91 {
92  if (value==mImageUid)
93  return false;
94  mImageUid = value;
95  emit changed();
96  emit dataChanged(mImageUid);
97  return true;
98 }
99 
101 {
102  return mImageUid;
103 }
104 
106 {
107  return mPatientModelService->getData<Image>(mImageUid);
108 }
109 
110 //---------------------------------------------------------
111 //---------------------------------------------------------
112 //---------------------------------------------------------
113 
114 
116  SelectDataStringPropertyBase(patientModelService, typeRegexp)
117 {
118 }
119 
120 bool StringPropertySelectData::setValue(const QString& value)
121 {
122  if (value==mUid)
123  return false;
124 
125  mUid = "";
126  if (mPatientModelService->getData(value))
127  mUid = value;
128 
129  emit changed();
130  emit dataChanged(this->getValue());
131  return true;
132 }
133 
135 {
136  return mUid;
137 // if(!mData)
138 // return "<no data>";
139 // return mData->getUid();
140 }
141 
143 {
144  return mPatientModelService->getData(mUid);
145 // return mData;
146 }
147 
148 //---------------------------------------------------------
149 //---------------------------------------------------------
150 //---------------------------------------------------------
151 
153  SelectDataStringPropertyBase(patientModelService, Mesh::getTypeName())
154 {
155  mValueName = "Select mesh";
156  mHelp = "Select a mesh";
157 }
158 
159 bool StringPropertySelectMesh::setValue(const QString& value)
160 {
161  if (value==mMeshUid)
162  return false;
163  mMeshUid = value;
164  emit changed();
165  emit dataChanged(mMeshUid);
166  return true;
167 }
168 
170 {
171  return mMeshUid;
172 }
173 
175 {
176  return mPatientModelService->getData<Mesh>(mMeshUid);
177 }
178 
179 //---------------------------------------------------------
180 //---------------------------------------------------------
181 //---------------------------------------------------------
182 
184  SelectDataStringPropertyBase(patientModelService, TrackedStream::getTypeName())
185 {
186  mValueName = "Select stream";
187  mHelp = "Select a tracked stream";
188 }
189 
191 {
192  if (value==mStreamUid)
193  return false;
194  mStreamUid = value;
195  emit changed();
196  emit dataChanged(mStreamUid);
197  return true;
198 }
199 
201 {
202  return mStreamUid;
203 }
204 
206 {
207  return mPatientModelService->getData<TrackedStream>(mStreamUid);
208 }
209 
210 //---------------------------------------------------------
211 //---------------------------------------------------------
212 //---------------------------------------------------------
213 
214 } // namespace cx
215 
cx::StringPropertySelectImage::getImage
ImagePtr getImage()
Definition: cxSelectDataStringProperty.cpp:105
cx::SelectDataStringPropertyBase::mValueName
QString mValueName
Definition: cxSelectDataStringPropertyBase.h:68
cx::StringPropertyActiveData::StringPropertyActiveData
StringPropertyActiveData(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
Definition: cxSelectDataStringProperty.cpp:24
cxActiveData.h
cx::SelectDataStringPropertyBase
Definition: cxSelectDataStringPropertyBase.h:32
cx::StringPropertyActiveImage::StringPropertyActiveImage
StringPropertyActiveImage(PatientModelServicePtr patientModelService)
Definition: cxSelectDataStringProperty.cpp:54
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::StringPropertySelectData::StringPropertySelectData
StringPropertySelectData(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
Definition: cxSelectDataStringProperty.cpp:115
cx::SelectDataStringPropertyBase::mPatientModelService
PatientModelServicePtr mPatientModelService
Definition: cxSelectDataStringPropertyBase.h:71
cxImage.h
cx::Property::changed
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cx::StringPropertySelectImage::getValue
virtual QString getValue() const
get the data value.
Definition: cxSelectDataStringProperty.cpp:100
cx::StringPropertyActiveImage::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxSelectDataStringProperty.cpp:65
cx::SelectDataStringPropertyBase::mTypeRegexp
QString mTypeRegexp
Definition: cxSelectDataStringPropertyBase.h:65
cx::StringPropertySelectTrackedStream::StringPropertySelectTrackedStream
StringPropertySelectTrackedStream(PatientModelServicePtr patientModelService)
Definition: cxSelectDataStringProperty.cpp:183
cx::StringPropertySelectMesh::getValue
virtual QString getValue() const
get the data value.
Definition: cxSelectDataStringProperty.cpp:169
cx::StringPropertyActiveData::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxSelectDataStringProperty.cpp:35
cx::StringPropertySelectData::getData
virtual DataPtr getData() const
Definition: cxSelectDataStringProperty.cpp:142
cx::StringPropertySelectData::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxSelectDataStringProperty.cpp:120
cx::ActiveData::activeDataChanged
void activeDataChanged(const QString &uId)
cx::MeshPtr
boost::shared_ptr< class Mesh > MeshPtr
Definition: cxForwardDeclarations.h:48
cx::StringPropertyActiveData::getValue
virtual QString getValue() const
get the data value.
Definition: cxSelectDataStringProperty.cpp:44
cx::StringPropertySelectTrackedStream::getTrackedStream
TrackedStreamPtr getTrackedStream()
Definition: cxSelectDataStringProperty.cpp:205
cxPatientModelServiceProxy.h
cx::SelectDataStringPropertyBase::dataChanged
void dataChanged(QString)
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cx::StringPropertySelectMesh::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxSelectDataStringProperty.cpp:159
cxTypeConversions.h
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::StringPropertySelectMesh::StringPropertySelectMesh
StringPropertySelectMesh(PatientModelServicePtr patientModelService)
Definition: cxSelectDataStringProperty.cpp:152
cx::StringPropertySelectData::getValue
virtual QString getValue() const
get the data value.
Definition: cxSelectDataStringProperty.cpp:134
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::StringPropertySelectMesh::getMesh
MeshPtr getMesh()
Definition: cxSelectDataStringProperty.cpp:174
cx::StringPropertySelectTrackedStream::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxSelectDataStringProperty.cpp:190
cx::StringPropertyActiveImage::mActiveData
ActiveDataPtr mActiveData
Definition: cxSelectDataStringProperty.h:63
cx::SelectDataStringPropertyBase::mHelp
QString mHelp
Definition: cxSelectDataStringPropertyBase.h:69
cx::ActiveData::activeImageChanged
void activeImageChanged(const QString &uId)
cx::Mesh
A mesh data set.
Definition: cxMesh.h:45
cx::Image
A volumetric data set.
Definition: cxImage.h:45
cx::StringPropertyActiveData::mActiveData
ActiveDataPtr mActiveData
Definition: cxSelectDataStringProperty.h:38
cxSelectDataStringProperty.h
cx::StringPropertyActiveImage::getValue
virtual QString getValue() const
get the data value.
Definition: cxSelectDataStringProperty.cpp:74
cx::TrackedStream
A data set for video streams (2D/3D).
Definition: cxTrackedStream.h:29
cxMesh.h
cx::StringPropertySelectImage::StringPropertySelectImage
StringPropertySelectImage(PatientModelServicePtr patientModelService)
Definition: cxSelectDataStringProperty.cpp:83
cx::TrackedStreamPtr
boost::shared_ptr< class TrackedStream > TrackedStreamPtr
Definition: cxStreamPropertiesWidget.h:22
cx::StringPropertySelectImage::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxSelectDataStringProperty.cpp:90
cxTrackedStream.h
cx::StringPropertySelectTrackedStream::getValue
virtual QString getValue() const
get the data value.
Definition: cxSelectDataStringProperty.cpp:200