fsleyes.displaycontext.shopts
¶
This module provides the SHOpts
class, a VectorOpts
class for rendering Image
instances which contain fibre orientation
distributions (FODs) in the form of spherical harmonic (SH) coefficients.
-
fsleyes.displaycontext.shopts.
SH_COEFFICIENT_TYPE
= {1: ('asym', 0), 6: ('sym', 2), 9: ('asym', 2), 15: ('sym', 4), 25: ('asym', 4), 28: ('sym', 6), 45: ('sym', 8), 49: ('asym', 6), 66: ('sym', 10), 81: ('asym', 8), 91: ('sym', 12), 120: ('sym', 14), 121: ('asym', 10), 153: ('sym', 16), 169: ('asym', 12), 225: ('asym', 14), 289: ('asym', 16)}¶ Image
files which contain SH coefficients may be symmetric (only containing coefficients for even spherical functions) or asymmetric (containing coefficients for odd and even functions). This dictionary provides mappings from the number coefficients (the volumes contained in the image), to the file type (either symmetric ['sym'
] or asymmetric ['asym'
), and the maximum SH order that was used in generating the coefficients.
-
class
fsleyes.displaycontext.shopts.
SHOpts
(*args, **kwargs)[source]¶ Bases:
fsleyes.displaycontext.vectoropts.VectorOpts
The
SHOpts
is used for renderingImage
instances which contain fibre orientation distributions (FODs) in the form of spherical harmonic (SH) coefficients. ASHOpts
instance will be used forImage
overlays with aDisplaty.overlayType
set to'sh'
.A collection of pre-calculated SH basis function parameters are stored in the
assets/sh/
directory. Depending on the SH order that was used in the fibre orientation, and the desired display resolution (controlled byshResolution
), a different set of parameters needs to be used. ThegetSHParameters()
method will load and return the corrrect set of parameters.-
shResolution
= <MagicMock name='mock.Int()' id='4116300320'>¶ Resolution of the sphere used to display the FODs at each voxel. The value is equal to the number of iterations that an isocahedron, starting with 12 vertices, is tessellated. The resulting number of vertices is as follows:
Number of iterations
Number of vertices
3
92
4
162
5
252
6
362
7
492
8
642
9
812
10
1002
-
size
= <MagicMock name='mock.Percentage()' id='4116877904'>¶ Display size - this is simply a linear scaling factor.
-
lighting
= <MagicMock name='mock.Boolean()' id='4117273880'>¶ Apply a simple directional lighting model to the FODs.
-
radiusThreshold
= <MagicMock name='mock.Real()' id='4116054224'>¶ FODs with a maximum radius that is below this threshold are not shown.
-
normalise
= <MagicMock name='mock.Boolean()' id='4117273880'>¶ If
True
, the size of each FOD is scaled to fit within a voxel. Otherwise the size of each FOD is scaled relative to the entire image.
-
colourMode
= <MagicMock name='mock.Choice()' id='4117029600'>¶ How to colour each FOD. This property is overridden if the
VectorOpts.colourImage
is set.'direction'
The vertices of an FOD are coloured according to theirx/y/z location (see
xColour
,yColour
, andzColour
).
'radius'
The vertices of an FOD are coloured according to theirdistance from the FOD centre (see
colourMap
).
-
__init__
(*args, **kwargs)[source]¶ Create a
VectorOpts
instance for the given image. All arguments are passed through to theNiftiOpts
constructor.
-
__module__
= 'fsleyes.displaycontext.shopts'¶
-
shOrder
= <MagicMock name='mock.Choice()' id='4117029600'>¶ Maximum spherical harmonic order to visualise. This is populated in
__init__()
.
-
property
shType
¶ Returns either
'sym'
or'asym'
, depending on the type of the SH coefficients contained in the file.
-
property
maxOrder
¶ Returns the maximum SH order that was used to generate the coefficients of the SH image.
-
getSHParameters
()[source]¶ Load and return a
numpy
array containing pre-calculated SH function parameters for the curert maximum SH order and display resolution. The returned array has the shape(N, C)
, whereN
is the number of vertices used to represent each FOD, andC
is the number of SH coefficients.
-