Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkFiberBundleThreadMonitorMapper3D.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 
20 #include <mitkProperties.h>
21 #include <vtkPropAssembly.h>
22 //#include <vtkTextActor.h>
23 #include <vtkTextProperty.h>
24 
25 
26 
27 
29 : m_FiberMonitorMapper(vtkSmartPointer<vtkPolyDataMapper>::New())
30 , m_TextActorClose(vtkSmartPointer<vtkTextActor>::New())
31 , m_TextActorOpen(vtkSmartPointer<vtkTextActor>::New())
32 , m_TextActorHeading(vtkSmartPointer<vtkTextActor>::New())
33 , m_TextActorMask(vtkSmartPointer<vtkTextActor>::New())
34 , m_TextActorStatus(vtkSmartPointer<vtkTextActor>::New())
35 , m_TextActorStarted(vtkSmartPointer<vtkTextActor>::New())
36 , m_TextActorFinished(vtkSmartPointer<vtkTextActor>::New())
37 , m_TextActorTerminated(vtkSmartPointer<vtkTextActor>::New())
38 , m_FiberAssembly(vtkPropAssembly::New())
39 , m_lastModifiedMonitorNodeTime(-1)
40 {
49 
50 }
51 
52 
54 {
55  m_FiberAssembly->Delete();
56 }
57 
58 
60 {
61  return static_cast<const mitk::FiberBundleThreadMonitor * > ( GetDataNode()->GetData() );
62 }
63 
64 
65 /*
66  This method is called once the mapper gets new input,
67  for UI rotation or changes in colorcoding this method is NOT called
68  */
70 {
71  bool visible = true;
72  GetDataNode()->GetVisibility(visible, renderer, "visible");
73 
74  if ( !visible ) return;
75 
76  const DataNode *node = this->GetDataNode();
77 
78  if (m_lastModifiedMonitorNodeTime >= node->GetMTime())
79  return;
80 
81  m_lastModifiedMonitorNodeTime = node->GetMTime();
82 
83  // MITK_INFO << m_LastUpdateTime;
84  FiberBundleThreadMonitor* monitor = dynamic_cast<FiberBundleThreadMonitor * > ( GetDataNode()->GetData() );
85 
86 // m_TextActor->SetInput( monitor->getTextL1().toStdString().c_str() );
87  m_TextActorClose->SetInput( monitor->getBracketClose().toStdString().c_str() );
88  vtkTextProperty* tpropClose = m_TextActorClose->GetTextProperty();
89  //tprop->SetFontFamilyToArial ();
90  //tprop->SetLineSpacing(1.0);
91  tpropClose->SetFontSize(16);
92  tpropClose->SetColor(0.85,0.8,0.8);
93  m_TextActorClose->SetDisplayPosition( monitor->getBracketClosePosition()[0], monitor->getBracketClosePosition()[1] );
94  //m_TextActorClose->Modified();
95 
96 
97  m_TextActorOpen->SetInput( monitor->getBracketOpen().toStdString().c_str() );
98  vtkTextProperty* tpropOpen = m_TextActorOpen->GetTextProperty();
99  //tprop->SetFontFamilyToArial ();
100  //tprop->SetLineSpacing(1.0);
101  tpropOpen->SetFontSize(16);
102  tpropOpen->SetColor(0.85,0.8,0.8);
103  m_TextActorOpen->SetDisplayPosition( monitor->getBracketOpenPosition()[0], monitor->getBracketOpenPosition()[1] );
104  //m_TextActorOpen->Modified();
105 
106 
107  m_TextActorHeading->SetInput( monitor->getHeading().toStdString().c_str() );
108  vtkTextProperty* tpropHeading = m_TextActorHeading->GetTextProperty();
109  tpropHeading->SetFontSize(12);
110  tpropHeading->SetOpacity( monitor->getHeadingOpacity() * 0.1 );
111  tpropHeading->SetColor(0.85,0.8,0.8);
112  m_TextActorHeading->SetDisplayPosition( monitor->getHeadingPosition()[0], monitor->getHeadingPosition()[1] );
113  //m_TextActorHeading->Modified();
114 
115 
116  m_TextActorMask->SetInput( monitor->getMask().toStdString().c_str() );
117  vtkTextProperty* tpropMask = m_TextActorMask->GetTextProperty();
118  tpropMask->SetFontSize(12);
119  tpropMask->SetOpacity( monitor->getMaskOpacity() * 0.1 );
120  tpropMask->SetColor(1.0,1.0,1.0);
121  m_TextActorMask->SetDisplayPosition( monitor->getMaskPosition()[0], monitor->getMaskPosition()[1] );
122  //m_TextActorHeading->Modified();
123 
124 
125  m_TextActorStatus->SetInput(monitor->getStatus().toStdString().c_str());
126  vtkTextProperty* tpropStatus = m_TextActorStatus->GetTextProperty();
127  tpropStatus->SetFontSize(10);
128  tpropStatus->SetOpacity( monitor->getStatusOpacity() * 0.1 );
129  tpropStatus->SetColor(0.85,0.8,0.8);
130  m_TextActorStatus->SetDisplayPosition( monitor->getStatusPosition()[0], monitor->getStatusPosition()[1] );
131  //m_TextActorStatus->Modified();
132 
133  m_TextActorStarted->SetInput(QString::number(monitor->getStarted()).toStdString().c_str());
134  vtkTextProperty* tpropStarted = m_TextActorStarted->GetTextProperty();
135  tpropStarted->SetFontSize(12);
136  tpropStarted->SetOpacity( monitor->getStartedOpacity() * 0.1 );
137  tpropStarted->SetColor(0.0,1.0,0.0);
138  m_TextActorStarted->SetDisplayPosition( monitor->getStartedPosition()[0], monitor->getStartedPosition()[1] );
139  //m_TextActorStarted->Modified();
140 
141  m_TextActorFinished->SetInput(QString::number(monitor->getFinished()).toStdString().c_str());
142  vtkTextProperty* tpropFinished = m_TextActorFinished->GetTextProperty();
143  tpropFinished->SetFontSize(12);
144  tpropFinished->SetOpacity( monitor->getFinishedOpacity() * 0.1 );
145  tpropFinished->SetColor(1.0,1.0,1.0);
146  m_TextActorFinished->SetDisplayPosition( monitor->getFinishedPosition()[0], monitor->getFinishedPosition()[1] );
147  //m_TextActorFinished->Modified();
148 
149  m_TextActorTerminated->SetInput(QString::number(monitor->getTerminated()).toStdString().c_str());
150  vtkTextProperty* tpropTerminated = m_TextActorTerminated->GetTextProperty();
151  tpropTerminated->SetFontSize(12);
152  tpropTerminated->SetOpacity( monitor->getTerminatedOpacity() * 0.1 );
153  tpropTerminated->SetColor(1.0,1.0,1.0);
154  m_TextActorTerminated->SetDisplayPosition( monitor->getTerminatedPosition()[0], monitor->getTerminatedPosition()[1] );
155  //m_TextActorTerminated->Modified();
156 
157 
158  // Calculate time step of the input data for the specified renderer (integer value)
159  // this method is implemented in mitkMapper
160 // this->CalculateTimeStep( renderer );
161 
162 
163 }
164 
165 
167 {
168 
169 // MITK_INFO << "FiberBundlexXXMapper3D()SetDefaultProperties";
170 
171 
172  Superclass::SetDefaultProperties(node, renderer, overwrite);
173 
174 
175 
176 }
177 
179 {
180  //MITK_INFO << "FiberBundlexXXMapper3D()GetVTKProp";
181  //this->GenerateData();
182  return m_FiberAssembly;
183 
184 }
185 
187 {
188 // MITK_INFO << "FiberBundleXXXMapper3D ApplyProperties(renderer)";
189 }
190 
192 {
193 // MITK_INFO << "FiberBundlexxXMapper3D UpdateVtkObjects()";
194 
195 
196 }
197 
199 {
200 
201 
202 
203 }
204 
205 
206 
static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer=NULL, bool overwrite=false)
Organizes the rendering process.
virtual unsigned long GetMTime() const override
Get the timestamp of the last change of the contents of this node or the referenced BaseData...
Base Class for Fiber Bundles;.
virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer)
Generate the data needed for rendering into renderer.
virtual vtkProp * GetVtkProp(mitk::BaseRenderer *renderer)
virtual void ApplyProperties(mitk::BaseRenderer *renderer)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.