17 #define SMW_INFO MITK_INFO("widget.stdmulti")
21 #include <QGridLayout>
22 #include <QHBoxLayout>
24 #include <QMouseEvent>
26 #include <QVBoxLayout>
27 #include <qsplitter.h>
46 #include <vtkCornerAnnotation.h>
48 #include <vtkTextProperty.h>
62 levelWindowWidget(NULL),
63 QmitkStdMultiWidgetLayout(NULL),
64 m_Layout(LAYOUT_DEFAULT),
65 m_PlaneMode(PLANE_MODE_SLICING),
66 m_RenderingManager(renderingManager),
67 m_GradientBackgroundFlag(true),
73 mitkWidget1Container(NULL),
74 mitkWidget2Container(NULL),
75 mitkWidget3Container(NULL),
76 mitkWidget4Container(NULL),
77 m_PendingCrosshairPositionEvent(false),
78 m_CrosshairNavigationEnabled(false)
139 mitkWidgetLayout1->setMargin(0);
140 mitkWidgetLayout2->setMargin(0);
141 mitkWidgetLayout3->setMargin(0);
142 mitkWidgetLayout4->setMargin(0);
208 QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
209 sizePolicy.setHorizontalStretch(0);
210 sizePolicy.setVerticalStretch(0);
211 sizePolicy.setHeightForWidth(
levelWindowWidget->sizePolicy().hasHeightForWidth());
222 this->resize(QSize(364, 477).expandedTo(minimumSizeHint()));
236 float tmp1[3] = {0.098f, 0.098f, 0.098f};
238 float tmp2[3] = {0.498f, 0.498f, 0.498f};
320 renderer4->GetOverlayManager()->AddOverlay(
m_LogoRendering.GetPointer(), renderer4);
326 for (
unsigned int i = 0; i < 4; ++i)
328 float black[3] = {0.0f, 0.0f, 0.0f};
335 if (widgetNumber > 3)
337 MITK_ERROR <<
"Decoration color for unknown widget!";
338 float black[3] = {0.0f, 0.0f, 0.0f};
351 float tmp[3] = {0.0f, 0.0f, 0.0f};
352 switch (widgetNumber)
363 float red[3] = {0.753f, 0.0f, 0.0f};
375 float green[3] = {0.0f, 0.69f, 0.0f};
387 float blue[3] = {0.0, 0.502f, 1.0f};
395 MITK_ERROR <<
"Decoration color for unknown widget!";
396 float black[3] = {0.0f, 0.0f, 0.0f};
403 if (widgetNumber > 3)
405 MITK_ERROR <<
"Decoration color for unknown widget!";
406 return std::string(
"");
454 SMW_INFO <<
"changing layout to 2D images up... " << std::endl;
488 QList<int> splitterSize;
489 splitterSize.push_back(1000);
490 splitterSize.push_back(1000);
491 splitterSize.push_back(1000);
498 splitterSize.clear();
499 splitterSize.push_back(400);
500 splitterSize.push_back(1000);
531 SMW_INFO <<
"changing layout to 2D images left... " << std::endl;
562 QList<int> splitterSize;
563 splitterSize.push_back(1000);
564 splitterSize.push_back(1000);
565 splitterSize.push_back(1000);
571 splitterSize.clear();
572 splitterSize.push_back(400);
573 splitterSize.push_back(1000);
604 if (widgetNumber > 3)
606 MITK_ERROR <<
"Unknown render window for annotation.";
613 annotation->SetText(0, text.c_str());
614 annotation->SetMaximumFontSize(12);
615 annotation->GetTextProperty()->SetColor(color[0], color[1], color[2]);
616 if (!renderer->HasViewProp(annotation))
618 renderer->AddViewProp(annotation);
620 vtkSmartPointer<vtkMitkRectangleProp> frame =
m_RectangleProps[widgetNumber];
621 frame->SetColor(color[0], color[1], color[2]);
622 if (!renderer->HasViewProp(frame))
624 renderer->AddViewProp(frame);
630 for (
int i = 0; i < 4; ++i)
654 MITK_ERROR <<
"Requested unknown render window";
662 SMW_INFO <<
"changing layout to default... " << std::endl;
695 QList<int> splitterSize;
696 splitterSize.push_back(1000);
697 splitterSize.push_back(1000);
729 SMW_INFO <<
"changing layout to big 3D ..." << std::endl;
774 SMW_INFO <<
"changing layout to big Widget1 ..." << std::endl;
820 SMW_INFO <<
"changing layout to big Widget2 ..." << std::endl;
865 SMW_INFO <<
"changing layout to big Widget3 ..." << std::endl;
910 SMW_INFO <<
"changing layout to Widget3 and 4 in a Row..." << std::endl;
936 QList<int> splitterSize;
937 splitterSize.push_back(1000);
938 splitterSize.push_back(1000);
966 SMW_INFO <<
"changing layout to Widget3 and 4 in one Column..." << std::endl;
992 QList<int> splitterSize;
993 splitterSize.push_back(1000);
994 splitterSize.push_back(1000);
1022 SMW_INFO <<
"changing layout to Widget3 and 4 in a Row..." << std::endl;
1031 SMW_INFO <<
"changing layout to Widget3 and 4 in a Row..." << std::endl;
1063 QList<int> splitterSize;
1064 splitterSize.push_back(1000);
1065 splitterSize.push_back(1000);
1067 splitterSize.clear();
1068 splitterSize.push_back(500);
1069 splitterSize.push_back(1000);
1098 SMW_INFO <<
"changing layout to 2 x 2D and 3D Widget" << std::endl;
1129 QList<int> splitterSize;
1130 splitterSize.push_back(1000);
1131 splitterSize.push_back(1000);
1161 SMW_INFO <<
"changing layout to 2D and 3D left, 2D right Widget" << std::endl;
1192 QList<int> splitterSize;
1193 splitterSize.push_back(1000);
1194 splitterSize.push_back(1000);
1224 SMW_INFO <<
"changing layout to 2D up and 3D down" << std::endl;
1256 QList<int> splitterSize;
1260 splitterSize.clear();
1261 splitterSize.push_back(700);
1262 splitterSize.push_back(700);
1304 vtkSmartPointer<vtkRenderer> vtkrenderer;
1306 if (vtkrenderer != NULL)
1307 vtkrenderer->ResetCamera();
1310 if (vtkrenderer != NULL)
1311 vtkrenderer->ResetCamera();
1314 if (vtkrenderer != NULL)
1315 vtkrenderer->ResetCamera();
1318 if (vtkrenderer != NULL)
1319 vtkrenderer->ResetCamera();
1326 int w = vtkObject::GetGlobalWarningDisplay();
1327 vtkObject::GlobalWarningDisplayOff();
1329 vtkObject::SetGlobalWarningDisplay(w);
1431 QWidget::moveEvent(e);
1465 if ((plane1 != NULL) && (plane2 != NULL) && (plane1->
IntersectionLine(plane2, line)))
1492 if (pointOnDisplay[0] < renderer->
GetVtkRenderer()->GetOrigin()[0] ||
1493 pointOnDisplay[1] < renderer->
GetVtkRenderer()->GetOrigin()[1] ||
1525 int maxlayer = -32768;
1527 if (nodes.IsNotNull())
1531 for (
unsigned int x = 0; x < nodes->size(); x++)
1533 if ((nodes->at(x)->GetData()->GetGeometry() != NULL) &&
1534 nodes->at(x)->GetData()->GetGeometry()->IsInside(crosshairPos))
1537 if (!(nodes->at(x)->GetIntProperty(
"layer", layer)))
1539 if (layer > maxlayer)
1541 if (static_cast<mitk::DataNode::Pointer>(nodes->at(x))->IsVisible(baseRenderer))
1543 node = nodes->at(x);
1564 bool isBinary =
false;
1567 if (node.IsNotNull())
1569 node->GetBoolProperty(
"binary", isBinary);
1573 if (!sourcenodes->empty())
1577 if (topSourceNode.IsNotNull())
1579 image =
dynamic_cast<mitk::Image *
>(topSourceNode->GetData());
1580 topSourceNode->GetIntProperty(
"Image.Displayed Component", component);
1584 image =
dynamic_cast<mitk::Image *
>(node->GetData());
1585 node->GetIntProperty(
"Image.Displayed Component", component);
1590 image =
dynamic_cast<mitk::Image *
>(node->GetData());
1591 node->GetIntProperty(
"Image.Displayed Component", component);
1596 std::string statusText;
1597 std::stringstream stream;
1600 unsigned int timestep = baseRenderer->
GetTimeStep();
1602 if (image.IsNotNull() && (image->GetTimeSteps() > timestep))
1604 image->GetGeometry()->WorldToIndex(crosshairPos, p);
1605 stream.precision(2);
1606 stream <<
"Position: <" << std::fixed << crosshairPos[0] <<
", " << std::fixed << crosshairPos[1] <<
", "
1607 << std::fixed << crosshairPos[2] <<
"> mm";
1608 stream <<
"; Index: <" << p[0] <<
", " << p[1] <<
", " << p[2] <<
"> ";
1613 image->GetChannelDescriptor().GetPixelType(),
1615 image->GetVolumeData(baseRenderer->
GetTimeStep()),
1620 if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01)
1622 stream <<
"; Time: " << baseRenderer->
GetTime() <<
" ms; Pixelvalue: " << std::scientific << pixelValue <<
" ";
1626 stream <<
"; Time: " << baseRenderer->
GetTime() <<
" ms; Pixelvalue: " << pixelValue <<
" ";
1631 stream <<
"No image information at this position!";
1634 statusText = stream.str();
1652 for (
unsigned int i = 0; i < 4; ++i)
1661 for (
unsigned int i = 0; i < 4; ++i)
1735 MITK_DEBUG <<
"Changing crosshair mode to " << userMode;
1743 m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::MITK);
1746 m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::ROTATION);
1750 m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::ROTATIONLINKED);
1754 m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::SWIVEL);
1762 unsigned int widgetNumber)
1764 if (widgetNumber > 3)
1766 MITK_ERROR <<
"Gradientbackground for unknown widget!";
1772 renderer->SetBackground2(upper[0], upper[1], upper[2]);
1773 renderer->SetBackground(lower[0], lower[1], lower[2]);
1779 for (
unsigned int i = 0; i < 4; ++i)
1782 renderer->SetBackground2(upper[0], upper[1], upper[2]);
1783 renderer->SetBackground(lower[0], lower[1], lower[2]);
1822 switch (layoutDesignIndex)
1930 switch (widgetNumber)
1954 MITK_ERROR <<
"Decoration color for unknown widget!";
mitk::RenderWindow::Pointer mitkWidget4
mitk::ScalarType FastSinglePixelAccess(mitk::PixelType, mitk::Image::Pointer im, ImageDataItem *item, itk::Index< 3 > idx, mitk::ScalarType &val, int component=0)
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
void LayoutDesignListChanged(int layoutDesignIndex)
virtual DataNode * GetCurrentWorldPlaneGeometryNode()
Get a DataNode pointing to a data object containing the current 2D-worldgeometry. ...
Data management class that handles 'was created by' relations.
const SliceNavigationController * GetTimeNavigationController() const
Standard implementation of BaseGeometry.
void Disconnect(T *receiver)
void SelectSliceByPoint(const mitk::Point3D &point)
Positions the SNC according to the specified point.
bool IntersectionPoint(const Line3D &line, Point3D &intersectionPoint) const
Calculate intersection point between the plane and a line.
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)
BaseRenderer * GetRenderer() const
Gets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used ...
void HideRenderWindowMenu()
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...
mitk::RenderWindow::Pointer mitkWidget2
void SetLayoutIndex(unsigned int layoutIndex)
Organizes the rendering process.
ScalarType GetTime() const
Get the time in ms of the currently displayed content.
static mitk::DataStorage::Pointer GetDataStorage()
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 vtkRenderWindow * GetVtkRenderWindow() override
virtual void SetSliceRotationLocked(bool _arg)
Feature option to lock slice rotation.
Controls the selection of the slice the associated BaseRenderer will display.
itk::SmartPointer< const Self > ConstPointer
The ColorProperty class RGB color property.
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...
void ConnectGeometryTimeEvent(T *receiver, bool connectSendEvent=true)
void ConnectGeometrySendEvent(T *receiver)
mitk::RenderWindow::Pointer mitkWidget1
Example of a NON QT DEPENDENT MITK RENDERING APPLICATION.
void SetRenderWindowFocus(vtkRenderWindow *focusWindow)
Sets a flag to the given renderwindow to indicated that it has the focus e.g. has been clicked recent...
Manager for coordinating the rendering process.
bool GetActivateMenuWidgetFlag()
static RenderingManager * GetInstance()
virtual CameraController * GetCameraController()
Image class for storing images.
mitk::RenderWindow::Pointer mitkWidget3
const mitk::PlaneGeometry * GetCurrentPlaneGeometry()
Returns the currently selected Plane in the current BaseGeometry (if existent).
MITK implementation of the QVTKWidget.
virtual mitk::VtkPropRenderer * GetRenderer()
void ForceImmediateUpdate(vtkRenderWindow *renderWindow)
virtual int * GetViewportSize() const
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
virtual unsigned int GetTimeStep() const
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 RequestUpdate(vtkRenderWindow *renderWindow)
const char * GetName() const
get the name of the Renderer
bool IntersectionLine(const PlaneGeometry *plane, Line3D &crossline) const
Calculate the intersecting line of two planes.
void DisplayGreyValueText(const char *t)
virtual mitk::SliceNavigationController * GetSliceNavigationController()
void ActivateMenuWidget(bool state, QmitkStdMultiWidget *stdMultiWidget=0)
#define mitkPixelTypeMultiplex5(function, ptype, param1, param2, param3, param4, param5)
Describes a two-dimensional, rectangular plane.
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
US_USE_NAMESPACE std::string tmp1
mitk::SliceNavigationController * m_TimeNavigationController
virtual void SetSliceLocked(bool _arg)
Feature option to lock planes during mouse interaction. This option flag disables the mouse event whi...
void MoveCameraToPoint(const Point2D &planePoint)
MoveCameraToPoint Move camera so that the point on the plane is in the view center.
vtkRenderer * GetVtkRenderer() const
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)
Class for nodes of the DataTree.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.