UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-11-21)

#include <visp3/ustk_gui/us2DSceneWidget.h>

+ Inheritance diagram for us2DSceneWidget:

Public Slots

void updateImageData (vtkImageData *imageData)
 
void changeMatrix (vpHomogeneousMatrix matrix)
 
void saveViewSlot ()
 
void updateView ()
 

Signals

void matrixChanged (vtkMatrix4x4 *matrix)
 
void voxelPicked (vpColVector vector)
 

Public Member Functions

 us2DSceneWidget (QWidget *parent=NULL, Qt::WindowFlags f=Qt::WindowFlags())
 
 ~us2DSceneWidget ()
 
void drawLine (double u1, double v1, double w1, double u2, double v2, double w2)
 
void getClick (vpColVector &vec)
 
void getCurrentSlice (usImagePostScan2D< unsigned char > &image2D)
 
vtkImageData * getImageData ()
 
vtkMatrix4x4 * getResliceMatrix ()
 
vtkPlane * getReslicePlane ()
 
void init ()
 
void keyPressEvent (QKeyEvent *event)
 
void keyReleaseEvent (QKeyEvent *event)
 
void mouseMoveEvent (QMouseEvent *event)
 
void mousePressEvent (QMouseEvent *event)
 
void paintEvent (QPaintEvent *event)
 
void setColor (double r, double g, double b)
 
void setImageData (vtkImageData *imageData)
 
void setResliceMatrix (vtkMatrix4x4 *matrix)
 
void setPolyDataPlaneContour (vtkPolyData *polyData)
 
void setPolyDataMeshContour (vtkPolyData *polyData)
 
void wheelEvent (QWheelEvent *event)
 

Detailed Description

Class used to render a 2D slice of a vtkImageData in a vtk scene in a QWidget (based on QVTKWidget)

Definition at line 129 of file us2DSceneWidget.h.

Constructor & Destructor Documentation

◆ us2DSceneWidget()

us2DSceneWidget::us2DSceneWidget ( QWidget *  parent = NULL,
Qt::WindowFlags  f = Qt::WindowFlags() 
)

Constructor.

Parameters
parentThe QWidget parent.
fQt window flags.

Definition at line 52 of file us2DSceneWidget.cpp.

◆ ~us2DSceneWidget()

us2DSceneWidget::~us2DSceneWidget ( )
inline

Definition at line 135 of file us2DSceneWidget.h.

Member Function Documentation

◆ changeMatrix

void us2DSceneWidget::changeMatrix ( vpHomogeneousMatrix  matrix)
slot

Orientation matrix update slot for vpMatrix.

Parameters
matrixThe new matrix defining rotation and translation in image coordinates system.

Definition at line 266 of file us2DSceneWidget.cpp.

References usVTKConverter::convert(), and matrixChanged().

◆ drawLine()

void us2DSceneWidget::drawLine ( double  u1,
double  v1,
double  w1,
double  u2,
double  v2,
double  w2 
)

Draw a red line between (u1,v1,w1) and (u2,v2,w2) over the image.

Definition at line 468 of file us2DSceneWidget.cpp.

References usVTKConverter::convert().

◆ getClick()

void us2DSceneWidget::getClick ( vpColVector &  vec)

Blocking getClick method : waits for user to pick a voxel, and return the voxel coordinates in (u,v,w) coordinates system.

Definition at line 531 of file us2DSceneWidget.cpp.

References voxelPicked().

◆ getCurrentSlice()

void us2DSceneWidget::getCurrentSlice ( usImagePostScan2D< unsigned char > &  image2D)

Getter for current 2D slice.

Parameters
[out]image2DSlice to extract.

Definition at line 409 of file us2DSceneWidget.cpp.

References usVTKConverter::convert().

Referenced by usResliceMatrixViewer::getView1Slice().

◆ getImageData()

vtkImageData * us2DSceneWidget::getImageData ( )

Image data getter.

Returns
The vtkImageData in wich we are slicing.

Definition at line 99 of file us2DSceneWidget.cpp.

◆ getResliceMatrix()

vtkMatrix4x4 * us2DSceneWidget::getResliceMatrix ( )

Homogeneous matrix getter.

Returns
The matrix defining the current slice (position and orientation).

Definition at line 105 of file us2DSceneWidget.cpp.

◆ getReslicePlane()

vtkPlane* us2DSceneWidget::getReslicePlane ( )

◆ init()

void us2DSceneWidget::init ( )

Init method, to call after image and matrix setters. Initializes the vtk workflow to display the image slice.

Definition at line 110 of file us2DSceneWidget.cpp.

Referenced by usResliceMatrixViewer::usResliceMatrixViewer().

◆ keyPressEvent()

void us2DSceneWidget::keyPressEvent ( QKeyEvent *  event)

Key press event catcher. H key to enable rotation mode, P key to pick a voxel.

Definition at line 320 of file us2DSceneWidget.cpp.

◆ keyReleaseEvent()

void us2DSceneWidget::keyReleaseEvent ( QKeyEvent *  event)

Key press event catcher. H key to enable rotation mode, P key to pick a voxel.

Definition at line 333 of file us2DSceneWidget.cpp.

◆ matrixChanged

void us2DSceneWidget::matrixChanged ( vtkMatrix4x4 *  matrix)
signal

◆ mouseMoveEvent()

void us2DSceneWidget::mouseMoveEvent ( QMouseEvent *  event)

Mouse move event catcher, used to calculate the rotation to apply on reslice view plane.

Definition at line 346 of file us2DSceneWidget.cpp.

References usVTKConverter::convert(), and matrixChanged().

◆ mousePressEvent()

void us2DSceneWidget::mousePressEvent ( QMouseEvent *  event)

Mouse press event filter. Used to pick voxels.

Definition at line 427 of file us2DSceneWidget.cpp.

References usVTKConverter::convert(), and voxelPicked().

◆ paintEvent()

void us2DSceneWidget::paintEvent ( QPaintEvent *  event)

Paint event catcher.

Parameters
eventThe event caught.

Definition at line 93 of file us2DSceneWidget.cpp.

References usViewerWidget::paintEvent().

◆ saveViewSlot

void us2DSceneWidget::saveViewSlot ( )
slot

Slot to save the current image displayed in the view.

Definition at line 395 of file us2DSceneWidget.cpp.

References us::getDataSetPath().

◆ setColor()

void us2DSceneWidget::setColor ( double  r,
double  g,
double  b 
)

Definition at line 459 of file us2DSceneWidget.cpp.

Referenced by usResliceMatrixViewer::usResliceMatrixViewer().

◆ setImageData()

void us2DSceneWidget::setImageData ( vtkImageData *  imageData)

Image setter.

Parameters
imageDataThe vtkImageData to display.

Definition at line 170 of file us2DSceneWidget.cpp.

Referenced by usResliceMatrixViewer::usResliceMatrixViewer().

◆ setPolyDataMeshContour()

void us2DSceneWidget::setPolyDataMeshContour ( vtkPolyData *  polyData)

Polydata mesh contour setter.

Parameters
polyDataThe vtk polydata representing the mesh contour in the plane.

Definition at line 211 of file us2DSceneWidget.cpp.

References usVTKConverter::convert().

Referenced by usResliceMatrixViewer::usResliceMatrixViewer().

◆ setPolyDataPlaneContour()

void us2DSceneWidget::setPolyDataPlaneContour ( vtkPolyData *  polyData)

Polydata plane contour setter.

Parameters
polyDataThe vtk polydata representing the plane contour (image bounds).

Definition at line 182 of file us2DSceneWidget.cpp.

References usVTKConverter::convert().

Referenced by usResliceMatrixViewer::usResliceMatrixViewer().

◆ setResliceMatrix()

void us2DSceneWidget::setResliceMatrix ( vtkMatrix4x4 *  matrix)

Orientation matrix setter.

Parameters
matrixThe vtk matrix to place the reslice plane in the image coordinate system (rotation and translation).

Definition at line 176 of file us2DSceneWidget.cpp.

Referenced by usResliceMatrixViewer::ResetViews(), and usResliceMatrixViewer::usResliceMatrixViewer().

◆ updateImageData

void us2DSceneWidget::updateImageData ( vtkImageData *  imageData)
slot

Image update slot.

Parameters
imageDataThe new vtkImageData to display.

Definition at line 240 of file us2DSceneWidget.cpp.

Referenced by usResliceMatrixViewer::openPostScan3D().

◆ updateView

void us2DSceneWidget::updateView ( )
slot

Slot used to recompute the view (if something shared changed in another view)

Definition at line 522 of file us2DSceneWidget.cpp.

◆ voxelPicked

void us2DSceneWidget::voxelPicked ( vpColVector  vector)
signal

Referenced by getClick(), and mousePressEvent().

◆ wheelEvent()

void us2DSceneWidget::wheelEvent ( QWheelEvent *  event)

Mouse wheel event catcher. Updates the translation along the plane normal.

Definition at line 276 of file us2DSceneWidget.cpp.

References usVTKConverter::convert(), and matrixChanged().