]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/ImageSliceActors.h
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceActors.h
index 4e29dc516916d5a0d3313f136a97a30208ca691e..25f81f6fae52a849e86019fe9a2b2c84e6b1dfcd 100644 (file)
@@ -1,28 +1,22 @@
-#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
-#define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
+#ifndef __cpExtensions__Visualization__ImageSliceActors__h__
+#define __cpExtensions__Visualization__ImageSliceActors__h__
 
-#include <cpExtensions/cpExtensions_Export.h>
-
-#include <cpExtensions/Interaction/ImageInteractorStyle.h>
-#include <vtkActor.h>
-#include <vtkCursor3D.h>
-#include <vtkImageActor.h>
-#include <vtkImageSliceMapper.h>
-#include <vtkPolyDataMapper.h>
+#include <cpExtensions/Config.h>
 #include <vtkPropCollection.h>
-#include <vtkTextActor.h>
 #include <vtkSmartPointer.h>
 
-#define MAX_TEXT_BUFFER 1024
-
-class vtkAlgorithmOutput;
+// -------------------------------------------------------------------------
 class vtkImageData;
-class vtkRenderer;
 
+// -------------------------------------------------------------------------
 namespace cpExtensions
 {
   namespace Visualization
   {
+    class ImageOutlineActor;
+    class LUTImageActor;
+    class WindowLevelImageActor;
+
     /**
      */
     class cpExtensions_EXPORT ImageSliceActors
@@ -30,150 +24,51 @@ namespace cpExtensions
     {
     public:
       typedef ImageSliceActors Self;
-      typedef cpExtensions::Interaction::ImageInteractorStyle TStyle;
-      typedef TStyle::TMouseCommand            TMouseCommand;
-      typedef TStyle::TMouseWheelCommand       TMouseWheelCommand;
-      typedef TStyle::TKeyCommand              TKeyCommand;
-      typedef TStyle::TVoidCommand             TVoidCommand;
-      typedef TStyle::TMouseMoveCommand        TMouseMoveCommand;
-      typedef TStyle::TMouseClickCommand       TMouseClickCommand;
-      typedef TStyle::TMouseDoubleClickCommand TMouseDoubleClickCommand;
-      typedef TStyle::TExposeCommand           TExposeCommand;
-      typedef TStyle::TConfigureCommand        TConfigureCommand;
-      typedef TStyle::TEnterCommand            TEnterCommand;
-      typedef TStyle::TLeaveCommand            TLeaveCommand;
-      typedef void ( *TSlicesCommand )( double*, int, void* );
-      typedef void ( *TWindowLevelCommand )( double, double, void* );
-      typedef TVoidCommand TRenderCommand;
-
-      template< class _TSource >
-        struct SourceActor
-      {
-        vtkSmartPointer< _TSource >          Source;
-        vtkSmartPointer< vtkPolyDataMapper > Mapper;
-        vtkSmartPointer< vtkActor >          Actor;
-        void Create( )
-          {
-            this->Source = vtkSmartPointer< _TSource >::New( );
-            this->Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
-            this->Actor = vtkSmartPointer< vtkActor >::New( );
-            this->Mapper->SetInputConnection( this->Source->GetOutputPort( ) );
-            this->Actor->SetMapper( this->Mapper );
-          }
-        void Modified( )
-          {
-            this->Source->Modified( );
-            this->Mapper->Modified( );
-            this->Actor->Modified( );
-          }
-      };
-        
 
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
 
-      cpExtensions_BaseInteractorStyle_Commands( Slices );
-      cpExtensions_BaseInteractorStyle_Commands( WindowLevel );
-      cpExtensions_BaseInteractorStyle_Commands( Render );
-
     public:
       static Self* New( );
 
-      void Clear( );
-      void SetInputConnection( vtkAlgorithmOutput* aout, int orientation );
-      void SetInputData( vtkImageData* data, int orientation );
+      vtkImageData* GetImage( );
+      const vtkImageData* GetImage( ) const;
 
-      void AssociateSlice( Self* slice );
-      void CleanAssociatedSlices( );
+      WindowLevelImageActor* GetWindowLevelImageActor( );
+      const WindowLevelImageActor* GetWindowLevelImageActor( ) const;
 
-      TStyle* GetStyle( );
-      void SetStyle( vtkInteractorStyle* st );
+      LUTImageActor* GetLUTImageActor( );
+      const LUTImageActor* GetLUTImageActor( ) const;
 
-      void PushInto( vtkRenderer* ren );
-      void PopFrom( vtkRenderer* ren );
+      ImageOutlineActor* GetImageOutlineActor( );
+      const ImageOutlineActor* GetImageOutlineActor( ) const;
 
-      long GetSliceNumber( ) const;
-      void SetSliceNumber( long slice );
+      int GetOrientation( ) const;
 
-      void ShowPixelText( double* pos );
-
-      void GetScalarRange( double r[ 2 ] ) const;
-      void SetScalarRange( const double& a, const double& b );
-      void UnsetScalarRange( );
-      void SetWindowLevel( const double& w, const double& l );
-      double GetWindow( ) const;
-      double GetLevel( ) const;
-
-      void Render( );
+      int GetSliceNumber( ) const;
+      virtual void SetImage( vtkImageData* image, int orientation );
+      virtual unsigned int AddLUTImage( vtkImageData* image );
+      virtual void SetSliceNumber( int slice );
 
     protected:
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
 
-      void _ConfigureInput( int orientation );
-      void _ConfigureCursor( );
-
-      // Events
-      static void _MouseMoveCommand(
-        void* data,
-        const TStyle::ButtonID& btn,
-        int* idx, double* pos,
-        bool alt, bool ctr, bool sft
-        );
-      static void _MouseClickCommand(
-        void* data,
-        const TStyle::ButtonID& btn,
-        int* idx, double* pos,
-        bool alt, bool ctr, bool sft
-        );
-      static void _MouseWheelCommand(
-        void* data,
-        const int& dir, bool alt, bool ctr, bool sft
-        );
-      static void _KeyCommand(
-        void* data,
-        const char& key
-        );
-      static void _EnterCommand( void* data );
-      static void _LeaveCommand( void* data );
-
     private:
       // Purposely not implemented
       ImageSliceActors( const Self& );
       Self& operator=( const Self& );
 
     protected:
-      // Main image
-      vtkSmartPointer< vtkImageSliceMapper > m_Mapper;
-      vtkSmartPointer< vtkImageActor >       m_Actor;
-
-      // Secondary slices
-      std::vector< vtkSmartPointer< Self > > m_AssociatedSlices;
-
-      // Cursor
-      SourceActor< vtkCursor3D > m_Cursor;
-
-      // Text
-      char                            m_TextBuffer[ MAX_TEXT_BUFFER ];
-      vtkSmartPointer< vtkTextActor > m_TextActor;
-
-      // WindowLevel
-      double m_ScalarRange[ 2 ];
-      bool m_ManualScalarRange;
-
-      // Style
-      vtkSmartPointer< vtkInteractorStyle > m_Style;
-
-      // Events-related data
-      double m_StartMouseEvent[ 3 ];
-      double m_StartWindow;
-      double m_StartLevel;
+      vtkSmartPointer< ImageOutlineActor >     m_ImageOutlineActor;
+      vtkSmartPointer< LUTImageActor >         m_LUTImageActor;
+      vtkSmartPointer< WindowLevelImageActor > m_WindowLevelImageActor;
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#endif // __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
+#endif // __cpExtensions__Visualization__ImageSliceActors__h__
 
 // eof - $RCSfile$