X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FMPRActors.h;h=91c0b5089d9e19eca6b90ba7a6bda710ae1f0be2;hb=a7142bafa94bd9f1d1fd9df4c11d5356676cf419;hp=8cdfe5a963c9abbdfae81ec36ab2316563d45794;hpb=2361f4f97631e09d88d8a5510a369817dcaa19db;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/MPRActors.h b/lib/cpExtensions/Visualization/MPRActors.h index 8cdfe5a..91c0b50 100644 --- a/lib/cpExtensions/Visualization/MPRActors.h +++ b/lib/cpExtensions/Visualization/MPRActors.h @@ -4,109 +4,122 @@ #include #include -#include -#include - -// ------------------------------------------------------------------------- -class vtkAlgorithmOutput; -class vtkImageData; -class vtkRenderer; -class vtkScalarsToColors; -class vtkWindowLevelLookupTable; - -// ------------------------------------------------------------------------- namespace cpExtensions +{ + namespace Visualization { - namespace Visualization + /** + */ + class cpExtensions_EXPORT MPRActors + : public vtkPropCollection { - /** - */ - class cpExtensions_EXPORT MPRActors - : public vtkPropCollection - { - public: - typedef MPRActors Self; - - public: - vtkTypeMacro( MPRActors, vtkPropCollection ); - - cpPlugins_ImageSliceActors( ImageOutline, vtkImageActor ); - - public: - // Creation - static MPRActors* New( ); - - ImageSliceActors* GetSliceActors( const int& i ) const; - void SetInputConnection( vtkAlgorithmOutput* aout ); - void SetInputData( vtkImageData* image ); - - void PushDataInto( - vtkRenderer* x, - vtkRenderer* y, - vtkRenderer* z, - vtkRenderer* w - ); - void PopDataFrom( - vtkRenderer* x, - vtkRenderer* y, - vtkRenderer* z, - vtkRenderer* w - ); - - // Lookup table methods - vtkScalarsToColors* GetLookupTable( ) const; - void SetLookupTable( vtkScalarsToColors* lut ); - - // Grayscale window/level lookup - vtkWindowLevelLookupTable* GetLookupTableAsWindowLevel( ) const; - void SetLookupTableToWindowLevel( ); - double GetMinWindow( ) const; - double GetMaxWindow( ) const; - double GetMinLevel( ) const; - double GetMaxLevel( ) const; - double GetWindow( ) const; - double GetLevel( ) const; - void SetWindow( const double& w ); - void SetLevel( const double& l ); - void SetWindowLevel( const double& w, const double& l ); - void ResetWindowLevel( ); - - // Slice access - 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( ); - - // General accessors - void GetImageBounds( double bounds[ 6 ] ) const; - - protected: - MPRActors( ); - virtual ~MPRActors( ); - - vtkImageData* _InputImage( ) const; - void _UpdateSlices( ); - - private: - // Purposely not implemented - MPRActors( const Self& ); - Self& operator=( const Self& ); - - protected: - vtkSmartPointer< vtkImageMapToColors > ImageMapToColors; - vtkSmartPointer< vtkActor > ImageOutlineActor; - - typedef - cpExtensions::Visualization::ImageSliceActors - _TSlice; - vtkSmartPointer< _TSlice > Slices[ 3 ]; - - unsigned int ImageOutlineActorIndex; - }; - - } // ecapseman + 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 ); + + public: + // Creation + static MPRActors* New( ); + + ImageSliceActors* GetSliceActors( const int& i ) const; + + 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( ); + + vtkImageData* GetInputImage( ); + const vtkImageData* GetInputImage( ) const; + + unsigned int GetNumberOfImages( ) const; + + void SetInterpolate( bool v ); + void InterpolateOn( ); + void InterpolateOff( ); + + void PushActorsInto( + vtkRenderWindow* x, + vtkRenderWindow* y, + vtkRenderWindow* z, + vtkRenderWindow* w + ); + void PopActorsFrom( + vtkRenderWindow* x, + vtkRenderWindow* y, + vtkRenderWindow* z, + vtkRenderWindow* w + ); + + 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; + 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( ); + + 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 + MPRActors( const Self& ); + Self& operator=( const Self& ); + + protected: + vtkSmartPointer< vtkActor > ImageOutlineActor; + vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ]; + }; + + } // ecapseman } // ecapseman