Class SoVolumeDetail
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.details.SoDetail
-
- com.openinventor.volumeviz.details.SoVolumeDetail
-
- Direct Known Subclasses:
SoFenceSliceDetail
,SoVolumeRenderDetail
,SoVolumeSkinDetail
public class SoVolumeDetail extends SoDetail
Base class for detail information about picking in a data volume. A successful pick operation returns anSoPickedPoint
object. If the picked geometry is anSoVolumeSkin
orSoVolumeRender
, use the getDetail method and cast the result to the appropriate class (SoVolumeSkinDetail
orSoVolumeRenderDetail
) to get extra information about the location of the pick.SoVolumeDetail
returns information about the first (closest) non-transparent voxel along the pick ray and/or information about all the voxels intersected by the pick ray (called a profile). For the first non-transparent voxel (if any) on the pick ray, it returns XYZ position, IJK location, and data value. For the profile defined by all the intersected voxels, it returns:- Profile position in object space (two XYZ points)
- Profile location in the data volume (two IJK indices)
- Number of values along the profile
- Each voxel value and corresponding IJK location
This class returns information about the data values in the picked voxels.
SoVolumeRenderDetail
also returns information about the mapped RGBA colors of the picked voxels.GPU picking vs. CPU picking
VolumeViz can compute the picked voxel(s) and voxel colors on the GPU.
GPU picking is generally faster than CPU picking, but more importantly it is the only way to be sure of getting the correct result if the application is using a custom shader (seeSoVolumeShader
and VVizComputeFragmentColor) to compute voxel color and opacity. CPU picking always uses the color and opacity values assigned by theSoTransferFunction
node. Therefore the result should be the same when usingSoTransferFunction
to assign color and opacity, but when using a custom shader the CPU picking algorithm is not able to know the color and opacity assigned by the shader.Important: To enable GPU picking
- The
realValue parameter must be false when calling the getXXX methods.
- The
SoRayPickAction
must be aware of theSoSceneManager
.
SoHandleEventAction
does this automatically, so it is not necessary for the application to take any action when using anSoEventCallback
node and calling the getPickedPoint() method. However if the application creates its own instance ofSoRayPickAction
, then it must call the methodSoAction.setSceneManager()
on that instance. If the scene manager is not specified, a warning message is issued and CPU picking is done.
Also be aware of the following trade-off. If the realValue parameter is set to false, the voxel value returned may be based on lower resolution (sub-sampled) data. The values should be approximately the same, but to be sure of getting values from the full resolution data, set the realValue parameter to true.
Limitations:- If multiple volumes are being combined under an
SoMultiDataSeparator
, the detail class only returns values for the first volume in the scene graph. - Because picking returns actual values of voxel, there may be a small difference between what you see on screen and what you get with picking. When visualizing a volume using LINEAR or CUBIC interpolation, you visualize interpolated data. Picking returns informations such as voxel value, voxel postion, etc... so picking return information of voxel values, not interpolated one. Visible areas may be not pickable and unvisibke areas may be pickable. When using NEAREST interpolation for rendering, picking matches what is displayed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoVolumeDetail.ProfileValue
static class
SoVolumeDetail.ProfileValueD
static class
SoVolumeDetail.TransparentDoubleValue
static class
SoVolumeDetail.TransparentLongValue
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoVolumeDetail()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SoDetail
copy()
Returns an instance that is a copy of this instance.SoVolumeDetail.TransparentDoubleValue
getFirstNonTransparentDoubleValue()
Calls getFirstNonTransparentDoubleValue(false).SoVolumeDetail.TransparentDoubleValue
getFirstNonTransparentDoubleValue(boolean realValue)
Retrieves the value and position of the first non-transparent voxel along the pick ray (if any).SoVolumeDetail.TransparentLongValue
getFirstNonTransparentValue()
Calls getFirstNonTransparentValue(false).SoVolumeDetail.TransparentLongValue
getFirstNonTransparentValue(boolean realValue)
Retrieves the value and position of the first non-transparent voxel along the pick ray (if any).SbVec3i32[]
getProfileDataPos()
Returns the number of values along the profile and the profile position in data space (voxel coordinates).int
getProfileNumValues()
Returns the number of values along the profile and the profile position in data space (voxel coordinates).SbVec3f[]
getProfileObjectPos()
Returns the profile position in object space (world coordinates).SoVolumeDetail.ProfileValue
getProfileValue(int index)
Calls getProfileValue(index, false).SoVolumeDetail.ProfileValue
getProfileValue(int index, boolean realValue)
Returns the index'th value (as an integer) and its position in object and data space.SoVolumeDetail.ProfileValueD
getProfileValueD(int index)
Calls getProfileValueD(index, false).SoVolumeDetail.ProfileValueD
getProfileValueD(int index, boolean realValue)
Returns the index'th value (as a double) and its position in object and data space.void
setDetails(SbLine line, SoVolumeData vd, SoTransferFunction tf, SoROI r)
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
getProfileValue
public SoVolumeDetail.ProfileValue getProfileValue(int index)
Calls getProfileValue(index, false).
-
getFirstNonTransparentValue
public SoVolumeDetail.TransparentLongValue getFirstNonTransparentValue()
Calls getFirstNonTransparentValue(false).
-
getFirstNonTransparentDoubleValue
public SoVolumeDetail.TransparentDoubleValue getFirstNonTransparentDoubleValue()
Calls getFirstNonTransparentDoubleValue(false).
-
getProfileValueD
public SoVolumeDetail.ProfileValueD getProfileValueD(int index)
Calls getProfileValueD(index, false).
-
getFirstNonTransparentDoubleValue
public SoVolumeDetail.TransparentDoubleValue getFirstNonTransparentDoubleValue(boolean realValue)
Retrieves the value and position of the first non-transparent voxel along the pick ray (if any). Depending on the argument realValue, the voxel value is either fetched from the real value in full resolution data or fetched from the displayed data tile on the GPU which is not necessarily in full resolution. Fetching the data in full resolution may require a read from the disk if the full-resolution data is not currently in memory.value the double value of the first non-transparent voxel along the pick ray. pos the position of the picked voxel in data space (IJK voxel coordinates) objPos the position of the picked voxel in object space (XYZ world coordinates). realValue if true, the integer value is fetched from the full resolution data. If false, it returns the voxel value from the (possibly subsampled) data currently in GPU memory, thus the voxel value that is displayed in the render area. The displayed voxel is not necessarily in full resolution. - Returns:
- false if all voxels along the ray pick are fully transparent, thus all out parameters are meaningless
Warning To use GPU picking, you must specify realValue = false.
-
setDetails
public void setDetails(SbLine line, SoVolumeData vd, SoTransferFunction tf, SoROI r)
-
getProfileObjectPos
public SbVec3f[] getProfileObjectPos()
Returns the profile position in object space (world coordinates). Specifically the profile parameter contains the XYZ coordinates of the first and last points on the profile.
-
copy
public SoDetail copy()
Returns an instance that is a copy of this instance. The caller is responsible for deleting the copy when it is no longer needed.
-
getFirstNonTransparentValue
public SoVolumeDetail.TransparentLongValue getFirstNonTransparentValue(boolean realValue)
Retrieves the value and position of the first non-transparent voxel along the pick ray (if any). Depending on the argument realValue, the voxel value is either fetched from the real value in full resolution data or fetched from the displayed data tile on the GPU which is not necessarily in full resolution. Fetching the data in full resolution may require a read from the disk if the full-resolution data is not currently in memory.value the integer value of the first non-transparent voxel along the pick ray. pos the position of the picked voxel in data space (IJK voxel coordinates) objPos the position of the picked voxel in object space (XYZ world coordinates). realValue if true, the integer value is fetched from the full resolution data. If false, it returns the voxel value from the (possibly subsampled) data currently in GPU memory, thus the voxel value that is displayed in the render area. The displayed voxel is not necessarily in full resolution. - Returns:
- false if all voxels along the ray pick are fully transparent, thus all out parameters are meaningless
Warning To use GPU picking, you must specify realValue = false.
-
getProfileDataPos
public SbVec3i32[] getProfileDataPos()
Returns the number of values along the profile and the profile position in data space (voxel coordinates). Specifically the profile parameter contains the IJK coordinates of the first and last points on the profile. The number of values is the number of of voxels intersected by the pick ray.
-
getProfileValue
public SoVolumeDetail.ProfileValue getProfileValue(int index, boolean realValue)
Returns the index'th value (as an integer) and its position in object and data space. The number of values along the profile can be queried using thegetProfileDataPos()
method. However index is automatically clamped to the valid range of values.If realValue is true, VolumeViz will return the actual voxel value from the full resolution data. Note that this may require a read from disk if full resolution data is not currently in memory. If false, VolumeViz will return the voxel value from the (possibly subsampled) data currently in memory.
Warning To use GPU picking, you must specify realValue = false.
-
getProfileValueD
public SoVolumeDetail.ProfileValueD getProfileValueD(int index, boolean realValue)
Returns the index'th value (as a double) and its position in object and data space. The number of values along the profile can be queried using thegetProfileDataPos()
method. However index is automatically clamped to the valid range of values.If realValue is true, VolumeViz will return the actual voxel value from the full resolution data. Note that this may require a read from disk if full resolution data is not currently in memory. If false, VolumeViz will return the voxel value from the (possibly subsampled) data currently in memory.
Warning To use GPU picking, you must specify realValue = false.
-
getProfileNumValues
public int getProfileNumValues()
Returns the number of values along the profile and the profile position in data space (voxel coordinates). Specifically the profile parameter contains the IJK coordinates of the first and last points on the profile. The number of values is the number of of voxels intersected by the pick ray.
-
-