#include <cpExtensions/cpExtensions_Export.h>
+#include <map>
#include <utility>
-#include <vector>
#include <vtkSmartPointer.h>
#include <vtkActor.h>
#include <vtkPropCollection.h>
#include <vtkTextActor.h>
-#include <cpExtensions/Visualization/ImageInteractorStyle.h>
+#include <cpExtensions/Interaction/ImageInteractorStyle.h>
// -------------------------------------------------------------------------
class vtkAlgorithmOutput;
public:
typedef ImageSliceActors Self;
- typedef void ( *TCursorCommand )( double*, int, void* );
- typedef BaseInteractorStyle::TMouseCommand TMouseCommand;
- typedef BaseInteractorStyle::TMouseWheelCommand TMouseWheelCommand;
- typedef BaseInteractorStyle::TKeyCommand TKeyCommand;
- typedef BaseInteractorStyle::TVoidCommand TVoidCommand;
+ typedef cpExtensions::Interaction::BaseInteractorStyle TBaseStyle;
+ typedef cpExtensions::Interaction::ImageInteractorStyle TStyle;
+ typedef void ( *TSlicesCommand )( double*, int, void* );
+ typedef void ( *TWindowLevelCommand )( double, double, void* );
+ typedef TBaseStyle::TMouseCommand TMouseCommand;
+ typedef TBaseStyle::TMouseWheelCommand TMouseWheelCommand;
+ typedef TBaseStyle::TKeyCommand TKeyCommand;
+ typedef TBaseStyle::TVoidCommand TVoidCommand;
public:
vtkTypeMacro( ImageSliceActors, vtkPropCollection );
// Creation
static ImageSliceActors* New( );
- void AddSlicesCommand( TCursorCommand command, void* data );
- void AddSeedCommand( TCursorCommand command, void* data );
+ void AddSlicesCommand( TSlicesCommand command, void* data );
+ void AddWindowLevelCommand( TWindowLevelCommand command, void* data );
+ void AddRenderCommand( TVoidCommand command, void* data );
+
+ void RemoveSlicesCommand( TSlicesCommand command );
+ void RemoveWindowLevelCommand( TWindowLevelCommand command );
+ void RemoveRenderCommand( TVoidCommand command );
void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
void AddInputData( vtkImageData* data, int axis = 2 );
void Clear( );
- void AssociateSlice( Self* other );
-
vtkInteractorStyle* GetStyle( );
const vtkInteractorStyle* GetStyle( ) const;
vtkPlane* GetPlaneFunction( );
const vtkPlane* GetPlaneFunction( ) const;
- void AddActor( vtkAlgorithm* algorithm, vtkActor* actor );
- void AddActor( vtkActor* actor );
-
void SetInterpolate( bool v );
void InterpolateOn( );
void InterpolateOff( );
void UpdateText( double pos[ 3 ] );
void UpdateText( const double& w, const double& l );
+ void Render( );
+ void ResetCamera( );
+
protected:
ImageSliceActors( );
virtual ~ImageSliceActors( );
// Events
static void _MouseMoveCommand(
void* data,
- const BaseInteractorStyle::ButtonID& btn, double* pos,
+ const TBaseStyle::ButtonID& btn,
+ int* idx, double* pos,
bool alt, bool ctr, bool sft
);
static void _MouseClickCommand(
void* data,
- const BaseInteractorStyle::ButtonID& btn, double* pos,
- bool alt, bool ctr, bool sft
- );
- static void _MouseDoubleClickCommand(
- void* data,
- const BaseInteractorStyle::ButtonID& btn, double* pos,
+ const TBaseStyle::ButtonID& btn,
+ int* idx, double* pos,
bool alt, bool ctr, bool sft
);
static void _MouseWheelCommand(
Self& operator=( const Self& );
protected:
- vtkSmartPointer< ImageInteractorStyle > m_Style;
+ vtkSmartPointer< TStyle > m_Style;
// Multiple actors
std::vector< vtkSmartPointer< vtkImageMapToColors > > m_ImageMaps;
double m_MinWindow, m_MaxWindow;
double m_MinLevel, m_MaxLevel;
- // Other associated slices
- std::vector< vtkSmartPointer< Self > > m_AssociatedSlices;
-
// Associated commands
- std::vector< std::pair< TCursorCommand, void* > > m_SlicesCommands;
- std::vector< std::pair< TCursorCommand, void* > > m_SeedCommands;
-
- // Other associated actors
- typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
- typedef std::vector< TAssociatedActor > TAssociatedActors;
- TAssociatedActors m_AssociatedActors;
+ std::map< TSlicesCommand, void* > m_SlicesCommands;
+ std::map< TWindowLevelCommand, void* > m_WindowLevelCommands;
+ std::map< TVoidCommand, void* > m_RenderCommands;
// Unique objects
vtkSmartPointer< vtkPolyData > m_Cursor;