Visualization Adaptors

<< Click to Display Table of Contents >>

Navigation:  XStream® HDVR® SDK > Implementation Concepts > Mouse Adaptors >

Visualization Adaptors

Previous pageReturn to chapter overviewNext page

C++ C++ Java Java .NET .NET

Summary

 

A number of different adaptors are provided for manipulating the camera, lighting, and visualization properties. When using the C++ API, the IPanAdaptor is used to pan the camera in a plane parallel to the user's camera view. The ICPRotateAdaptor rotates the camera about a point in the volume, usually the camera position. The IZoomAdaptor manipulates the camera position and the RENDER_PARAMS::Zoom value to allow the camera to zoom into a point in the dataset. The IAutonavigateAdaptor is used for auto-navigation of the camera through the volume. It is most commonly used for vessel navigation. The ILightAdjustAdaptor is used to control the orientation of the diffuse light that illuminates the scene. The ISlabAdaptor is used for adjusting the position of the slab clipping planes. The ISlabThicknessAdaptor is used for adjusting the thickness of (the distance between) the slab clipping planes. The IWindowLevelAdaptor adjusts the window/level contrast enhancement for MIP/MPR renderings and the density level of the transfer function in 3D renderings

 

A number of different adaptors are provided for manipulating the camera, lighting, and visualization properties. When using the Java/.NET APIs, the hdrcPanAdaptor is used to pan the camera in a plane parallel to the user's camera view. The hdrcCPRotateAdaptor rotates the camera about a point in the volume, usually the camera position. The hdrcZoomAdaptor manipulates the camera position and the RENDER_PARAMS::Zoom value to allow the camera to zoom into a point in the dataset. The hdrcAutonavigateAdaptor is used for auton-avigation of the camera through the volume. It is most commonly used for vessel navigation. The hdrcLightAdjustAdaptor is used to control the orientation of the diffuse light that illuminates the scene. The hdrcSlabAdaptor is used for adjusting the position of the slab clipping planes. The hdrcSlabThicknessAdaptor is used for adjusting the thickness of (the distance between) the slab clipping planes. The hdrcWindowLevelAdaptor adjusts the window/level contrast enhancement for MIP/MPR renderings and the density level of the transfer function in 3D renderings

 

Camera Pan Adaptor

 

The IPanAdaptor pans the viewpoint in the plane parallel to the user's screen-space viewpoint.

 

IPanAdaptor::SetVolumeDataMetrics()

 

Before using this adaptor during interaction, you should call this method to appropriately initialize the object. Similarly, if the dataset changes on the attached render engine, this method should be called.

 

IPanAdaptor::Get/SetClickAndDrag()

 

These methods set and get a Boolean flag that controls pan scaling. If set to H_TRUE and the RENDER_PARAMS::RenderType is set to RT_PERSPECTIVE, the speed of the pan operation allows the user to click on an object, and drag it on screen so that the object moves at the same speed as the mouse cursor. If set to H_FALSE, or if the RENDER_PARAMS::RenderType is set to RT_PARALLEL, then the RENDER_PARAMS::Zoom value is used to calculate the pan speed.

 

IPanAdaptor::SetUpdateDistPerPixelOnMove()

 

This method should be used only in applications where the RENDER_PARAMS::Zoom value is expected to change during mouse panning. Such a use case might be a touch-screen application where the user can pan and zoom at the same time using multi-touch. If set to H_TRUE the IPanAdaptor will recompute the volume pan distance per mouse move each time the IPanAdaptor::MouseDragged() method is called by the operating system specific mouse handler.

 

// Create an IPanAdaptor object

IPanAdaptor* pPanAdaptor = NULL;

pLibrary->CreateObject(&CLSID_PanAdaptor, &pPanAdaptor);

 

// Initialize the IPanAdaptor with the volume data

pPanAdaptor->SetVolumeDataMetrics(pVolumeDataContext);

 

// Compute accurate click-and-drag offset if in RT_PERSPECTIVE mode

pPanAdaptor->SetClickAndDrag(H_TRUE);

 

// No simultaneous zoom and pan in this application

pPanAdaptor->SetUpdateDistPerPixelOnMove(H_FALSE);

 

// Attach the IPanAdaptor object to a RenderQueue

pPanAdaptor->SetRenderParamsReciever(pRenderQueue);

 

The hdrcPanAdaptor pans the viewpoint in the plane parallel to the user's screen-space viewpoint.

 

hdrcPanAdaptor::getVolumeDataMetrics()

 

Before using this adaptor during interaction, you should call this method to appropriately initialize the object. Similarly, if the dataset changes on the attached render engine, this method should be called.

 

hdrcPanAdaptor::get/setClickAndDrag()

 

These methods set and get a Boolean flag that controls pan scaling. If set to TRUE and the RENDER_PARAMS::RenderType is set to RT_PERSPECTIVE, the speed of the pan operation allows the user to click on an object, and drag it on screen so that the object moves at the same speed as the mouse cursor. If set to false, or if the RENDER_PARAMS::RenderType is set to RT_PARALLEL, then the RENDER_PARAMS::Zoom value is used to calculate the pan speed.

 

 

// Create a hdrcPanAdaptor object and attaches it to a RenderQueue

hdrcPanAdaptor panAdaptor = new hdrcPanAdaptor(renderQueue);

 

// Initialize the hdrcPanAdaptor with the volume data

panAdaptor.getVolumeDataMetrics(volumeDataContext);

 

// Compute accurate click-and-drag offset if in RT_PERSPECTIVE mode

panAdaptor.setClickAndDrag(TRUE);

 

Camera Rotate Adaptor

 

The ICPRotateAdaptor rotates the camera viewpoint. In addition, there are class specific methods to control the rotation center point and center point offset.

 

ICPRotateAdaptor::Get/SetCenterPoint()

 

These methods get and set the point in the volume about which the camera rotates. Generally this will be set to the point in the volume on which the user clicks the mouse. A different point can be used if the user wants the camera to orbit about a specific point in the volume. The default value is 0,0,0.

 

ICPRotateAdaptor::Get/SetInvertInPerspective()

 

These methods get and set whether or not up/down should be inverted in perspective rendering.

 

ICPRotateAdaptor::Get/SetMoveOffsetInPerspective()

 

These methods get and set whether the camera can move during rotation. If set to H_TRUE, just the camera orientation can change. If set to H_FALSE the camera can move if the rotation center point is different than the camera's current position.

 

ICPRotateAdaptor::Get/SetSensitivity()

 

These methods get and set the rotation sensitivity. The default value is 1.0, and will affect the rotation speed linearly. The mathematical relationship between the number of radians to rotate per pixel and the sensitivity is as follows: sensitivity = radiansPerPixel * 300.0.

 

// Create an ICPRotateAdaptor object

ICPRotateAdaptor* pRotate = NULL;

pLibrary->CreateObject(&CLSID_CPRotateAdaptor, &pRotate);

 

// Offset rotation point to 100 mm along X axis

pRotate->SetCenterPoint(VECTOR3D(100, 0, 0));

 

// Do not invert mouse Y axis

pRotate->SetInvertInPerspective(H_FALSE);

 

// Do not move eyepoint position during rotation 

pRotate->SetMoveOffsetInPerspective(H_TRUE);

 

// Set rotation sensitivity to 2x default

pRotate->SetSensitivity(2.0);

 

// Attach the ICPRotateAdaptor object to the RenderQueue

pRotate->SetRenderParamsReciever(pRenderQueue);

 

The hdrcCPRotateAdaptor rotates the camera viewpoint. In addition, there are class specific methods to control the rotation center point and center point offset.

 

hdrcCPRotateAdaptor::get/setCenterPoint()

 

These methods get and set the point in the volume about which the camera rotates. Generally this will be set to the point in the volume on which the user clicks the mouse. A different point can be used if the user wants the camera to orbit about a specific point in the volume. The default value is 0,0,0.

 

hdrcCPRotateAdaptor::get/setInvertInPerspective()

 

These methods get and set whether or not up/down should be inverted in perspective rendering.

 

hdrcCPRotateAdaptor::get/setMoveOffsetInPerspective()

 

These methods get and set whether the camera can move during rotation. If set to TRUE, just the camera orientation can change. If set to FALSE the camera can move if the rotation center point is different than the camera's current position.

 

hdrcCPRotateAdaptor::get/setSensitivity()

 

These methods get and set the rotation sensitivity. The default value is 1.0, and will affect the rotation speed linearly. The mathematical relationship between the number of radians to rotate per pixel and the sensitivity is as follows: sensitivity = radiansPerPixel * 300.0.

 

// Create a hdrcCPRotateAdaptor object

hdrcCPRotateAdaptor rotateAdaptor = new hdrcCPRotateAdaptor(renderQueue);

 

// Offset rotation point to 100 mm along X axis

rotateAdaptor.setCenterPoint(VECTOR3D(100, 0, 0));

 

// Do not invert mouse Y axis

rotateAdaptor.setInvertInPerspective(FALSE);

 

// Do not move eyepoint position during rotation 

rotateAdaptor.setMoveOffsetInPerspective(TRUE);

 

// Set rotation sensitivity to 2x default

rotateAdaptor.setSensitivity(2.0);

 

Camera Zoom Adaptor

 

The IZoomAdaptor manipulates the camera position and the RENDER_PARAMS::Zoom value to allow the camera to zoom into a point in the dataset.

 

IZoomAdaptor::Get/SetSensitivity()

 

These methods get and set the sensitivity of the zoom operation. The larger the value, the greater the camera will zoom for a given mouse offset. The default value is 1.0.

 

IZoomAdaptor::Get/SetZoomToLoc()

 

These methods get and set the point in the dataset the camera will zoom into. The default value is the center of the image. Changing this value changes the zooming origination point within the image; zooming will go towards or away from the set point. Typically, it makes sense to use the cursor position for this value.

 

// Create an IZoomAdaptor object

IZoomAdaptor* pZoom = NULL;

pLibrary->CreateObject(&CLSID_ZoomAdaptor, &pZoom);

 

// Set zoom sensitivity to 2x default

pZoom->SetSensitivity(2.0);

 

// Set zoom point to center of screen

pZoom->SetZoomToLoc(POINT(0, 0));

 

// Attach the IZoomAdaptor object to a RenderQueue

pZoom->SetRenderParamsReciever(pRenderQueue);

 

The hdrcZoomAdaptor manipulates the camera position and the RENDER_PARAMS::Zoom value to allow the camera to zoom into a point in the dataset.

 

hdrcZoomAdaptor::get/setSensitivity()

 

These methods get and set the sensitivity of the zoom operation. The larger the value, the greater the camera will zoom for a given mouse offset. The default value is 1.0.

 

hdrcZoomAdaptor::get/setZoomToLoc()

 

These methods get and set the point in the dataset the camera will zoom into. The default value is the center of the image. Changing this value changes the zooming origination point within the image; zooming will go towards or away from the set point. Typically, it makes sense to use the cursor position for this value.

 

// Create a hdrcZoomAdaptor object

hdrcZoomAdaptor* zoomAdaptor = new hdrcZoomAdaptor(renderQueue);

 

// Set zoom sensitivity to 2x default

zoomAdaptor.setSensitivity(2.0);

 

// Set zoom point to center of screen

zoomAdaptor.setZoomToLoc(POINT(0, 0));

 

 

Autonavigation Adaptor

 

The IAutonavigateAdaptor is used for auton-avigation of the camera through the volume. It is most commonly used for vessel navigation. The IAutonavigateAdaptor works by shooting rays from the camera position to find the nearest surfaces in the volume, which depend on the transfer function settings. In this way the adaptor is able to construct a representation of its surroundings. When the user clicks the mouse on the screen, the camera will attempt to move in that approximate direction, while maintaining equal distance from the nearest obstructions (such as the vessel walls). The camera then moves towards the most open area, which allows it to traverse a vessel or other channel.

 

The IAutonavigateAdaptor class will only function if the RENDER_PARAMS::RenderType value is set to RT_PERSPECTIVE.

 

IAutonavigateAdaptor::Get/SetSpeed()

 

These methods are used to get and set the speed at which the camera moves during autonavigation. The speed of the auto-navigate feature will automatically vary depending on the size of the tunnel you are traveling down.

 

IAutonavigateAdaptor::Get/SetNudgeable()

 

These methods get and set whether the camera is 'nudgeable'. As the camera moves along a vessel during auto-navigation it may encounter branches in the vessel, making the direction of further of navigation ambiguous. If the Nudgeable value is set to H_TRUE, the user can 'nudge' the auto-navigation towards the desired direction by offsetting the mouse towards the desired channel of navigation. If the Nudgeable value is set to H_FALSE, the auto-navigation algorithm will determine on its own which direction to go.

 

// Create an IAutonavigateAdaptor object

IAutonavigateAdaptor* pAutonav = NULL;

pLibrary->CreateObject(&CLSID_AutonavigateAdaptor, &pAutonav);

 

// Set speed sensitivity to 2x default

pAutonav->SetSpeed(2.0);

 

// Set nudgeable to true.

pAutonav->SetNudgeable(H_TRUE);

 

// Attach the IAutonavigateAdaptor object to a RenderQueue

pAutonav->SetRenderParamsReciever(pRenderQueue);

 

The hdrcAutonavigateAdaptor is used for auton-avigation of the camera through the volume. It is most commonly used for vessel navigation. The hdrcAutonavigateAdaptor works by shooting rays from the camera position to find the nearest surfaces in the volume, which depend on the transfer function settings. In this way the adaptor is able to construct a representation of its surroundings. When the user clicks the mouse on the screen the camera will attempt to move in that approximate direction, while maintaining equal distance from the nearest obstructions (such as the vessel walls). The camera then moves towards the most open area, which allows it to traverse a vessel or other channel.

 

The hdrcAutonavigateAdaptor class will only function if the RENDER_PARAMS::RenderType value is set to RT_PERSPECTIVE.

 

hdrcAutonavigateAdaptor::Get/SetSpeed()

 

These methods are used to get and set the speed at which the camera moves during auton-avigation. The speed of the autonavigate feature will automatically vary depending on the size of the tunnel you are traveling down.

 

IAutonavigateAdaptor::Get/SetNudgeable()

 

These methods get and set whether the camera is 'nudgeable'. As the camera moves along a vessel during auto-navigation it may encounter branches in the vessel, making the direction of further of navigation ambiguous. If the Nudgeable value is set to TRUE, the user can 'nudge' the auto-navigation towards the desired direction by offsetting the mouse towards the desired channel of navigation. If the Nudgeable value is set to false, the auto-navigation algorithm will determine on its own which direction to go.

 

// Create a hdrcAutonavigateAdaptor object

hdrcAutonavigateAdaptor* autonavAdaptor = new hdrcAutonavigateAdaptor(renderQueue);

 

// Set speed sensitivity to 2x default

autonavAdaptor.setSpeed(2.0);

 

// Set nudgeable to true.

autonavAdaptor.setNudgeable(TRUE);

 

Lighting Adaptor

 

The ILightAdjustAdaptor is used to control the orientation of the diffuse light that illuminates the scene. There are two diffuse lights in the scene. The first is the primary illumination; the second is a dimmer diffuse light that has the inverse orientation to the primary light.

 

ILightAdjustAdaptor::Get/SetAttachToCamera()

 

These methods get and set whether the light changes direction when the camera orientation changes. If set to H_TRUE, rotating the camera orientation also rotates the light direction by the same amount and in the same direction. If set to H_FALSE, the light orientation will not change when the camera is rotated.

 

ILightAdjustAdaptor::Get/SetSensitivity()

 

These methods get and set the rotation sensitivity. The default value is 1.0 and will affect the rotation speed linearly. The mathematical relationship between the number of radians to rotate per pixel and the sensitivity is as follows: sensitivity = radiansPerPixel * 300.0.

 

// Create an ILightAdjustAdaptor object

ILightAdjustAdaptor* pLight = NULL;

pLibrary->CreateObject(&CLSID_LightAdjustAdaptor, &pLight);

 

// Set light not to move with camera.

pLight->SetAttachToCamera(H_FALSE);

 

// Set rotation sensitivity to default.

pLight->SetSensitivity(1.0);

 

// Attach the ILightAdjustAdaptor object to a RenderQueue

pLight->SetRenderParamsReciever(pRenderQueue);

 

The hdrcLightAdjustAdaptor is used to control the orientation of the diffuse light which illuminates the scene. There are two diffuse lights in the scene. The first is the primary illumination, the section is a dimmer diffuse light which has the inverse orientation to the primary light.

 

hdrcLightAdjustAdaptor::get/setAttachToCamera()

 

These methods get and set whether the light changes direction when the camera orientation changes. If set to TRUE, then rotating the camera orientation also rotates the light direction by the same amount and in the same direction. If set to FALSE, the light orientation will not change when the camera is rotated.

 

hdrcLightAdjustAdaptor::get/setSensitivity()

 

These methods get and set the rotation sensitivity. The default value is 1.0 and will affect the rotation speed linearly. The mathematical relationship between the number of radians to rotate per pixel and the sensitivity is as follows: sensitivity = radiansPerPixel * 300.0.

 

// Create a hdrcLightAdjustAdaptor object.

ILightAdjustAdaptor* lightAdaptor = new ILightAdjustAdaptor(renderQueue);

 

// Set light not to move with camera.

lightAdaptor.setAttachToCamera(FALSE);

 

// Set rotation sensitivity to default.

lightAdaptor.setSensitivity(1.0);

 

Slab Adaptor

 

The ISlabAdaptor is used for adjusting the position of the slab clipping planes. For the purposes of rendering the dataset, a 'slab' represents a box-like region within which the volume is rendered. Areas outside the slab are not visualized. The slab is therefore a clipping volume represented by a front and back clipping plane.

 

ISlabAdaptor::Get/SetSensitivity()

 

These methods get and set the sensitivity level. The higher the value, the more the clipping planes will move with respect to a corresponding mouse movement.

 

ISlabAdaptor::Get/SetUpIsForward()

 

These methods get and set the relationship between a forward mouse movement and the movement of the clipping planes. If this method is set to H_TRUE, then moving the mouse forward will move the clipping planes forward. If set to H_FALSE then moving the mouse forward will move the clipping planes backwards.

 

// Create an ISlabAdaptor object

ISlabAdaptor* pSlabAdaptor = NULL;

pLibrary->CreateObject(&CLSID_SlabAdaptor, &pSlabAdaptor);

 

// Sets the mouse sensitivity.

pSlabAdaptor->SetSensitivity(1.0);

 

// Set the segmentation type to positive or negative.

pSlabAdaptor->SetUpIsForward(H_TRUE);

 

// Attach the ISlabAdaptor object to a RenderQueue

pSlabAdaptor->SetRenderParamsReciever(pRenderQueue);

 

The hdrcSlabAdaptor is used for adjusting the position of the slab clipping planes. For the purposes of rendering the dataset, a 'slab' represents a box-like region within which the volume is rendered. Areas outside the slab are not visualized. The slab is therefore a clipping volume represented by a front and back clipping plane.

 

hdrcSlabAdaptor::get/setSensitivity()

 

These methods get and set the sensitivity level. The higher the value, the more the clipping planes will move with respect to a corresponding mouse movement.

 

hdrcSlabAdaptor::get/setUpIsForward()

 

These methods get and set the relationship between a forward mouse movement and the movement of the clipping planes. If this method is set to TRUE, then moving the mouse forward will move the clipping planes forward. If set to FALSE then moving the mouse forward will move the clipping planes backwards.

 

// Create a hdrcSlabAdaptor object

hdrcSlabAdaptor* slabAdaptor = new hdrcSlabAdaptor(renderQueue);

 

// Sets the mouse sensitivity.

slabAdaptor.setSensitivity(1.0);

 

// Set the segmentation type to positive or negative.

slabAdaptor.setUpIsForward(TRUE);

 

 

Slab Thickness Adaptor

 

The ISlabThicknessAdaptor is used for adjusting the thickness of the slab, the distance between the slab clipping planes.

 

ISlabThicknessAdaptor::Get/SetGrowFromSlabCenter()

 

These methods get and set how the slab region grows and shrinks. If set to H_TRUE, the slab will grow and shrink from its center. If set to H_FALSE, the slab will grow and shrink from the rear.

 

ISlabThicknessAdaptor::Get/SetSensitivity()

 

These methods get and set the sensitivity of the mouse movement. The higher the value the more the slab thickness will change with respect to mouse movement.

 

// Create an ISlabThicknessAdaptor object

ISlabThicknessAdaptor* pSlabThicknessAdaptor = NULL;

pLibrary->CreateObject(&CLSID_SlabThicknessAdaptor, &pSlabThicknessAdaptor);

 

// Sets the mouse sensitivity.

pSlabThicknessAdaptor->SetSensitivity(1.0);

 

// Set the segmentation type to positive or negative.

pSlabThicknessAdaptor->SetGrowFromSlabCenter(H_FALSE);

 

// Attach the ISlabThicknessAdaptor object to a RenderQueue

pSlabThicknessAdaptor->SetRenderParamsReciever(pRenderQueue);

 

The hdrcSlabThicknessAdaptor is used for adjusting the thickness of the slab, the distance between the slab clipping planes.

 

hdrcSlabThicknessAdaptor::get/setGrowFromSlabCenter()

 

These methods get and set how the slab region grows and shrinks. If set to TRUE, the slab will grow and shrink from its center. If set to FALSE, the slab will grow and shrink from the rear.

 

hdrcSlabThicknessAdaptor::get/setSensitivity()

 

These methods get and set the sensitivity of the mouse movement. The higher the value the more the slab thickness will change with respect to mouse movement.

 

// Create a hdrcSlabThicknessAdaptor object

hdrcSlabThicknessAdaptor* slabThicknessAdaptor = hdrcSlabThicknessAdaptor(renderQueue);

 

// Sets the mouse sensitivity.

slabThicknessAdaptor.setSensitivity(1.0);

 

// Set the segmentation type to positive or negative.

slabThicknessAdaptor.setGrowFromSlabCenter(FALSE);

 

Window Level Adaptor

 

The IWindowLevelAdaptor adjusts the window/level contrast enhancement for MIP/MPR renderings and the density level of the transfer function in 3D renderings. In a MIP/MPR view, moving the mouse forward and back will increase or decrease the relative brightness of elements in the rendered view. Increasing the window level can make visible areas that are too dark to see; decreasing the window level can show detail elements in areas which appear over-exposed. In a 3D view, adjusting the window level adjusts the position of the transfer function with respect to the density level of Hounsfield values (or other dataset units) in the volume. Moving the mouse forward will adjust the transfer function towards more dense material, moving the mouse back will adjust the transfer function towards less dense material.

 

IWindowLevelAdaptor::Get/SetSensitivity()

 

These methods get and set the sensitivity level. The higher the value the more the window level will change with mouse movement.

 

// Create an IWindowLevelAdaptor object

IWindowLevelAdaptor* pWindowLevelAdaptor = NULL;

pLibrary->CreateObject(&CLSID_WindowLevelAdaptor, &pWindowLevelAdaptor);

 

// Sets the mouse sensitivity.

pWindowLevelAdaptor->SetSensitivity(1.0);

 

// Attach the IWindowLevelAdaptor object to a RenderQueue

pWindowLevelAdaptor->SetRenderParamsReciever(pRenderQueue);

 

The hdrcWindowLevelAdaptor adjusts the window/level contrast enhancement for MIP/MPR renderings and the density level of the transfer function in 3D renderings. In a MIP/MPR view, moving the mouse forward and back will increase or decrease the relative brightness of elements in the rendered view. Increasing the window level can make visible areas that are too dark to see; decreasing the window level can show detail elements in areas which appear over-exposed. In a 3D view, adjusting the window level adjusts the position of the transfer function with respect to the density level of Hounsfield values (or other dataset units) in the volume. Moving the mouse forward will adjust the transfer function towards more dense material, moving the mouse back will adjust the transfer function towards less dense material.

 

hdrcWindowLevelAdaptor::get/setSensitivity()

 

These methods get and set the sensitivity level. The higher the value the more the window level will change with mouse movement.

 

// Create a hdrcWindowLevelAdaptor object

hdrcWindowLevelAdaptor* windowLevelAdaptor = new hdrcWindowLevelAdaptor(rendeQueue);

 

// Sets the mouse sensitivity.

windowLevelAdaptor.setSensitivity(1.0);