fsleyes.displaycontext.volume3dopts
¶
This module provides the Volume3DOpts
class, a mix-in for
use with DisplayOpts
classes.
-
class
fsleyes.displaycontext.volume3dopts.
Volume3DOpts
[source]¶ Bases:
object
The
Volume3DOpts
class is a mix-in for use withDisplayOpts
classes. It defines display properties used for ray-cast based rendering ofImage
overlays.The properties in this class are tightly coupled to the ray-casting implementation used by the
GLVolume
class - see its documentation for details.-
numInnerSteps
= <MagicMock name='mock.Int()' id='281473494293760'>¶ Only used in low performance environments. Specifies the number of ray-casting steps to execute in a single iteration on the GPU, as part of an outer loop which is running on the CPU. See the
GLVolume
class documentation for more details on the rendering process.Warning
The maximum number of iterations that can be performed within an ARB fragment program is implementation-dependent. Too high a value may result in errors or a corrupted view. See the
GLVolume
class for details.
-
smoothing
= <MagicMock name='mock.Int()' id='281473494293760'>¶ Amount of smoothing to apply to the rendered volume - this setting controls the smoothing filter radius, in pixels.
-
numClipPlanes
= <MagicMock name='mock.Int()' id='281473494293760'>¶ Number of active clip planes.
-
showClipPlanes
= <MagicMock name='mock.Boolean()' id='281473497326640'>¶ If
True
, wirframes depicting the active clipping planes will be drawn.
-
clipMode
= <MagicMock name='mock.Choice()' id='281473498355456'>¶ This setting controls how the active clip planes are combined.
intersection
clips the intersection of all planesunion
clips the union of all planescomplement
clips the complement of all planes
-
clipPosition
= <MagicMock name='mock.List()' id='281473495788224'>¶ Centre of clip-plane rotation, as a distance from the volume centre - 0.5 is centre.
-
__dict__
= mappingproxy({'__module__': 'fsleyes.displaycontext.volume3dopts', '__doc__': 'The ``Volume3DOpts`` class is a mix-in for use with :class:`.DisplayOpts`\n classes. It defines display properties used for ray-cast based rendering\n of :class:`.Image` overlays.\n\n\n The properties in this class are tightly coupled to the ray-casting\n implementation used by the :class:`.GLVolume` class - see its documentation\n for details.\n ', 'blendFactor': <MagicMock name='mock.Real()' id='281473497926576'>, 'numSteps': <MagicMock name='mock.Int()' id='281473494293760'>, 'numInnerSteps': <MagicMock name='mock.Int()' id='281473494293760'>, 'resolution': <MagicMock name='mock.Int()' id='281473494293760'>, 'smoothing': <MagicMock name='mock.Int()' id='281473494293760'>, 'numClipPlanes': <MagicMock name='mock.Int()' id='281473494293760'>, 'showClipPlanes': <MagicMock name='mock.Boolean()' id='281473497326640'>, 'clipMode': <MagicMock name='mock.Choice()' id='281473498355456'>, 'clipPosition': <MagicMock name='mock.List()' id='281473495788224'>, 'clipAzimuth': <MagicMock name='mock.List()' id='281473495788224'>, 'clipInclination': <MagicMock name='mock.List()' id='281473495788224'>, '__init__': <function Volume3DOpts.__init__>, 'destroy': <function Volume3DOpts.destroy>, 'dithering': <property object>, 'getNumSteps': <function Volume3DOpts.getNumSteps>, 'getNumOuterSteps': <function Volume3DOpts.getNumOuterSteps>, 'calculateRayCastSettings': <function Volume3DOpts.calculateRayCastSettings>, 'get3DClipPlane': <function Volume3DOpts.get3DClipPlane>, '__dict__': <attribute '__dict__' of 'Volume3DOpts' objects>, '__weakref__': <attribute '__weakref__' of 'Volume3DOpts' objects>})¶
-
__module__
= 'fsleyes.displaycontext.volume3dopts'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
clipAzimuth
= <MagicMock name='mock.List()' id='281473495788224'>¶ Rotation (degrees) of the clip plane about the Z axis, in the display coordinate system.
-
clipInclination
= <MagicMock name='mock.List()' id='281473495788224'>¶ Rotation (degrees) of the clip plane about the Y axis in the display coordinate system.
-
__init__
()[source]¶ Create a
Volume3DOpts
instance.
-
numSteps
= <MagicMock name='mock.Int()' id='281473494293760'>¶ Specifies the maximum number of samples to acquire in the rendering of each pixel of the 3D scene. This corresponds to the number of iterations of the ray-casting loop.
Note
In a low performance environment, the actual number of steps may differ from this value - use the
getNumSteps()
method to get the number of steps that are actually executed.
-
resolution
= <MagicMock name='mock.Int()' id='281473494293760'>¶ Only used in low performance environments. Specifies the resolution of the off-screen buffer to which the volume is rendered, as a percentage of the screen resolution.
See the
GLVolume
class documentation for more details.
-
blendFactor
= <MagicMock name='mock.Real()' id='281473497926576'>¶ Controls how much each sampled point on each ray contributes to the final colour.
-
property
dithering
¶ MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself.
If you use the spec or spec_set arguments then only magic methods that exist in the spec will be created.
Attributes and the return value of a MagicMock will also be MagicMocks.
-
getNumSteps
()[source]¶ Return the value of the
numSteps
property, possibly adjusted according to the thenumInnerSteps
property. The result of this method should be used instead of the value of thenumSteps
property.See the
GLVolume
class for more details.
-
getNumOuterSteps
()[source]¶ Returns the number of iterations for the outer ray-casting loop.
See the
GLVolume
class for more details.
-
calculateRayCastSettings
(view=None, proj=None)[source]¶ Calculates various parameters required for 3D ray-cast rendering (see the
GLVolume
class).- Parameters
view – Transformation matrix which transforms from model coordinates to view coordinates (i.e. the GL view matrix).
proj – Transformation matrix which transforms from view coordinates to normalised device coordinates (i.e. the GL projection matrix).
Returns a tuple containing:
A vector defining the amount by which to move along a ray in a single iteration of the ray-casting algorithm. This can be added directly to the volume texture coordinates.
A transformation matrix which transforms from image texture coordinates into the display coordinate system.
Note
This method will raise an error if called on a
GLImageObject
which is managing an overlay that is not associated with aVolume3DOpts
instance.
-
get3DClipPlane
(planeIdx)[source]¶ A convenience method which calculates a point-vector description of the specified clipping plane.
planeIdx
is an index into theclipPosition
,clipAzimuth
, andclipInclination
, properties.Returns the clip plane at the given
planeIdx
as an origin and normal vector, in the display coordinate system..
-