15 #include "vtkCamera.h"
27 #include "boost/bind.hpp"
74 for (
unsigned int i=0; i<cstCOUNT; ++i)
76 CAMERA_STYLE_TYPE current =
static_cast<CAMERA_STYLE_TYPE
>(i);
101 QDomElement elem = dataNode.toElement();
110 elem.setAttribute(
"uniCam",
mUniCam);
112 elem.setAttribute(
"focusROI",
mFocusROI);
117 QDomElement elem = dataNode.toElement();
126 mUniCam = elem.attribute(
"uniCam", QString::number(
mUniCam)).toInt();
153 retval.mVolume3D =
true;
154 retval.mSlice3D =
false;
155 retval.mSlice2D =
true;
161 retval.mVolume3D =
true;
162 retval.mSlice3D =
true;
163 retval.mSlice2D =
true;
170 retval.mVolume3D =
true;
171 retval.mSlice3D =
false;
172 retval.mSlice2D =
false;
179 retval.mVolume3D =
false;
180 retval.mSlice3D =
true;
181 retval.mSlice2D =
false;
188 retval.mVolume3D =
false;
189 retval.mSlice3D =
false;
190 retval.mSlice2D =
true;
197 retval.mVolume3D =
true;
198 retval.mSlice3D =
true;
199 retval.mSlice2D =
false;
206 QDomElement elem = dataNode.toElement();
207 elem.setAttribute(
"volume3D", mVolume3D);
208 elem.setAttribute(
"slice3D", mSlice3D);
209 elem.setAttribute(
"slice2D", mSlice2D);
214 QDomElement elem = dataNode.toElement();
215 mVolume3D = elem.attribute(
"volume3D", QString::number(mVolume3D)).toInt();
216 mSlice3D = elem.attribute(
"slice3D", QString::number(mSlice3D)).toInt();
217 mSlice2D = elem.attribute(
"slice2D", QString::number(mSlice2D)).toInt();
222 return !(mVolume3D || mSlice3D || mSlice2D);
228 retval.mSlice2D = mSlice2D || rhs.mSlice2D;
229 retval.mSlice3D = mSlice3D || rhs.mSlice3D;
230 retval.mVolume3D = mVolume3D || rhs.mVolume3D;
237 retval.mSlice2D = mSlice2D && !rhs.mSlice2D;
238 retval.mSlice3D = mSlice3D && !rhs.mSlice3D;
239 retval.mVolume3D = mVolume3D && !rhs.mVolume3D;
245 if (required.mSlice2D && mSlice2D)
return true;
246 if (required.mSlice3D && mSlice3D)
return true;
247 if (required.mVolume3D && mVolume3D)
return true;
266 DataMetricPtr metric = boost::dynamic_pointer_cast<DataMetric>(data);
270 ImagePtr image = boost::dynamic_pointer_cast<Image>(data);
273 if (image->getModality() ==
imUS)
280 else if (image->getModality() ==
imMR)
285 else if (image->getModality() ==
imCT)
304 mShowLandmarks(false), mShowPointPickerProbe(false),
305 mPickerGlyph(new
Mesh(
"PickerGlyph"))
316 mVideoSource =
"active";
318 mGlobal2DZoom = mGroup2DZoom;
320 this->createSliceDefinitionProperty();
324 void ViewGroupData::purgeDataNotExistingInPatientModelService()
327 for (
unsigned i = 0; i < mData.size(); )
329 QString uid = mData[i].first;
330 if (!mServices->patient()->getData(uid))
332 if (this->contains(uid))
335 mData.erase(std::find_if(mData.begin(), mData.end(), data_equals(uid)));
342 for(
int i = 0; i < purged.size(); ++i)
361 if (this->contains(uid))
365 DataAndViewPropertiesPair item(uid, properties);
367 for (
int i=
int(mData.size())-1; i>=0; --i)
371 this->insertData(mData.begin()+i+1, item);
375 if (!this->contains(uid))
376 this->insertData(mData.begin(), item);
380 void ViewGroupData::insertData(std::vector<DataAndViewPropertiesPair>::iterator iter, DataAndViewPropertiesPair &item)
383 this->mData.insert(iter, item);
404 if (this->contains(uid))
405 return std::find_if(mData.begin(), mData.end(), data_equals(uid))->second;
414 if (properties.
empty())
420 if (!this->contains(uid))
422 DataAndViewPropertiesPair item(uid, properties);
424 this->insertData(mData.end(), item);
428 std::find_if(mData.begin(), mData.end(), data_equals(uid))->second = properties;
434 bool ViewGroupData::contains(QString uid)
const
436 return std::count_if(mData.begin(), mData.end(), data_equals(uid));
441 if (!this->contains(uid))
443 mData.erase(std::find_if(mData.begin(), mData.end(), data_equals(uid)));
446 trackedStream->deleteImageToStopEmittingFrames();
453 while (!mData.empty())
457 mGroup2DZoom->set(1.0);
458 mGlobal2DZoom->set(1.0);
463 DataPtr data = mServices->patient()->getData(uid);
466 reportError(
"Couldn't find the data: [" + uid +
"] in the datamanager.");
474 if (mVideoSource==uid)
487 return this->getDataOfType<Data>(properties);
491 template<
class DATA_TYPE>
492 std::vector<boost::shared_ptr<DATA_TYPE> > ViewGroupData::getDataOfType(
DataViewProperties requiredProperties)
const
495 std::map<QString, DataPtr> alldata = mServices->patient()->getDatas();
497 typedef boost::shared_ptr<DATA_TYPE> DATA_PTR;
498 std::vector<DATA_PTR> retval;
499 for (
unsigned i = 0; i < mData.size(); ++i)
501 DATA_PTR data = boost::dynamic_pointer_cast<DATA_TYPE>(alldata[mData[i].first]);
507 retval.push_back(data);
514 return this->getDataOfType<Image>(properties);
519 return this->getDataOfType<Mesh>(properties);
524 return this->getDataOfType<TrackedStream>(properties);
529 std::vector<ImagePtr> images = this->
getImages(properties);
532 for(
unsigned i = 0; i < streams.size(); ++i)
534 ImagePtr changingImage = streams[i]->getChangingImage();
535 if(streams[i]->is3D())
536 images.push_back(changingImage);
537 if(include2D && streams[i]->is2D())
538 images.push_back(changingImage);
565 return mGlobal2DZoom;
578 camera->Dolly(zoomFactor);
581 void ViewGroupData::createSliceDefinitionProperty()
583 QStringList slicedefs;
584 for (
int i=0; i<ptCOUNT; ++i)
586 QStringList slicedefaults;
590 "Select slice planes to view in 3D",
598 QStringList val = mSliceDefinitionProperty->getValue();
604 QStringList val_list = val.
toString().split(
"/");
605 mSliceDefinitionProperty->setValue(val_list);
610 return mSliceDefinitionProperty;
617 for (
unsigned i = 0; i < mData.size(); ++i)
621 mData[i].second.addXml(elem);
639 for (
unsigned i=0; i<dataElems.size(); ++i)
641 QDomElement elem = dataElems[i];
642 QString uid = elem.text();
669 if (mode == rsPATIENT_REGISTRATED)
681 return mControllingTool;
685 mControllingTool = tool;