cortex.dataset.VertexRGB¶
- class cortex.dataset.VertexRGB(red: ndarray[tuple[Any, ...], dtype[_ScalarT]] | Vertex, green: ndarray[tuple[Any, ...], dtype[_ScalarT]] | Vertex, blue: ndarray[tuple[Any, ...], dtype[_ScalarT]] | Vertex, subject: str | None = None, alpha: ndarray[tuple[Any, ...], dtype[_ScalarT]] | Vertex | None = None, description: str = '', state=None, channel1color=(255, 0, 0), channel2color=(0, 255, 0), channel3color=(0, 0, 255), max_color_value=None, max_color_saturation=1.0, vmin=None, vmax=None, autorange='individual', priority=1)[source]¶
Contains RGB (or RGBA) colors for each vertex in a surface dataset. Includes information about the subject.
Three data channels are mapped into a 3D color set. By default the data channels are mapped on to red, green, and blue. They can also be mapped to be different colors as specified, and then linearly combined.
Each color channel is represented as a separate Vertex object (these can either be supplied explicitly as Vertex objects or implicitly as np arrays). By default, each channel’s range is determined independently from the data. Use
vmin/vmaxto specify explicit bounds, orautorangeto control how bounds are auto-determined.- Parameters:
- redndarray or Vertex
Array or Vertex that represents the first data channel for each vertex. Can be a 1D array (see Vertex for details), or a Vertex.
- greenndarray or Vertex
Array or Vertex that represents the second data channel for each vertex. Can be a 1D array (see Vertex for details), or a Vertex.
- bluendarray or Vertex
Array or Vertex that represents the third data channel for each vertex. Can be a 1D array (see Vertex for details), or a Vertex.
- subjectstr, optional
Subject identifier. Must exist in the pycortex database. If not given, red must be a Vertex from which the subject can be extracted.
- alphandarray or Vertex, optional
Array or Vertex that represents the alpha component of the color for each vertex. Can be a 1D array (see Vertex for details), or a Vertex. If None, all vertices will be assumed to have alpha=1.0.
- descriptionstr, optional
String describing this dataset. Displayed in webgl viewer.
- stateoptional
TODO: describe what this is
- channel1colortuple<uint8, uint8, uint8>
RGB color to use for the first data channel
- channel2colortuple<uint8, uint8, uint8>
RGB color to use for the second data channel
- channel3colortuple<uint8, uint8, uint8>
RGB color to use for the third data channel
- max_color_valuefloat [0, 1], optional
Maximum HSV value for voxel colors. If not given, will be the value of the average of the three channel colors.
- max_color_saturation: float [0, 1]
Maximum HSV saturation for voxel colors.
- vminfloat or tuple of float, optional
Lower bound(s) that map to 0 in each color channel. If a single float, the same lower bound is used for all three channels. If a tuple of three floats, each channel uses its respective value. If None, the lower bound is auto-determined based on
autorange.- vmaxfloat or tuple of float, optional
Upper bound(s) that map to 255 in each color channel. If a single float, the same upper bound is used for all three channels. If a tuple of three floats, each channel uses its respective value. If None, the upper bound is auto-determined based on
autorange.- autorange‘shared’ or ‘individual’
How to auto-determine bounds when vmin or vmax is None. ‘shared’ computes the 1st and 99th percentile across all three channels combined. ‘individual’ computes per-channel 1st and 99th percentiles. Overridden when vmin and vmax are both provided. Default is ‘individual’.
- priorityint, optional
Priority for display ordering. Default is 1.
Methods
__init__(red, green, blue[, subject, alpha, ...])blend_curvature(alpha[, threshold, ...])Blend the data with a curvature map depending on a transparency map.
color_voxels(channel1, channel2, channel3, ...)Colors voxels in 3 color dimensions but not necessarily canonical red, green, and blue Parameters ---------- channel1 : ndarray or Volume or Vertex voxel values for first channel channel2 : ndarray or Volume or Vertex voxel values for second channel channel3 : ndarray or Volume or Vertex voxel values for third channel channel1color : tuple<uint8, uint8, uint8> color in RGB for first channel channel2color : tuple<uint8, uint8, uint8> color in RGB for second channel channel3Color : tuple<uint8, uint8, uint8> color in RGB for third channel value_max : float, optional Maximum HSV value for voxel colors. If not given, will be the value of the average of the three channel colors. saturation_max : float [0, 1] Maximum HSV saturation for voxel colors. vmin : float or tuple of float, optional Lower bound(s) that map to 0 in each color channel. If a single float, the same lower bound is used for all three channels. If a tuple of three floats, each channel uses its respective value. If None, the lower bound is auto-determined based on
autorange. vmax : float or tuple of float, optional Upper bound(s) that map to 255 in each color channel. If a single float, the same upper bound is used for all three channels. If a tuple of three floats, each channel uses its respective value. If None, the upper bound is auto-determined based onautorange. autorange : 'shared' or 'individual' How to auto-determine bounds when vmin or vmax is None. 'shared' computes the 1st and 99th percentile across all three channels combined. 'individual' computes per-channel 1st and 99th percentiles. Overridden when vmin and vmax are both provided. alpha : ndarray or Volume or Vertex, optional Alpha values for each voxel. If None, alpha is set to 1 for all voxels.copy(*args, **kwargs)from_hdf(node[, subject])Returns a dictionary with cmap information.
to_json([simple])uniques([collapse])Attributes
Compute alpha transparency
3-dimensional volume (t, v, rgba) with data that has been mapped into 8-bit unsigned integers that correspond to colors.