-#ifndef __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__
-#define __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__
+#ifndef __cpExtensions__QT__SimpleMPRWidget__h__
+#define __cpExtensions__QT__SimpleMPRWidget__h__
#include <cpExtensions/Config.h>
#ifdef cpExtensions_QT4
-#include <map>
+#include <cpExtensions/QT/ActorsWidgetInterface.h>
#include <QWidget>
-#include <vtkPolyDataNormals.h>
-#include <vtkQuadricLODActor.h>
-#include <vtkRenderer.h>
-#include <vtkStripper.h>
#include <vtkSmartPointer.h>
-#include <cpExtensions/Visualization/ImageSliceActors.h>
-
-#define cpExtensions_MAX_POLYS 65535
+#include <map>
+#include <set>
// -------------------------------------------------------------------------
-class QVTKWidget;
+class vtkDataSet;
+class vtkProp;
+class vtkPropCollection;
-namespace Ui
-{
- class SimpleMPRWidget;
-}
+namespace Ui { class SimpleMPRWidget; }
// -------------------------------------------------------------------------
namespace cpExtensions
{
namespace QT
{
+ class MPR3DWidget;
+ class ImageWidget;
+
/**
*/
class cpExtensions_EXPORT SimpleMPRWidget
- : public QWidget
+ : public QWidget,
+ public ActorsWidgetInterface
{
Q_OBJECT;
public:
- typedef SimpleMPRWidget Self;
-
- typedef cpExtensions::Visualization::ImageSliceActors TActors;
-
- /**
- */
- struct PolyDataActor
- {
- vtkSmartPointer< vtkPolyData > Data;
- vtkSmartPointer< vtkPolyDataNormals > Normals;
- vtkSmartPointer< vtkStripper > Stripper;
- vtkSmartPointer< vtkPolyDataMapper > Mapper;
- vtkSmartPointer< vtkActor > Actor;
-
- void Configure( vtkPolyData* data )
- {
- this->Data = data;
- double r[ 2 ];
- this->Data->GetScalarRange( r );
-
- this->Normals = vtkSmartPointer< vtkPolyDataNormals >::New( );
- this->Stripper = vtkSmartPointer< vtkStripper >::New( );
- this->Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->Normals->SetInputData( this->Data );
- this->Normals->SetFeatureAngle( 60.0 );
- this->Stripper->SetInputConnection(
- this->Normals->GetOutputPort( )
- );
- this->Mapper->SetInputConnection(
- this->Stripper->GetOutputPort( )
- );
- this->Mapper->UseLookupTableScalarRangeOff( );
- this->Mapper->SetScalarRange( r[ 0 ], r[ 1 ] );
-
- unsigned long nPolys = this->Data->GetNumberOfPolys( );
- if( nPolys < cpExtensions_MAX_POLYS )
- {
- this->Actor = vtkSmartPointer< vtkActor >::New( );
- this->Actor->SetMapper( this->Mapper );
- }
- else
- {
- vtkSmartPointer< vtkQuadricLODActor > actor =
- vtkSmartPointer< vtkQuadricLODActor >::New( );
- actor->SetMapper( this->Mapper );
- actor->DeferLODConstructionOff( );
- this->Actor = actor.GetPointer( );
-
- } // fi
- }
- };
+ typedef SimpleMPRWidget Self;
+ typedef QWidget Superclass;
+ typedef ActorsWidgetInterface Superclass2;
- public:
- explicit SimpleMPRWidget( QWidget* parent = 0 );
- virtual ~SimpleMPRWidget( );
+ typedef vtkSmartPointer< vtkPropCollection > TProp;
+ typedef std::set< TProp > TProps;
- // Data management
- void Clear( );
- void SetMainImage( vtkImageData* image );
- void AddMesh( vtkPolyData* mesh );
+ // typedef cpExtensions::Visualization::MeshActor TMeshActor;
- // Visual objects
- vtkRenderWindowInteractor* GetInteractor( unsigned int i );
+ public:
+ explicit SimpleMPRWidget( QWidget* parent = NULL, Qt::WindowFlags f = 0 );
+ virtual ~SimpleMPRWidget( );
- vtkActor* GetActor( vtkPolyData* mesh );
+ void Configure( char q1, char q2, char q3, char q4 );
+
+ bool HasImage( ) const;
+ void SetImage( vtkImageData* image, const std::string& name );
+
+ bool Add( vtkDataSet* data, const std::string& name );
+
+ TProps GetViewProps( const std::string& name ) const;
+ TProps GetImageProps( ) const;
+
+ vtkRenderWindowInteractor* GetXInteractor( );
+ const vtkRenderWindowInteractor* GetXInteractor( ) const;
+ vtkRenderWindowInteractor* GetYInteractor( );
+ const vtkRenderWindowInteractor* GetYInteractor( ) const;
+ vtkRenderWindowInteractor* GetZInteractor( );
+ const vtkRenderWindowInteractor* GetZInteractor( ) const;
+ vtkRenderWindowInteractor* GetWInteractor( );
+ const vtkRenderWindowInteractor* GetWInteractor( ) const;
+
+ vtkRenderWindow* GetXRenderWindow( );
+ const vtkRenderWindow* GetXRenderWindow( ) const;
+ vtkRenderWindow* GetYRenderWindow( );
+ const vtkRenderWindow* GetYRenderWindow( ) const;
+ vtkRenderWindow* GetZRenderWindow( );
+ const vtkRenderWindow* GetZRenderWindow( ) const;
+ vtkRenderWindow* GetWRenderWindow( );
+ const vtkRenderWindow* GetWRenderWindow( ) const;
+
+ void ResetCameras( );
+ void Render( );
+
+ virtual std::set< std::string > GetActorsNames( ) const cpExtensions_OVERRIDE;
+ virtual bool IsWindowLevelImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual bool IsLUTImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual bool Is3DActor( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void GetScalarRange( const std::string& name, double r[ 2 ] ) const cpExtensions_OVERRIDE;
+ virtual void GetWindowLevel( const std::string& name, double wl[ 2 ] ) const cpExtensions_OVERRIDE;
+ virtual double GetWindow( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetLevel( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual char GetImageInterpolation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void GetColor( const std::string& name, double& r, double& g, double& b ) const cpExtensions_OVERRIDE;
+ virtual double GetOpacity( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetPointSize( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetLineWidth( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual int GetRepresentation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void SetScalarRange( const std::string& name, double r[ 2 ] ) cpExtensions_OVERRIDE;
+ virtual void SetScalarRange( const std::string& name, double min, double max ) cpExtensions_OVERRIDE;
+ virtual void SetWindowLevel( const std::string& name, double wl[ 2 ] ) cpExtensions_OVERRIDE;
+ virtual void SetWindowLevel( const std::string& name, double w, double l ) cpExtensions_OVERRIDE;
+ virtual void SetWindow( const std::string& name, double w ) cpExtensions_OVERRIDE;
+ virtual void SetLevel( const std::string& name, double l ) cpExtensions_OVERRIDE;
+ virtual void SetImageInterpolation( const std::string& name, char i ) cpExtensions_OVERRIDE;
+
+ virtual void SetColor( const std::string& name, double r, double g, double b ) cpExtensions_OVERRIDE;
+ virtual void SetOpacity( const std::string& name, double o ) cpExtensions_OVERRIDE;
+ virtual void SetPointSize( const std::string& name, double s ) cpExtensions_OVERRIDE;
+ virtual void SetLineWidth( const std::string& name, double w ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToPoints( const std::string& name ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToSurface( const std::string& name ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToWireframe( const std::string& name ) cpExtensions_OVERRIDE;
private slots:
void _SyncBottom( int a, int b );
protected:
Ui::SimpleMPRWidget* m_UI;
- QVTKWidget* m_VTK[ 4 ];
- vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
- vtkSmartPointer< TActors > m_2DSlices[ 3 ];
- vtkSmartPointer< TActors > m_3DSlices[ 3 ];
+ ImageWidget* m_XImage;
+ ImageWidget* m_YImage;
+ ImageWidget* m_ZImage;
+ MPR3DWidget* m_3DView;
- std::map< vtkPolyData*, PolyDataActor > m_PolyDatas;
+ std::string m_MainImageName;
+ vtkSmartPointer< vtkImageData > m_MainImage;
};
} // ecapseman
#endif // cpExtensions_QT4
-#endif // __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__
+#endif // __cpExtensions__QT__SimpleMPRWidget__h__
// eof - $RCSfile$