]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/MPRActors.h
Some bugs...
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.h
index 24967800a36e80ab093e91bdb64913e2c2f1807a..91c0b5089d9e19eca6b90ba7a6bda710ae1f0be2 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
 #define __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
 
-#include <vector>
-
 #include <cpExtensions/cpExtensions_Export.h>
 #include <cpExtensions/Visualization/ImageSliceActors.h>
 
@@ -18,10 +16,18 @@ namespace cpExtensions
     public:
       typedef MPRActors Self;
 
-      typedef ImageSliceActors::TCursorCommand     TCursorCommand;
-      typedef ImageSliceActors::TMouseCommand      TMouseCommand;
-      typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand;
-      typedef ImageSliceActors::TKeyCommand        TKeyCommand;
+      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 );
@@ -30,19 +36,29 @@ namespace cpExtensions
       // Creation
       static MPRActors* New( );
 
-      void AddCursorCommand( TCursorCommand command, void* data )
-      {
-        this->Slices[ 0 ][ 0 ]->AddSlicesCommand( command, data );
-        this->Slices[ 0 ][ 1 ]->AddSlicesCommand( command, data );
-        this->Slices[ 0 ][ 2 ]->AddSlicesCommand( command, data );
-      }
-
       ImageSliceActors* GetSliceActors( const int& i ) const;
 
-      int AddInputConnection( vtkAlgorithmOutput* aout );
-      int AddInputData( vtkImageData* new_image );
+      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,
@@ -56,36 +72,42 @@ namespace cpExtensions
         vtkRenderWindow* w
         );
 
-      // Color lookup table
-      void SetLookupTableAsColor(
-        unsigned int i, double r, double g, double b
-        );
-
-      double GetWindow( )
-      {
-        return( this->Slices[ 0 ][ 0 ]->GetWindow( ) );
-      }
-      double GetLevel( )
-      {
-        return( this->Slices[ 0 ][ 0 ]->GetLevel( ) );
-      }
+      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 _SetSlices( double* pos, int axis, void* data );
+      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
@@ -95,13 +117,6 @@ namespace cpExtensions
     protected:
       vtkSmartPointer< vtkActor >         ImageOutlineActor;
       vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ];
-
-      std::vector< TCursorCommand >     CursorCommands;
-      std::vector< TMouseCommand >      MouseCommands;
-      std::vector< TMouseCommand >      MouseClickCommands;
-      std::vector< TMouseCommand >      MouseDoubleClickCommands;
-      std::vector< TMouseWheelCommand > MouseWheelCommands;
-      std::vector< TKeyCommand >        KeyCommands;
     };
 
   } // ecapseman