X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FImageSliceActors.h;h=25f81f6fae52a849e86019fe9a2b2c84e6b1dfcd;hb=bbf5fdea58d522fe9385f8cb506100e062348fe6;hp=6aca9db1b470ce4f705024db2ebbf01de258294b;hpb=28f9b7dc84eb4b09e985ad7e43a9f0001a6be928;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index 6aca9db..25f81f6 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -1,30 +1,22 @@ -#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ -#define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef __cpExtensions__Visualization__ImageSliceActors__h__ +#define __cpExtensions__Visualization__ImageSliceActors__h__ + +#include #include -#include #include -#define MAX_TEXT_BUFFER 1024 - -class vtkAlgorithmOutput; +// ------------------------------------------------------------------------- class vtkImageData; -class vtkRenderer; +// ------------------------------------------------------------------------- namespace cpExtensions { namespace Visualization { + class ImageOutlineActor; + class LUTImageActor; + class WindowLevelImageActor; + /** */ class cpExtensions_EXPORT ImageSliceActors @@ -32,159 +24,51 @@ namespace cpExtensions { public: typedef ImageSliceActors Self; - 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 TVoidCommand TRenderCommand; - - template< class _TSource > - struct SourceActor - { - vtkSmartPointer< _TSource > Source; - vtkSmartPointer< vtkPolyDataMapper > Mapper; - vtkSmartPointer< vtkActor > Actor; - void Create( ) - { - this->Source = vtkSmartPointer< _TSource >::New( ); - this->Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( ); - this->Actor = vtkSmartPointer< vtkActor >::New( ); - this->Mapper->SetInputConnection( this->Source->GetOutputPort( ) ); - this->Actor->SetMapper( this->Mapper ); - } - void Modified( ) - { - this->Source->Modified( ); - this->Mapper->Modified( ); - this->Actor->Modified( ); - } - }; public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); - cpExtensions_BaseInteractorStyle_Commands( Slices ); - cpExtensions_BaseInteractorStyle_Commands( WindowLevel ); - cpExtensions_BaseInteractorStyle_Commands( Render ); - public: static Self* New( ); - void Clear( ); - void SetInputConnection( vtkAlgorithmOutput* aout, int orientation ); - void SetInputData( vtkImageData* data, int orientation ); - void SetInputActor( vtkProp* actor, int orientation ); - vtkImageData* GetInputData( ); - - vtkImageActor* GetImageActor( ); - const vtkImageActor* GetImageActor( ) const; - - void AddMesh( vtkPolyData* mesh ); - - void AssociateSlice( Self* slice ); - void CleanAssociatedSlices( ); - - TStyle* GetStyle( ); - void SetStyle( vtkInteractorStyle* st ); + vtkImageData* GetImage( ); + const vtkImageData* GetImage( ) const; - void PushInto( vtkRenderer* ren ); - void PopFrom( vtkRenderer* ren ); + WindowLevelImageActor* GetWindowLevelImageActor( ); + const WindowLevelImageActor* GetWindowLevelImageActor( ) const; - long GetSliceNumber( ) const; - void SetSliceNumber( long slice ); + LUTImageActor* GetLUTImageActor( ); + const LUTImageActor* GetLUTImageActor( ) const; - void ShowPixelText( double* pos ); + ImageOutlineActor* GetImageOutlineActor( ); + const ImageOutlineActor* GetImageOutlineActor( ) const; - void GetScalarRange( double r[ 2 ] ) const; - void SetScalarRange( const double& a, const double& b ); - void UnsetScalarRange( ); - void SetWindowLevel( const double& w, const double& l ); - double GetWindow( ) const; - double GetLevel( ) const; + int GetOrientation( ) const; - void Render( ); + 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 _ConfigureInput( int orientation ); - void _ConfigureCursor( ); - - // Events - static void _MouseMoveCommand( - void* data, - const TStyle::ButtonID& btn, - int* idx, double* pos, - bool alt, bool ctr, bool sft - ); - static void _MouseClickCommand( - void* data, - const TStyle::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: - // Main image - vtkSmartPointer< vtkImageSliceMapper > m_Mapper; - vtkSmartPointer< vtkImageActor > m_Actor; - - // Secondary slices - std::vector< vtkSmartPointer< Self > > m_AssociatedSlices; - - // Associated meshes - std::map< vtkPolyData*, SourceActor< vtkCutter > > m_Meshes; - - // Cursor - SourceActor< vtkCursor3D > m_Cursor; - - // Text - char m_TextBuffer[ MAX_TEXT_BUFFER ]; - vtkSmartPointer< vtkTextActor > m_TextActor; - - // WindowLevel - double m_ScalarRange[ 2 ]; - bool m_ManualScalarRange; - - // Style - vtkSmartPointer< vtkInteractorStyle > m_Style; - - // Events-related data - double m_StartMouseEvent[ 3 ]; - double m_StartWindow; - double m_StartLevel; + 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$