X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FImageSliceActors.h;h=f940a90a6ff6f93a6af1dce2fda93df14c4c575e;hb=f2f39f66027a98bd8dac50bade5618e0136bbefa;hp=90b9ff018f4ed2d75a0ced687465dd42ad20a9a8;hpb=b23970017af98ef6617ddf40f225d4d15fa65854;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index 90b9ff0..f940a90 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -3,17 +3,21 @@ #include +#include #include #include #include #include +#include #include #include #include #include #include +#include + // ------------------------------------------------------------------------- class vtkAlgorithmOutput; class vtkImageData; @@ -38,10 +42,15 @@ namespace cpExtensions // Creation static ImageSliceActors* New( ); - void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 0 ); - void AddInputData( vtkImageData* data, int axis = 0 ); + void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 ); + void AddInputData( vtkImageData* data, int axis = 2 ); void Clear( ); + vtkInteractorStyle* GetStyle( ); + const vtkInteractorStyle* GetStyle( ) const; + + void PushActorsInto( vtkRenderer* renderer ); + void PopActorsFrom( vtkRenderer* renderer ); unsigned int GetNumberOfImageActors( ) const; vtkImageActor* GetImageActor( unsigned int id ); const vtkImageActor* GetImageActor( unsigned int id ) const; @@ -49,6 +58,11 @@ namespace cpExtensions 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( ); @@ -63,6 +77,7 @@ namespace cpExtensions int GetSliceNumberMaxValue( ) const; void SetSliceNumber( const int& slice ); void UpdateText( ); + void UpdateText( double pos[ 3 ] ); void UpdateText( const double& w, const double& l ); protected: @@ -71,18 +86,51 @@ namespace cpExtensions 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< vtkImageSliceMapper > > SliceMappers; std::vector< vtkSmartPointer< vtkImageActor > > ImageActors; bool Interpolate; + // Other associated actors + typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor; + typedef std::vector< TAssociatedActor > TAssociatedActors; + TAssociatedActors AssociatedActors; + // Unique objects + vtkSmartPointer< vtkPlane > PlaneFunction; vtkSmartPointer< vtkPolyData > PlaneSource; vtkSmartPointer< vtkPolyDataMapper > PlaneMapper; char TextBuffer[ 1024 ];