vtkMimxSelectPointsWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   MIMX Meshing Toolkit
00004 Module:    $RCSfile: vtkMimxSelectPointsWidget.h,v $
00005 Language:  C++
00006 
00007 Date:      $Date: 2008/08/14 05:01:52 $
00008 Version:   $Revision: 1.11 $
00009 
00010 
00011  Musculoskeletal Imaging, Modelling and Experimentation (MIMX)
00012  Center for Computer Aided Design
00013  The University of Iowa
00014  Iowa City, IA 52242
00015  http://www.ccad.uiowa.edu/mimx/
00016  
00017 Copyright (c) The University of Iowa. All rights reserved.
00018 See MIMXCopyright.txt or http://www.ccad.uiowa.edu/mimx/Copyright.htm for details.
00019 
00020 This software is distributed WITHOUT ANY WARRANTY; without even 
00021 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00022 PURPOSE.  See the above copyright notices for more information.
00023 
00024 =========================================================================*/
00025 // .NAME vtkMimxSelectPointsWidget - a widget to manipulate 3D parallelopipeds
00026 //
00027 // .SECTION Description
00028 // This widget was designed with the aim of visualizing / probing cuts on
00029 // a skewed image data / structured grid. 
00030 //
00031 // .SECTION Interaction
00032 // The widget allows you to create a parallelopiped (defined by 8 handles).
00033 // The widget is initially placed by using the "PlaceWidget" method in the
00034 // representation class. After the widget has been created, the following
00035 // interactions may be used to manipulate it :
00036 // 1) Click on a handle and drag it around moves the handle in space, while
00037 //    keeping the same axis alignment of the parallelopiped
00038 // 2) Dragging a handle with the shift button pressed resizes the piped
00039 //    along an axis.
00040 // 3) Control-click on a handle creates a chair at that position. (A chair
00041 //    is a depression in the piped that allows you to visualize cuts in the
00042 //    volume). 
00043 // 4) Clicking on a chair and dragging it around moves the chair within the
00044 //    piped.
00045 // 5) Shift-click on the piped enables you to translate it.
00046 //
00047 // .SECTION Caveats
00048 // .SECTION See Also vtkParallelopipedRepresentation
00049 
00050 #ifndef __vtkMimxSelectPointsWidget_h
00051 #define __vtkMimxSelectPointsWidget_h
00052 
00053 #include "vtkAbstractWidget.h"
00054 #include "vtkUnstructuredGrid.h"
00055 #include "vtkMimxWidgetsWin32Header.h"
00056 
00057 
00058 class vtkActor;
00059 class vtkDataSet;
00060 class vtkDataSetMapper;
00061 class vtkCleanPolyData;
00062 class vtkGeometryFilter;
00063 class vtkGlyph3D;
00064 class vtkIdList;
00065 class vtkInteractorStyleRubberBandPick;
00066 class vtkPolyData;
00067 class vtkPolyDataMapper;
00068 class vtkRenderedAreaPicker;
00069 class vtkSphereSource;
00070 class vtkStructuredGrid;
00071 class vtkUnstructuredGrid;
00072 class vtkPointLocator;
00073 class vtkPoints;
00074 
00075 class VTK_MIMXWIDGETS_EXPORT vtkMimxSelectPointsWidget : public vtkAbstractWidget
00076 {
00077  public:
00078   // Description:
00079   // Instantiate the object.
00080   static vtkMimxSelectPointsWidget *New();
00081 
00082   vtkTypeRevisionMacro(vtkMimxSelectPointsWidget,vtkAbstractWidget);
00083   void PrintSelf(ostream& os, vtkIndent indent);
00084 
00085   // Description:
00086   // Override the superclass method. This is a composite widget, (it internally
00087   // consists of handle widgets). We will override the superclass method, so
00088   // that we can pass the enabled state to the internal widgets as well.
00089   virtual void SetEnabled(int);
00090   
00091   // Description:
00092   // Methods to change the whether the widget responds to interaction.
00093   // Overridden to pass the state to component widgets.
00094 //  virtual void SetProcessEvents(int);
00095 
00096   void SetPointSelectionState(int PointState);
00097   vtkSetMacro(BooleanState, int);
00098   vtkGetObjectMacro(SelectedPointIds, vtkIdList);
00099   void CreateDefaultRepresentation(){}
00100   void ComputeSelectedPointIds(vtkDataSet *ExtractedUGrid, vtkMimxSelectPointsWidget *Self);
00101   void ComputeExtractedPointIds(vtkDataSet *ExtractedUGrid, vtkMimxSelectPointsWidget *Self);
00102   void ComputeSelectedPointIds(vtkMimxSelectPointsWidget *Self);
00103   int CheckGivenPointBelongsToStructuredGrid(
00104           vtkStructuredGrid *SGrid, double x[3], double *bounds);
00105   int DoAllPointsLieOnSurface(vtkStructuredGrid *SGrid, vtkPolyData *Surface, double *bounds);
00106   double GetSphereRadius();
00107   void SetSphereRadius(double Radius);
00108   void SetInput(vtkUnstructuredGrid *UGrid);
00109   void SetInputOpacity(double Val);
00110   void ClearSelections();
00111   enum BooleanType
00112   {
00113           Add = 0,
00114           Subtract
00115   };
00116  protected:
00117   vtkMimxSelectPointsWidget();
00118   ~vtkMimxSelectPointsWidget();
00119 
00120   static void CrtlMouseMoveCallback               (vtkAbstractWidget* );
00121   static void ShiftMouseMoveCallback               (vtkAbstractWidget* );
00122   static void CrtlLeftButtonDownCallback                        (vtkAbstractWidget* );
00123   static void CrtlLeftButtonUpCallback            (vtkAbstractWidget* );
00124   static void LeftButtonUpCallback            (vtkAbstractWidget* );
00125   static void RightButtonUpCallback                     (vtkAbstractWidget* );
00126   static void RightButtonDownCallback                   (vtkAbstractWidget* );
00127 
00128   static void SelectPointsOnSurfaceFunction(vtkMimxSelectPointsWidget *Self);
00129   static void SelectVisiblePointsOnSurfaceFunction(vtkMimxSelectPointsWidget *Self);
00130   static double ComputeSphereRadius(vtkDataSet *DataSet);
00131   static void SelectPointsThroughFunction(vtkMimxSelectPointsWidget *Self);
00132   static void SelectSinglePointFunction(vtkMimxSelectPointsWidget *Self);
00133   static void SelectSinglePointBelongingToAFaceFunction(vtkMimxSelectPointsWidget *Self);
00134   static void SelectPointsOnAFaceFunction(vtkMimxSelectPointsWidget *Self);
00135   static void ShiftLeftButtonUpCallback            (vtkAbstractWidget* );
00136   static void ShiftLeftButtonDownCallback                       (vtkAbstractWidget* );
00137   static void UpdateExtractedGlyphDisplay       (vtkDataSet * UGrid, 
00138           vtkMimxSelectPointsWidget *Self);
00139   static void UpdateSelectedGlyphDisplay        (vtkMimxSelectPointsWidget *Self);
00140   //void ComputeExtratedPointSet(vtkPoints *points);
00141   //BTX
00142   // Description:
00143   // Events invoked by this widget
00144   int WidgetEvent;
00145   enum WidgetEventIds 
00146     {
00147     Start = 0,
00148         Outside,
00149         CrtlLeftMouseButtonDown,
00150         CrtlLeftMouseButtonUp,
00151         CrtlLeftMouseButtonMove,
00152         VTKLeftButtonDown,
00153         VTKMouseMove,
00154         ShiftLeftMouseButtonDown,
00155         ShiftLeftMouseButtonUp,
00156         ShiftLeftMouseButtonMove,
00157         LeftMouseButtonUp,
00158         RightMouseButtonDown,
00159         RightMouseButtonUp
00160     };
00161   //ETX
00162   int PointSelectionState;
00163   enum PointSelectionType
00164   {
00165           SelectPointsThrough = 0,
00166           SelectPointsOnSurface,
00167           SelectVisiblePointsOnSurface,
00168           SelectSinglePoint,
00169           SelectPointsBelongingToAFace
00170   };
00171 
00172   vtkInteractorStyleRubberBandPick *RubberBandStyle;
00173   vtkRenderedAreaPicker *AreaPicker;
00174 
00175   vtkUnstructuredGrid *Input;
00176   vtkDataSetMapper *InputMapper;
00177   vtkActor *InputActor;
00178 
00179   vtkPointSet *SelectedPointSet;
00180   vtkSphereSource *SelectedSphere;
00181   vtkGlyph3D *SelectedGlyph;
00182   vtkPolyDataMapper *SelectedGlyphMapper;
00183   vtkActor *SelectedGlyphActor;
00184 
00185   vtkPointSet *ExtractedPointSet;
00186   vtkSphereSource *ExtractedSphere;
00187   vtkGlyph3D *ExtractedGlyph;
00188   vtkPolyDataMapper *ExtractedGlyphMapper;
00189   vtkActor *ExtractedGlyphActor;
00190 
00191   vtkSphereSource *SingleSphere;
00192   vtkPolyDataMapper *SingleSphereMapper;
00193   vtkActor *SingleSphereActor;
00194 
00195   vtkIdType PickX0;
00196   vtkIdType PickY0;
00197   vtkIdType PickX1;
00198   vtkIdType PickY1;
00199 
00200   int PickStatus;
00201 
00202   vtkIdList *SelectedPointIds;
00203   vtkIdList *ExtractedPointIds;
00204 
00205   int BooleanState;
00206   int EditMeshState;
00207   enum EditMeshType
00208   {
00209           Full = 0,
00210           Partial
00211   };
00212   vtkPolyDataMapper *SurfaceMapper;
00213   vtkActor *SurfaceActor;
00214   vtkGeometryFilter *InputSurfaceFilter;
00215   vtkCleanPolyData *InputCleanPolyData;
00216   vtkPointLocator *PointLocator;
00217   vtkPoints *LocatorPoints;
00218 private:
00219   vtkMimxSelectPointsWidget(const vtkMimxSelectPointsWidget&);  //Not implemented
00220   void operator=(const vtkMimxSelectPointsWidget&);  //Not implemented
00221 };
00222 
00223 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1