oursin.volumes

Volumetric datasets (x*y*z matrix)

Functions

clear

Clear all custom meshes

clear_clicks

Clear the volumes click list

colormap

Build a colormap

compress_volume

Compress a volume of float data into a uint8 volume by quantiles.

save_clicks

Save the current click list to a CSV file.

Classes

Volume

Volumetric dataset represented in a compressed format by using a colormap to translate uint8 x/y/z data into full RGB color.

clear_clicks()[source]

Clear the volumes click list

save_clicks(fpath)[source]

Save the current click list to a CSV file.

Use urchin.volumes.clear_clicks() before starting your click sequence.

Parameters

fpathstring

Relative filepath

clear()[source]

Clear all custom meshes

class Volume(volume_data, colormap=None)[source]

Bases: object

Volumetric dataset represented in a compressed format by using a colormap to translate uint8 x/y/z data into full RGB color.

Volumes should be created in (AP, ML, DV)

update()[source]
delete()[source]
compress_volume(volume_data, n_colors=254)[source]

Compress a volume of float data into a uint8 volume by quantiles.

NaN values are mapped to 255 (transparent) for Urchin.

This is required for use with the urchin.volume.Volume object type.

Parameters

volume_datafloat volume

3D matrix of float data

n_colorsint (optional)

Default to 254, number of un-reserved colors. 255 must always be reserved for NaN / transparency

Returns

(uint8 volume, float[] map)

colormap(colormap_name='greens', reserved_colors=[], datapoints=None)[source]

Build a colormap

This function has two parts: 1. It builds a standard colormap in indexes 0->n_colors 2. It leaves “reserved” colors at the end, by default this is just 255 which becomes transparent in Urchin. But you can add a list of additional colors which will be added to the end of the colormap. The order will match the list you pass in, so e.g. 3. If you pass in datapoints, it will generate a non-uniform colormap going from the min to maximum value.

indexes: [0->252, 253->254, 255] colors: [greens, your reserved colors, transparent]

Colormap options

reds: 0->255 R channel greens: 0->255 G channel blues: 0->255 B channel

Parameters

colormap_namestr, optional

_description_, by default ‘greens’

reserved_colors_type_, optional

_description_, by default None

Returns

list of string

List of colormap hex colors in Urchin-compatible format