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;
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)));
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;
int getPriority(DataPtr data)
static DataViewProperties createSlice3D()
ptCORONAL
a slice seen from the front of the patient
void reportError(QString msg)
void initializeGlobal2DZoom(SyncedValuePtr val)
QString mCameraNotBehindROI
CameraDataPtr getCamera3D()
bool mCameraLockToTooltip
void addXml(QDomNode &dataNode)
static DataViewProperties createDefault()
void dataAddedOrRemoved()
boost::shared_ptr< class CameraData > CameraDataPtr
boost::shared_ptr< class TrackedStream > TrackedStreamPtr
PlaneTypeCollection getSliceDefinitions()
std::string toString(T const &value)
converts any type to a string
boost::shared_ptr< DataMetric > DataMetricPtr
void parseXml(QDomNode dataNode)
std::vector< QDomElement > getDuplicateElements(QString name)
boost::shared_ptr< class Image > ImagePtr
std::vector< ImagePtr > getImagesAndChangingImagesFromTrackedStreams(DataViewProperties properties, bool include2D=false) const
CAMERA_STYLE_TYPE getStyle()
SyncedValuePtr getGroup2DZoom()
void parseXml(QDomNode dataNode)
SyncedValuePtr getGlobal2DZoom()
DataViewProperties getProperties(QString uid)
ptAXIAL
a slice seen from the top of the patient
A data set for video streams (2D/3D).
ViewGroupData(CoreServicesPtr services, QString uid)
void setProperties(QString uid, DataViewProperties properties)
static DataViewProperties createSlice2D()
void controllingToolChanged()
static StringListPropertyPtr initialize(const QString &uid, QString name, QString help, QStringList value, QStringList range, QDomNode root=QDomNode())
void addObjectToElement(QString name, T object)
CameraStyleData mCameraStyle
static DataViewProperties create3D()
boost::shared_ptr< class Data > DataPtr
std::vector< MeshPtr > getMeshes(DataViewProperties properties) const
ptSAGITTAL
a slice seen from the side of the patient
static PlaneTypeCollection fromString(QString input, PlaneTypeCollection defVal=PlaneTypeCollection())
void setCameraStyle(CAMERA_STYLE_TYPE style)
void addData(QString uid)
void addDataSorted(QString uid)
add data in a predefined ordering: CT/MR/SC/US/USA/Mesh/Metrics
static SyncedValuePtr create(QVariant val=QVariant())
ToolPtr getControllingTool()
QDomElement addTextToElement(QString name, QString text)
Options getOptions() const
void addXml(QDomNode &dataNode)
bool containsAnyFlagsIn(DataViewProperties required) const
static DataViewProperties createFull()
std::vector< ImagePtr > getImages(DataViewProperties properties) const
void parseXml(QDomNode dataNode)
void deleteImageToStopEmittingFrames()
std::vector< TrackedStreamPtr > getTrackedStreams(DataViewProperties properties) const
void dataViewPropertiesChanged(QString uid)
double mCameraTooltipOffset
void changed()
emit when the underlying data value is changed: The user interface will be updated.
static DataViewProperties createVolume3D()
void zoomCamera3D(int zoomFactor)
bool dataTypeSort(const DataPtr data1, const DataPtr data2)
bool removeData(QString uid)
boost::shared_ptr< class StringListProperty > StringListPropertyPtr
bool operator==(const RegistrationTransform &lhs, const RegistrationTransform &rhs)
QString parseTextFromElement(QString name)
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
void setVideoSource(QString uid)
boost::shared_ptr< class CoreServices > CoreServicesPtr
DataViewProperties removeFlagsIn(DataViewProperties rhs) const
void parseObjectFromElement(QString name, T object)
DataViewProperties addFlagsIn(DataViewProperties rhs) const
static QString getTypeName()
void setControllingTool(ToolPtr tool)
void videoSourceChanged(QString uid)
boost::shared_ptr< class SyncedValue > SyncedValuePtr
void setRegistrationMode(REGISTRATION_STATUS mode)
StringListPropertyPtr getSliceDefinitionProperty()
void addXml(QDomNode &dataNode)
std::vector< DataPtr > getData(DataViewProperties properties=DataViewProperties::createFull()) const
Base class for all Data Metrics.
void setSliceDefinitions(PlaneTypeCollection val)
bool mShowPointPickerProbe
QString enum2string(const ENUM &val)
QString getVideoSource() const
void setOptions(Options options)
vtkSmartPointer< class vtkCamera > vtkCameraPtr
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr