1 /*=========================================================================
4 Module: $RCSfile: vtk3DSurfaceSTLWidget.h,v $
6 Date: $Date: 2008/10/31 16:32:41 $
7 Version: $Revision: 1.1 $
9 Copyright: (c) 2002, 2003
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notice for more information.
16 =========================================================================*/
17 #ifndef __VTK3DSURFACESTLWIDGET__
18 #define __VTK3DSURFACESTLWIDGET__
20 #include "wxVTKRenderWindowInteractorEditContour.h"
22 #include "vtkImagePolyDataSeedConnectivity.h"
23 #include "vtkInteractorStyleCutter.h"
24 #include "kernel/marInterface.h"
26 #include <vtkImageData.h>
27 #include <vtkProperty2D.h>
28 #include <vtkPolyData.h>
30 #include <vtkMarchingCubes.h>
31 #include <vtkPolyDataMapper.h>
32 #include <vtkRenderer.h>
33 #include <vtkRenderWindow.h>
34 #include <vtkSphereSource.h>
35 #include <vtkOutlineFilter.h>
36 #include <vtkProperty.h>
39 * \brief Class that brigde to VTK, override double click...
41 class vtk3DSurfaceSTLWidget : public wxVTKRenderWindowInteractor
45 vtk3DSurfaceSTLWidget(
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
51 const wxString& name = wxPanelNameStr
53 ~vtk3DSurfaceSTLWidget();
56 // void OnLeftDClick( wxMouseEvent& event );
60 bool IntersectPlaneWithLine( double* p, double* x1, double* x2, double* x3, double* x4, double* x5 );
61 bool FindCubePointsFromPoints( double* pO, double* pF, double* pickPoint, double* cameraPos );
62 bool GetPointAndNormalIntersection( double* p, double* n, double* pO, double* pF );
64 void ShowMARACASData( marInterface* mar );
65 void ShowMARACASDataAndAxe( marInterface* mar );
66 void SetSurfaceColor(float red, float green, float blue );
67 void SetSurfaceVisibility( bool visible );
68 void SetSTLSurfaceVisibility( bool intvisible , bool extvisible);
69 void SetSurfaceIsoValue( int isoval );
70 void SetSurfaceOpacity( int opaval );
72 void GetSphereCenter( double center[3] );
73 void SetAxis( vtkPolyData *axis );
76 void ConstructVessel();
77 void SetCuttingMode( bool mode );
78 void ExportSurfaceAsSTL( const char* fileprefix );
81 vtkImageData *_marImageData;
82 vtkPolyData *_marPolyData;
84 void SetSTLThresholdRatio(double ratio);
85 float GetSTLThreshold();
86 vtkGetMacro(InitialSphere, int);
90 void SetInitialPoint( double* pickPoint, double* cameraPos );
91 void SetInitialPoint( double* point );
92 vtkPolyData* ConvertMarAxisToPolyData();
94 vtkImagePolyDataSeedConnectivity *_psc;
97 vtkRenderer *_pRenderer;
98 vtkRenderWindow *_pRenderWindow;
99 vtkOutlineFilter *_outLine;
100 vtkPolyDataMapper *_outMapper;
102 vtkMarchingCubes *_mCubes;
103 vtkPolyDataMapper *_surfMapper;
104 vtkActor *_surfActor;
106 vtkPolyData *_centralLine;
107 vtkPolyDataMapper *_centralLineMapper;
108 vtkActor *_centralLineActor;
110 vtkSphereSource *_spheres[ 4 ];
111 vtkPolyDataMapper *_spheresMapper[ 4 ];
112 vtkActor *_spheresActor[ 4 ];
114 vtkPolyDataMapper *_axesMapper;
115 vtkActor *_axesActor;
117 vtkActor *_actorVessel;
118 vtkActor *_actorExternalVessel;
119 //We should keep internal and external as different mesh to be able
120 //to save them in difference files at the end of process:
121 vtkPolyData *_stlInternalVessel;
122 vtkPolyData *_stlExternalVessel;
123 vtkInteractorStyleCutter *_iasc;
132 DECLARE_EVENT_TABLE( );
136 #endif //__VTK3DSURFACESTLWIDGET__