-#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
-#define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
-
-#include <cpExtensions/cpExtensions_Export.h>
-
-#include <cpExtensions/Interaction/ImageInteractorStyle.h>
-#include <map>
-#include <vtkActor.h>
-#include <vtkCursor3D.h>
-#include <vtkCutter.h>
-#include <vtkImageActor.h>
-#include <vtkImageSliceMapper.h>
-#include <vtkPolyDataMapper.h>
+#ifndef __cpExtensions__Visualization__ImageSliceActors__h__
+#define __cpExtensions__Visualization__ImageSliceActors__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
{
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* GetInputData( );
+ vtkImageData* GetImage( );
+ const vtkImageData* GetImage( ) const;
- void AddMesh( vtkPolyData* mesh );
+ WindowLevelImageActor* GetWindowLevelImageActor( );
+ const WindowLevelImageActor* GetWindowLevelImageActor( ) const;
- void AssociateSlice( Self* slice );
- void CleanAssociatedSlices( );
+ LUTImageActor* GetLUTImageActor( );
+ const LUTImageActor* GetLUTImageActor( ) const;
- TStyle* GetStyle( );
- void SetStyle( vtkInteractorStyle* st );
+ ImageOutlineActor* GetImageOutlineActor( );
+ const ImageOutlineActor* GetImageOutlineActor( ) const;
- void PushInto( vtkRenderer* ren );
- void PopFrom( vtkRenderer* ren );
+ int GetOrientation( ) const;
- long GetSliceNumber( ) const;
- void SetSliceNumber( long slice );
-
- 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;
-
- // Associated meshes
- std::map< vtkPolyData*, SourceActor< vtkCutter > > m_Meshes;
-
- // 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$