#ifndef __IDMS__VOLUMEACTORS__H__ #define __IDMS__VOLUMEACTORS__H__ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class vtkImageData; class vtkPlane; class vtkRenderWindowInteractor; // ------------------------------------------------------------------------- #define IDMS_VOLUMEACTORS( name, type ) \ inline type* Get##name##Actor( ) const \ { \ return( \ dynamic_cast< type* >( \ const_cast< Self* >( this )-> \ GetItemAsObject( this->name##Index ) \ ) \ ); \ } namespace idms { /** */ class VolumeActors : public vtkPropCollection { public: typedef VolumeActors Self; protected: struct SliceActor { vtkSmartPointer< vtkImageSliceMapper > SliceMapper; vtkSmartPointer< vtkImageSliceMapper > SegmentationSliceMapper; vtkSmartPointer< vtkPlaneSource > PlaneSource; vtkSmartPointer< vtkPolyDataMapper > PlaneMapper; vtkSmartPointer< vtkActor > PlaneActor; vtkSmartPointer< vtkImageActor > ImageActor; vtkSmartPointer< vtkImageActor > SegmentationActor; vtkSmartPointer< vtkTextActor > TextActor; vtkSmartPointer< vtkPlane > RegionCutterPlane; vtkSmartPointer< vtkCutter > RegionCutter; vtkSmartPointer< vtkPolyDataMapper > RegionCutterMapper; vtkSmartPointer< vtkActor > RegionCutterActor; char TextBuffer[ 128 ]; SliceActor( ); void Configure( vtkAlgorithmOutput* aout, int axis ); void ConfigureRegion( vtkAlgorithmOutput* aout ); void SetSegmentation( vtkAlgorithmOutput* aout ); void SetSliceNumber( const int& slice ); void UpdateText( const double& w, const double& l ); }; typedef std::set< vtkRenderWindowInteractor* > TInteractors; public: vtkTypeMacro( VolumeActors, vtkPropCollection ); IDMS_VOLUMEACTORS( ImageOutline, vtkActor ); IDMS_VOLUMEACTORS( XPlane, vtkImageActor ); IDMS_VOLUMEACTORS( YPlane, vtkImageActor ); IDMS_VOLUMEACTORS( ZPlane, vtkImageActor ); IDMS_VOLUMEACTORS( XText, vtkTextActor ); IDMS_VOLUMEACTORS( YText, vtkTextActor ); IDMS_VOLUMEACTORS( ZText, vtkTextActor ); IDMS_VOLUMEACTORS( XBounds, vtkActor ); IDMS_VOLUMEACTORS( YBounds, vtkActor ); IDMS_VOLUMEACTORS( ZBounds, vtkActor ); IDMS_VOLUMEACTORS( Cursor, vtkActor ); IDMS_VOLUMEACTORS( Region, vtkActor ); public: // Creation static VolumeActors* New( ); void Configure( vtkImageData* image, vtkRenderWindowInteractor* xi, vtkRenderWindowInteractor* yi, vtkRenderWindowInteractor* zi ); void SetSegmentation( vtkImageData* segmentation ); void AddAuxiliaryInteractor( vtkRenderWindowInteractor* i ); inline vtkImageData* GetImage( ) { return( this->Image ); } inline vtkImageData* GetSegmentation( ) { return( this->Segmentation ); } inline const vtkImageData* GetImage( ) const { return( this->Image ); } inline const vtkImageData* GetSegmentation( ) const { return( this->Segmentation ); } // Window/Level double GetMinWindow( ) const; double GetMaxWindow( ) const; double GetMinLevel( ) const; double GetMaxLevel( ) const; double GetWindow( ) const; double GetLevel( ) const; void SetWindow( const double& w ); void SetLevel( const double& l ); void SetWindowLevel( const double& w, const double& l ); void ResetWindowLevel( ); // Slice access vtkPlane* GetSlicePlane( const int& axis ) const; int GetSliceNumberMinValue( const int& axis ) const; int GetSliceNumberMaxValue( const int& axis ) const; int GetSlice( const int& axis ) const; void SetSlice( const int& axis, const int& slice ); void SetSlice( const int& axis, const double& slice ); void ResetSlices( ); // Seeds void AddSeed( int idx[ 3 ] ); void AddSeed( double pos[ 3 ] ); unsigned int GetNumberOfSeeds( ) const; void GetSeed( unsigned int i, int idx[ 3 ] ) const; // 3D cursor and region void SetCursorPosition( double pos[ 3 ] ); void ShowRegion( int a ); void HideRegion( int a ); void SetRegionPosition( double pos[ 3 ] ); void SetRegionRadius( double pos[ 3 ] ); // General accessors void GetImageBounds( double bounds[ 6 ] ) const; // Rendering synch void Render( ); void RenderAuxiliaryInteractors( ); void ResetCameras( ); protected: VolumeActors( ); virtual ~VolumeActors( ); private: // Purposely not implemented VolumeActors( const Self& ); Self& operator=( const Self& ); protected: vtkImageData* Image; vtkImageData* Segmentation; vtkRenderWindowInteractor* Interactors[ 3 ]; TInteractors AuxiliaryInteractors; vtkSmartPointer< vtkImageMapToWindowLevelColors > ImageToWindowLevel; vtkSmartPointer< vtkImageMapToColors > SegmentationToColors; vtkSmartPointer< vtkOutlineSource > ImageOutlineSource; SliceActor Planes[ 3 ]; std::vector< std::vector< int > > Seeds; vtkSmartPointer< vtkSphereSource > Cursor; vtkSmartPointer< vtkPolyDataMapper > CursorMapper; vtkSmartPointer< vtkActor > CursorActor; vtkSmartPointer< vtkSphereSource > Region; vtkSmartPointer< vtkPolyDataMapper > RegionMapper; vtkSmartPointer< vtkActor > RegionActor; unsigned int ImageOutlineIndex; unsigned int XPlaneIndex; unsigned int YPlaneIndex; unsigned int ZPlaneIndex; unsigned int XTextIndex; unsigned int YTextIndex; unsigned int ZTextIndex; unsigned int XBoundsIndex; unsigned int YBoundsIndex; unsigned int ZBoundsIndex; unsigned int CursorIndex; unsigned int RegionIndex; }; } // ecapseman #endif // __IDMS__VOLUMEACTORS__H__ // eof - $RCSfile$