#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ #define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ------------------------------------------------------------------------- class vtkAlgorithmOutput; class vtkImageData; class vtkLookupTable; // ------------------------------------------------------------------------- namespace cpExtensions { namespace Visualization { /** */ class cpExtensions_EXPORT ImageSliceActors : public vtkPropCollection { public: typedef ImageSliceActors Self; typedef void ( *TCursorCommand )( double*, int, void* ); public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); vtkGetMacro( MinWindow, double ); vtkGetMacro( MaxWindow, double ); vtkGetMacro( MinLevel, double ); vtkGetMacro( MaxLevel, double ); public: // Creation static ImageSliceActors* New( ); void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 ); void AddInputData( vtkImageData* data, int axis = 2 ); void Clear( ); void AssociateSlice( Self* other ); void SetSlicesCommand( TCursorCommand cmd, void* data ); vtkInteractorStyle* GetStyle( ); const vtkInteractorStyle* GetStyle( ) const; void PushActorsInto( vtkRenderWindow* window, bool force_style = true ); void PopActorsFrom( vtkRenderWindow* window ); unsigned int GetNumberOfImageActors( ) const; vtkImageActor* GetImageActor( unsigned int id ); const vtkImageActor* GetImageActor( unsigned int id ) const; vtkTextActor* GetTextActor( ); const vtkTextActor* GetTextActor( ) const; vtkActor* GetPlaneActor( ); const vtkActor* GetPlaneActor( ) const; vtkPlane* GetPlaneFunction( ); const vtkPlane* GetPlaneFunction( ) const; void AddActor( vtkAlgorithm* algorithm, vtkActor* actor ); void AddActor( vtkActor* actor ); void SetInterpolate( bool v ); void InterpolateOn( ); void InterpolateOff( ); double* GetDisplayBounds( ) const; void GetDisplayBounds( double bounds[ 6 ] ) const; void ResetCursor( ); void SetCursor( double pos[ 3 ] ); vtkImageMapToColors* GetImageMap( unsigned int id ); const vtkImageMapToColors* GetImageMap( unsigned int id ) const; double GetWindow( ) const; double GetLevel( ) const; void SetWindow( double w ); void SetLevel( double l ); void SetWindowLevel( double w, double l ); void ResetWindowLevel( ); void SetLookupTable( unsigned int id, vtkLookupTable* lut ); void SetLookupTableAsColor( unsigned int id, double r, double g, double b ); int GetAxis( ) const; int GetSliceNumber( ) const; int GetSliceNumberMinValue( ) const; int GetSliceNumberMaxValue( ) const; void SetSliceNumber( const int& slice ); void SetSlice( double* pos ); void UpdateText( ); void UpdateText( double pos[ 3 ] ); void UpdateText( const double& w, const double& l ); protected: ImageSliceActors( ); virtual ~ImageSliceActors( ); void _ConfigureNewLUT( vtkImageData* data ); void _ConfigureNewInput( int axis ); // Events static void _MouseMoveCommand( void* data, const ImageInteractorStyle::ButtonID& btn, double* pos, bool alt, bool ctr, bool sft ); static void _MouseClickCommand( void* data, const ImageInteractorStyle::ButtonID& btn, double* pos, bool alt, bool ctr, bool sft ); static void _MouseDoubleClickCommand( void* data, const ImageInteractorStyle::ButtonID& btn, double* pos, bool alt, bool ctr, bool sft ); static void _MouseWheelCommand( void* data, const int& dir, bool alt, bool ctr, bool sft ); static void _KeyCommand( void* data, const char& key ); private: // Purposely not implemented ImageSliceActors( const Self& ); Self& operator=( const Self& ); protected: vtkSmartPointer< ImageInteractorStyle > Style; // Multiple actors std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps; std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers; std::vector< vtkSmartPointer< vtkImageActor > > ImageActors; bool Interpolate; // Window-Level values double MinWindow, MaxWindow; double MinLevel, MaxLevel; // Other associated slices std::vector< vtkSmartPointer< Self > > AssociatedSlices; TCursorCommand SlicesCommand; void* SlicesData; // Other associated actors typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor; typedef std::vector< TAssociatedActor > TAssociatedActors; TAssociatedActors AssociatedActors; // Unique objects vtkSmartPointer< vtkPolyData > Cursor; vtkSmartPointer< vtkPolyDataMapper > CursorMapper; vtkSmartPointer< vtkActor > CursorActor; vtkSmartPointer< vtkPlane > PlaneFunction; vtkSmartPointer< vtkPolyData > Plane; vtkSmartPointer< vtkPolyDataMapper > PlaneMapper; char TextBuffer[ 1024 ]; vtkSmartPointer< vtkTextActor > TextActor; vtkSmartPointer< vtkActor > PlaneActor; double StartWindowLevelPos[ 3 ]; double StartWindowLevel[ 2 ]; }; } // ecapseman } // ecapseman #endif // __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ // eof - $RCSfile$