VivoQuant
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | List of all members
VTKController Class Reference

Object for controling the VTK Viewer. More...

#include <VTKController.h>

Public Slots

void forceRender ()
 force refresh the VTKViwer if vtk status is not up to date. Example use case: after loading a ROI in 3D ROI operator but ROI in VTKViewer is not shown.
 
void rotateZ (float angle)
 rotation VTK object with angle in degree
 
void setEnableGradientBackground (bool toEnable)
 enable or disable gray background
 
void setMIPEnabled (bool toEnable)
 enable or disable MIP volume
 
void setMPREnabled (bool toEnable)
 enable or disable MPR view
 
void setCrosshairMode (bool toEnable)
 enable or disable crosshair
 
void setAutoUpdate (bool toEnable)
 enable autoUpdate, with autoUpdate On. user do not need to call forceRender() or updateVolumeColors() after make changes
 

Public Member Functions

void rotateCamera (int x, int y, int z)
 rotate the camera around the object (focus point).
 
void panCamera (double x, double y)
 Pan camera horizontally and vertically.
 
void zoomCamera (double z)
 Zoom in or Zoom out camera.
 
void setCameraPosition (double x, double y, double z)
 set camera position in Cartesian coordinates
 
void setCameraSplineMovement (QList< Variant > locations, bool closeSpline=true)
 Set camera to move on the spline defined by user parameters.
 
string getCameraSplineMovement ()
 get camera to move on the spline defined by user parameters
 
bool getMIPEnabled ()
 Check if VTK Volume Rendering(Max Intensity Projection) is enabled.
 
bool getMPREnabled ()
 Check if VTK Multiplanar Reconstruction is enabled.
 
bool getAnnotationEnabled ()
 Check if VTK Annottation text is enabled.
 
void setAnnotationEnabled (bool toEnable)
 Enable or disable VTK Annottation text. Enable or disable The image Toggle indicator(before 4.0Invicro1) Use VQ.MainWin().switchShowActive(bool) in later version.
 
bool getOrientEnabled ()
 Check if VTK orientation widget is enabled.
 
void setOrientEnabled (bool toEnable)
 Enable or disable VTK orientation widget.
 
string getRenderSpeed ()
 return rendering quality.
 
string getAnnotationModel ()
 get current orientation widget model name
 
void forceVolumeMapperMode (int mode)
 Sets requested volume rendering mode. Options are: 0: Default, in configuration; 2: RayCastRenderMode 4: GPURenderMode.
 
void resetColorControls ()
 Sets all color controls back to their defaults.
 
void setActiveVolume (int idx)
 Set the current active volume.
 
int currentActiveVolume ()
 Get the current active volume index.
 
bool isClippingEnabled ()
 Get the status of the volume clipping.
 
bool isClippingBoundingBoxEnabled ()
 Get the status of the clipping bounding boxes.
 
void setStillUpdateRate (double factor)
 Sets update speed for volume rendering. Factor can be interpreted as "Frames/sec". In summary: larger factor=faster rendering, smaller factor=slower rendering.
 
bool getAutoUpdate ()
 returns the state of automatic rendering
 
void setSmoothingIterations (int iter)
 Sets the number of iterations done by vtkWindowedSincPolyDataFilter. More iterations create smoother ROI surfaces. Default value is 15.
 
void setFeatureAngle (double angle)
 Sets the feature angle for the vtkWindowedSincPolyDataFilter. A feature edge occurs when the angle between the two surface normals of a polygon sharing an edge is greater than the FeatureAngle. Default value is 120 degrees.
 
void setPassBand (double passBand)
 Sets the pass band used by vtkWindowedSincPolyDataFilter. By design, the PassBand is specified as a doubleing point number between 0 and 2. Lower PassBand values produce more smoothing. Default value is 0.001.
 
void disableAxes (bool b=true)
 enable or disable Axes in vtk
 
void setMPRPlanes (int planes)
 turn on and off MPR palne 0. all off
 
void setScalarOpacityPoints (int imgIdx, QList< Variant > imgRange, QList< Variant > opacityRange)
 setOpacityPoints sets the opacity piece-wise function for the VTK MIP's volume pixel opacities
 
void saveVTKViewerStatus (string str)
 save all current VTKViewer status in a text file, including view angle, distance, annotation text, orientation widget, rendering mode ...
 
void restoreVTKViewerStatus (string str)
 restore VTKViewer status from a text file
 
bool setPreset (Index idx, string name)
 Set the specified color function preset.
 
string getPresetName (Index idx)
 Get the secified color function preset name.
 
bool createPreset (string name, bool quiet=false)
 Create a preset from the current color function selection.
 
bool removePreset (string name)
 Remove the specified preset from the list.
 
void setViewAngleRange (int nbSteps)
 Set the range of the view angle slider [0 nbSteps].
 
int getViewAngleRange ()
 Get the range of the view angle slider.
 
void setViewAnglePos (int pos)
 Set the view angle slider position inside to the range.
 
int getViewAnglePos ()
 Get the view angle slider positio.
 
void enableClipping (bool isEnabled)
 Enable or disable the volume clipping.
 
void enableClippingBoundingBox (bool toEnable)
 Enable or disable the clipping bounding box.
 

Detailed Description

Object for controling the VTK Viewer.

See also ScriptMaster::vtkController() to obtain this object.

Member Function Documentation

◆ createPreset()

bool createPreset ( string  name,
bool  quiet = false 
)

Create a preset from the current color function selection.

Parameters
nameThe name of the preset
quietDo not prompt message box if preset already exist, forces overwrite.

◆ currentActiveVolume()

int currentActiveVolume ( )

Get the current active volume index.

Returns
An integer from 0 to 2 representing the active volume.

◆ enableClipping()

void enableClipping ( bool  isEnabled)

Enable or disable the volume clipping.

Parameters
isEnabledTrue if enabled, false otherwise

◆ enableClippingBoundingBox()

void enableClippingBoundingBox ( bool  toEnable)

Enable or disable the clipping bounding box.

Parameters
isEnabledTrue if enabled, false otherwise

◆ forceRender

void forceRender ( )
slot

force refresh the VTKViwer if vtk status is not up to date. Example use case: after loading a ROI in 3D ROI operator but ROI in VTKViewer is not shown.

Note
example: VQ.vtkController().forceRender();

◆ getCameraSplineMovement()

string getCameraSplineMovement ( )

get camera to move on the spline defined by user parameters

Returns
return spline points defined in string format

◆ getPresetName()

string getPresetName ( Index  idx)

Get the secified color function preset name.

Parameters
nameThe data index to get the preset name from
Returns
The name of the preset

◆ isClippingBoundingBoxEnabled()

bool isClippingBoundingBoxEnabled ( )

Get the status of the clipping bounding boxes.

Returns
True if enabled, false otherwise

◆ isClippingEnabled()

bool isClippingEnabled ( )

Get the status of the volume clipping.

Returns
True if enabled, false otherwise

◆ panCamera()

void panCamera ( double  x,
double  y 
)

Pan camera horizontally and vertically.

Parameters
xshift distance along X-Axis (a scale factor: 0 ? 300 in percentage, the base unit distance is DimX * PixelSizeX)
yshift distance along Y-Axis (a scale factor: 0 ? 300 in percentage, the base unit distance is DimY * PixelSizeY)

◆ removePreset()

bool removePreset ( string  name)

Remove the specified preset from the list.

Parameters
nameThe preset name

◆ restoreVTKViewerStatus()

void restoreVTKViewerStatus ( string  str)

restore VTKViewer status from a text file

Parameters
outputfilename and path
Note
example: var path = "C:\status.txt"; VQ.vtkController().restoreVTKViewerStatus( path );

◆ rotateCamera()

void rotateCamera ( int  x,
int  y,
int  z 
)

rotate the camera around the object (focus point).

Parameters
xdegree along X-axis (0-359) degree
ydegree along Y-axis (0-359) degree
zdegree along Z-axis (0-359) degree

◆ saveVTKViewerStatus()

void saveVTKViewerStatus ( string  str)

save all current VTKViewer status in a text file, including view angle, distance, annotation text, orientation widget, rendering mode ...

Parameters
outputfilename and path
Note
example: var path = "C:\status.txt"; VQ.vtkController().saveVTKViewerStatus( path );

◆ setActiveVolume()

void setActiveVolume ( int  idx)

Set the current active volume.

Parameters
idxThe index of the volume.

◆ setCameraPosition()

void setCameraPosition ( double  x,
double  y,
double  z 
)

set camera position in Cartesian coordinates

Parameters
xcoordinate in x axis
ycoordinate in y axis
zcoordinate in z axis

◆ setCameraSplineMovement()

void setCameraSplineMovement ( QList< Variant >  locations,
bool  closeSpline = true 
)

Set camera to move on the spline defined by user parameters.

Parameters
locationsA list of points specifying camera location. The function will use these points to calculate the spline. The points are arrays with either four elements for spherical (theta, phi, roll, radius) coordinates or three elements for Cartesian (x, y, z) coordinates.
closeSplineWhether the spine is closed

◆ setFeatureAngle()

void setFeatureAngle ( double  angle)

Sets the feature angle for the vtkWindowedSincPolyDataFilter. A feature edge occurs when the angle between the two surface normals of a polygon sharing an edge is greater than the FeatureAngle. Default value is 120 degrees.

Parameters
angleThe angle in degrees

◆ setMPRPlanes()

void setMPRPlanes ( int  planes)

turn on and off MPR palne 0. all off

  1. sagittal
  2. coronal
  3. sagittal & coronal
  4. transverse
  5. transervse & sagittal
  6. transervse & coronal
  7. all on

◆ setPassBand()

void setPassBand ( double  passBand)

Sets the pass band used by vtkWindowedSincPolyDataFilter. By design, the PassBand is specified as a doubleing point number between 0 and 2. Lower PassBand values produce more smoothing. Default value is 0.001.

Parameters
passBandThe pass band

◆ setPreset()

bool setPreset ( Index  idx,
string  name 
)

Set the specified color function preset.

Parameters
nameThe data index to apply to preset to
nameThe name of the preset

◆ setScalarOpacityPoints()

void setScalarOpacityPoints ( int  imgIdx,
QList< Variant >  imgRange,
QList< Variant >  opacityRange 
)

setOpacityPoints sets the opacity piece-wise function for the VTK MIP's volume pixel opacities

Parameters
imgRangemust be between 0.0 -> 1.0
opacityRangemust be between 0.0 -> 1.0

◆ setSmoothingIterations()

void setSmoothingIterations ( int  iter)

Sets the number of iterations done by vtkWindowedSincPolyDataFilter. More iterations create smoother ROI surfaces. Default value is 15.

Parameters
iterThe number of iterations

◆ setStillUpdateRate()

void setStillUpdateRate ( double  factor)

Sets update speed for volume rendering. Factor can be interpreted as "Frames/sec". In summary: larger factor=faster rendering, smaller factor=slower rendering.

Parameters
doubleThe speed factor

◆ setViewAnglePos()

void setViewAnglePos ( int  pos)

Set the view angle slider position inside to the range.

Parameters
posThe position

◆ setViewAngleRange()

void setViewAngleRange ( int  nbSteps)

Set the range of the view angle slider [0 nbSteps].

Parameters
nbStepsThe range in steps

◆ zoomCamera()

void zoomCamera ( double  z)

Zoom in or Zoom out camera.

Parameters
zdistance to focus point (a scale factor: 0 ? 300 in percentage, the base unit distance is the default distance