X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FImageSliceActors.h;h=25f81f6fae52a849e86019fe9a2b2c84e6b1dfcd;hb=510ac31d52c1ac725baf278243c958e6c564b5b3;hp=c5165c5665d5b7a2ab3f58b6240dd7fc53ea2c61;hpb=f9ab41413f58223ff4c616022e1ca4f3cccad21e;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index c5165c5..25f81f6 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -1,35 +1,22 @@ -#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ -#define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ +#ifndef __cpExtensions__Visualization__ImageSliceActors__h__ +#define __cpExtensions__Visualization__ImageSliceActors__h__ -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include - -#include +#include // ------------------------------------------------------------------------- -class vtkAlgorithmOutput; class vtkImageData; -class vtkLookupTable; -class vtkRenderer; // ------------------------------------------------------------------------- namespace cpExtensions { namespace Visualization { + class ImageOutlineActor; + class LUTImageActor; + class WindowLevelImageActor; + /** */ class cpExtensions_EXPORT ImageSliceActors @@ -38,173 +25,50 @@ namespace cpExtensions public: typedef ImageSliceActors Self; - typedef cpExtensions::Interaction::BaseInteractorStyle TBaseStyle; - typedef cpExtensions::Interaction::ImageInteractorStyle TStyle; - 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; - public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); 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 ); - void Clear( ); - - void AssociateSlice( Self* slice ); - - vtkImageData* GetInputImage( unsigned int id ); - const vtkImageData* GetInputImage( unsigned int id ) const; - - 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 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 GetMinWindow( ) const; - double GetMaxWindow( ) const; - double GetMinLevel( ) const; - double GetMaxLevel( ) 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 ); + static Self* New( ); - void Render( ); - void ResetCamera( ); + vtkImageData* GetImage( ); + const vtkImageData* GetImage( ) const; + + WindowLevelImageActor* GetWindowLevelImageActor( ); + const WindowLevelImageActor* GetWindowLevelImageActor( ) const; + + LUTImageActor* GetLUTImageActor( ); + const LUTImageActor* GetLUTImageActor( ) const; + + ImageOutlineActor* GetImageOutlineActor( ); + const ImageOutlineActor* GetImageOutlineActor( ) const; + + int GetOrientation( ) const; + + int GetSliceNumber( ) const; + virtual void SetImage( vtkImageData* image, int orientation ); + virtual unsigned int AddLUTImage( vtkImageData* image ); + virtual void SetSliceNumber( int slice ); protected: ImageSliceActors( ); virtual ~ImageSliceActors( ); - void _ConfigureStyle( ); - void _ConfigureNewLUT( vtkImageData* data ); - void _ConfigureNewInput( int axis ); - - // Events - static void _MouseMoveCommand( - void* data, - const TBaseStyle::ButtonID& btn, - int* idx, double* pos, - bool alt, bool ctr, bool sft - ); - static void _MouseClickCommand( - void* data, - const TBaseStyle::ButtonID& btn, - int* idx, 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 - ); - static void _EnterCommand( void* data ); - static void _LeaveCommand( void* data ); - private: // Purposely not implemented ImageSliceActors( const Self& ); Self& operator=( const Self& ); protected: - vtkSmartPointer< TStyle > m_Style; - vtkRenderWindow* m_Window; - - // Multiple actors - std::vector< vtkSmartPointer< vtkImageMapToColors > > m_ImageMaps; - std::vector< vtkSmartPointer< vtkImageSliceMapper > > m_SliceMappers; - std::vector< vtkSmartPointer< vtkImageActor > > m_ImageActors; - bool m_Interpolate; - - // 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< vtkPolyData > m_Plane; - vtkSmartPointer< vtkPolyDataMapper > m_PlaneMapper; - char m_TextBuffer[ 1024 ]; - vtkSmartPointer< vtkTextActor > m_TextActor; - vtkSmartPointer< vtkActor > m_PlaneActor; - - double m_StartWindowLevelPos[ 3 ]; - double m_StartWindowLevel[ 2 ]; + vtkSmartPointer< ImageOutlineActor > m_ImageOutlineActor; + vtkSmartPointer< LUTImageActor > m_LUTImageActor; + vtkSmartPointer< WindowLevelImageActor > m_WindowLevelImageActor; }; } // ecapseman } // ecapseman -#endif // __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ +#endif // __cpExtensions__Visualization__ImageSliceActors__h__ // eof - $RCSfile$