00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273 00020 #define MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273 00021 00022 #include "mitkCommon.h" 00023 #include "MitkExtExports.h" 00024 #include "mitkVtkMapper3D.h" 00025 #include "mitkBaseRenderer.h" 00026 #include "mitkPointSet.h" 00027 #include "mitkVector.h" 00028 00029 class vtkActor; 00030 class vtkAssembly; 00031 class vtkSphereSource; 00032 class vtkCubeSource; 00033 class vtkConeSource; 00034 class vtkCylinderSource; 00035 class vtkTubeFilter; 00036 class vtkProp; 00037 00038 00039 namespace mitk { 00040 00070 class MitkExt_EXPORT EnhancedPointSetVtkMapper3D : public VtkMapper3D 00071 { 00072 public: 00073 mitkClassMacro(EnhancedPointSetVtkMapper3D, VtkMapper3D); 00074 00075 itkNewMacro(Self); 00076 00077 virtual const mitk::PointSet* GetInput(); 00078 00079 virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer); 00080 00081 virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer); 00082 00083 static void SetDefaultProperties(mitk::DataNode* node, 00084 mitk::BaseRenderer* renderer = NULL, bool overwrite = false); 00085 00086 void ReleaseGraphicsResources(vtkWindow *renWin); 00087 00088 protected: 00089 EnhancedPointSetVtkMapper3D(); 00090 00091 virtual ~EnhancedPointSetVtkMapper3D(); 00092 00093 void RemoveEntryFromSourceMaps( mitk::PointSet::PointIdentifier pointID ); 00094 void DeleteVtkObject(vtkObject* o); // functor for stl_each in destructor 00095 00096 // update all vtk sources, mappers, actors with current data and properties 00097 void UpdateVtkObjects(); 00098 00099 virtual void GenerateData(); 00100 virtual void GenerateData(mitk::BaseRenderer* renderer); 00101 virtual void ApplyProperties(mitk::BaseRenderer* renderer); 00102 00103 typedef mitk::PointSet::PointIdentifier PointIdentifier; 00104 typedef std::map<PointIdentifier, vtkSphereSource*> SphereSourceMap; 00105 typedef std::map<PointIdentifier, vtkCubeSource*> CubeSourceMap; 00106 typedef std::map<PointIdentifier, vtkConeSource*> ConeSourceMap; 00107 typedef std::map<PointIdentifier, vtkCylinderSource*> CylinderSourceMap; 00108 00109 typedef std::pair<vtkActor*, mitk::PointSpecificationType> ActorAndPointType; 00110 typedef std::map<PointIdentifier, ActorAndPointType> ActorMap; 00111 00112 SphereSourceMap m_SphereSources; // stores all sphere sources 00113 CubeSourceMap m_CubeSources; // stores all cube sources 00114 ConeSourceMap m_ConeSources; // stores all cone sources 00115 CylinderSourceMap m_CylinderSources; // stores all cylinder sources 00116 ActorMap m_PointActors; // stores an actor for each point(referenced by its ID) and the currently used pointspec = which source type is generating the polydata 00117 00118 vtkActor* m_Contour; 00119 vtkTubeFilter* m_ContourSource; 00120 00121 vtkAssembly* m_PropAssembly; // this contains everything, this will be returned by GetVtkProp() 00122 }; 00123 } // namespace mitk 00124 00125 #endif /* MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273 */