]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/ImageSliceActors.h
Widget integration (step 5/6): Just one step leftgit shortlog !
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceActors.h
index 6322d18ca515df66878d2f3805722c0cdd94c69f..962c8f2b0cf0b2388981f949b1be19f85d768236 100644 (file)
@@ -9,6 +9,7 @@
 #include <vtkSmartPointer.h>
 #include <vtkActor.h>
 #include <vtkImageActor.h>
+#include <vtkImageMapToColors.h>
 #include <vtkImageSliceMapper.h>
 #include <vtkPlane.h>
 #include <vtkPolyData.h>
@@ -35,21 +36,40 @@ namespace cpExtensions
     public:
       typedef ImageSliceActors Self;
 
+      typedef void ( *TCursorCommand )( double*, int, void* );
+
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
 
+      enum LUTType
+      {
+        LUTType_None = 0,
+        LUTType_WindowLevel,
+        LUTType_Colors
+      };
+
     public:
       // Creation
       static ImageSliceActors* New( );
 
-      void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
-      void AddInputData( vtkImageData* data, int axis = 2 );
+      void AddInputConnection(
+        vtkAlgorithmOutput* aout,
+        int axis = 2,
+        LUTType lut = Self::LUTType_None
+        );
+      void AddInputData(
+        vtkImageData* data,
+        int axis = 2,
+        LUTType lut = Self::LUTType_None );
       void Clear( );
 
+      void AssociateSlice( Self* other );
+      void SetSlicesCommand( TCursorCommand cmd, void* data );
+
       vtkInteractorStyle* GetStyle( );
       const vtkInteractorStyle* GetStyle( ) const;
 
-      void PushActorsInto( vtkRenderWindow* window );
+      void PushActorsInto( vtkRenderWindow* window, bool force_style = true );
       void PopActorsFrom( vtkRenderWindow* window );
       unsigned int GetNumberOfImageActors( ) const;
       vtkImageActor* GetImageActor( unsigned int id );
@@ -74,11 +94,22 @@ namespace cpExtensions
       void ResetCursor( );
       void SetCursor( double pos[ 3 ] );
 
+      vtkImageMapToColors* GetImageMap( unsigned int id );
+      const vtkImageMapToColors* GetImageMap( unsigned int id ) const;
+
+      double GetWindow( unsigned int id ) const;
+      double GetLevel( unsigned int id ) const;
+      void SetWindow( unsigned int id, double w );
+      void SetLevel( unsigned int id, double l );
+      void SetWindowLevel( unsigned int id, double w, double l );
+      void ResetWindowLevel( unsigned int id );
+
       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 );
@@ -87,6 +118,7 @@ namespace cpExtensions
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
 
+      void _ConfigureNewLUT( vtkImageData* data, LUTType lut_t );
       void _ConfigureNewInput( int axis );
 
       // Events
@@ -123,10 +155,16 @@ namespace cpExtensions
       vtkSmartPointer< ImageInteractorStyle > Style;
 
       // Multiple actors
+      std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps;
       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
       bool Interpolate;
 
+      // Other associated slices
+      std::vector< vtkSmartPointer< Self > > AssociatedSlices;
+      TCursorCommand SlicesCommand;
+      void* SlicesData;
+
       // Other associated actors
       typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
       typedef std::vector< TAssociatedActor >       TAssociatedActors;
@@ -142,6 +180,9 @@ namespace cpExtensions
       char                                 TextBuffer[ 1024 ];
       vtkSmartPointer< vtkTextActor >      TextActor;
       vtkSmartPointer< vtkActor >          PlaneActor;
+
+      double StartWindowLevelPos[ 3 ];
+      double StartWindowLevel[ 2 ];
     };
 
   } // ecapseman