X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FMPRActors.h;h=91c0b5089d9e19eca6b90ba7a6bda710ae1f0be2;hb=e2fb8817731f6231d34941a208e46b36dad425b2;hp=ac49dc6d2f417f7d8cd3a9cedf2bcbf3c5b84482;hpb=4c644edb0ddb4adcf7bbecc8fb2316723df15825;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/MPRActors.h b/lib/cpExtensions/Visualization/MPRActors.h index ac49dc6..91c0b50 100644 --- a/lib/cpExtensions/Visualization/MPRActors.h +++ b/lib/cpExtensions/Visualization/MPRActors.h @@ -1,26 +1,9 @@ #ifndef __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__ #define __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__ -#include - #include #include -/* -#include -#include -#include -*/ - -// ------------------------------------------------------------------------- -/* -class vtkAlgorithmOutput; -class vtkImageData; -class vtkRenderer; -class vtkScalarsToColors; -*/ - -// ------------------------------------------------------------------------- namespace cpExtensions { namespace Visualization @@ -33,6 +16,19 @@ namespace cpExtensions public: typedef MPRActors Self; + typedef ImageSliceActors::TStyle TStyle; + typedef ImageSliceActors::TMouseCommand TMouseCommand; + typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand; + typedef ImageSliceActors::TKeyCommand TKeyCommand; + typedef ImageSliceActors::TVoidCommand TVoidCommand; + typedef ImageSliceActors::TMouseMoveCommand TMouseMoveCommand; + typedef ImageSliceActors::TMouseClickCommand TMouseClickCommand; + typedef ImageSliceActors::TMouseDoubleClickCommand TMouseDoubleClickCommand; + typedef ImageSliceActors::TExposeCommand TExposeCommand; + typedef ImageSliceActors::TConfigureCommand TConfigureCommand; + typedef ImageSliceActors::TEnterCommand TEnterCommand; + typedef ImageSliceActors::TLeaveCommand TLeaveCommand; + public: vtkTypeMacro( MPRActors, vtkPropCollection ); @@ -42,14 +38,26 @@ namespace cpExtensions ImageSliceActors* GetSliceActors( const int& i ) const; - int AddInputConnection( + void SetInputConnection( vtkAlgorithmOutput* aout ); + void SetInputImage( vtkImageData* data ); + int AddBinaryConnection( vtkAlgorithmOutput* aout, - ImageSliceActors::LUTType lut = ImageSliceActors::LUTType_WindowLevel + const double& r, const double& g, const double& b ); - int AddInputData( - vtkImageData* image, - ImageSliceActors::LUTType lut = ImageSliceActors::LUTType_WindowLevel + int AddBinaryImage( + vtkImageData* data, + const double& r, const double& g, const double& b ); + void Clear( ); + + vtkImageData* GetInputImage( ); + const vtkImageData* GetInputImage( ) const; + + unsigned int GetNumberOfImages( ) const; + + void SetInterpolate( bool v ); + void InterpolateOn( ); + void InterpolateOff( ); void PushActorsInto( vtkRenderWindow* x, @@ -57,52 +65,49 @@ namespace cpExtensions vtkRenderWindow* z, vtkRenderWindow* w ); - void PopDataFrom( - vtkRenderer* x, - vtkRenderer* y, - vtkRenderer* z, - vtkRenderer* w + void PopActorsFrom( + vtkRenderWindow* x, + vtkRenderWindow* y, + vtkRenderWindow* z, + vtkRenderWindow* w ); - // Lookup table methods - void SetLookupTable( unsigned int i, vtkScalarsToColors* lut ); - vtkScalarsToColors* GetLookupTable( unsigned int i ) const; - - // Grayscale window/level lookup - void SetLookupTableToWindowLevel( unsigned int i ); - double GetMinWindow( unsigned int i ) const; - double GetMaxWindow( unsigned int i ) const; - double GetMinLevel( unsigned int i ) const; - double GetMaxLevel( unsigned int i ) const; - double GetWindow( unsigned int i ) const; - double GetLevel( unsigned int i ) const; - void SetWindow( unsigned int i, const double& w ); - void SetLevel( unsigned int i, const double& l ); - void SetWindowLevel( unsigned int i, const double& w, const double& l ); - void ResetWindowLevel( unsigned int i ); - - // Color lookup table - void SetLookupTableToColor( - unsigned int i, - const double& r = double( 1 ), - const double& g = double( 0 ), - const double& b = double( 0 ) - ); + double GetMinWindow( ) const; + double GetMaxWindow( ) const; + double GetMinLevel( ) const; + double GetMaxLevel( ) const; + double GetWindow( ); + double GetLevel( ); + void SetWindow( double w ); + void SetLevel( double l ); + void SetWindowLevel( double w, double l ); + void ResetWindowLevel( ); // Slice access + int GetSliceNumber( const int& axis ) const; int GetSliceNumberMinValue( const int& axis ) const; int GetSliceNumberMaxValue( const int& axis ) const; - int GetSlice( const int& axis ) const; - void SetSlice( const int& axis, const int& slice ); - void SetSlice( const int& axis, const double& slice ); - void ResetSlices( ); + void SetSliceNumber( const int& axis, const int& slice ); + void SetSlice( const int& axis, double* pos ); + void SetAxesCursor( const int& axis, double* pos ); + + // Rendering controls + void Render( const int& axis ); + void Render( ); + void ResetCamera( const int& axis ); + void ResetCameras( ); protected: MPRActors( ); virtual ~MPRActors( ); - vtkImageData* _Image( unsigned int i ) const; - void _Update( unsigned int i ); + void _CreateBoundingBox( ); + + static void _SlicesCommand( double* pos, int axis, void* data ); + static void _WindowLevelCommand( + double window, double level, void* data + ); + static void _RenderCommand( void* data ); private: // Purposely not implemented @@ -110,7 +115,6 @@ namespace cpExtensions Self& operator=( const Self& ); protected: - // TODO: std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps; vtkSmartPointer< vtkActor > ImageOutlineActor; vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ]; };