CustusX  15.8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 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 "cxImage.h"
36 #include "cxMesh.h"
37 #include "cxTrackedStream.h"
38 #include "cxTypeConversions.h"
40 
41 namespace cx
42 {
43 
45  SelectDataStringPropertyBase(patientModelService, "image")
46 {
47  mValueName = "Active Volume";
48  mHelp = "Select the active volume";
50 }
51 
52 bool StringPropertyActiveImage::setValue(const QString& value)
53 {
54  ImagePtr newImage = mPatientModelService->getData<Image>(value);
55  if (newImage==mPatientModelService->getActiveImage())
56  return false;
57  mPatientModelService->setActiveImage(newImage);
58  return true;
59 }
60 
62 {
63  return mPatientModelService->getActiveImageUid();
64 }
65 
66 //---------------------------------------------------------
67 //---------------------------------------------------------
68 //---------------------------------------------------------
69 
71  SelectDataStringPropertyBase(patientModelService, "image")
72 {
73  mValueName = "Select volume";
74  mHelp = "Select a volume";
75 }
76 
77 bool StringPropertySelectImage::setValue(const QString& value)
78 {
79  if (value==mImageUid)
80  return false;
81  mImageUid = value;
82  emit changed();
83  emit dataChanged(mImageUid);
84  return true;
85 }
86 
88 {
89  return mImageUid;
90 }
91 
93 {
94  return mPatientModelService->getData<Image>(mImageUid);
95 }
96 
97 //---------------------------------------------------------
98 //---------------------------------------------------------
99 //---------------------------------------------------------
100 
101 
103  SelectDataStringPropertyBase(patientModelService, ".*")
104 {
105 }
106 
107 bool StringPropertySelectData::setValue(const QString& value)
108 {
109  if (value==mUid)
110  return false;
111 
112  mUid = "";
113  if (mPatientModelService->getData(value))
114  mUid = value;
115 
116  emit changed();
117  emit dataChanged(this->getValue());
118  return true;
119 }
120 
122 {
123  return mUid;
124 // if(!mData)
125 // return "<no data>";
126 // return mData->getUid();
127 }
128 
130 {
131  return mPatientModelService->getData(mUid);
132 // return mData;
133 }
134 
135 //---------------------------------------------------------
136 //---------------------------------------------------------
137 //---------------------------------------------------------
138 
140  SelectDataStringPropertyBase(patientModelService, "mesh")
141 {
142  mValueName = "Select mesh";
143  mHelp = "Select a mesh";
144 }
145 
146 bool StringPropertySelectMesh::setValue(const QString& value)
147 {
148  if (value==mMeshUid)
149  return false;
150  mMeshUid = value;
151  emit changed();
152  emit dataChanged(mMeshUid);
153  return true;
154 }
155 
157 {
158  return mMeshUid;
159 }
160 
162 {
163  return mPatientModelService->getData<Mesh>(mMeshUid);
164 }
165 
166 //---------------------------------------------------------
167 //---------------------------------------------------------
168 //---------------------------------------------------------
169 
171  SelectDataStringPropertyBase(patientModelService, "TrackedStream")
172 {
173  mValueName = "Select stream";
174  mHelp = "Select a tracked stream";
175 }
176 
178 {
179  if (value==mStreamUid)
180  return false;
181  mStreamUid = value;
182  emit changed();
183  emit dataChanged(mStreamUid);
184  return true;
185 }
186 
188 {
189  return mStreamUid;
190 }
191 
193 {
194  return mPatientModelService->getData<TrackedStream>(mStreamUid);
195 }
196 
197 //---------------------------------------------------------
198 //---------------------------------------------------------
199 //---------------------------------------------------------
200 
201 } // namespace cx
202 
void activeImageChanged(const QString &uId)
A mesh data set.
Definition: cxMesh.h:61
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.
StringPropertySelectData(PatientModelServicePtr patientModelService)
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
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.
A volumetric data set.
Definition: cxImage.h:66
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.
boost::shared_ptr< class Mesh > MeshPtr
virtual bool setValue(const QString &value)
set the data value.
StringPropertySelectMesh(PatientModelServicePtr patientModelService)