vtk3DSurfaceSTLWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   wxMaracas
00004   Module:    $RCSfile: vtk3DSurfaceSTLWidget.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009/05/14 13:54:57 $
00007   Version:   $Revision: 1.1 $
00008 
00009   Copyright: (c) 2002, 2003
00010   License:
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 notice for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __VTK3DSURFACESTLWIDGET__
00018 #define __VTK3DSURFACESTLWIDGET__
00019 
00020 #include "wxVTKRenderWindowInteractorEditContour.h"
00021 
00022 #include "vtkImagePolyDataSeedConnectivity.h"
00023 #include "vtkInteractorStyleCutter.h"
00024 #include "kernel/marInterface.h"
00025 
00026 #include <vtkImageData.h>
00027 #include <vtkProperty2D.h>
00028 #include <vtkPolyData.h>
00029 #include <vtkActor.h>
00030 #include <vtkMarchingCubes.h>
00031 #include <vtkPolyDataMapper.h>
00032 #include <vtkRenderer.h>
00033 #include <vtkRenderWindow.h>
00034 #include <vtkSphereSource.h>
00035 #include <vtkOutlineFilter.h>
00036 #include <vtkProperty.h>
00037 
00041 class vtk3DSurfaceSTLWidget : public wxVTKRenderWindowInteractor
00042 {
00043 public:
00044 
00045     vtk3DSurfaceSTLWidget(
00046         wxWindow* parent,
00047         wxWindowID id,
00048         const wxPoint& pos = wxDefaultPosition,
00049         const wxSize& size = wxDefaultSize,
00050         long style = 0,
00051         const wxString& name = wxPanelNameStr
00052         );
00053     ~vtk3DSurfaceSTLWidget();
00054 
00055 //EED Borrame
00056 //    void OnLeftDClick( wxMouseEvent& event );
00057 
00058     void ConfigureVTK( );
00059 
00060     bool IntersectPlaneWithLine( double* p, double* x1, double* x2, double* x3, double* x4, double* x5 );
00061     bool FindCubePointsFromPoints( double* pO, double* pF, double* pickPoint, double* cameraPos );
00062     bool GetPointAndNormalIntersection( double* p, double* n, double* pO, double* pF );
00063     
00064     void ShowMARACASData( marInterface* mar );
00065         void ShowMARACASDataAndAxe( marInterface* mar );
00066     void SetSurfaceColor(float red, float green, float blue );
00067     void SetSurfaceVisibility( bool visible );
00068     void SetSTLSurfaceVisibility( bool intvisible , bool extvisible);
00069     void SetSurfaceIsoValue( int isoval );
00070     void SetSurfaceOpacity( int opaval );
00071 
00072     void GetSphereCenter( double center[3] );
00073     void SetAxis( vtkPolyData *axis );
00074     void RemoveAxis( );
00075 
00076     void ConstructVessel();
00077     void SetCuttingMode( bool mode );
00078     void ExportSurfaceAsSTL( const char* fileprefix );
00079 
00081     vtkImageData        *_marImageData;
00082     vtkPolyData         *_marPolyData;
00083 
00084     void SetSTLThresholdRatio(double ratio);
00085     float GetSTLThreshold();
00086     vtkGetMacro(InitialSphere, int);
00087     
00088 protected:
00089 
00090     void SetInitialPoint( double* pickPoint, double* cameraPos );
00091     void SetInitialPoint( double* point );
00092     vtkPolyData* ConvertMarAxisToPolyData();
00093     
00094     vtkImagePolyDataSeedConnectivity *_psc;
00095 
00096     marInterface                *_mar;
00097     vtkRenderer                 *_pRenderer;
00098     vtkRenderWindow             *_pRenderWindow;
00099     vtkOutlineFilter    *_outLine;
00100     vtkPolyDataMapper   *_outMapper;
00101     vtkActor                    *_outActor;
00102     vtkMarchingCubes    *_mCubes;
00103     vtkPolyDataMapper   *_surfMapper;
00104     vtkActor                    *_surfActor;
00105 
00106     vtkPolyData                 *_centralLine;
00107     vtkPolyDataMapper   *_centralLineMapper;
00108     vtkActor                    *_centralLineActor;
00109 
00110     vtkSphereSource             *_spheres[ 4 ];
00111     vtkPolyDataMapper   *_spheresMapper[ 4 ];
00112     vtkActor                    *_spheresActor[ 4 ];
00113 
00114     vtkPolyDataMapper   *_axesMapper;
00115     vtkActor                    *_axesActor;
00116 
00117     vtkActor                    *_actorVessel;
00118     vtkActor                    *_actorExternalVessel;
00119     //We should keep internal and external as different mesh to be able
00120     //to save them in difference files at the end of process:
00121     vtkPolyData                 *_stlInternalVessel;
00122     vtkPolyData                 *_stlExternalVessel;
00123     vtkInteractorStyleCutter *_iasc;
00124 
00125 private:
00126 
00127     int _width;
00128     int _height;
00129     int _depth;
00130     int InitialSphere;
00131 
00132     DECLARE_EVENT_TABLE( );
00133 
00134 };
00135 
00136 #endif //__VTK3DSURFACESTLWIDGET__

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1