15 #include "vtkCamera.h" 27 #include "boost/bind.hpp" 75 for (
unsigned int i=0; i<cstCOUNT; ++i)
77 CAMERA_STYLE_TYPE current =
static_cast<CAMERA_STYLE_TYPE
>(i);
102 QDomElement elem = dataNode.toElement();
111 elem.setAttribute(
"uniCam",
mUniCam);
113 elem.setAttribute(
"focusROI",
mFocusROI);
118 QDomElement elem = dataNode.toElement();
127 mUniCam = elem.attribute(
"uniCam", QString::number(
mUniCam)).toInt();
154 retval.mVolume3D =
true;
155 retval.mSlice3D =
false;
156 retval.mSlice2D =
true;
162 retval.mVolume3D =
true;
163 retval.mSlice3D =
true;
164 retval.mSlice2D =
true;
171 retval.mVolume3D =
true;
172 retval.mSlice3D =
false;
173 retval.mSlice2D =
false;
180 retval.mVolume3D =
false;
181 retval.mSlice3D =
true;
182 retval.mSlice2D =
false;
189 retval.mVolume3D =
false;
190 retval.mSlice3D =
false;
191 retval.mSlice2D =
true;
198 retval.mVolume3D =
true;
199 retval.mSlice3D =
true;
200 retval.mSlice2D =
false;
207 QDomElement elem = dataNode.toElement();
208 elem.setAttribute(
"volume3D", mVolume3D);
209 elem.setAttribute(
"slice3D", mSlice3D);
210 elem.setAttribute(
"slice2D", mSlice2D);
215 QDomElement elem = dataNode.toElement();
216 mVolume3D = elem.attribute(
"volume3D", QString::number(mVolume3D)).toInt();
217 mSlice3D = elem.attribute(
"slice3D", QString::number(mSlice3D)).toInt();
218 mSlice2D = elem.attribute(
"slice2D", QString::number(mSlice2D)).toInt();
223 return !(mVolume3D || mSlice3D || mSlice2D);
229 retval.mSlice2D = mSlice2D || rhs.mSlice2D;
230 retval.mSlice3D = mSlice3D || rhs.mSlice3D;
231 retval.mVolume3D = mVolume3D || rhs.mVolume3D;
238 retval.mSlice2D = mSlice2D && !rhs.mSlice2D;
239 retval.mSlice3D = mSlice3D && !rhs.mSlice3D;
240 retval.mVolume3D = mVolume3D && !rhs.mVolume3D;
246 if (required.mSlice2D && mSlice2D)
return true;
247 if (required.mSlice3D && mSlice3D)
return true;
248 if (required.mVolume3D && mVolume3D)
return true;
265 if (data->getType()==
"mesh")
274 if (image->getModality().toUpper().contains(
"US"))
276 if (image->getImageType().toUpper().contains(
"B-MODE"))
281 else if (image->getModality().toUpper().contains(
"MR"))
286 else if (image->getModality().toUpper().contains(
"CT"))
305 mShowLandmarks(false), mShowPointPickerProbe(false),
306 mPickerGlyph(new
Mesh(
"PickerGlyph"))
317 mVideoSource =
"active";
319 mGlobal2DZoom = mGroup2DZoom;
321 this->createSliceDefinitionProperty();
325 void ViewGroupData::purgeDataNotExistingInPatientModelService()
328 for (
unsigned i = 0; i < mData.size(); )
330 QString uid = mData[i].first;
331 if (!mServices->patient()->getData(uid))
333 if (this->contains(uid))
336 mData.erase(std::find_if(mData.begin(), mData.end(), data_equals(uid)));
343 for(
int i = 0; i < purged.size(); ++i)
362 if (this->contains(uid))
366 DataAndViewPropertiesPair item(uid, properties);
368 for (
int i=
int(mData.size())-1; i>=0; --i)
372 this->insertData(mData.begin()+i+1, item);
376 if (!this->contains(uid))
377 this->insertData(mData.begin(), item);
381 void ViewGroupData::insertData(std::vector<DataAndViewPropertiesPair>::iterator iter, DataAndViewPropertiesPair &item)
384 this->mData.insert(iter, item);
405 if (this->contains(uid))
406 return std::find_if(mData.begin(), mData.end(), data_equals(uid))->second;
415 if (properties.
empty())
421 if (!this->contains(uid))
423 DataAndViewPropertiesPair item(uid, properties);
425 this->insertData(mData.end(), item);
429 std::find_if(mData.begin(), mData.end(), data_equals(uid))->second = properties;
435 bool ViewGroupData::contains(QString uid)
const 437 return std::count_if(mData.begin(), mData.end(), data_equals(uid));
442 if (!this->contains(uid))
444 mData.erase(std::find_if(mData.begin(), mData.end(), data_equals(uid)));
451 while (!mData.empty())
455 mGroup2DZoom->set(1.0);
456 mGlobal2DZoom->set(1.0);
461 DataPtr data = mServices->patient()->getData(uid);
464 reportError(
"Couldn't find the data: [" + uid +
"] in the datamanager.");
472 if (mVideoSource==uid)
485 return this->getDataOfType<Data>(properties);
489 template<
class DATA_TYPE>
490 std::vector<boost::shared_ptr<DATA_TYPE> > ViewGroupData::getDataOfType(
DataViewProperties requiredProperties)
const 493 std::map<QString, DataPtr> alldata = mServices->patient()->getDatas();
495 typedef boost::shared_ptr<DATA_TYPE> DATA_PTR;
496 std::vector<DATA_PTR> retval;
497 for (
unsigned i = 0; i < mData.size(); ++i)
499 DATA_PTR data = boost::dynamic_pointer_cast<DATA_TYPE>(alldata[mData[i].first]);
505 retval.push_back(data);
512 return this->getDataOfType<Image>(properties);
517 return this->getDataOfType<Mesh>(properties);
522 return this->getDataOfType<TrackedStream>(properties);
527 std::vector<ImagePtr> images = this->
getImages(properties);
530 for(
unsigned i = 0; i < streams.size(); ++i)
532 ImagePtr changingImage = streams[i]->getChangingImage();
533 if(streams[i]->is3D())
534 images.push_back(changingImage);
535 if(include2D && streams[i]->is2D())
536 images.push_back(changingImage);
563 return mGlobal2DZoom;
576 camera->Dolly(zoomFactor);
579 void ViewGroupData::createSliceDefinitionProperty()
581 QStringList slicedefs;
582 for (
int i=0; i<ptCOUNT; ++i)
584 QStringList slicedefaults;
588 "Select slice planes to view in 3D",
596 QStringList val = mSliceDefinitionProperty->getValue();
602 QStringList val_list = val.
toString().split(
"/");
603 mSliceDefinitionProperty->setValue(val_list);
608 return mSliceDefinitionProperty;
615 for (
unsigned i = 0; i < mData.size(); ++i)
619 mData[i].second.addXml(elem);
637 for (
unsigned i=0; i<dataElems.size(); ++i)
639 QDomElement elem = dataElems[i];
640 QString uid = elem.text();
667 if (mode == rsPATIENT_REGISTRATED)
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
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
ViewGroupData(CoreServicesPtr services, QString uid)
void setProperties(QString uid, DataViewProperties properties)
static DataViewProperties createSlice2D()
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())
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)
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
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.