Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef ODFVTKMAPPER2D_H_HEADER_INCLUDED
00020 #define ODFVTKMAPPER2D_H_HEADER_INCLUDED
00021
00022 #include "mitkVtkMapper2D.h"
00023 #include "vtkPropAssembly.h"
00024 #include "vtkAppendPolyData.h"
00025 #include "vtkActor.h"
00026 #include "vtkPolyDataMapper.h"
00027 #include "vtkPlane.h"
00028 #include "vtkCutter.h"
00029 #include "vtkClipPolyData.h"
00030 #include "vtkTransform.h"
00031 #include "vtkDataArrayTemplate.h"
00032 #include "vtkSmartPointer.h"
00033 #include "vtkOdfSource.h"
00034 #include "vtkThickPlane.h"
00035
00036
00037
00038 namespace mitk {
00039
00040
00041
00042
00043
00044
00045
00046 template<class TPixelType, int NrOdfDirections>
00047 class OdfVtkMapper2D : public VtkMapper2D
00048 {
00049 struct OdfDisplayGeometry {
00050 vtkFloatingPointType vp[ 3 ], vnormal[ 3 ];
00051 Vector3D normal;
00052 double d, d1, d2;
00053 mitk::Point3D M3D, L3D, O3D;
00054
00055 vtkFloatingPointType vp_original[ 3 ], vnormal_original[ 3 ];
00056 mitk::Vector2D size, origin;
00057
00058 bool Equals(OdfDisplayGeometry* other)
00059 {
00060 return other->vp_original[0] == vp[0] &&
00061 other->vp_original[1] == vp[1] &&
00062 other->vp_original[2] == vp[2] &&
00063 other->vnormal_original[0] == vnormal[0] &&
00064 other->vnormal_original[1] == vnormal[1] &&
00065 other->vnormal_original[2] == vnormal[2] &&
00066 other->size[0] == size[0] &&
00067 other->size[1] == size[1] &&
00068 other->origin[0] == origin[0] &&
00069 other->origin[1] == origin[1];
00070 }
00071 };
00072
00073 public:
00074
00075 mitkClassMacro(OdfVtkMapper2D,VtkMapper2D);
00076 itkNewMacro(Self);
00077
00078 virtual vtkProp* GetProp(mitk::BaseRenderer* renderer);
00079
00080 virtual void MitkRenderOverlay(mitk::BaseRenderer* renderer);
00081 virtual void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer);
00082 virtual void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer);
00083
00084 #if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
00085 virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* ){};
00086 #endif
00087
00088 OdfDisplayGeometry* MeasureDisplayedGeometry(mitk::BaseRenderer* renderer);
00089 void AdaptCameraPosition(mitk::BaseRenderer* renderer, OdfDisplayGeometry* dispGeo );
00090 void AdaptOdfScalingToImageSpacing( int index );
00091 void SetRendererLightSources( mitk::BaseRenderer *renderer );
00092 void ApplyPropertySettings();
00093 virtual void Slice(mitk::BaseRenderer* renderer,
00094 OdfDisplayGeometry* dispGeo);
00095 virtual int GetIndex(mitk::BaseRenderer* renderer);
00096
00097 static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false);
00098
00099 virtual void GenerateData();
00100 virtual void GenerateData(mitk::BaseRenderer* renderer);
00101
00102 virtual bool IsLODEnabled( BaseRenderer * ) const { return true; }
00103
00104 protected:
00105 OdfVtkMapper2D();
00106
00107 virtual ~OdfVtkMapper2D();
00108
00109 static void GlyphMethod(void *arg);
00110
00111 private:
00112
00113 std::vector<vtkPropAssembly*> m_PropAssemblies;
00114 std::vector<vtkAppendPolyData*> m_OdfsPlanes;
00115 std::vector<vtkActor*> m_OdfsActors;
00116 std::vector<vtkPolyDataMapper*> m_OdfsMappers;
00117 vtkPolyData* m_TemplateOdf;
00118
00119 static vtkSmartPointer<vtkTransform> m_OdfTransform;
00120 static vtkSmartPointer<vtkDoubleArray> m_OdfVals;
00121 static vtkSmartPointer<vtkOdfSource> m_OdfSource;
00122 static float m_Scaling;
00123 static int m_Normalization;
00124 static int m_ScaleBy;
00125 static float m_IndexParam1;
00126 static float m_IndexParam2;
00127
00128 int m_ShowMaxNumber;
00129
00130
00131
00132 std::vector<vtkPlane*> m_Planes;
00133 std::vector<vtkCutter*> m_Cutters;
00134
00135 std::vector<vtkThickPlane*> m_ThickPlanes1;
00136 std::vector<vtkClipPolyData *> m_Clippers1;
00137
00138 std::vector<vtkThickPlane*> m_ThickPlanes2;
00139 std::vector<vtkClipPolyData *> m_Clippers2;
00140
00141 vtkImageData* m_VtkImage ;
00142
00143 mitk::Image* GetInput();
00144
00145 OdfDisplayGeometry* m_LastDisplayGeometry;
00146 };
00147
00148 }
00149
00150 #include "mitkOdfVtkMapper2D.txx"
00151
00152 #endif