X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FImageSliceActors.h;h=8fff84881d01249d7283f281382366de4a7a510d;hb=106a56bfe6a48067380089ffd61a518e40d77933;hp=f24bc7e280053e6fea96cf9f2e218dd7d8c1789f;hpb=4f9005fe71854d7cff6ab68e48627989a6d1fbc8;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index f24bc7e..8fff848 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -3,13 +3,9 @@ #include -#include -#include - #include #include #include -#include #include #include #include @@ -18,6 +14,7 @@ #include #include +#include // ------------------------------------------------------------------------- class vtkAlgorithmOutput; @@ -38,32 +35,39 @@ namespace cpExtensions public: typedef ImageSliceActors Self; - typedef cpExtensions::Interaction::BaseInteractorStyle TBaseStyle; typedef cpExtensions::Interaction::ImageInteractorStyle TStyle; + typedef TStyle::TMouseCommand TMouseCommand; + typedef TStyle::TMouseWheelCommand TMouseWheelCommand; + typedef TStyle::TKeyCommand TKeyCommand; + typedef TStyle::TVoidCommand TVoidCommand; + typedef TStyle::TMouseMoveCommand TMouseMoveCommand; + typedef TStyle::TMouseClickCommand TMouseClickCommand; + typedef TStyle::TMouseDoubleClickCommand TMouseDoubleClickCommand; + typedef TStyle::TExposeCommand TExposeCommand; + typedef TStyle::TConfigureCommand TConfigureCommand; + typedef TStyle::TEnterCommand TEnterCommand; + typedef TStyle::TLeaveCommand TLeaveCommand; typedef void ( *TSlicesCommand )( double*, int, void* ); typedef void ( *TWindowLevelCommand )( double, double, void* ); - typedef TBaseStyle::TMouseCommand TMouseCommand; - typedef TBaseStyle::TMouseWheelCommand TMouseWheelCommand; - typedef TBaseStyle::TKeyCommand TKeyCommand; - typedef TBaseStyle::TVoidCommand TVoidCommand; + typedef TVoidCommand TRenderCommand; public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); + cpExtensions_BaseInteractorStyle_Commands( Slices ); + cpExtensions_BaseInteractorStyle_Commands( WindowLevel ); + cpExtensions_BaseInteractorStyle_Commands( Render ); + public: // Creation static ImageSliceActors* New( ); - void AddSlicesCommand( TSlicesCommand command, void* data ); - void AddWindowLevelCommand( TWindowLevelCommand command, void* data ); - void AddRenderCommand( TVoidCommand command, void* data ); - - void RemoveSlicesCommand( TSlicesCommand command ); - void RemoveWindowLevelCommand( TWindowLevelCommand command ); - void RemoveRenderCommand( TVoidCommand command ); - - void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 ); - void AddInputData( vtkImageData* data, int axis = 2 ); + ImageBlender* GetBlender( ); + const ImageBlender* GetBlender( ) const; + void SetBlender( ImageBlender* blender ); + void SetAxis( int axis ); + void AddInputConnection( vtkAlgorithmOutput* aout ); + void AddInputData( vtkImageData* data ); void Clear( ); void AssociateSlice( Self* slice ); @@ -76,9 +80,9 @@ namespace cpExtensions 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; + unsigned int GetNumberOfImages( ) const; + vtkImageActor* GetImageActor( ); + const vtkImageActor* GetImageActor( ) const; vtkTextActor* GetTextActor( ); const vtkTextActor* GetTextActor( ) const; vtkActor* GetPlaneActor( ); @@ -96,9 +100,6 @@ namespace cpExtensions void ResetCursor( ); void SetCursor( double pos[ 3 ] ); - vtkImageMapToColors* GetImageMap( unsigned int id ); - const vtkImageMapToColors* GetImageMap( unsigned int id ) const; - double GetMinWindow( ) const; double GetMaxWindow( ) const; double GetMinLevel( ) const; @@ -110,11 +111,6 @@ namespace cpExtensions 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; @@ -125,7 +121,7 @@ namespace cpExtensions void UpdateText( double pos[ 3 ] ); void UpdateText( const double& w, const double& l ); - void Render( ); + void Render( const double& t ); void ResetCamera( ); protected: @@ -133,19 +129,17 @@ namespace cpExtensions virtual ~ImageSliceActors( ); void _ConfigureStyle( ); - void _ConfigureNewLUT( vtkImageData* data ); - void _ConfigureNewInput( int axis ); // Events static void _MouseMoveCommand( void* data, - const TBaseStyle::ButtonID& btn, + const TStyle::ButtonID& btn, int* idx, double* pos, bool alt, bool ctr, bool sft ); static void _MouseClickCommand( void* data, - const TBaseStyle::ButtonID& btn, + const TStyle::ButtonID& btn, int* idx, double* pos, bool alt, bool ctr, bool sft ); @@ -157,6 +151,8 @@ namespace cpExtensions void* data, const char& key ); + static void _EnterCommand( void* data ); + static void _LeaveCommand( void* data ); private: // Purposely not implemented @@ -168,33 +164,36 @@ namespace cpExtensions vtkRenderWindow* m_Window; // Multiple actors - std::vector< vtkSmartPointer< vtkImageMapToColors > > m_ImageMaps; - std::vector< vtkSmartPointer< vtkImageSliceMapper > > m_SliceMappers; - std::vector< vtkSmartPointer< vtkImageActor > > m_ImageActors; + vtkSmartPointer< ImageBlender > m_ImageBlender; + vtkSmartPointer< vtkImageSliceMapper > m_ImageMapper; + vtkSmartPointer< vtkImageActor > m_ImageActor; bool m_Interpolate; + int m_VisibleExtent[ 6 ]; + double m_VisibleBounds[ 6 ]; + // Associated slices std::vector< Self* > m_AssociatedSlices; - // Window-Level values - double m_MinWindow, m_MaxWindow; - double m_MinLevel, m_MaxLevel; - - // Associated commands - std::map< TSlicesCommand, void* > m_SlicesCommands; - std::map< TWindowLevelCommand, void* > m_WindowLevelCommands; - std::map< TVoidCommand, void* > m_RenderCommands; - // Unique objects vtkSmartPointer< vtkPolyData > m_Cursor; vtkSmartPointer< vtkPolyDataMapper > m_CursorMapper; vtkSmartPointer< vtkActor > m_CursorActor; - vtkSmartPointer< vtkPlane > m_PlaneFunction; + + vtkSmartPointer< vtkPolyData > m_HorizontalLine; + vtkSmartPointer< vtkPolyDataMapper > m_HorizontalLineMapper; + vtkSmartPointer< vtkActor > m_HorizontalLineActor; + + vtkSmartPointer< vtkPolyData > m_VerticalLine; + vtkSmartPointer< vtkPolyDataMapper > m_VerticalLineMapper; + vtkSmartPointer< vtkActor > m_VerticalLineActor; + vtkSmartPointer< vtkPolyData > m_Plane; vtkSmartPointer< vtkPolyDataMapper > m_PlaneMapper; + vtkSmartPointer< vtkActor > m_PlaneActor; + char m_TextBuffer[ 1024 ]; vtkSmartPointer< vtkTextActor > m_TextActor; - vtkSmartPointer< vtkActor > m_PlaneActor; double m_StartWindowLevelPos[ 3 ]; double m_StartWindowLevel[ 2 ];