oursin.volumes

Volumetric datasets (x*y*z matrix)

Functions

create

Create an empty volume data matrix in the renderer.

delete

Delete a volume data matrix.

set_colormap

Set the colormap for a volume, maximum of 254 values

set_data

Set the data for a volume using uint8 values from 0->254 (255 is reserved for transparent).

set_slice_data

Set a single slice of data in a volume

set_visibility

Change the visibility of a volume

set_visibility_allen

Set the visibility of the Allen CCF annotation volume

create(volume_name)[source]

Create an empty volume data matrix in the renderer.

Note: you must call create_volume and set_volume_colormap before setting data.

Parameters

volume_namestring

volume name

Examples

>>> urn.create('histology')
delete(volume_name)[source]

Delete a volume data matrix.

Parameters

volume_namestring

volume name

Examples

>>> urn.delete('histology')
set_colormap(volume_name, colormap)[source]

Set the colormap for a volume, maximum of 254 values

Note: index 255 is reserved by the renderer for transparency.

Parameters

volumeNamestring

volume name

volumeDatalist of string

list of hex colors, values can be RGB or RGBA

Examples

>>> urn.set_colormap('histology',['#800000','#FF0000'])
set_visibility(volume_name, volume_visibility)[source]

Change the visibility of a volume

Parameters

volumeNamestring

Volume name

volumeVisibilitybool

New visibility setting

Examples

>>> urn.set_visibility('histology', True)
set_data(volume_name, volumeData)[source]

Set the data for a volume using uint8 values from 0->254 (255 is reserved for transparent). Sending your data as any type other than np.uint8 is potentially unsafe. Data will be remapped in the renderer according to the active colormap. nan values will be set to transparent.

Note: this function slices the data by depth and sends data slice-by-slice, it may take a long time to run.

Parameters

volumeData[string, numpy matrix]

Name of the volume and the volume itself. Volume should be [528, 320, 456] with +x = posterior, +y = ventral, +z = right

set_slice_data(volume_name, slice, volume_bytes, override_gpu_apply=False)[source]

Set a single slice of data in a volume

Parameters

volumeNamestring

name of volume

sliceint

depth slice in volume (on lr dimension)

volume_bytesbytes

flattened bytes array from slice

override_gpu_applybool, optional

immediately set the GPU texture data after this slice is sent, by default False

set_visibility_allen(allenVisibility)[source]

Set the visibility of the Allen CCF annotation volume

Parameters

allenDatabool

visibility of Allen CCF volume