vtkMimxCreateElementSetWidgetFEMesh.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   MIMX Meshing Toolkit
00004 Module:    $RCSfile: vtkMimxCreateElementSetWidgetFEMesh.h,v $
00005 Language:  C++
00006 Date:      $Date: 2008/07/15 21:08:47 $
00007 Version:   $Revision: 1.10 $
00008 
00009  Musculoskeletal Imaging, Modelling and Experimentation (MIMX)
00010  Center for Computer Aided Design
00011  The University of Iowa
00012  Iowa City, IA 52242
00013  http://www.ccad.uiowa.edu/mimx/
00014  
00015 Copyright (c) The University of Iowa. All rights reserved.
00016 See MIMXCopyright.txt or http://www.ccad.uiowa.edu/mimx/Copyright.htm for details.
00017 
00018 This software is distributed WITHOUT ANY WARRANTY; without even 
00019 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00020 PURPOSE.  See the above copyright notices for more information.
00021 
00022 =========================================================================*/
00023 // .NAME vtkMimxCreateElementSetWidgetFEMesh - a widget to manipulate 3D parallelopipeds
00024 //
00025 // .SECTION Description
00026 // This widget was designed with the aim of visualizing / probing cuts on
00027 // a skewed image data / structured grid. 
00028 //
00029 // .SECTION Interaction
00030 // The widget allows you to create a parallelopiped (defined by 8 handles).
00031 // The widget is initially placed by using the "PlaceWidget" method in the
00032 // representation class. After the widget has been created, the following
00033 // interactions may be used to manipulate it :
00034 // 1) Click on a handle and drag it around moves the handle in space, while
00035 //    keeping the same axis alignment of the parallelopiped
00036 // 2) Dragging a handle with the shift button pressed resizes the piped
00037 //    along an axis.
00038 // 3) Control-click on a handle creates a chair at that position. (A chair
00039 //    is a depression in the piped that allows you to visualize cuts in the
00040 //    volume). 
00041 // 4) Clicking on a chair and dragging it around moves the chair within the
00042 //    piped.
00043 // 5) Shift-click on the piped enables you to translate it.
00044 //
00045 // .SECTION Caveats
00046 // .SECTION See Also vtkParallelopipedRepresentation
00047 
00048 #ifndef __vtkMimxCreateElementSetWidgetFEMesh_h
00049 #define __vtkMimxCreateElementSetWidgetFEMesh_h
00050 
00051 #include "vtkAbstractWidget.h"
00052 #include "vtkUnstructuredGrid.h"
00053 #include "vtkActor.h"
00054 #include "vtkMimxWidgetsWin32Header.h"
00055 
00056 
00057 class vtkActor;
00058 class vtkCellPicker;
00059 class vtkDataSet;
00060 class vtkIdList;
00061 class vtkInteractorStyleRubberBandPick;
00062 class vtkPointLocator;
00063 class vtkPolyDataMapper;
00064 class vtkRenderedAreaPicker;
00065 class vtkUnstructuredGrid;
00066 class vtkGeometryFilter;
00067 class vtkPolyData;
00068 class vtkExtractCells;
00069 class vtkDataSetMapper;
00070 
00071 class VTK_MIMXWIDGETS_EXPORT vtkMimxCreateElementSetWidgetFEMesh : public vtkAbstractWidget
00072 {
00073  public:
00074   // Description:
00075   // Instantiate the object.
00076   static vtkMimxCreateElementSetWidgetFEMesh *New();
00077 
00078   vtkTypeRevisionMacro(vtkMimxCreateElementSetWidgetFEMesh,vtkAbstractWidget);
00079   void PrintSelf(ostream& os, vtkIndent indent);
00080 
00081   // Description:
00082   // Override the superclass method. This is a composite widget, (it internally
00083   // consists of handle widgets). We will override the superclass method, so
00084   // that we can pass the enabled state to the internal widgets as well.
00085   virtual void SetEnabled(int);
00086   
00087   // Description:
00088   // Methods to change the whether the widget responds to interaction.
00089   // Overridden to pass the state to component widgets.
00090 //  vtkSetObjectMacro(InputActor, vtkActor);
00091   //
00092   vtkGetObjectMacro(SelectedCellIds, vtkIdList);
00093   vtkGetObjectMacro(SelectedPointIds, vtkIdList);
00094   vtkSetMacro(BooleanState, int);
00095   vtkSetMacro(DimensionState, int);
00096   vtkGetObjectMacro(SelectedGrid, vtkUnstructuredGrid);
00097 
00098   void CreateDefaultRepresentation(){}
00099   void ComputeSelectedPointIds(vtkDataSet *SelectedUGrid, vtkMimxCreateElementSetWidgetFEMesh *Self);
00100   void AcceptSelectedMesh(vtkMimxCreateElementSetWidgetFEMesh *Self);
00101   void SetInput(vtkUnstructuredGrid *input);
00102   void SetCellSelectionState(int Selection);
00103   void SetEditMeshState(int MeshType);
00104   void ClearSelections();
00105   enum EditMeshType
00106   {
00107           FullMesh = 0,
00108           SelectedMesh
00109   };
00110   
00111   enum BooleanType
00112   {
00113           Add = 0,
00114           Subtract
00115   };
00116   
00117   enum DimensionType
00118   {
00119           Volume = 0,
00120           Surface
00121   };
00122   void SetInputOpacity(double Val);
00123 
00124 protected:
00125   vtkMimxCreateElementSetWidgetFEMesh();
00126   ~vtkMimxCreateElementSetWidgetFEMesh();
00127 
00128   static void CrtlMouseMoveCallback               (vtkAbstractWidget* );
00129   static void ShiftMouseMoveCallback               (vtkAbstractWidget* );
00130   static void CrtlLeftButtonDownCallback                        (vtkAbstractWidget* );
00131   static void CrtlLeftButtonUpCallback            (vtkAbstractWidget* );
00132   static void ShiftLeftButtonDownCallback                       (vtkAbstractWidget* );
00133   static void ShiftLeftButtonUpCallback            (vtkAbstractWidget* );
00134   static void LeftButtonUpCallback                      (vtkAbstractWidget* );
00135   static void LeftButtonDownCallback                    (vtkAbstractWidget* );
00136   static void RightButtonUpCallback                     (vtkAbstractWidget* );
00137   static void RightButtonDownCallback                   (vtkAbstractWidget* );
00138   static void MouseMoveCallback                         (vtkAbstractWidget* );
00139 
00140   static void SelectCellsOnSurfaceFunction(vtkMimxCreateElementSetWidgetFEMesh *Self);
00141   static void SelectVisibleCellsOnSurfaceFunction(vtkMimxCreateElementSetWidgetFEMesh *Self);
00142   static void SelectCellsThroughFunction(vtkMimxCreateElementSetWidgetFEMesh *Self);
00143   static void SelectIndividualCellFunction(vtkMimxCreateElementSetWidgetFEMesh *Self);
00144   static void SelectIndividualSurfaceCellFunction(vtkMimxCreateElementSetWidgetFEMesh *Self);
00145   static void SelectMultipleCellFunction(vtkMimxCreateElementSetWidgetFEMesh *Self);
00146   static void AddDeleteSelectedElement(vtkMimxCreateElementSetWidgetFEMesh *Self);
00147   void ComputeExtractedCellIds(
00148         vtkMimxCreateElementSetWidgetFEMesh *self, vtkDataSet *DataSet);
00149   void ComputeExtractedCellIdsSurface(
00150           vtkMimxCreateElementSetWidgetFEMesh *self, vtkDataSet *DataSet);
00151   int ComputeOriginalCellNumber(
00152           vtkMimxCreateElementSetWidgetFEMesh *self, vtkIdList *PtIds);
00153   int ComputeOriginalCellNumberFromSelectedSurfaceMesh(
00154           vtkMimxCreateElementSetWidgetFEMesh *self, vtkIdList *PtIds);
00155   void DeleteExtractedCells(vtkMimxCreateElementSetWidgetFEMesh *Self);
00156   int DoesCellBelong(int CellNum, vtkMimxCreateElementSetWidgetFEMesh *Self);
00157   int GetCellNumGivenFaceIds(vtkIdList *PtIds, vtkMimxCreateElementSetWidgetFEMesh *Self);
00158   int GetCellNumGivenFaceIdsSelectedMesh(vtkIdList *PtIds, vtkMimxCreateElementSetWidgetFEMesh *Self);
00159   int GetFaceNumGivenCellNumFaceIds(int CellNum, 
00160           vtkIdList *PtIds, vtkPolyData *Surface, vtkMimxCreateElementSetWidgetFEMesh *Self);
00161   static void ExtractElementsBelongingToAFace(vtkMimxCreateElementSetWidgetFEMesh *Self);
00162   // for surface mesh selection of elements belonging to a face
00163   static void ExtractElementsBelongingToAFaceSurface(vtkMimxCreateElementSetWidgetFEMesh *Self);
00164   int GetCellNumGivenFaceIdsSurface(vtkIdList *PtIds, vtkMimxCreateElementSetWidgetFEMesh *Self);
00165   int GetFaceNumGivenCellNumFaceIdsSurface(int CellNum, 
00166           vtkIdList *PtIds, vtkPolyData *Surface, vtkMimxCreateElementSetWidgetFEMesh *Self);
00167   //
00168   vtkIdList *ExtractedCellIds;
00169   vtkIdList *SelectedPointIds;
00170   vtkIdList *DeleteCellIds;
00171   vtkIdList *SelectedCellIds;
00172   //BTX
00173   // Description:
00174   // Events invoked by this widget
00175   int WidgetEvent;
00176   enum WidgetEventIds 
00177     {
00178     Start = 0,
00179         Outside,
00180         CrtlLeftMouseButtonDown,
00181         CrtlLeftMouseButtonUp,
00182         CrtlLeftMouseButtonMove,
00183         VTKLeftButtonDown,
00184         VTKMouseMove,
00185         CrtlRightMouseButtonDown,
00186         ShiftLeftMouseButtonDown,
00187         ShiftLeftMouseButtonUp,
00188         ShiftMouseMove,
00189         LeftMouseButtonUp,
00190         LeftMouseButtonDown,
00191         RightMouseButtonUp,
00192         RightMouseButtonDown,
00193         MouseMove
00194     };
00195   //ETX
00196   enum CellSelectionType
00197   {
00198           SelectCellsThrough = 0,
00199           SelectCellsOnSurface,
00200           SelectVisibleCellsOnSurface,
00201           SelectIndividualCell,
00202           SelectMultipleCells
00203   };
00204 
00205   int EditMeshState;
00206  
00207    int CellSelectionState;
00208    int BooleanState;
00209   vtkInteractorStyleRubberBandPick *RubberBandStyle;
00210   vtkRenderedAreaPicker *AreaPicker;
00211   
00212   vtkUnstructuredGrid *InputVolume;
00213   vtkUnstructuredGrid *Input;
00214   vtkDataSetMapper *InputMapper;
00215   vtkIdType PickX0;
00216   vtkIdType PickY0;
00217   vtkIdType PickX1;
00218   vtkIdType PickY1;
00219   vtkIdType PickStatus;
00220   vtkActor *InputActor;
00221   //vtkActor *ExtractedActor;
00222   vtkPointLocator *PointLocator;
00223   vtkPoints *LocatorPoints;
00224   vtkPointLocator *InputLocator;
00225   vtkPoints *InputPoints;
00226   vtkGeometryFilter *SurfaceFilter;
00227   vtkPolyDataMapper *SurfaceMapper;
00228   vtkActor *SurfaceActor;
00229 
00230   vtkUnstructuredGrid *ExtractedGrid;
00231   vtkGeometryFilter *ExtractedSurfaceFilter;
00232   vtkPolyDataMapper *ExtractedSurfaceMapper;
00233   vtkActor *ExtractedSurfaceActor;
00234   vtkExtractCells *ExtractedCells;
00235   vtkDataSetMapper *ExtractedMapper;
00236   vtkActor *ExtractedActor;
00237 
00238   vtkExtractCells *SelectedCells;
00239   vtkUnstructuredGrid *SelectedGrid;
00240   vtkDataSetMapper *SelectedMapper;
00241   vtkActor *SelectedActor;
00242   double LineWidth;
00243 private:
00244   vtkMimxCreateElementSetWidgetFEMesh(const vtkMimxCreateElementSetWidgetFEMesh&);  //Not implemented
00245   void operator=(const vtkMimxCreateElementSetWidgetFEMesh&);  //Not implemented
00246   
00247   int MeshType;
00248   int DimensionState;
00249 };
00250 
00251 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1