38 #include "vtkImageData.h"
43 #include "vtkRenderWindowInteractor.h"
44 #include "vtkRenderWindow.h"
45 #include "vtkRendererCollection.h"
46 #include "vtkRenderer.h"
48 #include "vtkTextProperty.h"
49 #include "vtkProperty.h"
50 #include "vtkImageClip.h"
51 #include "vtkImagePermute.h"
52 #include "vtkImageResample.h"
53 #include "vtkWindowToImageFilter.h"
54 #include "vtkBMPWriter.h"
55 #include "vtkPostScriptWriter.h"
56 #include "vtkJPEGWriter.h"
57 #include "vtkPNGWriter.h"
58 #include "vtkTIFFWriter.h"
59 #include "vtkCamera.h"
61 #include "vtkEventQtSlotConnect.h"
63 #include "QVTKWidget.h"
65 #include <QResizeEvent>
71 #include "vtkImageActorPointPlacer.h"
73 #include "vtkCellArray.h"
75 #include "vtkPolyData.h"
77 #include "vtkImplicitPlaneWidget.h"
80 #include "vtkLookupTable.h"
82 #include "vtkPiecewiseFunction.h"
112 this->
HbSplitter, SLOT( moveSplitter(
int,
int) ) );
114 this->
HtSplitter, SLOT( moveSplitter(
int,
int) ) );
134 vtkRenderWindow *renwin4 = this->
QvtkWidget_XYZ->GetRenderWindow();
136 this->
m_View3D->SetRenderWindow(renwin4);
191 iParent->
resize(800, 800);
272 this->
m_Image->GetExtent(extent);
279 View1->GetImageActor(),
280 View1->GetSlicePlane() );
290 View2->GetImageActor(),
291 View2->GetSlicePlane() );
301 View3->GetImageActor(),
302 View3->GetSlicePlane() );
357 for (
int i = 0; i < 3; i++ )
359 this->
m_Pool->
GetItem(i)->GetTextProperty()->SetFontFamilyToArial();
360 this->
m_Pool->
GetItem(i)->GetTextProperty()->SetFontSize(14);
385 vtkCamera *camera = this->
m_View3D->GetRenderer()->GetActiveCamera();
387 camera->Azimuth(-45);
389 this->
m_View3D->GetRenderer()->SetActiveCamera(camera);
416 reinterpret_cast< vtkObject * >( View1->GetInteractorStyle() ),
421 reinterpret_cast< vtkObject * >( View1->GetInteractorStyle() ),
429 reinterpret_cast< vtkObject * >( View2->GetInteractorStyle() ),
434 reinterpret_cast< vtkObject * >( View2->GetInteractorStyle() ),
441 reinterpret_cast< vtkObject * >( View3->GetInteractorStyle() ),
449 reinterpret_cast< vtkObject * >( View3->GetInteractorStyle() ),
454 reinterpret_cast< vtkObject * >( View3->GetInteractorStyle() ),
461 reinterpret_cast< vtkObject * >( View2->GetInteractorStyle() ),
468 reinterpret_cast< vtkObject * >( View1->GetInteractorStyle() ),
477 reinterpret_cast< vtkObject * >( View1->GetInteractorStyle() ),
482 reinterpret_cast< vtkObject * >( View2->GetInteractorStyle() ),
487 reinterpret_cast< vtkObject * >( View3->GetInteractorStyle() ),
503 reinterpret_cast< vtkObject * >( View1->GetInteractorStyle() ),
504 vtkCommand::WindowLevelEvent,
508 reinterpret_cast< vtkObject * >( View2->GetInteractorStyle() ),
509 vtkCommand::WindowLevelEvent,
513 reinterpret_cast< vtkObject * >( View3->GetInteractorStyle() ),
514 vtkCommand::WindowLevelEvent,
522 reinterpret_cast< vtkObject * >( View3D ),
529 reinterpret_cast< vtkObject * >( View3D ),
544 vtkSmartPointer<vtkImageData> test = vtkSmartPointer<vtkImageData>::New();
545 this->
m_Image->ShallowCopy(test);
550 input->GetDimensions(dim);
552 assert ( dim[0] + dim[1] + dim[2] > 0 );
555 this->
m_Image->ShallowCopy(input);
565 if ( ( iId < 0 ) || ( iId > 3 ) )
955 std::vector< vtkActor * >
958 std::vector< vtkActor * > oList =
962 iProperty,
false,
false );
964 oList.push_back(temp);
978 m_View3D->GetRenderer()->RemoveActor(iActor);
996 m_View3D->GetRenderer()->AddActor(iActor);
1021 if ( this->
m_Image->GetNumberOfScalarComponents() == 1 )
1063 vtkCamera *camera = vtkCamera::New();
1065 this->
m_View3D->GetRenderer()->SetActiveCamera(camera);
1074 camera->Elevation(90);
1080 camera->Azimuth(-90);
1170 this->
m_BoxWidget->InvokeEvent(vtkViewImage2DCommand::InteractionEvent);
1187 this->
m_PlaneWidget->InvokeEvent(vtkViewImage2DCommand::InteractionEvent);
1228 vtkImageData *imageData = this->
m_Image;
1231 imageData->GetExtent(extent);
1232 imageData->GetSpacing(spacing);
1237 m_BoxWidget->PlaceWidget(extent[0] * spacing[0], extent[1] * spacing[0],
1238 extent[2] * spacing[1], extent[3] * spacing[1],
1239 extent[4] * spacing[2], extent[5] * spacing[2]);
1246 vtkViewImage2DCommand::InteractionEvent,
m_View3D->GetCommand() );
1249 vtkCommand::EndInteractionEvent,
m_Pool->GetCommand() );
1261 vtkImageData *imageData = this->
m_Image;
1264 imageData->GetExtent(extent);
1265 imageData->GetSpacing(spacing);
1271 extent[0] * spacing[0], extent[1] * spacing[0],
1272 extent[2] * spacing[1], extent[3] * spacing[1],
1273 extent[4] * spacing[2], extent[5] * spacing[2]);
1275 ( extent[0] + extent[1] ) * spacing[0] / 2,
1276 ( extent[2] + extent[3] ) * spacing[1] / 2,
1277 ( extent[4] + extent[5] ) * spacing[2] / 2);
1287 vtkCommand::InteractionEvent,
m_View3D->GetCommand() );
1290 vtkCommand::EndInteractionEvent,
m_Pool->GetCommand() );
1301 const std::vector<vtkPiecewiseFunction*>& iOpacities)
1372 int n =
m_Pool->GetNumberOfItems();
1374 for (
int i = 0; i < n; i++ )
vtkActor * GetCurrentActor()
virtual void ShowScalarBar(const bool &)
void EnableZoomMode()
Start the Zoom Mode.
void SliceViewXZChanged(int Slice)
void SliceViewXYChanged(int Slice)
void EnableBoxWidget(bool)
Creates a box in 3d view to allow multiple meshes selection.
void setSizes(const QList< int > &list)
virtual void SetViewOrientation(int orientation)
void SetupVTKtoQtConnections()
virtual void Render(void)
in the QSplitter class, the method moveSplitter is protected, so it is not possible to use connect be...
void push_back(const T &value)
void UpdateRenderWindows()
Update only the visualization.
void InitializeSeedWidget()
Initializae the seed widget.
QSplitterChild * HtSplitter
void FullScreenViewChanged(int View)
QGoImageView3D(QWidget *parent=0)
Constructor by default.
virtual vtkActor * AddDataSet(vtkDataSet *dataset, vtkProperty *property=NULL, const bool &intersection=true, const bool &iDataVisibility=false)
void SetPlanesActors(std::vector< vtkProp3D * > iBounds)
void EnablePickMode()
Start the Pick Mode.
void UpdateCurrentActorVisibility(vtkObject *caller)
void SetVolumeRenderingOff()
virtual void AddActor(const int &iId, vtkActor *iActor)
vtkProp * GetCurrentProp()
Return the actor which is pointed by the cursor.
void ShowScalarBar(const bool &)
Show/hide the scalar bar in the collection.
void NewWindowLevel(double, double)
void SetVolumeRenderingOn(const std::vector< vtkImageData * > &iImages, const std::vector< vtkPiecewiseFunction * > &iOpacities)
void EnableDefaultMode()
Start the Default Mode.
void PanMode()
Use the pan interactor style.
void InitializeBoxWidget()
std::vector< vtkActor * > AddContour(vtkPolyData *iDataset, vtkProperty *iProperty=NULL)
Add contour with given property into the visualization.
void ShowPlanes(bool iShow)
void SynchronizeViews(bool iSynchronize)
void InitializeContourWidget()
Initializae the angle widget.
QSplitterChild * HbSplitter
void SetPlanesActors(std::vector< vtkProp3D * > iBounds)
void addSpacing(int size)
void EnableSeedWidget(bool iActivate)
Use the one click interactor style.
Define the interactor behavior withing a vtkImage2D. 4 modes (Default, Zoom, Pan and Pick) ...
void EnableContourPickingMode()
Use the contour picking mode.
virtual void SyncReset(void)
Description: Synchronize reset between views.
QString tr(const char *sourceText, const char *disambiguation, int n)
int GetSliceViewYZ() const
void DefaultMode()
Use the default interactor style.
virtual void SyncRender()
Description: Synchronize render between views.
void SetupViewGivenQVTKWidget(vtkViewImage2D *iView, QVTKWidget *iWidget)
void SetLookupTable(vtkLookupTable *iLut)
Set the lookup table in the collection.
std::vector< vtkProp3D * > GetPlanesActors()
void setValue(const QString &key, const QVariant &value)
void SynchronizeViews(bool iSynchronize)
Synchronize the 2d views.
void SetSliceViewXZ(const int &)
vtkViewImage3D * m_View3D
virtual void resizeEvent(QResizeEvent *event)
virtual void retranslateUi(QWidget *parent)
vtkInteractorStyleImage3D * GetInteractorStyle3D()
Get the interactor style for the vtkViewImage3D.
int GetFullScreenView() const
void SetSplinePlaneActorsVisibility(bool iVisibility)
Set the visibility of the plane actor.
void SetTriPlanarRenderingOn()
virtual void RemoveActor(const int &iId, vtkActor *iActor)
Abstract class for the visualization of 3D Image represented by one vtkImageData*.
vtkViewImage3D * GetImageViewer3D()
QString SnapshotViewXYZ(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-xyz-"))
QVTKInteractor * GetInteractor(const int &)
Returns the interactor for one given view.
void InitializeAllObservers()
void ZoomMode()
Use the zoom interactor style.
virtual void SetLookupTable(vtkLookupTable *lookuptable)
void SetBoundsActorsVisibility(bool iVisibility)
Set the bounds actors visibility.
void SynchronizeViews(bool iSynchronize)
void UpdateCurrentActorSelection(vtkObject *caller)
void SetCubeVisibility(const bool &a)
Set the cube visibility.
QVTKWidget * QvtkWidget_XZ
std::vector< vtkProp3D * > GetPlanesActors()
Get the plane actors.
void EnableVolumeRendering(const std::vector< vtkImageData * > &iImages, const std::vector< vtkPiecewiseFunction * > &iOpacities)
Creates a box in 3d view to allow multiple meshes selection.
virtual void setupUi(QWidget *parent)
Basic class to handle items such as images and polydatas visualization in 3D.
void InitializePlaneWidget()
virtual void Add2DPhantom(const unsigned int &i, vtkImageActor *input, vtkPolyData *in_bounds=NULL)
vtkImplicitPlaneWidget * m_PlaneWidget
virtual void SetInput(vtkImageData *input)
void SetTriPlanarRenderingOff()
virtual void SetSlice(int s)
Set/Get the current slice to display (depending on the orientation this can be in X...
QVTKWidget * QvtkWidget_YZ
void InitializeDistanceWidget()
Initializae the distance widget.
void SyncSetBackground(double *rgb)
bool GetCurrentState()
Store the actor which is pointed by the cursor into "m_CurrentProp".
void EnableSeedWidget(bool iEnable)
void SetSliceViewYZ(const int &)
QString SnapshotViewYZ(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-yz"))
const QSize & size() const
virtual void AddActor(const int &iId, vtkActor *iActor)
static vtkViewImage2D * New()
Convenient method to access the constructor.
virtual double * GetBackground(void)
QString SnapshotViewXY(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-xy-"))
int GetSliceViewXZ() const
virtual void SetImage(vtkImageData *iImage)
Set the image to displaid.
void ActorPickingMode()
switch to contour picking mode
void SetFullScreenView(const int &iS)
vtkActor * m_CurrentActor
virtual void Render(void)
virtual void SetShowScalarBar(const bool &)
Show/Hide scalar bar.
QVTKWidget * QvtkWidget_XYZ
virtual std::vector< vtkActor * > AddContour(vtkPolyData *iDataset, vtkProperty *iProperty=NULL)
Add contour with given property into the visualization.
virtual void SetLookupTable(vtkLookupTable *)
void DisableVolumeRendering()
void PanMode()
Use the pan interactor style.
void ShowSplinePlane()
Invert visibility of the Spline Plane.
void UpdateOnFirstRender()
void SaveStateSplitters()
QString SnapshotViewXZ(const GoFigure::FileType &iType, const QString &iBaseName=QString("snapshot-xz-"))
virtual vtkRenderWindowInteractor * GetInteractor()
void SliceViewYZChanged(int Slice)
void EnablePlaneWidget(bool)
Creates a box in 3d view to allow multiple meshes selection.
unsigned int m_SnapshotId
void InitializeAngleWidget()
Initializae the angle widget.
void EnablePanMode()
Start the Pan Mode.
QString SnapshotView(QVTKWidget *iWidget, const GoFigure::FileType &iType, const QString &iBaseName, const unsigned int &iSnapshotId)
virtual void SetViewConvention(int convention)
vtkOrientedBoxWidget * m_BoxWidget
vtkProperty * m_HighlightedContourProperty
vtkProp * GetCurrentProp()
Return the actor which is pointed by the cursor.
vtkViewImage2D * GetItem(int i)
Define the interactor behavior withing a vtkImage3D. 4 modes (Default, Zoom, Pan and Pick) ...
void AddItem(vtkViewImage2D *)
static vtkViewImage3D * New()
Convenient method to access the constructor.
void ChangeCursorShape(QCursor iCursorShape)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void ZoomMode()
Use the zoom interactor style.
int GetSliceViewXY() const
float m_IntersectionLineWidth
void SetExtraRenderWindow(vtkRenderWindow *win)
QByteArray saveState() const
virtual void RemoveActor(const int &iId, vtkActor *iActor)
void SetSliceViewXY(const int &)
QVTKWidget * QvtkWidget_XY
void DefaultMode()
Use the default interactor style.
vtkEventQtSlotConnect * VtkEventQtConnector
vtkViewImage2DCollection * m_Pool
Basic class to handle 2D/3D items such as images and polydatas visualization in 2D.
virtual void ResetCamera(void)
Reset the camera.
virtual ~QGoImageView3D()
Destructor.