1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: vtk3DSurfaceSTLWidget.h,v $
31 Date: $Date: 2012/11/15 14:15:18 $
32 Version: $Revision: 1.2 $
34 Copyright: (c) 2002, 2003
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE. See the above copyright notice for more information.
41 =========================================================================*/
42 #ifndef __VTK3DSURFACESTLWIDGET__
43 #define __VTK3DSURFACESTLWIDGET__
45 #include "wxVTKRenderWindowInteractorEditContour.h"
47 #include "vtkImagePolyDataSeedConnectivity.h"
48 #include "vtkInteractorStyleCutter.h"
49 #include "kernel/marInterface.h"
51 #include <vtkImageData.h>
52 #include <vtkProperty2D.h>
53 #include <vtkPolyData.h>
55 #include <vtkMarchingCubes.h>
56 #include <vtkPolyDataMapper.h>
57 #include <vtkRenderer.h>
58 #include <vtkRenderWindow.h>
59 #include <vtkSphereSource.h>
60 #include <vtkOutlineFilter.h>
61 #include <vtkProperty.h>
64 * \brief Class that brigde to VTK, override double click...
66 class vtk3DSurfaceSTLWidget : public wxVTKRenderWindowInteractor
70 vtk3DSurfaceSTLWidget(
73 const wxPoint& pos = wxDefaultPosition,
74 const wxSize& size = wxDefaultSize,
76 const wxString& name = wxPanelNameStr
78 ~vtk3DSurfaceSTLWidget();
81 // void OnLeftDClick( wxMouseEvent& event );
85 bool IntersectPlaneWithLine( double* p, double* x1, double* x2, double* x3, double* x4, double* x5 );
86 bool FindCubePointsFromPoints( double* pO, double* pF, double* pickPoint, double* cameraPos );
87 bool GetPointAndNormalIntersection( double* p, double* n, double* pO, double* pF );
89 void ShowMARACASData( marInterface* mar );
90 void ShowMARACASDataAndAxe( marInterface* mar );
91 void SetSurfaceColor(float red, float green, float blue );
92 void SetSurfaceVisibility( bool visible );
93 void SetSTLSurfaceVisibility( bool intvisible , bool extvisible);
94 void SetSurfaceIsoValue( int isoval );
95 void SetSurfaceOpacity( int opaval );
97 void GetSphereCenter( double center[3] );
98 void SetAxis( vtkPolyData *axis );
101 void ConstructVessel();
102 void SetCuttingMode( bool mode );
103 void ExportSurfaceAsSTL( const char* fileprefix );
106 vtkImageData *_marImageData;
107 vtkPolyData *_marPolyData;
109 void SetSTLThresholdRatio(double ratio);
110 float GetSTLThreshold();
111 vtkGetMacro(InitialSphere, int);
115 void SetInitialPoint( double* pickPoint, double* cameraPos );
116 void SetInitialPoint( double* point );
117 vtkPolyData* ConvertMarAxisToPolyData();
119 vtkImagePolyDataSeedConnectivity *_psc;
122 vtkRenderer *_pRenderer;
123 vtkRenderWindow *_pRenderWindow;
124 vtkOutlineFilter *_outLine;
125 vtkPolyDataMapper *_outMapper;
127 vtkMarchingCubes *_mCubes;
128 vtkPolyDataMapper *_surfMapper;
129 vtkActor *_surfActor;
131 vtkPolyData *_centralLine;
132 vtkPolyDataMapper *_centralLineMapper;
133 vtkActor *_centralLineActor;
135 vtkSphereSource *_spheres[ 4 ];
136 vtkPolyDataMapper *_spheresMapper[ 4 ];
137 vtkActor *_spheresActor[ 4 ];
139 vtkPolyDataMapper *_axesMapper;
140 vtkActor *_axesActor;
142 vtkActor *_actorVessel;
143 vtkActor *_actorExternalVessel;
144 //We should keep internal and external as different mesh to be able
145 //to save them in difference files at the end of process:
146 vtkPolyData *_stlInternalVessel;
147 vtkPolyData *_stlExternalVessel;
148 vtkInteractorStyleCutter *_iasc;
157 DECLARE_EVENT_TABLE( );
161 #endif //__VTK3DSURFACESTLWIDGET__