Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkPlaneGeometryDataVtkMapper3D.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 #include "mitkImageVtkMapper2D.h"
17 #include "mitkNodePredicateOr.h"
19 #include "mitkSurface.h"
24 
25 #include <vtkAssembly.h>
26 #include <vtkDataSetMapper.h>
27 #include <vtkFeatureEdges.h>
28 #include <vtkHedgeHog.h>
29 #include <vtkImageData.h>
30 #include <vtkLinearTransform.h>
31 #include <vtkPolyData.h>
32 #include <vtkPolyDataMapper.h>
33 #include <vtkProp3DCollection.h>
34 #include <vtkProperty.h>
35 #include <vtkTransformPolyDataFilter.h>
36 #include <vtkTubeFilter.h>
37 
38 namespace mitk
39 {
41  {
42  m_EdgeTuber = vtkTubeFilter::New();
43  m_EdgeMapper = vtkPolyDataMapper::New();
44 
46  m_SurfaceCreatorBoundingBox = BoundingBox::New();
47  m_SurfaceCreatorPointsContainer = BoundingBox::PointsContainer::New();
48  m_Edges = vtkFeatureEdges::New();
49 
50  m_Edges->BoundaryEdgesOn();
51  m_Edges->FeatureEdgesOff();
52  m_Edges->NonManifoldEdgesOff();
53  m_Edges->ManifoldEdgesOff();
54 
55  m_EdgeTransformer = vtkTransformPolyDataFilter::New();
56  m_NormalsTransformer = vtkTransformPolyDataFilter::New();
57  m_EdgeActor = vtkActor::New();
58  m_BackgroundMapper = vtkPolyDataMapper::New();
59  m_BackgroundActor = vtkActor::New();
60  m_Prop3DAssembly = vtkAssembly::New();
61  m_ImageAssembly = vtkAssembly::New();
62 
64 
65  m_Cleaner = vtkCleanPolyData::New();
66 
67  m_Cleaner->PieceInvariantOn();
68  m_Cleaner->ConvertLinesToPointsOn();
69  m_Cleaner->ConvertPolysToLinesOn();
70  m_Cleaner->ConvertStripsToPolysOn();
71  m_Cleaner->PointMergingOn();
72 
73  // Make sure that the FeatureEdge algorithm is initialized with a "valid"
74  // (though empty) input
75  vtkPolyData *emptyPolyData = vtkPolyData::New();
76  m_Cleaner->SetInputData(emptyPolyData);
77  emptyPolyData->Delete();
78 
79  m_Edges->SetInputConnection(m_Cleaner->GetOutputPort());
80  m_EdgeTransformer->SetInputConnection(m_Edges->GetOutputPort());
81 
82  m_EdgeTuber->SetInputConnection(m_EdgeTransformer->GetOutputPort());
83  m_EdgeTuber->SetVaryRadiusToVaryRadiusOff();
84  m_EdgeTuber->SetNumberOfSides(12);
85  m_EdgeTuber->CappingOn();
86 
87  m_EdgeMapper->SetInputConnection(m_EdgeTuber->GetOutputPort());
88  m_EdgeMapper->ScalarVisibilityOff();
89 
90  m_BackgroundMapper->SetInputData(emptyPolyData);
91  m_BackgroundMapper->Update();
92 
93  m_EdgeActor->SetMapper(m_EdgeMapper);
94 
95  m_BackgroundActor->GetProperty()->SetAmbient(0.5);
96  m_BackgroundActor->GetProperty()->SetColor(0.0, 0.0, 0.0);
97  m_BackgroundActor->GetProperty()->SetOpacity(0.0);
99 
100  vtkProperty *backfaceProperty = m_BackgroundActor->MakeProperty();
101  backfaceProperty->SetColor(0.0, 0.0, 0.0);
102  m_BackgroundActor->SetBackfaceProperty(backfaceProperty);
103  backfaceProperty->Delete();
104 
105  m_FrontHedgeHog = vtkHedgeHog::New();
106  m_BackHedgeHog = vtkHedgeHog::New();
107 
108  m_FrontNormalsMapper = vtkPolyDataMapper::New();
109  m_FrontNormalsMapper->SetInputConnection(m_FrontHedgeHog->GetOutputPort());
110  m_BackNormalsMapper = vtkPolyDataMapper::New();
111 
112  m_Prop3DAssembly->AddPart(m_EdgeActor);
114  m_FrontNormalsActor = vtkActor::New();
116  m_BackNormalsActor = vtkActor::New();
118 
119  m_ImageMapperDeletedCommand = MemberCommandType::New();
121  }
122 
124  {
125  m_ImageAssembly->Delete();
126  m_Prop3DAssembly->Delete();
127  m_EdgeTuber->Delete();
128  m_EdgeMapper->Delete();
129  m_EdgeTransformer->Delete();
130  m_Cleaner->Delete();
131  m_Edges->Delete();
132  m_NormalsTransformer->Delete();
133  m_EdgeActor->Delete();
134  m_BackgroundMapper->Delete();
135  m_BackgroundActor->Delete();
136  m_FrontNormalsMapper->Delete();
137  m_FrontNormalsActor->Delete();
138  m_FrontHedgeHog->Delete();
139  m_BackNormalsMapper->Delete();
140  m_BackNormalsActor->Delete();
141  m_BackHedgeHog->Delete();
142 
143  for (auto it = m_ImageActors.begin(); it != m_ImageActors.end(); ++it)
144  it->second.m_Actor->ReleaseGraphicsResources(nullptr);
145 
146  // Delete entries in m_ImageActors list one by one
147  m_ImageActors.clear();
148 
149  m_DataStorage = nullptr;
150  }
151 
153  {
154  if ((this->GetDataNode() != nullptr) && (m_ImageAssembly != nullptr))
155  {
156  // Do not transform the entire Prop3D assembly, but only the image part
157  // here. The colored frame is transformed elsewhere (via m_EdgeTransformer),
158  // since only vertices should be transformed there, not the poly data
159  // itself, to avoid distortion for anisotropic datasets.
160  m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform());
161  }
162  return m_Prop3DAssembly;
163  }
164 
166  {
167  m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()));
168  }
169 
171  {
172  return static_cast<const PlaneGeometryData *>(GetDataNode()->GetData());
173  }
174 
176  {
177  if (storage != nullptr && m_DataStorage != storage)
178  {
179  m_DataStorage = storage;
180  this->Modified();
181  }
182  }
183 
184  void PlaneGeometryDataVtkMapper3D::ImageMapperDeletedCallback(itk::Object *caller, const itk::EventObject & /*event*/)
185  {
186  auto *imageMapper = dynamic_cast<ImageVtkMapper2D *>(caller);
187  if ((imageMapper != nullptr))
188  {
189  if (m_ImageActors.count(imageMapper) > 0)
190  {
191  m_ImageActors[imageMapper].m_Sender = nullptr; // sender is already destroying itself
192  m_ImageActors.erase(imageMapper);
193  }
194  }
195  }
196 
198  {
199  // Remove all actors from the assembly, and re-initialize it with the
200  // edge actor
201  m_ImageAssembly->GetParts()->RemoveAllItems();
202 
203  bool visible = true;
204  GetDataNode()->GetVisibility(visible, renderer, "visible");
205 
206  if (!visible)
207  {
208  // visibility has explicitly to be set in the single actors
209  // due to problems when using cell picking:
210  // even if the assembly is invisible, the renderer contains
211  // references to the assemblies parts. During picking the
212  // visibility of each part is checked, and not only for the
213  // whole assembly.
214  m_ImageAssembly->VisibilityOff();
215  m_EdgeActor->VisibilityOff();
216  return;
217  }
218 
219  // visibility has explicitly to be set in the single actors
220  // due to problems when using cell picking:
221  // even if the assembly is invisible, the renderer contains
222  // references to the assemblies parts. During picking the
223  // visibility of each part is checked, and not only for the
224  // whole assembly.
225  m_ImageAssembly->VisibilityOn();
226  bool drawEdges = true;
227  this->GetDataNode()->GetBoolProperty("draw edges", drawEdges, renderer);
228  m_EdgeActor->SetVisibility(drawEdges);
229 
231 
232  if (input.IsNotNull() && (input->GetPlaneGeometry() != nullptr))
233  {
234  SmartPointerProperty::Pointer surfacecreatorprop;
235  surfacecreatorprop =
236  dynamic_cast<SmartPointerProperty *>(GetDataNode()->GetProperty("surfacegeometry", renderer));
237 
238  if ((surfacecreatorprop.IsNull()) || (surfacecreatorprop->GetSmartPointer().IsNull()) ||
239  ((m_SurfaceCreator =
240  dynamic_cast<PlaneGeometryDataToSurfaceFilter *>(surfacecreatorprop->GetSmartPointer().GetPointer()))
241  .IsNull()))
242  {
243  m_SurfaceCreator->PlaceByGeometryOn();
244  surfacecreatorprop = SmartPointerProperty::New(m_SurfaceCreator);
245  GetDataNode()->SetProperty("surfacegeometry", surfacecreatorprop);
246  }
247 
248  m_SurfaceCreator->SetInput(input);
249 
250  int res;
251  if (GetDataNode()->GetIntProperty("xresolution", res, renderer))
252  {
253  m_SurfaceCreator->SetXResolution(res);
254  }
255  if (GetDataNode()->GetIntProperty("yresolution", res, renderer))
256  {
257  m_SurfaceCreator->SetYResolution(res);
258  }
259 
260  double tubeRadius = 1.0; // Radius of tubular edge surrounding plane
261 
262  // Clip the PlaneGeometry with the reference geometry bounds (if available)
263  if (input->GetPlaneGeometry()->HasReferenceGeometry())
264  {
265  const BaseGeometry *referenceGeometry = input->GetPlaneGeometry()->GetReferenceGeometry();
266 
267  BoundingBox::PointType boundingBoxMin, boundingBoxMax;
268  boundingBoxMin = referenceGeometry->GetBoundingBox()->GetMinimum();
269  boundingBoxMax = referenceGeometry->GetBoundingBox()->GetMaximum();
270 
271  if (referenceGeometry->GetImageGeometry())
272  {
273  for (unsigned int i = 0; i < 3; ++i)
274  {
275  boundingBoxMin[i] -= 0.5;
276  boundingBoxMax[i] -= 0.5;
277  }
278  }
279 
280  m_SurfaceCreatorPointsContainer->CreateElementAt(0) = boundingBoxMin;
281  m_SurfaceCreatorPointsContainer->CreateElementAt(1) = boundingBoxMax;
282 
283  m_SurfaceCreatorBoundingBox->ComputeBoundingBox();
284 
286 
287  tubeRadius = referenceGeometry->GetDiagonalLength() / 450.0;
288  }
289 
290  // If no reference geometry is available, clip with the current global
291  // bounds
292  else if (!m_DataStorage.IsExpired())
293  {
294  m_SurfaceCreator->SetBoundingBox(m_DataStorage.Lock()->ComputeVisibleBoundingBox(nullptr, "includeInBoundingBox"));
295  tubeRadius = sqrt(m_SurfaceCreator->GetBoundingBox()->GetDiagonalLength2()) / 450.0;
296  }
297 
298  // Calculate the surface of the PlaneGeometry
299  m_SurfaceCreator->Update();
300  Surface *surface = m_SurfaceCreator->GetOutput();
301 
302  // Check if there's something to display, otherwise return
303  if ((surface->GetVtkPolyData() == nullptr) || (surface->GetVtkPolyData()->GetNumberOfCells() == 0))
304  {
305  m_ImageAssembly->VisibilityOff();
306  return;
307  }
308 
309  // add a graphical representation of the surface normals if requested
310  DataNode *node = this->GetDataNode();
311  bool displayNormals = false;
312  bool colorTwoSides = false;
313  bool invertNormals = false;
314  node->GetBoolProperty("draw normals 3D", displayNormals, renderer);
315  node->GetBoolProperty("color two sides", colorTwoSides, renderer);
316  node->GetBoolProperty("invert normals", invertNormals, renderer);
317 
318  // if we want to draw the display normals or render two sides we have to get the colors
319  if (displayNormals || colorTwoSides)
320  {
321  // get colors
322  float frontColor[3] = {0.0, 0.0, 1.0};
323  node->GetColor(frontColor, renderer, "front color");
324  float backColor[3] = {1.0, 0.0, 0.0};
325  node->GetColor(backColor, renderer, "back color");
326 
327  if (displayNormals)
328  {
329  m_NormalsTransformer->SetInputData(surface->GetVtkPolyData());
330  m_NormalsTransformer->SetTransform(node->GetVtkTransform(this->GetTimestep()));
331 
332  m_FrontHedgeHog->SetInputConnection(m_NormalsTransformer->GetOutputPort());
333  m_FrontHedgeHog->SetVectorModeToUseNormal();
334  m_FrontHedgeHog->SetScaleFactor(invertNormals ? 1.0 : -1.0);
335  m_FrontHedgeHog->Update();
336 
337  m_FrontNormalsActor->GetProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
338 
339  m_BackHedgeHog->SetInputConnection(m_NormalsTransformer->GetOutputPort());
340  m_BackHedgeHog->SetVectorModeToUseNormal();
341  m_BackHedgeHog->SetScaleFactor(invertNormals ? -1.0 : 1.0);
342  m_BackHedgeHog->Update();
343 
344  m_BackNormalsActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
345 
346  // if there is no actor added yet, add one
347  if (!m_NormalsActorAdded)
348  {
351  m_NormalsActorAdded = true;
352  }
353  }
354  // if we don't want to display normals AND there is an actor added remove the actor
355  else if (m_NormalsActorAdded)
356  {
359  m_NormalsActorAdded = false;
360  }
361 
362  if (colorTwoSides)
363  {
364  if (!invertNormals)
365  {
366  m_BackgroundActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
367  m_BackgroundActor->GetBackfaceProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
368  }
369  else
370  {
371  m_BackgroundActor->GetProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
372  m_BackgroundActor->GetBackfaceProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
373  }
374  }
375  }
376 
377  // Add black background for all images (which may be transparent)
378  m_BackgroundMapper->SetInputData(surface->GetVtkPolyData());
379  // m_ImageAssembly->AddPart(m_BackgroundActor);
380 
381  LayerSortedActorList layerSortedActors;
382 
383  // Traverse the data tree to find nodes resliced by ImageMapperGL2D
384  // use a predicate to get all data nodes which are "images" or inherit from mitk::Image
387  mitk::DataStorage::SetOfObjects::ConstPointer all = m_DataStorage.Lock()->GetSubset(predicateAllImages);
388  // process all found images
389  for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
390  {
391  DataNode *node = it->Value();
392  if (node != nullptr)
393  this->ProcessNode(node, renderer, surface, layerSortedActors);
394  }
395 
396  // Add all image actors to the assembly, sorted according to
397  // layer property
398  LayerSortedActorList::iterator actorIt;
399  for (actorIt = layerSortedActors.begin(); actorIt != layerSortedActors.end(); ++actorIt)
400  {
401  m_ImageAssembly->AddPart(actorIt->second);
402  }
403 
404  // Configurate the tube-shaped frame: size according to the surface
405  // bounds, color as specified in the plane's properties
406  vtkPolyData *surfacePolyData = surface->GetVtkPolyData();
407  m_Cleaner->SetInputData(surfacePolyData);
408  m_EdgeTransformer->SetTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()));
409 
410  // Adjust the radius according to extent
411  m_EdgeTuber->SetRadius(tubeRadius);
412 
413  // Get the plane's color and set the tube properties accordingly
414  ColorProperty::Pointer colorProperty;
415  colorProperty = dynamic_cast<ColorProperty *>(this->GetDataNode()->GetProperty("color"));
416  if (colorProperty.IsNotNull())
417  {
418  const Color &color = colorProperty->GetColor();
419  m_EdgeActor->GetProperty()->SetColor(color.GetRed(), color.GetGreen(), color.GetBlue());
420  }
421  else
422  {
423  m_EdgeActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
424  }
425 
426  m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()));
427  }
428 
429  VtkRepresentationProperty *representationProperty;
430  this->GetDataNode()->GetProperty(representationProperty, "material.representation", renderer);
431  if (representationProperty != nullptr)
432  m_BackgroundActor->GetProperty()->SetRepresentation(representationProperty->GetVtkRepresentation());
433  }
434 
436  BaseRenderer *renderer,
437  Surface *surface,
438  LayerSortedActorList &layerSortedActors)
439  {
440  if (node != nullptr)
441  {
442  // we need to get the information from the 2D mapper to render the texture on the 3D plane
443  auto *imageMapper =
444  dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(1)); // GetMapper(1) provides the 2D mapper for the data node
445 
446  // if there is a 2D mapper, which is not the standard image mapper...
447  if (!imageMapper && node->GetMapper(1))
448  { //... check if it is the composite mapper
449  std::string cname(node->GetMapper(1)->GetNameOfClass());
450  if (!cname.compare("CompositeMapper")) // string.compare returns 0 if the two strings are equal.
451  {
452  // get the standard image mapper.
453  // This is a special case in MITK and does only work for the CompositeMapper.
454  imageMapper = dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(3));
455  }
456  }
457 
458  if ((node->IsVisible(renderer)) && imageMapper)
459  {
460  WeakPointerProperty::Pointer rendererProp =
461  dynamic_cast<WeakPointerProperty *>(GetDataNode()->GetPropertyList()->GetProperty("renderer"));
462 
463  if (rendererProp.IsNotNull())
464  {
465  BaseRenderer::Pointer planeRenderer =
466  dynamic_cast<BaseRenderer *>(rendererProp->GetWeakPointer().GetPointer());
467  // Retrieve and update image to be mapped
468  const ImageVtkMapper2D::LocalStorage *localStorage = imageMapper->GetLocalStorage(planeRenderer);
469 
470  if (planeRenderer.IsNotNull())
471  {
472  // perform update of imagemapper if needed (maybe the respective 2D renderwindow is not rendered/update
473  // before)
474  imageMapper->Update(planeRenderer);
475 
476  // If it has not been initialized already in a previous pass,
477  // generate an actor and a texture object to
478  // render the image associated with the ImageVtkMapper2D.
479  vtkActor *imageActor;
480  vtkDataSetMapper *dataSetMapper = nullptr;
481  vtkTexture *texture;
482  if (m_ImageActors.count(imageMapper) == 0)
483  {
484  dataSetMapper = vtkDataSetMapper::New();
485 
487  texture->RepeatOff();
488 
489  imageActor = vtkActor::New();
490  imageActor->SetMapper(dataSetMapper);
491  imageActor->SetTexture(texture);
492  imageActor->GetProperty()->SetOpacity(
493  0.999); // HACK! otherwise VTK wouldn't recognize this as translucent
494  // surface (if LUT values map to alpha < 255
495  // improvement: apply "opacity" property onle HERE and also in 2D image mapper. DO NOT change LUT to
496  // achieve
497  // translucent images (see method ChangeOpacity in image mapper 2D)
498 
499  // Make imageActor the sole owner of the mapper and texture
500  // objects
501  dataSetMapper->UnRegister(nullptr);
502  texture->UnRegister(nullptr);
503 
504  // Store the actor so that it may be accessed in following
505  // passes.
506  m_ImageActors[imageMapper].Initialize(imageActor, imageMapper, m_ImageMapperDeletedCommand);
507  }
508  else
509  {
510  // Else, retrieve the actor and associated objects from the
511  // previous pass.
512  imageActor = m_ImageActors[imageMapper].m_Actor;
513  dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
514  texture = imageActor->GetTexture();
515  }
516 
517  // Set poly data new each time its object changes (e.g. when
518  // switching between planar and curved geometries)
519  if ((dataSetMapper != nullptr) && (dataSetMapper->GetInput() != surface->GetVtkPolyData()))
520  {
521  dataSetMapper->SetInputData(surface->GetVtkPolyData());
522  }
523 
524  dataSetMapper->Update();
525 
526  // Check if the m_ReslicedImage is nullptr.
527  // This is the case when no image geometry is met by
528  // the reslicer. In that case, the texture has to be
529  // empty (black) and we don't have to do anything.
530  // See fixed bug #13275
531  if (localStorage->m_ReslicedImage != nullptr)
532  {
533  texture->SetInputConnection(localStorage->m_LevelWindowFilter->GetOutputPort());
534 
535  // do not use a VTK lookup table (we do that ourselves in m_LevelWindowFilter)
536  texture->SetColorModeToDirectScalars();
537 
538  // re-use properties from the 2D image mapper
539  imageActor->SetProperty(localStorage->m_Actor->GetProperty());
540  imageActor->GetProperty()->SetAmbient(0.5);
541 
542  // Set texture interpolation on/off
543  bool textureInterpolation = node->IsOn("texture interpolation", renderer);
544  texture->SetInterpolate(textureInterpolation);
545 
546  // Store this actor to be added to the actor assembly, sort
547  // by layer
548  int layer = 1;
549  node->GetIntProperty("layer", layer);
550  layerSortedActors.insert(std::pair<int, vtkActor *>(layer, imageActor));
551  }
552  }
553  }
554  }
555  }
556  }
557 
558  void PlaneGeometryDataVtkMapper3D::ActorInfo::Initialize(vtkActor *actor, itk::Object *sender, itk::Command *command)
559  {
560  m_Actor = actor;
561  m_Sender = sender;
562  // Get informed when ImageMapper object is deleted, so that
563  // the data structures built here can be deleted as well
564  m_ObserverID = sender->AddObserver(itk::DeleteEvent(), command);
565  }
566 
567  PlaneGeometryDataVtkMapper3D::ActorInfo::ActorInfo() : m_Actor(nullptr), m_Sender(nullptr), m_ObserverID(0) {}
569  {
570  if (m_Sender != nullptr)
571  {
572  m_Sender->RemoveObserver(m_ObserverID);
573  }
574  if (m_Actor != nullptr)
575  {
576  m_Actor->ReleaseGraphicsResources(nullptr);
577  m_Actor->Delete();
578  }
579  }
580 } // namespace mitk
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
vtkActor * m_FrontNormalsActor
Actor to hold the normals arrows.
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
virtual bool GetImageGeometry() const
Is this an ImageGeometry?
Data management class that handles &#39;was created by&#39; relations.
itk::SmartPointer< T > Lock() const
virtual vtkPolyData * GetVtkPolyData(unsigned int t=0) const
PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
The DataStorage defines which part of the data tree is traversed for renderering. ...
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
vtkSmartPointer< vtkActor > m_Actor
Actor of a 2D render window.
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
Definition: mitkMapper.cpp:31
static vtkNeverTranslucentTexture * New()
vtkTransformPolyDataFilter * m_NormalsTransformer
Transforms the suface before applying the glyph filter.
Organizes the rendering process.
void GenerateDataForRenderer(BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
DataCollection - Class to facilitate loading/accessing structured data.
void ImageMapperDeletedCallback(itk::Object *caller, const itk::EventObject &event)
Property containing a smart-pointer.
vtkPolyDataMapper * m_BackgroundMapper
Mapper for black plane background.
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
std::multimap< int, vtkActor * > LayerSortedActorList
Property containing a smart-pointer.
bool GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for int properties (instances of IntProperty)
void Initialize(vtkActor *actor, itk::Object *sender, itk::Command *command)
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
The ColorProperty class RGB color property.
Mapper to resample and display 2D slices of a 3D image.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
vtkAssembly * m_Prop3DAssembly
general PropAssembly to hold the entire scene
bool IsVisible(const mitk::BaseRenderer *renderer, const char *propertyKey="visible", bool defaultIsOn=true) const
Convenience access method for visibility properties (instances of BoolProperty). Return value is the ...
Definition: mitkDataNode.h:462
mitk::DataStorage::Pointer m_DataStorage
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
vtkSmartPointer< vtkMitkLevelWindowFilter > m_LevelWindowFilter
This filter is used to apply the level window to Grayvalue and RBG(A) images.
bool IsExpired() const noexcept
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
Definition: mitkDataNode.h:422
virtual const PlaneGeometryData * GetInput()
Get the PlaneGeometryData to map.
vtkPolyDataMapper * m_EdgeMapper
Mapper for the tube-shaped frame.
bool IsOn(const char *propertyKey, const mitk::BaseRenderer *renderer, bool defaultIsOn=true) const
Convenience access method for boolean properties (instances of BoolProperty). Return value is the val...
Definition: mitkDataNode.h:443
Data class containing PlaneGeometry objects.
vtkHedgeHog * m_FrontHedgeHog
Generates lines for surface normals.
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
void ProcessNode(DataNode *node, BaseRenderer *renderer, Surface *surface, LayerSortedActorList &layerSortedActors)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
vtkAssembly * m_ImageAssembly
PropAssembly to hold the planes.
virtual void SetDataStorageForTexture(mitk::DataStorage *storage)
All images found when traversing the (sub-) tree starting at iterator which are resliced by an ImageV...
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is nullptr, the BaseRenderer-independent PropertyLi...
mitk::Mapper * GetMapper(MapperSlotId id) const
vtkFeatureEdges * m_Edges
Edge extractor for tube-shaped frame.
BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer
vtkTubeFilter * m_EdgeTuber
Source to create the tube-shaped frame.
double GetDiagonalLength() const
Get the length of the diagonal of the bounding-box in mm.
vtkTransformPolyDataFilter * m_EdgeTransformer
Filter to apply object transform to the extracted edges.
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
int GetTimestep() const
Returns the current time step as calculated from the renderer.
Definition: mitkMapper.h:147
mitk::BaseProperty * GetProperty(const std::string &propertyKey) const
Get a property by its name.
void UpdateVtkTransform(mitk::BaseRenderer *renderer) override
Set the vtkTransform of the m_Prop3D for the current time step of renderer.
vtkActor * m_BackgroundActor
Actor for black plane background.
BaseGeometry Describes the geometry of a data object.
vtkPolyDataMapper * m_FrontNormalsMapper
Mapper for normals representation (thin lines)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57
vtkActor * m_EdgeActor
Actor for the tube-shaped frame.
vtkSmartPointer< vtkImageData > m_ReslicedImage
Current slice of a 2D render window.
virtual const BoundingBoxType * GetBoundingBox()