1 #ifndef __IDMS__VOLUMEACTORS__H__
2 #define __IDMS__VOLUMEACTORS__H__
8 #include <vtkImageActor.h>
9 #include <vtkImageMapToColors.h>
10 #include <vtkImageMapToWindowLevelColors.h>
11 #include <vtkImageSliceMapper.h>
12 #include <vtkOutlineSource.h>
14 #include <vtkPlaneSource.h>
15 #include <vtkPolyDataMapper.h>
16 #include <vtkProp3D.h>
17 #include <vtkPropCollection.h>
18 #include <vtkSmartPointer.h>
19 #include <vtkSphereSource.h>
20 #include <vtkTextActor.h>
21 #include <vtkTransform.h>
25 class vtkRenderWindowInteractor;
27 // -------------------------------------------------------------------------
28 #define IDMS_VOLUMEACTORS( name, type ) \
29 inline type* Get##name##Actor( ) const \
32 dynamic_cast< type* >( \
33 const_cast< Self* >( this )-> \
34 GetItemAsObject( this->name##Index ) \
44 : public vtkPropCollection
47 typedef VolumeActors Self;
52 vtkSmartPointer< vtkImageSliceMapper > SliceMapper;
53 vtkSmartPointer< vtkImageSliceMapper > SegmentationSliceMapper;
54 vtkSmartPointer< vtkPlaneSource > PlaneSource;
55 vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
56 vtkSmartPointer< vtkActor > PlaneActor;
57 vtkSmartPointer< vtkImageActor > ImageActor;
58 vtkSmartPointer< vtkImageActor > SegmentationActor;
59 vtkSmartPointer< vtkTextActor > TextActor;
60 vtkSmartPointer< vtkPlane > RegionCutterPlane;
61 vtkSmartPointer< vtkCutter > RegionCutter;
62 vtkSmartPointer< vtkPolyDataMapper > RegionCutterMapper;
63 vtkSmartPointer< vtkActor > RegionCutterActor;
64 char TextBuffer[ 128 ];
67 void Configure( vtkAlgorithmOutput* aout, int axis );
68 void ConfigureRegion( vtkAlgorithmOutput* aout );
69 void SetSegmentation( vtkAlgorithmOutput* aout );
70 void SetSliceNumber( const int& slice );
71 void UpdateText( const double& w, const double& l );
73 typedef std::set< vtkRenderWindowInteractor* > TInteractors;
76 vtkTypeMacro( VolumeActors, vtkPropCollection );
78 IDMS_VOLUMEACTORS( ImageOutline, vtkActor );
79 IDMS_VOLUMEACTORS( XPlane, vtkImageActor );
80 IDMS_VOLUMEACTORS( YPlane, vtkImageActor );
81 IDMS_VOLUMEACTORS( ZPlane, vtkImageActor );
82 IDMS_VOLUMEACTORS( XText, vtkTextActor );
83 IDMS_VOLUMEACTORS( YText, vtkTextActor );
84 IDMS_VOLUMEACTORS( ZText, vtkTextActor );
85 IDMS_VOLUMEACTORS( XBounds, vtkActor );
86 IDMS_VOLUMEACTORS( YBounds, vtkActor );
87 IDMS_VOLUMEACTORS( ZBounds, vtkActor );
88 IDMS_VOLUMEACTORS( Cursor, vtkActor );
89 IDMS_VOLUMEACTORS( Region, vtkActor );
93 static VolumeActors* New( );
96 vtkRenderWindowInteractor* xi,
97 vtkRenderWindowInteractor* yi,
98 vtkRenderWindowInteractor* zi
100 void SetSegmentation( vtkImageData* segmentation );
101 void AddAuxiliaryInteractor( vtkRenderWindowInteractor* i );
103 inline vtkImageData* GetImage( )
104 { return( this->Image ); }
105 inline vtkImageData* GetSegmentation( )
106 { return( this->Segmentation ); }
107 inline const vtkImageData* GetImage( ) const
108 { return( this->Image ); }
109 inline const vtkImageData* GetSegmentation( ) const
110 { return( this->Segmentation ); }
113 double GetMinWindow( ) const;
114 double GetMaxWindow( ) const;
115 double GetMinLevel( ) const;
116 double GetMaxLevel( ) const;
117 double GetWindow( ) const;
118 double GetLevel( ) const;
119 void SetWindow( const double& w );
120 void SetLevel( const double& l );
121 void SetWindowLevel( const double& w, const double& l );
122 void ResetWindowLevel( );
125 vtkPlane* GetSlicePlane( const int& axis ) const;
126 int GetSliceNumberMinValue( const int& axis ) const;
127 int GetSliceNumberMaxValue( const int& axis ) const;
128 int GetSlice( const int& axis ) const;
129 void SetSlice( const int& axis, const int& slice );
130 void SetSlice( const int& axis, const double& slice );
134 void AddSeed( int idx[ 3 ] );
135 void AddSeed( double pos[ 3 ] );
136 unsigned int GetNumberOfSeeds( ) const;
137 void GetSeed( unsigned int i, int idx[ 3 ] ) const;
139 // 3D cursor and region
140 void SetCursorPosition( double pos[ 3 ] );
141 void ShowRegion( int a );
142 void HideRegion( int a );
143 void SetRegionPosition( double pos[ 3 ] );
144 void SetRegionRadius( double pos[ 3 ] );
147 void GetImageBounds( double bounds[ 6 ] ) const;
151 void RenderAuxiliaryInteractors( );
152 void ResetCameras( );
156 virtual ~VolumeActors( );
159 // Purposely not implemented
160 VolumeActors( const Self& );
161 Self& operator=( const Self& );
165 vtkImageData* Segmentation;
166 vtkRenderWindowInteractor* Interactors[ 3 ];
167 TInteractors AuxiliaryInteractors;
169 vtkSmartPointer< vtkImageMapToWindowLevelColors > ImageToWindowLevel;
170 vtkSmartPointer< vtkImageMapToColors > SegmentationToColors;
172 vtkSmartPointer< vtkOutlineSource > ImageOutlineSource;
173 SliceActor Planes[ 3 ];
175 std::vector< std::vector< int > > Seeds;
177 vtkSmartPointer< vtkSphereSource > Cursor;
178 vtkSmartPointer< vtkPolyDataMapper > CursorMapper;
179 vtkSmartPointer< vtkActor > CursorActor;
181 vtkSmartPointer< vtkSphereSource > Region;
182 vtkSmartPointer< vtkPolyDataMapper > RegionMapper;
183 vtkSmartPointer< vtkActor > RegionActor;
185 unsigned int ImageOutlineIndex;
186 unsigned int XPlaneIndex;
187 unsigned int YPlaneIndex;
188 unsigned int ZPlaneIndex;
189 unsigned int XTextIndex;
190 unsigned int YTextIndex;
191 unsigned int ZTextIndex;
192 unsigned int XBoundsIndex;
193 unsigned int YBoundsIndex;
194 unsigned int ZBoundsIndex;
195 unsigned int CursorIndex;
196 unsigned int RegionIndex;
201 #endif // __IDMS__VOLUMEACTORS__H__