fsleyes.displaycontext.vectoropts
This module provides the VectorOpts
, LineVectorOpts
, and
RGBVectorOpts
classes, which contain options for displaying NIFTI
vector images.
- class fsleyes.displaycontext.vectoropts.VectorOpts[source]
Bases:
object
The
VectorOpts
class is a mixin for use withDisplayOpts
sub-classes, providng properties and logic for displaying overlays which can be coloured according to XYZ orientations.- xColour
Colour used to represent the X vector magnitude.
- yColour
Colour used to represent the Y vector magnitude.
- zColour
Colour used to represent the Z vector magnitude.
- suppressX
Do not use the X vector magnitude to colour vectors.
- suppressY
Do not use the Y vector magnitude to colour vectors.
- suppressZ
Do not use the Z vector magnitude to colour vectors.
- suppressMode
How vector direction colours should be suppressed.
- normaliseColour
If
True
, the vector values are normalised to uniform brightness. IfFalse
(the default), the vector XYZ values are used directly as RGB values.
- getVectorColours()[source]
Prepares the colours that represent each direction.
- Returns:
a
numpy
array of size(3, 4)
containing the RGBA colours that correspond to thex
,y
, andz
vector directions.A
numpy
array of shape(4, 4)
which encodes a scale and offset to be applied to the vector value before it is combined with the colours, encoding the current brightness and contrast settings.
- __annotations__ = {}
- __dict__ = mappingproxy({'__module__': 'fsleyes.displaycontext.vectoropts', '__doc__': 'The ``VectorOpts`` class is a mixin for use with :class:`.DisplayOpts`\n sub-classes, providng properties and logic for displaying overlays which\n can be coloured according to XYZ orientations.\n ', 'xColour': <fsleyes_props.properties_types.Colour object>, 'yColour': <fsleyes_props.properties_types.Colour object>, 'zColour': <fsleyes_props.properties_types.Colour object>, 'suppressX': <fsleyes_props.properties_types.Boolean object>, 'suppressY': <fsleyes_props.properties_types.Boolean object>, 'suppressZ': <fsleyes_props.properties_types.Boolean object>, 'suppressMode': <fsleyes_props.properties_types.Choice object>, 'normaliseColour': <fsleyes_props.properties_types.Boolean object>, 'getVectorColours': <function VectorOpts.getVectorColours>, '__dict__': <attribute '__dict__' of 'VectorOpts' objects>, '__weakref__': <attribute '__weakref__' of 'VectorOpts' objects>, '__annotations__': {}})
- __module__ = 'fsleyes.displaycontext.vectoropts'
- __weakref__
list of weak references to the object
- class fsleyes.displaycontext.vectoropts.NiftiVectorOpts(*args, **kwargs)[source]
Bases:
NiftiOpts
,VectorOpts
The
NiftiVectorOpts
class is the base class forLineVectorOpts
,RGBVectorOpts
,TensorOpts
, andSHOpts
. It contains display settings which are common to each of them.A note on orientation
The
orientFlip
property allows you to flip the left-right orientation of line vectors, tensors, and SH functions. This option is necessary, because different tools may output vector data in different ways, depending on the image orientation.For images which are stored radiologically (with the X axis increasaing from right to left), the FSL tools (e.g. dtifit) will generate vectors which are oriented according to the voxel coordinate system. However, for neurologically stored images (X axis increasing from left to right), FSL tools generate vectors which are radiologically oriented, and thus are inverted with respect to the X axis in the voxel coordinate system. Therefore, in order to correctly display vectors from such an image, we must flip each vector about the X axis.
This issue is also applicable to
tensor
andsh
overlays.- cmap
If an image is selected as the
colourImage
, this colour map is used to colour the vector voxels.
- colourImage
Colour vector voxels by the values contained in this image. Any image which is in the
OverlayList
, and which has the same voxel dimensions as the vector image can be selected for colouring. If acolourImage
is selected, thexColour
,yColour
,zColour
,suppressX
,suppressY
, andsuppressZ
properties are all ignored.
- modulateImage
Modulate the vector colour brightness/alpha by another image. Any image which is in the
OverlayList
, and which has the same voxel dimensions as the vector image can be selected for modulation.
- modulateMode
Modulate either the brightness or transparency by the modulation image.
- clipImage
Clip voxels from the vector image according to another image. Any image which is in the
OverlayList
, and which has the same voxel dimensions as the vector image can be selected for clipping. TheclippingRange
dictates the value below which vector voxels are clipped.
- modulateRange
Data range used in brightness/transparency modulation, when a
modulateImage
is in use.
- colourRange
Data range used for colouring, when a
colourImage
is in use.
- __init__(image, *args, **kwargs)[source]
Create a
VectorOpts
instance for the given image. All arguments are passed through to theNiftiOpts
constructor.
- orientFlip
If
True
, individual vectors are flipped along the x-axis. This property is only applicable to theLineVectorOpts
,TensorOpts
, andSHOpts
classes. See theNiftiOpts.getTransform()
method for more information.This value defaults to
True
for images which have a neurological storage order, andFalse
for radiological images.
- __annotations__ = {}
- __module__ = 'fsleyes.displaycontext.vectoropts'
- destroy()[source]
Removes some property listeners, and calls the
NiftiOpts.destroy()
method.
- __clipImageChanged(*a)
Called when the
clipImage
property changes. Updates the range of theclippingRange
property.
- __modulateImageChanged(*a)
Called when the
modulateImage
property changes. Updates the range of themodulateRange
property.
- __colourImageChanged(*a)
Called when the
colourImage
property changes. Updates the range of thecoluorRange
property.
- __updateRange(image, rangeobj, pad=False)
Used whenever
clipImage
,modulateImage
, orcolourImage
change. Updates theclippingRange
,modulateRange
, orcolourRange
respectively.
- __overlayListChanged(*a)
Called when the overlay list changes. Updates the
modulateImage
,colourImage
andclipImage
properties so that they contain a list of overlays which could be used to modulate the vector image.
- __refreshAuxImage(imageName)
Updates the named image property (
modulateImage
,colourImage
orclipImage
) so that it contains a list of overlays which could be used to modulate the vector image.
- class fsleyes.displaycontext.vectoropts.LineVectorOpts(*args, **kwargs)[source]
Bases:
NiftiVectorOpts
The
LineVectorOpts
class contains settings for displaying vector images, using a line to represent the vector value at each voxel.- __annotations__ = {}
- __module__ = 'fsleyes.displaycontext.vectoropts'
- lineWidth
Width of the line in pixels.
- directed
If
True
, the vector data is interpreted as directed. Otherwise, the vector data is assumed to be undirected.
- modulateMode
Overwrites
NiftiVectorOpts.modulateMode
.Modulate the brightness, transparency, or line length by the modulation image. When set to
'lineLength'
, this is applied after theunitLength
and before thelengthScale
properties.
- unitLength
If
True
, each vector is scaled so that it has a length of1 * lengthScale
(or 0.5 ifdirected
isTrue
).
- lengthScale
Length scaling factor.
- __init__(*args, **kwargs)[source]
Create a
LineVectorOpts
instance. All arguments are passed through to theVectorOpts
constructor.
- class fsleyes.displaycontext.vectoropts.RGBVectorOpts(*args, **kwargs)[source]
Bases:
NiftiVectorOpts
The
RGBVectorOpts
class contains settings for displaying vector images, using a combination of three colours to represent the vector value at each voxel.- __annotations__ = {}
- __module__ = 'fsleyes.displaycontext.vectoropts'
- interpolation
Apply interpolation to the image data.
- unitLength
Alias for
VectorOpts.normaliseColour
. Not used internally, kept for compatibility.
- __init__(*args, **kwargs)[source]
Create a
RGBVectorOpts
instance. All arguments are passed through to theVectorOpts
constructor.