13 #define SMW_INFO MITK_INFO("widget.stdmulti") 38 #include <QMouseEvent> 42 #include <vtkSmartPointer.h> 52 , m_PendingCrosshairPositionEvent(false)
68 m_DecorationColorWidget4[0] = 1.0f;
69 m_DecorationColorWidget4[1] = 1.0f;
70 m_DecorationColorWidget4[2] = 0.0f;
81 m_PlaneNode1->SetProperty(
"layer", layer);
88 m_PlaneNode2->SetProperty(
"layer", layer);
95 m_PlaneNode3->SetProperty(
"layer", layer);
98 m_ParentNodeForGeometryPlanes =
101 m_ParentNodeForGeometryPlanes->SetProperty(
"layer", layer);
108 if (
nullptr != displayActionEventHandler)
110 displayActionEventHandler->InitActions();
116 if (
"axial" == widgetName)
121 if (
"sagittal" == widgetName)
126 if (
"coronal" == widgetName)
131 if (
"3d" == widgetName)
161 if ((plane1 !=
nullptr) && (plane2 !=
nullptr)
176 if (m_PlaneNode1.IsNotNull())
178 m_PlaneNode1->SetVisibility(visible);
180 if (m_PlaneNode2.IsNotNull())
182 m_PlaneNode2->SetVisibility(visible);
184 if (m_PlaneNode3.IsNotNull())
186 m_PlaneNode3->SetVisibility(visible);
194 bool crosshairVisibility =
true;
196 if (m_PlaneNode1.IsNotNull())
198 bool visibilityProperty =
false;
199 m_PlaneNode1->GetVisibility(visibilityProperty,
nullptr);
200 crosshairVisibility &= visibilityProperty;
203 if (m_PlaneNode2.IsNotNull())
205 bool visibilityProperty =
false;
206 crosshairVisibility &= m_PlaneNode2->GetVisibility(visibilityProperty,
nullptr);
207 crosshairVisibility &= visibilityProperty;
210 if (m_PlaneNode3.IsNotNull())
212 bool visibilityProperty =
false;
213 crosshairVisibility &= m_PlaneNode3->GetVisibility(visibilityProperty,
nullptr);
214 crosshairVisibility &= visibilityProperty;
217 return crosshairVisibility;
223 if (
nullptr == dataStorage)
235 MITK_DEBUG <<
"Changing crosshair mode to " << userMode;
256 return m_TimeNavigationController;
262 if (
nullptr == dataStorage)
267 if (m_PlaneNode1.IsNotNull() && m_PlaneNode2.IsNotNull()
268 && m_PlaneNode3.IsNotNull() && m_ParentNodeForGeometryPlanes.IsNotNull())
270 dataStorage->Add(m_ParentNodeForGeometryPlanes);
271 dataStorage->Add(m_PlaneNode1, m_ParentNodeForGeometryPlanes);
272 dataStorage->Add(m_PlaneNode2, m_ParentNodeForGeometryPlanes);
273 dataStorage->Add(m_PlaneNode3, m_ParentNodeForGeometryPlanes);
280 if (
nullptr == dataStorage)
285 if (m_PlaneNode1.IsNotNull() && m_PlaneNode2.IsNotNull()
286 && m_PlaneNode3.IsNotNull() && m_ParentNodeForGeometryPlanes.IsNotNull())
288 dataStorage->Remove(m_PlaneNode1);
289 dataStorage->Remove(m_PlaneNode2);
290 dataStorage->Remove(m_PlaneNode3);
291 dataStorage->Remove(m_ParentNodeForGeometryPlanes);
297 if (!m_PendingCrosshairPositionEvent)
299 m_PendingCrosshairPositionEvent =
true;
317 MITK_ERROR <<
"Requested unknown render window";
370 MITK_ERROR <<
"Requested unknown render window";
379 switch (widgetNumber)
382 if (m_PlaneNode1.IsNotNull())
384 m_PlaneNode1->SetColor(color);
388 if (m_PlaneNode2.IsNotNull())
390 m_PlaneNode2->SetColor(color);
394 if (m_PlaneNode3.IsNotNull())
396 m_PlaneNode3->SetColor(color);
400 m_DecorationColorWidget4 = color;
403 MITK_ERROR <<
"Decoration color for unknown widget!";
415 float tmp[3] = { 0.0f, 0.0f, 0.0f };
416 switch (widgetNumber)
420 if (m_PlaneNode1.IsNotNull())
422 if (m_PlaneNode1->GetColor(tmp))
424 return dynamic_cast<mitk::ColorProperty *
>(m_PlaneNode1->GetProperty(
"color"))->GetColor();
427 float red[3] = { 0.753f, 0.0f, 0.0f };
432 if (m_PlaneNode2.IsNotNull())
434 if (m_PlaneNode2->GetColor(tmp))
436 return dynamic_cast<mitk::ColorProperty *
>(m_PlaneNode2->GetProperty(
"color"))->GetColor();
439 float green[3] = { 0.0f, 0.69f, 0.0f };
444 if (m_PlaneNode3.IsNotNull())
446 if (m_PlaneNode3->GetColor(tmp))
448 return dynamic_cast<mitk::ColorProperty *
>(m_PlaneNode3->GetProperty(
"color"))->GetColor();
451 float blue[3] = { 0.0, 0.502f, 1.0f };
456 return m_DecorationColorWidget4;
459 MITK_ERROR <<
"Decoration color for unknown widget!";
460 float black[3] = { 0.0f, 0.0f, 0.0f };
467 if (QEvent::MouseButtonPress != e->type())
473 if (
nullptr == renderWindowWidget)
484 QWidget::moveEvent(e);
499 if (
nullptr == dataStorage)
504 m_PendingCrosshairPositionEvent =
false;
508 mitk::DataStorage::SetOfObjects::ConstPointer nodes = dataStorage->GetSubset(isImageData).GetPointer();
511 auto globalCurrentTimePoint = baseRenderer->
GetTime();
516 bool isBinary =
false;
519 if (node.IsNotNull())
521 node->GetBoolProperty(
"binary", isBinary);
524 mitk::DataStorage::SetOfObjects::ConstPointer sourcenodes = dataStorage->GetSources(node,
nullptr,
true);
525 if (!sourcenodes->empty())
529 if (topSourceNode.IsNotNull())
531 image =
dynamic_cast<mitk::Image *
>(topSourceNode->GetData());
532 topSourceNode->GetIntProperty(
"Image.Displayed Component", component);
536 image =
dynamic_cast<mitk::Image *
>(node->GetData());
537 node->GetIntProperty(
"Image.Displayed Component", component);
542 image =
dynamic_cast<mitk::Image *
>(node->GetData());
543 node->GetIntProperty(
"Image.Displayed Component", component);
547 std::string statusText;
548 std::stringstream stream;
550 unsigned int timestep = baseRenderer->
GetTimeStep();
552 if (image.IsNotNull() && (image->GetTimeSteps() > timestep))
554 image->GetGeometry()->WorldToIndex(crosshairPos, p);
556 stream <<
"Position: <" << std::fixed << crosshairPos[0] <<
", " << std::fixed << crosshairPos[1] <<
", " 557 << std::fixed << crosshairPos[2] <<
"> mm";
558 stream <<
"; Index: <" << p[0] <<
", " << p[1] <<
", " << p[2] <<
"> ";
563 image->GetChannelDescriptor().GetPixelType(),
565 image->GetVolumeData(image->GetTimeGeometry()->TimePointToTimeStep(globalCurrentTimePoint)),
570 if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01)
572 stream <<
"; Time: " << globalCurrentTimePoint <<
" ms; Pixelvalue: " << std::scientific << pixelValue <<
" ";
576 stream <<
"; Time: " << globalCurrentTimePoint <<
" ms; Pixelvalue: " << pixelValue <<
" ";
581 stream <<
"No image information at this position!";
584 statusText = stream.str();
590 vtkSmartPointer<vtkRenderer> vtkrenderer;
592 if (
nullptr != vtkrenderer)
594 vtkrenderer->ResetCamera();
598 if (
nullptr != vtkrenderer)
600 vtkrenderer->ResetCamera();
604 if (
nullptr != vtkrenderer)
606 vtkrenderer->ResetCamera();
610 if (
nullptr != vtkrenderer)
612 vtkrenderer->ResetCamera();
620 int w = vtkObject::GetGlobalWarningDisplay();
621 vtkObject::GlobalWarningDisplayOff();
623 vtkObject::SetGlobalWarningDisplay(w);
673 if (pointOnDisplay[0] < renderer->
GetVtkRenderer()->GetOrigin()[0] ||
687 if (
nullptr != dataStorage)
690 if (dataNode !=
nullptr)
699 if (m_PlaneNode1.IsNotNull())
701 m_PlaneNode1->SetVisibility(visible, renderer);
703 if (m_PlaneNode2.IsNotNull())
705 m_PlaneNode2->SetVisibility(visible, renderer);
707 if (m_PlaneNode3.IsNotNull())
709 m_PlaneNode3->SetVisibility(visible, renderer);
717 void QmitkStdMultiWidget::SetLayoutImpl()
719 CreateRenderWindowWidgets();
727 void QmitkStdMultiWidget::CreateRenderWindowWidgets()
732 auto renderWindow1 = renderWindowWidget1->GetRenderWindow();
735 renderWindowWidget1->SetCornerAnnotationText(
"Axial");
742 auto renderWindow2 = renderWindowWidget2->GetRenderWindow();
745 renderWindowWidget2->setStyleSheet(
"border: 0px");
746 renderWindowWidget2->SetCornerAnnotationText(
"Sagittal");
753 auto renderWindow3 = renderWindowWidget3->GetRenderWindow();
756 renderWindowWidget3->SetCornerAnnotationText(
"Coronal");
763 auto renderWindow4 = renderWindowWidget4->GetRenderWindow();
766 renderWindowWidget4->SetCornerAnnotationText(
"3D");
778 renderWindow1->GetSliceNavigationController()->ConnectGeometrySendEvent(
782 renderWindow1->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController,
false);
783 renderWindow2->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController,
false);
784 renderWindow3->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController,
false);
mitk::ScalarType FastSinglePixelAccess(mitk::PixelType, mitk::Image::Pointer im, ImageDataItem *item, itk::Index< 3 > idx, mitk::ScalarType &val, int component=0)
void LayoutDesignChanged(QmitkRenderWindowMenu::LayoutDesign)
ScalarType GetTime() const
Get the time in ms of the currently displayed content.
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
virtual DataNode * GetCurrentWorldPlaneGeometryNode()
Get a DataNode pointing to a data object containing the current 2D-worldgeometry. ...
void Disconnect(T *receiver)
void SelectSliceByPoint(const mitk::Point3D &point)
Positions the SNC according to the specified point.
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
vtkRenderer * GetVtkRenderer() const
TimeGeometry::ConstPointer ComputeBoundingGeometry3D(const SetOfObjects *input, const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr) const
Compute the axis-parallel bounding geometry of the input objects.
Organizes the rendering process.
bool IntersectionPoint(const Line3D &line, Point3D &intersectionPoint) const
Calculate intersection point between the plane and a line.
virtual const PlaneGeometry * GetCurrentWorldPlaneGeometry()
Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering.
Constants for most interaction classes, due to the generic StateMachines.
virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const
Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 2D point in mm (pt2d_m...
const SliceNavigationController * GetTimeNavigationController() const
void WorldToDisplay(const Point3D &worldIndex, Point2D &displayPoint) const
This method converts a 3D world index to the display point using the geometry of the renderWindow...
Controls the selection of the slice the associated BaseRenderer will display.
The ColorProperty class RGB color property.
bool IntersectionLine(const PlaneGeometry *plane, Line3D &crossline) const
Calculate the intersecting line of two planes.
void ConnectGeometryTimeEvent(T *receiver, bool connectSendEvent=true)
static RenderingManager * GetInstance()
virtual unsigned int GetTimeStep() const
virtual CameraController * GetCameraController()
void CrosshairRotationModeChanged(int)
Image class for storing images.
const mitk::PlaneGeometry * GetCurrentPlaneGeometry()
Returns the currently selected Plane in the current BaseGeometry (if existent).
MITK implementation of the QVTKWidget.
virtual int * GetViewportSize() const
void CrosshairVisibilityChanged(bool)
mitk::Image::Pointer image
Point< ScalarType, 3 > Point3D
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
static StatusBar * GetInstance()
static method to get the GUI dependent StatusBar-instance so the methods DisplayText, etc. can be called No reference counting, cause of decentral static use!
void DisplayGreyValueText(const char *t)
ViewDirection
Possible view directions for render windows.
virtual mitk::SliceNavigationController * GetSliceNavigationController()
#define mitkPixelTypeMultiplex5(function, ptype, param1, param2, param3, param4, param5)
Describes a two-dimensional, rectangular plane.
mitk::SliceNavigationController * m_TimeNavigationController
MITKCORE_EXPORT DataNode::Pointer FindTopmostVisibleNode(const DataStorage::SetOfObjects::ConstPointer nodes, const Point3D worldPosition, const TimePointType timePoint, const BaseRenderer *baseRender)
returns the topmost visible node of a given list of nodes. The function returns a node that is visibl...
BaseRenderer * GetRenderer() const
Gets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used ...
void MoveCameraToPoint(const Point2D &planePoint)
MoveCameraToPoint Move camera so that the point on the plane is in the view center.
void Fit()
Fit Adjust the camera, so that the world bounding box is fully visible.
virtual void InitializeViewsByBoundingObjects(const DataStorage *)
Initializes the renderwindows by the aggregated geometry of all objects that are held in the data sto...
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
const char * GetName() const
get the name of the Renderer
Class for nodes of the DataTree.