fsleyes.gl.textures.data¶
This module contains functions for working with OpenGL texture data:
Given a 3D image shape, returns the number of dimensions needd to store the image as a texture - either |
|
|
MagicMock is a subclass of Mock with default implementations of most of the magic methods. |
|
MagicMock is a subclass of Mock with default implementations of most of the magic methods. |
|
MagicMock is a subclass of Mock with default implementations of most of the magic methods. |
This function prepares and returns the given |
-
fsleyes.gl.textures.data._makeInstance(dtype)[source]¶ Used by
oneChannelFormat()andgetTextureType(). If anumpy.dtypeclass is given, converts it into an instance.
-
fsleyes.gl.textures.data.numTextureDims(shape)[source]¶ Given a 3D image shape, returns the number of dimensions needd to store the image as a texture - either
2or3.- Parameters
shape – 3D image shape
- Returns
2 if a 2D texture can be used to store the image data, 3 otherwise.
-
fsleyes.gl.textures.data.prepareData(data, prefilter=None, prefilterRange=None, resolution=None, scales=None, normalise=None, normaliseRange=None)[source]¶ This function prepares and returns the given
data, ready to be used as GL texture data.This process potentially involves:
Resampling to a different resolution (see the
routines.subsample()function).Pre-filtering (see the
prefilterparameter to__init__()).Normalising (if the
normaliseparameter to__init__()wasTrue, or if the data type cannot be used as-is).Casting to a different data type (if the data type cannot be used as-is).
- Returns
A tuple containing:
- A
numpyarray containing the image data, ready to be copied to the GPU.
- A
An affine transformation matrix which encodes an offset and a scale, which may be used to transform the texture data from the range
[0.0, 1.0]to its raw data range.Inverse of
voxValXform.