X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FImageSliceActors.h;h=25f81f6fae52a849e86019fe9a2b2c84e6b1dfcd;hb=510ac31d52c1ac725baf278243c958e6c564b5b3;hp=c8d739f9a8185925b322965e4a34962aa1bcd59a;hpb=4c1d2229e65d601ac8138d804b4ae5e91c468e1a;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index c8d739f..25f81f6 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -1,33 +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 // ------------------------------------------------------------------------- -class vtkAlgorithmOutput; class vtkImageData; -class vtkLookupTable; -class vtkRenderer; // ------------------------------------------------------------------------- namespace cpExtensions { namespace Visualization { + class ImageOutlineActor; + class LUTImageActor; + class WindowLevelImageActor; + /** */ class cpExtensions_EXPORT ImageSliceActors @@ -36,201 +25,50 @@ 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; - - typedef cpExtensions::Visualization::ImageBlender TBlender; - public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); - cpExtensions_BaseInteractorStyle_Commands( Slices ); - cpExtensions_BaseInteractorStyle_Commands( WindowLevel ); - cpExtensions_BaseInteractorStyle_Commands( Render ); - public: - // Creation - static ImageSliceActors* New( ); - - void SetAxis( int axis ); - void SetInputConnection( vtkAlgorithmOutput* aout ); - void SetInputImage( vtkImageData* data ); - int AddBinaryConnection( - vtkAlgorithmOutput* aout, - const double& r, const double& g, const double& b - ); - int AddBinaryImage( - vtkImageData* data, - const double& r, const double& g, const double& b - ); - void Clear( ); - - void AssociateSlice( Self* slice ); - - vtkImageData* GetInputImage( ); - const vtkImageData* GetInputImage( ) const; - - vtkInteractorStyle* GetStyle( ); - const vtkInteractorStyle* GetStyle( ) const; - - void PushActorsInto( vtkRenderWindow* window, bool force_style = true ); - void PopActorsFrom( vtkRenderWindow* window ); - unsigned int GetNumberOfImages( ) const; - - vtkImageActor* GetImageActor( ); - const vtkImageActor* GetImageActor( ) const; - vtkImageActor* GetBinaryActor( ); - const vtkImageActor* GetBinaryActor( ) 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 ] ); - - void ResetAxesCursor( ); - void SetAxesCursor( double pos[ 3 ] ); - - 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( ); - - 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( ); + + vtkImageData* GetImage( ); + const vtkImageData* GetImage( ) const; + + WindowLevelImageActor* GetWindowLevelImageActor( ); + const WindowLevelImageActor* GetWindowLevelImageActor( ) const; + + LUTImageActor* GetLUTImageActor( ); + const LUTImageActor* GetLUTImageActor( ) const; - void Render( const double& t ); - void ResetCamera( ); + 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 _ConfigureInputImage( ); - void _ConfigureBinaryImage( - const double& r, const double& g, const double& b - ); - - // 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: - static double m_PlaneColors[ 3 ][ 3 ]; - - vtkSmartPointer< TStyle > m_Style; - vtkRenderWindow* m_Window; - - // Multiple actors - vtkSmartPointer< vtkImageSliceMapper > m_ImageMapper; - vtkSmartPointer< vtkImageActor > m_ImageActor; - - vtkSmartPointer< vtkImageData > m_BlenderBase; - vtkSmartPointer< TBlender > m_Blender; - vtkSmartPointer< vtkImageSliceMapper > m_BlenderMapper; - vtkSmartPointer< vtkLookupTable > m_BlenderLUT; - vtkSmartPointer< vtkImageActor > m_BlenderActor; - - bool m_Interpolate; - - double m_WLRange[ 4 ]; - - int m_VisibleExtent[ 6 ]; - double m_VisibleBounds[ 6 ]; - - // Associated slices - std::vector< Self* > m_AssociatedSlices; - - // Unique objects - vtkSmartPointer< vtkPolyData > m_Cursor; - vtkSmartPointer< vtkPolyDataMapper > m_CursorMapper; - vtkSmartPointer< vtkActor > m_CursorActor; - - vtkSmartPointer< vtkPolyData > m_Axis1; - vtkSmartPointer< vtkPolyDataMapper > m_Axis1Mapper; - vtkSmartPointer< vtkActor > m_Axis1Actor; - - vtkSmartPointer< vtkPolyData > m_Axis2; - vtkSmartPointer< vtkPolyDataMapper > m_Axis2Mapper; - vtkSmartPointer< vtkActor > m_Axis2Actor; - - vtkSmartPointer< vtkPolyData > m_Plane; - vtkSmartPointer< vtkPolyDataMapper > m_PlaneMapper; - vtkSmartPointer< vtkActor > m_PlaneActor; - - char m_TextBuffer[ 1024 ]; - vtkSmartPointer< vtkTextActor > m_TextActor; - - 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$