NorMIT-nav  18.04
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")
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")
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")
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")
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 
A mesh data set.
Definition: cxMesh.h:45
virtual bool setValue(const QString &value)
set the data value.
boost::shared_ptr< class TrackedStream > TrackedStreamPtr
virtual QString getValue() const
get the data value.
virtual QString getValue() const
get the data value.
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
StringPropertyActiveData(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
virtual bool setValue(const QString &value)
set the data value.
A data set for video streams (2D/3D).
virtual QString getValue() const
get the data value.
StringPropertyActiveImage(PatientModelServicePtr patientModelService)
boost::shared_ptr< class Data > DataPtr
StringPropertySelectImage(PatientModelServicePtr patientModelService)
virtual bool setValue(const QString &value)
set the data value.
void activeDataChanged(const QString &uId)
A volumetric data set.
Definition: cxImage.h:45
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
StringPropertySelectTrackedStream(PatientModelServicePtr patientModelService)
virtual QString getValue() const
get the data value.
virtual QString getValue() const
get the data value.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
virtual bool setValue(const QString &value)
set the data value.
virtual bool setValue(const QString &value)
set the data value.
virtual QString getValue() const
get the data value.
boost::shared_ptr< class Mesh > MeshPtr
virtual bool setValue(const QString &value)
set the data value.
StringPropertySelectData(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
StringPropertySelectMesh(PatientModelServicePtr patientModelService)
void activeImageChanged(const QString &uId)
Namespace for all CustusX production code.