1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkResliceCursorLineRepresentation.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 // .NAME vtkResliceCursorLineRepresentation - represent the vtkResliceCursorWidget 16 // .SECTION Description 17 // This class provides a representation for the reslice cursor widget. It 18 // consists of two cross sectional hairs, with an optional thickness. The 19 // hairs may have a hole in the center. These may be translated or rotated 20 // independent of each other in the view. The result is used to reslice 21 // the data along these cross sections. This allows the user to perform 22 // multi-planar thin or thick reformat of the data on an image view, rather 23 // than a 3D view. 24 // .SECTION See Also 25 // vtkResliceCursorWidget vtkResliceCursor vtkResliceCursorPolyDataAlgorithm 26 // vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation 27 // vtkResliceCursorActor vtkImagePlaneWidget 28 29 30 #ifndef vtkResliceCursorLineRepresentation_h 31 #define vtkResliceCursorLineRepresentation_h 32 33 #include "vtkInteractionWidgetsModule.h" // For export macro 34 #include "vtkResliceCursorRepresentation.h" 35 36 class vtkPolyData; 37 class vtkResliceCursorActor; 38 class vtkResliceCursorPolyDataAlgorithm; 39 class vtkResliceCursorPicker; 40 class vtkResliceCursor; 41 42 43 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorLineRepresentation : public vtkResliceCursorRepresentation 44 { 45 public: 46 // Description: 47 // Instantiate the class. 48 static vtkResliceCursorLineRepresentation *New(); 49 50 // Description: 51 // Standard VTK methods. 52 vtkTypeMacro(vtkResliceCursorLineRepresentation,vtkResliceCursorRepresentation); 53 void PrintSelf(ostream& os, vtkIndent indent); 54 55 // Description: 56 // These are methods that satisfy vtkWidgetRepresentation's API. 57 virtual void BuildRepresentation(); 58 virtual int ComputeInteractionState(int X, int Y, int modify=0); 59 virtual void StartWidgetInteraction(double startEventPos[2]); 60 virtual void WidgetInteraction(double e[2]); 61 virtual void Highlight(int highlightOn); 62 63 // Description: 64 // Methods required by vtkProp superclass. 65 virtual void ReleaseGraphicsResources(vtkWindow *w); 66 virtual int RenderOverlay(vtkViewport *viewport); 67 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 68 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 69 virtual int HasTranslucentPolygonalGeometry(); 70 71 // Description: 72 // Get the bounds of this prop. This simply returns the bounds of the 73 // reslice cursor object. 74 virtual double * GetBounds(); 75 76 // Description: 77 // Get the reslice cursor actor. You must set the reslice cursor on this 78 // class 79 vtkGetObjectMacro( ResliceCursorActor, vtkResliceCursorActor ); 80 81 // Description: 82 // Get the reslice cursor. 83 virtual vtkResliceCursor * GetResliceCursor(); 84 85 // Description: 86 // Set the user matrix on all the internal actors. 87 virtual void SetUserMatrix( vtkMatrix4x4 *matrix); 88 89 protected: 90 vtkResliceCursorLineRepresentation(); 91 ~vtkResliceCursorLineRepresentation(); 92 93 virtual vtkResliceCursorPolyDataAlgorithm * GetCursorAlgorithm(); 94 95 double RotateAxis( double evenPos[2], int axis ); 96 97 void RotateAxis( int axis, double angle ); 98 99 void RotateVectorAboutVector( double vectorToBeRotated[3], 100 double axis[3], // vector about which we rotate 101 double angle, // angle in radians 102 double o[3] ); 103 int DisplayToReslicePlaneIntersection( 104 double displayPos[2], double intersectionPos[3] ); 105 106 vtkResliceCursorActor * ResliceCursorActor; 107 vtkResliceCursorPicker * Picker; 108 109 double StartPickPosition[3]; 110 double StartCenterPosition[3]; 111 112 // Transformation matrices. These have no offset. Offset is recomputed 113 // based on the cursor, so that the center of the cursor has the same 114 // location in transformed space as it does in physical space. 115 vtkMatrix4x4 * MatrixReslice; 116 vtkMatrix4x4 * MatrixView; 117 vtkMatrix4x4 * MatrixReslicedView; 118 119 private: 120 vtkResliceCursorLineRepresentation(const vtkResliceCursorLineRepresentation&); //Not implemented 121 void operator=(const vtkResliceCursorLineRepresentation&); //Not implemented 122 }; 123 124 #endif 125