]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/ImageSliceActors.h
Intermediary commit
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceActors.h
index 6322d18ca515df66878d2f3805722c0cdd94c69f..4708e07f7bcb588cad04d52d84cf922154fb37b3 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>
@@ -38,18 +39,32 @@ namespace cpExtensions
     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( );
 
       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,6 +89,16 @@ 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;
@@ -87,6 +112,7 @@ namespace cpExtensions
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
 
+      void _ConfigureNewLUT( vtkImageData* data, LUTType lut_t );
       void _ConfigureNewInput( int axis );
 
       // Events
@@ -123,6 +149,7 @@ namespace cpExtensions
       vtkSmartPointer< ImageInteractorStyle > Style;
 
       // Multiple actors
+      std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps;
       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
       bool Interpolate;
@@ -142,6 +169,9 @@ namespace cpExtensions
       char                                 TextBuffer[ 1024 ];
       vtkSmartPointer< vtkTextActor >      TextActor;
       vtkSmartPointer< vtkActor >          PlaneActor;
+
+      double StartWindowLevelPos[ 3 ];
+      double StartWindowLevel[ 2 ];
     };
 
   } // ecapseman