36 #include "vtkCamera.h"
65 mLastDataActionUid =
"________________________";
66 for (std::vector<DataPtr>::iterator iter=sorted.begin(); iter!=sorted.end(); ++iter)
68 this->addDataAction((*iter)->getUid(), parent);
74 mProperties = properties;
77 void DataViewPropertiesInteractor::addDataAction(QString uid, QWidget* parent)
79 DataPtr data = mBackend->getPatientService()->getData(uid);
81 QAction* action =
new QAction(
qstring_cast(data->getName()), parent);
83 if (boost::dynamic_pointer_cast<Image>(data))
84 action->setIcon(QIcon(
":/icons/volume.png"));
85 else if (boost::dynamic_pointer_cast<Mesh>(data))
86 action->setIcon(QIcon(
":/icons/surface.png"));
87 else if (boost::dynamic_pointer_cast<DataMetric>(data))
88 action->setIcon(QIcon(
":/icons/metric.png"));
91 if (uid.contains(mLastDataActionUid))
93 action->setText(
" " + action->text());
98 mLastDataActionUid = uid;
102 action->setCheckable(
true);
103 std::vector<DataPtr> allVisible = mGroupData->getData(mProperties);
104 action->setChecked(std::count(allVisible.begin(), allVisible.end(), data));
105 connect(action, SIGNAL(triggered()),
this, SLOT(dataActionSlot()));
106 parent->addAction(action);
109 void DataViewPropertiesInteractor::dataActionSlot()
111 QAction* theAction =
static_cast<QAction*
>(sender());
115 QString uid = theAction->data().toString();
116 DataPtr data = mBackend->getPatientService()->getData(uid);
117 ImagePtr image = mBackend->getPatientService()->getData<Image>(data->getUid());
121 DataViewProperties old = mGroupData->getProperties(uid);
123 if (theAction->isChecked())
125 DataViewProperties props = old.addFlagsIn(mProperties);
126 mGroupData->setProperties(uid, props);
129 mBackend->getPatientService()->setActiveImage(image);
133 DataViewProperties props = old.removeFlagsIn(mProperties);
134 mGroupData->setProperties(uid, props);
139 Navigation(mBackend).centerToGlobalDataCenter();
140 mGroupData->requestInitialize();
162 std::vector<DataPtr> data =
mGroupData->getData();
163 for (
unsigned i = 0; i < data.size(); ++i)
182 contextMenu.exec(point);
188 connect(view.get(), SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
contextMenuSlot(
const QPoint &)));
194 return QStringList();
195 std::vector<DataPtr> data =
mGroupData->getData(properties);
198 for (
unsigned i = 0; i < data.size(); ++i)
203 QString line = data[i]->
getName();
205 ImagePtr image = boost::dynamic_pointer_cast<
Image>(data[i]);
208 if (image->getCropping())
209 line +=
" (cropped)";
210 if (!image->getAllClipPlanes().empty())
211 line +=
" (clipped)";
216 std::reverse(text.begin(), text.end());
QString qstring_cast(const T &val)
static DataViewProperties createSlice3D()
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
static DataViewProperties createDefault()
virtual void appendToContextMenu(QMenu &contextMenu)=0
boost::shared_ptr< DataMetric > DataMetricPtr
boost::shared_ptr< class Image > ImagePtr
void addDataActions(QWidget *parent)
DataViewPropertiesInteractorPtr mDataViewPropertiesInteractor
boost::shared_ptr< class View > ViewPtr
virtual void setViewGroup(ViewGroupDataPtr group)
boost::shared_ptr< class Data > DataPtr
virtual void videoSourceChangedSlot(QString uid)
std::vector< T > sortOnGroupsAndAcquisitionTime(std::map< QString, T > input)
virtual QString getName() const
ViewGroupDataPtr mGroupData
static DataViewProperties createFull()
virtual void dataViewPropertiesChangedSlot(QString uid)
QStringList getAllDataNames(DataViewProperties properties) const
void contextMenuSlot(const QPoint &point)
boost::shared_ptr< class CoreServices > CoreServicesPtr
DataViewPropertiesInteractorPtr mShow3DSlicesInteractor
DataViewPropertiesInteractor(CoreServicesPtr backend, ViewGroupDataPtr groupData)
void setDataViewProperties(DataViewProperties properties)
Base class for all Data Metrics.
void connectContextMenu(ViewPtr view)
ViewWrapper(CoreServicesPtr backend)