27 #include <QMessageBox>
41 QListView::setAlternatingRowColors(
true);
43 QListView::setSelectionBehavior(QAbstractItemView::SelectRows);
44 QListView::setSelectionMode(QAbstractItemView::SingleSelection);
46 QString tooltip = QString(
"Use the F2/F3 keys to move a point up/down, the Del key to remove a point\nand the mouse "
47 "wheel to change the timestep.\n\nTimeStep:\t%1")
49 QListView::setToolTip(tooltip);
50 this->setContextMenuPolicy(Qt::CustomContextMenu);
53 QFont font(
"Arial", 17);
56 this->setMinimumHeight(40);
58 this->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
62 connect(
this, SIGNAL(doubleClicked(
const QModelIndex &)),
this, SLOT(
OnPointDoubleClicked(
const QModelIndex &)));
64 connect(QListView::selectionModel(),
65 SIGNAL(selectionChanged(
const QItemSelection &,
const QItemSelection &)),
69 connect(
this, SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
ctxMenu(
const QPoint &)));
104 _EditPointDialog.exec();
110 if (pointSet == NULL)
119 MITK_ERROR <<
"Point set has multiple selected points. This view is not designed for more than one selected point.";
124 if (selectedIndex == -1)
134 if (modelIndexOkay ==
true)
135 QListView::selectionModel()->select(index, QItemSelectionModel::ClearAndSelect);
143 const QItemSelection & )
150 if (pointSet == NULL)
157 QModelIndexList selectedIndexes = selected.indexes();
159 for (mitk::PointSet::PointsContainer::Iterator it =
167 if (selectedIndexes.indexOf(index) != -1)
193 for (std::set<mitk::SliceNavigationController *>::const_iterator i =
m_Sncs.begin(); i !=
m_Sncs.end(); ++i)
195 (*i)->SelectSliceByPoint(p);
241 int whe =
event->delta();
243 unsigned int numberOfTS = ps->GetTimeSteps();
250 if ((currentTS + 1 >= (
int)numberOfTS))
257 if ((currentTS <= 0))
262 QString tooltip = QString(
"Use the F2/F3 keys to move a point up/down, the Del key to remove a point\nand the mouse "
263 "wheel to change the timestep.\n\nTimeStep:\t%1")
265 this->setToolTip(tooltip);
273 QWidget *m_TimeStepFader =
new QWidget(
this);
274 QHBoxLayout *layout =
new QHBoxLayout(m_TimeStepFader);
276 int x = (int)(this->geometry().x() + this->width() * 0.6);
277 int y = (int)(this->geometry().y() + this->height() * 0.8);
278 m_TimeStepFader->move(x, y);
279 m_TimeStepFader->resize(60, 55);
280 m_TimeStepFader->setLayout(layout);
281 m_TimeStepFader->setAttribute(Qt::WA_DeleteOnClose);
291 QColor semiTransparentColor(139, 192, 223, 50);
292 QColor labelTransparentColor(0, 0, 0, 200);
299 m_TimeStepFader->show();
313 QMenu *
menu =
new QMenu;
316 QAction *showFading =
new QAction(
this);
317 showFading->setCheckable(
false);
318 showFading->setEnabled(
false);
319 showFading->setText(
"Fade TimeStep");
320 connect(showFading, SIGNAL(triggered(
bool)),
this, SLOT(
SetFading(
bool)));
321 menu->addAction(showFading);
324 QAction *clearList =
new QAction(
this);
325 clearList->setText(
"Clear List");
326 connect(clearList, SIGNAL(triggered()),
this, SLOT(
ClearPointList()));
327 menu->addAction(clearList);
330 QAction *clearTS =
new QAction(
this);
331 clearTS->setText(
"Clear current time step");
333 menu->addAction(clearTS);
335 menu->exec(this->mapToGlobal(pos));
348 if (curPS->GetSize() == 0)
351 switch (QMessageBox::question(
this,
353 tr(
"Remove all points from the displayed list?"),
354 QMessageBox::Yes | QMessageBox::No,
357 case QMessageBox::Yes:
361 while (!curPS->IsEmptyTimeStep(0))
363 curPsPoints = curPS->GetPointSet()->GetPoints();
364 it = curPsPoints->Begin();
365 curPS->SetSelectInfo(it->Index(),
true);
371 case QMessageBox::No:
DataType::PointsContainerIterator PointsIterator
A dialog for editing points directly (coordinates) via TextEdits.
void SetMultiWidget(QmitkStdMultiWidget *multiWidget)
If Multiwidget is set, the crosshair is automatically centering to the selected point As an alternati...
void AddSliceNavigationController(mitk::SliceNavigationController *snc)
Add a mitk::SliceNavigationController instance.
void RemoveSelectedPoint()
QmitkPointListView(QWidget *parent=0)
void SelectSliceByPoint(const mitk::Point3D &point)
Positions the SNC according to the specified point.
void OnPointDoubleClicked(const QModelIndex &index)
Filtering double click event for editing point coordinates via a dialog.
QLabel * m_TimeStepFaderLabel
void wheelEvent(QWheelEvent *event) override
change timestep of the current pointset by mouse wheel
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.
mitk::SliceNavigationController * m_Snc3
void MoveSelectedPointUp()
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by it...
void SetTimeStep(int t)
which time step to display/model
mitk::SliceNavigationController * m_Snc1
virtual void SetSelectInfo(int position, bool selected, int t=0)
void SetSnc3(mitk::SliceNavigationController *snc)
Sets the SliceNavigationController of the three 2D Renderwindows. If they are defined, they can be used to automatically set the crosshair to the selected point.
Controls the selection of the slice the associated BaseRenderer will display.
void SetPointSetNode(mitk::DataNode *pointSetNode)
which point set to work on
DataType::PointIdentifier PointIdentifier
std::set< mitk::SliceNavigationController * > m_Sncs
void SetSnc1(mitk::SliceNavigationController *snc)
Sets the SliceNavigationController of the three 2D Renderwindows. If they are defined, they can be used to automatically set the crosshair to the selected point.
bool GetPointForModelIndex(const QModelIndex &index, mitk::PointSet::PointType &p, mitk::PointSet::PointIdentifier &id) const
get point and point ID that correspond to a given QModelIndex
QmitkPointListModel * m_PointListModel
int GetTimeStep() const
which time step to display/model
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual DataType::Pointer GetPointSet(int t=0) const
returns the pointset
static RenderingManager * GetInstance()
The custom viewer plugin implements simple viewer functionality presented in a customized look and feel It was developed to demonstrate extensibility and customizability of the blueberry application framework As an example for the GUI customization capabilities provided by the BlueBerry application the custom viewer plugin was developed It features simple viewer functionality presented in a customized look and feel The custom viewer consists of two i e a viewer perspective and a DICOM perspective As part of the viewer an instance of QmitkDataManagerView allows for data selection Visualization of the selected data is then performed by a simple render window view According data can either be directly loaded from file or be imported as DICOM data DICOM import functionality is accessible from the DICOM perspective incorporating the QmitkDicomExternalDataWidget The customization of Qt Stylesheets is used to give the application a non native look and feel This is further emphasized by a Tab Widget like unification of the perspectives with the according perspective bar In addition to an absence of menu
void SetSnc2(mitk::SliceNavigationController *snc)
Sets the SliceNavigationController of the three 2D Renderwindows. If they are defined, they can be used to automatically set the crosshair to the selected point.
virtual int SearchSelectedPoint(int t=0) const
searches a selected point and returns the id of that point. If no point is found, then -1 is returned...
void SetFading(bool onOff)
Turn TimeStep Fading On/Off.
void OnListViewSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
called when the selection of the view widget changes
DataType::PointsContainer PointsContainer
void MoveSelectedPointDown()
mitk::SliceNavigationController * m_Snc2
virtual int GetNumberOfSelected(int t=0) const
returns the number of selected points
void ClearPointListTS()
delete all points in the list in the current timestep
QmitkStdMultiWidget * GetMultiWidget() const
return the QmitkStdMultiWidget that is used for updating render window crosshair
void OnPointSetSelectionChanged()
called when the point set data structure changes
const mitk::PointSet * GetPointSet() const
which point set to work on
void keyPressEvent(QKeyEvent *e) override
react to F2, F3 and DEL keys
bool GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex &index) const
returns a QModelIndex for a given point ID
void ClearPointList()
Delete all points in the list.
QmitkStdMultiWidget * m_MultiWidget
used to position the planes on a selected point
void ctxMenu(const QPoint &pos)
open ContextMenu
void fadeTimeStepOut()
fade the shown timestep out
mitk::PointSet * GetPointSet() const
which point set to work on
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
void SetPointSetNode(mitk::DataNode *pointSetNode)
assign a point set for observation
Class for nodes of the DataTree.
void fadeTimeStepIn()
fade a label with the currently shown timestep in
void SignalPointSelectionChanged()
this signal is emmitted, if the selection of a point in the pointset is changed
void RemoveSliceNavigationController(mitk::SliceNavigationController *snc)
Remove a mitk::SliceNavigationController instance.
void SetPoint(mitk::PointSet *_PointSet, mitk::PointSet::PointIdentifier _PointId, int timestep=0)